//统计用工部门 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)); }
//添加部门 public ActionResult AddBuMen(Inventory_BumenInfoSet bis) { bis.SubTime = DateTime.Now; bis.Renark = "0"; bis.DelFlag = 0; bis.Gushu = 0; BumenInfoSetService.AddEntity(bis); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); }
//修改部门名称 public ActionResult EditBuMenName() { int bmid = Convert.ToInt32(Request["bmid"]); string newName = Request["New"]; var temp = BumenInfoSetService.LoadEntities(x => x.ID == bmid).FirstOrDefault(); temp.Name = newName; BumenInfoSetService.EditEntity(temp); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); }
//获取部门列表 public ActionResult GetBuMenList() { var temp = BumenInfoSetService.LoadEntities(x => x.Renark == "2" && x.DelFlag == 0).DefaultIfEmpty(); var rtmp = from a in temp select new { ID = a.ID, Name = a.Name }; return(Json(rtmp, JsonRequestBehavior.AllowGet)); }
//获取工作地点部门 public ActionResult GetWorkbumen() { var temp = BumenInfoSetService.LoadEntities(x => x.DelFlag == 0 && x.Gushu == 1).DefaultIfEmpty().ToList(); var rtmp = from a in temp select new { ID = a.ID, Name = a.Name }; return(Json(rtmp, JsonRequestBehavior.AllowGet)); }
//获取部门信息 public ActionResult GetBuMen() { var sbm = BumenInfoSetService.LoadEntities(x => x.DelFlag == 0 && x.Gushu < 99).DefaultIfEmpty(); var temp = from a in sbm select new { ID = a.ID, MyTexts = a.Name }; return(Json(temp, JsonRequestBehavior.AllowGet)); }
//获取部门id(机加或铆焊) public ActionResult GetInfoExcelMsg() { int id = Convert.ToInt32(Request["bloID"]); var sdata = T_BoolItemService.LoadEntities(x => x.ID == id).FirstOrDefault(); if (sdata != null) { List <serchMsg> lsm = new List <serchMsg>(); if (sdata.@int == 0) { var temp = BumenInfoSetService.LoadEntities(x => x.ID == 26 || x.ID == 43).DefaultIfEmpty(); foreach (var a in temp) { serchMsg sm = new serchMsg(); sm.ID = a.ID; sm.Name = a.Name; lsm.Add(sm); } } else if (sdata.@int == 1) { var temp = BumenInfoSetService.LoadEntities(x => x.ID > 0).DefaultIfEmpty(); foreach (var a in temp) { serchMsg sm = new serchMsg(); sm.ID = a.ID; sm.Name = a.Name; lsm.Add(sm); } } else if (sdata.@int == 3) { var temp = BumenInfoSetService.LoadEntities(x => x.ID == 41 || x.ID == 42).DefaultIfEmpty(); foreach (var a in temp) { serchMsg sm = new serchMsg(); sm.ID = a.ID; sm.Name = a.Name; lsm.Add(sm); } } else { return(Json(new { rer = "no" }, JsonRequestBehavior.AllowGet)); } return(Json(lsm, JsonRequestBehavior.AllowGet)); } else { return(Json(new { rer = "no" }, JsonRequestBehavior.AllowGet)); } }
//借款与报销详细表 public ActionResult JieKuanBaoXiaoTable() { int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1; int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 15; string jkdw = Request["jkdw"] != null ? Request["jkdw"] : string.Empty; int totalCount = 0; var Bumen = BumenInfoSetService.LoadEntities(x => x.ID == LoginUser.BuMenID).FirstOrDefault(); IQueryable <T_JieKuanBill> jktemp; IQueryable <T_BaoxiaoItems> Bxtable; if (Bumen.Name == "财务部" || Bumen.Name == "系统管理员") { jktemp = T_JieKuanBillService.LoadEntities(x => x.Del == 0); // jktemp = T_JieKuanBillService.LoadPageEntities(pageIndex, pageSize, out totalCount, x => x.Del == 0 , x => x.AddTime, false); Bxtable = T_BaoxiaoItemsService.LoadEntities(x => x.Del == 0).DefaultIfEmpty(); } else { jktemp = T_JieKuanBillService.LoadEntities(x => x.Del == 0 && x.UserAdd == LoginUser.ID); //jktemp = T_JieKuanBillService.LoadPageEntities(pageIndex, pageSize, out totalCount, x => x.Del == 0 && x.UserAdd == LoginUser.ID, x => x.AddTime, false); Bxtable = T_BaoxiaoItemsService.LoadEntities(x => x.Del == 0 && x.T_BaoXiaoBill.AddUserID == LoginUser.ID).DefaultIfEmpty(); } var temp = from a in jktemp from b in Bxtable where a.SkdwName == b.BaoXiaoName select new jkbxdan { jkID = a.ID, kename = a.SkdwName, jkmoney = a.JieKuanMoney, jkperson = a.JieKuanPerson, jktime = a.BillTime, bxID = b.ID, bxmoney = b.BaoXiaoMoeny, bxperson = b.T_BaoXiaoBill.UserInfo.PerSonName, bxtime = b.AddTime }; totalCount = temp.Count(); temp = temp.OrderByDescending <jkbxdan, DateTime?>(x => x.bxtime).Skip <jkbxdan>((pageIndex - 1) * pageSize).Take <jkbxdan>(pageSize); return(Json(new { rows = temp, total = totalCount }, JsonRequestBehavior.AllowGet)); }
////获取所有菜单信息 //public ActionResult getAllMenuInfo() //{ // var temp = WXXMenuInfoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList(); // if (temp[0] != null) // { // return Json(new { ret = "ok", rows = temp }, JsonRequestBehavior.AllowGet); // } // else // { // return Json(new { ret = "no" }, JsonRequestBehavior.AllowGet); // } //} ////获取菜单列表 //public ActionResult getWXXMenuList() //{ // var temp = WXXMenuInfoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList(); // if (temp[0] != null) // { // return Json(new { ret = "ok", rows = temp }, JsonRequestBehavior.AllowGet); // } // return Json(new { ret = "no", msg = "数据表中无数据!" }, JsonRequestBehavior.AllowGet); //} ////添加菜单数据 //public ActionResult addMenuInfo() //{ // WXXMenuInfo menu = new WXXMenuInfo(); // menu.Name = Request["CHNname"]; // menu.EngName = Request["ENGname"]; // WXXMenuInfoService.AddEntity(menu); // return Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet); //} ////修改菜单信息 //public ActionResult editMenuInfo() //{ // WXXMenuInfo menu = new WXXMenuInfo(); // menu.ID= Convert.ToInt32(Request["id"]); // menu.Name = Request["CHNname"]; // menu.EngName = Request["ENGname"]; // if (WXXMenuInfoService.EditEntity(menu)) // { // return Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet); // } // return Json(new { ret = "no" ,msg="修改失败,联系管理员"}, JsonRequestBehavior.AllowGet); //} //获取所有部门名称 public ActionResult GetAllBuMen() { var temp = BumenInfoSetService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList(); List <STUBuMen> list = new List <STUBuMen>(); foreach (var a in temp) { if (a == null) { continue; } STUBuMen stubm = new STUBuMen(); stubm.ID = a.ID; stubm.Name = a.Name; list.Add(stubm); } return(Json(list, JsonRequestBehavior.AllowGet)); }
//获取所有部门 public ActionResult GetAllBuMen() { var temp = BumenInfoSetService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList(); List <BMinfo> list = new List <BMinfo>(); foreach (var a in temp) { if (a == null) { continue; } BMinfo bmif = new BMinfo(); bmif.ID = a.ID; bmif.Name = a.Name; list.Add(bmif); } return(Json(list, JsonRequestBehavior.AllowGet)); }
//获取部门数据 public ActionResult GetDepartment() { int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1; int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5; int totalCount; var temp = BumenInfoSetService.LoadPageEntities(pageIndex, pageSize, out totalCount, x => x.ID > 0, a => a.ID, true); var rtmp = from u in temp select new { ID = u.ID, DepName = u.Name, AddTime = u.SubTime }; return(Json(new { rows = rtmp, total = totalCount }, JsonRequestBehavior.AllowGet)); }