Beispiel #1
0
        //统计用工部门
        public ActionResult TongJiYGBM()
        {
            DateTime    startDate = Convert.ToDateTime(Request["startTime"]);
            DateTime    endDate   = Convert.ToDateTime(Request["endTime"]);
            var         temp      = YSGPtopService.LoadEntities(x => x.GPtime >= startDate && x.GPtime <= endDate && x.GPState == 2 && x.Del_f == 0).DefaultIfEmpty().ToList();
            var         bmList    = BumenInfoSetService.LoadEntities(x => x.DelFlag == 0 && x.Gushu == 1).DefaultIfEmpty().ToList();
            List <YGTJ> temp1     = new List <YGTJ>();

            if (temp != null && temp[0] != null)
            {
                foreach (var a in bmList)
                {
                    YGTJ yg = new YGTJ();
                    yg.BuMenid           = a.Name;
                    yg.mouthSumTime      = 0;
                    yg.monthTimeMoneySum = 0;
                    var rtmp = temp.Where(x => x.WorkAddress == a.ID).DefaultIfEmpty().ToList();
                    if (rtmp != null && rtmp[0] != null)
                    {
                        foreach (var b in rtmp)
                        {
                            yg.mouthSumTime      += b.WorkTime;
                            yg.monthTimeMoneySum += b.SettlementAmount;
                        }
                    }
                    temp1.Add(yg);
                }
                return(Json(temp1, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        //统计派工部门
        public ActionResult TongJiPGBM()
        {
            DateTime    startDate = Convert.ToDateTime(Request["startTime"]);
            DateTime    endDate   = Convert.ToDateTime(Request["endTime"]);
            int         bumenid   = Convert.ToInt32(Request["BMID"]);
            var         temp      = YSGPtopService.LoadEntities(x => x.GPtime >= startDate && x.GPtime <= endDate && x.PGbumen == bumenid && x.GPState == 2 && x.Del_f == 0).DefaultIfEmpty().ToList();
            var         userList  = UserInfoService.LoadEntities(x => x.BuMenID == bumenid && x.DelFlag == 0).DefaultIfEmpty();
            List <PGTJ> temp1     = new List <PGTJ>();

            if (temp != null && temp[0] != null)
            {
                foreach (var a in userList)
                {
                    var  id   = a.ID.ToString();
                    var  rtmp = temp.Where(x => x.PGperson.Contains(id)).DefaultIfEmpty().ToList();
                    PGTJ pj   = new PGTJ();
                    pj.BuMenid          = a.BumenInfoSet.Name;
                    pj.PersonName       = a.PerSonName;
                    pj.mouthSumTime     = 0;
                    pj.PersonMouthMoney = a.YSGPmoneys.Where(x => x.UID == a.ID).First().YueMoney;
                    if (rtmp != null && rtmp[0] != null)
                    {
                        foreach (var b in rtmp)
                        {
                            pj.mouthSumTime += b.WorkTime;
                        }
                        pj.monthTimeMoneySum = pj.mouthSumTime * a.YSGPmoneys.Where(x => x.UID == a.ID).First().HoursMoney;
                    }
                    temp1.Add(pj);
                }
                return(Json(temp1, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        //删除工票
        public ActionResult DelGP()
        {
            long topID = Convert.ToInt64(Request["topID"]);
            var  temp  = YSGPtopService.LoadEntities(x => x.ID == topID).FirstOrDefault();

            if (temp != null)
            {
                int uid = Convert.ToInt32(Request["uid"]);
                if (temp.AddUser == uid)
                {
                    if (temp.GPState <= 0)
                    {
                        temp.Del_f = 1;
                        if (YSGPtopService.EditEntity(temp))
                        {
                            return(Json(new { ret = "ok", msg = "删除成功!" }, JsonRequestBehavior.AllowGet));
                        }
                        return(Json(new { ret = "no", msg = "删除失败!" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { ret = "no", msg = "该条记录已进入审核阶段,无法删除!" }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new { ret = "no", msg = "该条记录非本人所创建,无权删除!" }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { ret = "no", msg = "数据库中无此数据" }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #4
0
        //微信用获取工票信息
        public ActionResult GetGPtopInfo()
        {
            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 15;

            int    toalcount = 0;
            var    temp      = new List <YSGPtop>();
            var    rtmp      = new List <GPtop>();
            var    userList  = UserInfoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList();
            int    uid       = Convert.ToInt32(Request["uid"]);
            string uidStr    = Request["uid"];

            temp = YSGPtopService.LoadPageEntities(pageIndex, pageSize, out toalcount, x => x.Del_f == 0 && (x.AddUser == uid || x.PGperson.Contains(uidStr)), x => x.GPtime, false).DefaultIfEmpty().ToList();
            if (temp != null && temp[0] != null)
            {
                foreach (var a in temp)
                {
                    GPtop gt = new GPtop();
                    gt.ID      = a.ID;
                    gt.GPtime  = a.GPtime;
                    gt.PGbumen = a.BumenInfoSet.Name;
                    if (a.PGperson.IndexOf("|") == -1)
                    {
                        int id       = Convert.ToInt32(a.PGperson);
                        var userinfo = userList.Where(x => x.ID == id).FirstOrDefault();
                        gt.PGperson = userinfo.PerSonName;
                    }
                    else
                    {
                        string userStr = "";
                        var    ary     = a.PGperson.Split('|');
                        foreach (var b in ary)
                        {
                            int sid      = Convert.ToInt32(b.Trim());
                            var userinfo = userList.Where(x => x.ID == sid).FirstOrDefault();
                            userStr = userStr == "" ? userinfo.PerSonName : userStr + "、" + userinfo.PerSonName;
                        }
                        gt.PGperson = userStr;
                    }
                    gt.StartTime        = a.StartTime;
                    gt.EndTime          = a.EndTime;
                    gt.WorkTime         = a.WorkTime;
                    gt.PGpersonAllWages = a.PGpersonAllWages;
                    gt.SettlementAmount = a.SettlementAmount;
                    gt.gpInfo           = a.WorkInfo;
                    gt.WorkAddress      = a.BumenInfoSet1.Name;
                    gt.GPState          = T_BoolItemService.LoadEntities(x => x.ItemsID == 9 && x.@int == a.GPState).First().str;
                    gt.GPStateNum       = a.GPState;
                    gt.pingJiaStateNum  = a.pingjiaState;
                    gt.pingJiaState     = a.pingjiaState == 0 ? "满意" : a.pingjiaState == 1 ? "一般" : "不满意";
                    rtmp.Add(gt);
                }
            }
            return(Json(new { rows = rtmp, total = toalcount }, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        //添加工票
        public ActionResult AddGP()
        {
            YSGPtop yt = new YSGPtop();

            yt.GPtime           = Convert.ToDateTime(Request["gpDate"]);
            yt.PGbumen          = Convert.ToInt32(Request["PGbumenID"]);
            yt.PGperson         = Request["PGpersonID"];
            yt.StartTime        = Convert.ToDateTime(Request["startTime"]);
            yt.EndTime          = Convert.ToDateTime(Request["endTime"]);
            yt.WorkTime         = Convert.ToDecimal(Request["WorkTime"]);
            yt.PGpersonAllWages = Convert.ToDecimal(Request["PGpersonAllWages"]);
            yt.SettlementAmount = Convert.ToDecimal(Request["SettlementAmount"]);
            yt.WorkInfo         = Request["WorkInfo"];
            yt.WorkAddress      = Convert.ToInt32(Request["WorkAddress"]);
            yt.AddUser          = Convert.ToInt32(Request["uid"]);
            yt.AddTime          = DateTime.Now;
            yt.GPState          = 0;
            yt.Del_f            = 0;
            var temp = YSGPtopService.AddEntity(yt);

            /* var YSGPinfo = Request["YSGPinfo"];
             * JavaScriptSerializer Serializers = new JavaScriptSerializer();
             * //json字符串转为数组对象, 反序列化
             * List<YSGPinfo> objs = Serializers.Deserialize<List<YSGPinfo>>(YSGPinfo);
             * foreach (var a in objs)
             * {
             *   YSGPinfo yi = new YSGPinfo();
             *   yi.TopID = temp.ID;
             *   yi.WorkAddress = a.WorkAddress;
             *   yi.WorkInfo = a.WorkInfo;
             *   yi.WorkTrueStartTime = a.WorkTrueStartTime;
             *   yi.WorkTrueEndTime = a.WorkTrueEndTime;
             *   yi.Del_f = 0;
             *   YSGPinfoService.AddEntity(yi);
             * }*/
            return(Json("ok", JsonRequestBehavior.AllowGet));
        }
Beispiel #6
0
        //部门审核工票
        public ActionResult SHGP()
        {
            short shyi = Convert.ToInt16(Request["shyj"]);
            long  gpid = Convert.ToInt64(Request["gpid"]);
            int   uid  = Convert.ToInt32(Request["uid"]);
            var   temp = YSGPtopService.LoadEntities(x => x.ID == gpid).FirstOrDefault();

            if (temp != null)
            {
                if (shyi == 1)
                {
                    short pingjia = Convert.ToInt16(Request["pingjia"]);
                    temp.GPState        = shyi;
                    temp.YGQueRenPerson = uid;
                    temp.pingjiaState   = pingjia;
                    temp.YGBuMenQRTime  = DateTime.Now;
                }
                else if (shyi == 2 || shyi == -2)
                {
                    temp.GPState        = shyi;
                    temp.PGQueRenPerson = uid;
                    temp.PGBuMenQRTime  = DateTime.Now;
                }
                if (YSGPtopService.EditEntity(temp))
                {
                    return(Json(new { ret = "ok", msg = "审核成功!" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { ret = "no", msg = "审核失败!" }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { ret = "no", msg = "该条记录不存在,可能已被删除!" }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #7
0
        //获取工票头信息
        public ActionResult GetAllGPtopInfo()
        {
            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 15;

            int    bumenID   = Request["BMID"] != null && Request["BMID"].Trim().Length > 0 ? int.Parse(Request["BMID"]) : 0;
            string uid       = Request["uid"] != null && Request["uid"].Trim().Length > 0 ? Request["uid"] : "0";
            string startDate = Request["startDate"] != null && Request["startDate"].Trim().Length > 0 ? Request["startDate"] : "0";
            string endDate   = Request["endDate"] != null && Request["endDate"].Trim().Length > 0 ? Request["endDate"] : "0";
            int    toalcount = 0;
            var    temp      = new List <YSGPtop>();
            var    rtmp      = new List <GPtop>();
            var    userList  = UserInfoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList();

            if (bumenID == 0 && uid == "0")
            {
                temp = YSGPtopService.LoadPageEntities(pageIndex, pageSize, out toalcount, x => x.Del_f == 0 && x.GPState == 2, x => x.GPtime, false).DefaultIfEmpty().ToList();
            }
            else if (bumenID != 0 && uid == "0")
            {
                temp = YSGPtopService.LoadEntities(x => x.Del_f == 0 && x.PGbumen == bumenID && x.GPState == 2).DefaultIfEmpty().OrderBy(x => x.GPtime).ToList();
            }
            else if (bumenID != 0 && uid != "0")
            {
                temp = YSGPtopService.LoadEntities(x => x.Del_f == 0 && x.PGperson.Contains(uid) && x.GPState == 2).DefaultIfEmpty().OrderBy(x => x.GPtime).ToList();
            }
            if (startDate != "0" && endDate != "0")
            {
                DateTime start = Convert.ToDateTime(startDate);
                DateTime end   = Convert.ToDateTime(endDate);
                temp = temp.Where(x => x.GPtime >= start && x.GPtime <= end).DefaultIfEmpty().ToList();
            }
            if (temp != null && temp[0] != null)
            {
                foreach (var a in temp)
                {
                    GPtop gt = new GPtop();
                    gt.ID      = a.ID;
                    gt.GPtime  = a.GPtime;
                    gt.PGbumen = a.BumenInfoSet.Name;
                    if (a.PGperson.IndexOf("|") == -1)
                    {
                        int id       = Convert.ToInt32(a.PGperson);
                        var userinfo = userList.Where(x => x.ID == id).FirstOrDefault();
                        gt.PGperson = userinfo.PerSonName;
                    }
                    else
                    {
                        string userStr = "";
                        var    ary     = a.PGperson.Split('|');
                        foreach (var b in ary)
                        {
                            int sid      = Convert.ToInt32(b.Trim());
                            var userinfo = userList.Where(x => x.ID == sid).FirstOrDefault();
                            userStr = userStr == "" ? userinfo.PerSonName : userStr + "、" + userinfo.PerSonName;
                        }
                        gt.PGperson = userStr;
                    }
                    gt.StartTime        = a.StartTime;
                    gt.EndTime          = a.EndTime;
                    gt.WorkTime         = a.WorkTime;
                    gt.PGpersonAllWages = a.PGpersonAllWages;
                    gt.SettlementAmount = a.SettlementAmount;
                    gt.gpInfo           = a.WorkInfo;
                    gt.WorkAddress      = a.BumenInfoSet1.Name;
                    gt.pingJiaStateNum  = a.pingjiaState;
                    gt.pingJiaState     = a.pingjiaState == 0 ? "满意" : a.pingjiaState == 1 ? "一般" : "不满意";
                    rtmp.Add(gt);
                }
            }
            return(Json(new { rows = rtmp, total = toalcount }, JsonRequestBehavior.AllowGet));
        }