//获取当前开户银行的所有卡号 public ActionResult GetAllFaHuoBakCardNumber() { string fhb = Request["FHB"]; var cardNum = T_JieKuanBillService.LoadEntities(x => x.OpenHang == fhb).DefaultIfEmpty().ToList(); List <T_JieKuanBill> sb = new List <T_JieKuanBill>(); if (cardNum.Count <= 1) { sb.AddRange(cardNum); } else { var a = cardNum.Where((x, i) => cardNum.FindIndex(z => z.CardNumber == x.CardNumber) == i).ToList(); sb.AddRange(a); } List <BaoXiaoLR> list = new List <BaoXiaoLR>(); foreach (var a in sb) { if (a == null || a.CardNumber == null) { continue; } BaoXiaoLR bxlr = new BaoXiaoLR(); bxlr.ID = a.ID; bxlr.Text = a.CardNumber; list.Add(bxlr); } return(Json(list, JsonRequestBehavior.AllowGet)); }
//获取当前收款单位所有开户行 public ActionResult GetAllFaHuoBak() { string skdw = Request["SKDW"]; var temp = T_JieKuanBillService.LoadEntities(x => x.SkdwName == skdw).DefaultIfEmpty().ToList(); List <T_JieKuanBill> sb = new List <T_JieKuanBill>(); if (temp.Count <= 1) { sb.AddRange(temp); } else { var a = temp.Where((x, i) => temp.FindIndex(z => z.OpenHang == x.OpenHang) == i).ToList(); sb.AddRange(a); } List <BaoXiaoLR> list = new List <BaoXiaoLR>(); foreach (var a in sb) { if (a == null || a.OpenHang == null) { continue; } BaoXiaoLR bxlr = new BaoXiaoLR(); bxlr.ID = a.ID; bxlr.Text = a.OpenHang; list.Add(bxlr); } return(Json(list, JsonRequestBehavior.AllowGet)); }
//获取借款部门下所有收款单位 public ActionResult GetBuMenAllSKDW() { int bmid = Convert.ToInt32(Request["BMID"]); var temp = T_JieKuanBillService.LoadEntities(x => x.BuMenid == bmid).DefaultIfEmpty().ToList(); List <T_JieKuanBill> sb = new List <T_JieKuanBill>(); if (temp.Count <= 1) { sb.AddRange(temp); } else { var a = temp.Where((x, i) => temp.FindIndex(z => z.SkdwName == x.SkdwName) == i).ToList(); sb.AddRange(a); } List <BaoXiaoLR> list = new List <BaoXiaoLR>(); foreach (var a in sb) { if (a == null || a.SkdwName == null) { continue; } BaoXiaoLR bxlr = new BaoXiaoLR(); bxlr.ID = a.ID; bxlr.Text = a.SkdwName; list.Add(bxlr); } return(Json(list, JsonRequestBehavior.AllowGet)); }
//获取借款内容的借款金额 public ActionResult GetJieKuanMoney() { long jkid = Convert.ToInt64(Request["id"]); var temp = T_JieKuanBillService.LoadEntities(x => x.ID == jkid).FirstOrDefault(); if (temp == null || temp.JieKuanMoney == null) { return(Json(new { ret = "no" }, JsonRequestBehavior.AllowGet)); } return(Json(new { ret = "ok", jkmoney = temp.JieKuanMoney }, 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 DELJiekuan() { long id = Request["id"] == null ? 0 : Convert.ToInt64(Request["id"]); if (id == 0) { return(Json(new { ret = "ok", msg = "ID不可为空!" }, JsonRequestBehavior.AllowGet)); } T_JieKuanBill Jkb = T_JieKuanBillService.LoadEntities(x => x.ID == id).FirstOrDefault(); if (Jkb == null) { return(Json(new { ret = "ok", msg = "数据库中未找到该ID,联系管理员!" }, JsonRequestBehavior.AllowGet)); } Jkb.Del = 1; if (T_JieKuanBillService.EditEntity(Jkb)) { return(Json(new { ret = "ok", msg = "修改成功!" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ret = "ok", msg = "修改出错,联系管理员!" }, JsonRequestBehavior.AllowGet)); } }
//获取所有报销内容 public ActionResult GetBaoXiaoall() { //获取所有本用户创建过的报销内容 int uid = LoginUser.ID; var tempBXB = T_BaoXiaoBillService.LoadEntities(x => x.AddUserID == uid && x.Del == 0).DefaultIfEmpty(); List <BaoXiaoLR> list = new List <BaoXiaoLR>(); if (tempBXB.First() == null) { BaoXiaoLR bxlr = new BaoXiaoLR(); bxlr.ID = 0; bxlr.Text = ""; list.Add(bxlr); return(Json(list, JsonRequestBehavior.AllowGet)); } List <T_BaoxiaoItems> bilist = new List <T_BaoxiaoItems>(); foreach (var a in tempBXB) { var tempBXI = T_BaoxiaoItemsService.LoadEntities(x => x.BaoXiaoID == a.ID).DefaultIfEmpty().ToList(); foreach (var d in tempBXI) { if (d == null || d.BaoXiaoName == null) { continue; } else { bilist.Add(d); } } } List <T_BaoxiaoItems> sb1 = new List <T_BaoxiaoItems>(); if (bilist.Count <= 1) { sb1.AddRange(bilist); } else { sb1 = bilist.Where((x, i) => bilist.FindIndex(z => z.BaoXiaoName == x.BaoXiaoName) == i).ToList(); } Random rd = new Random(); foreach (var c in sb1) { BaoXiaoLR bxlr = new BaoXiaoLR(); bxlr.ID = c.ID + rd.Next(100, 10000); bxlr.Text = c.BaoXiaoName; list.Add(bxlr); } //获取所有本部门创建过得借款单内容 var tempJKB = T_JieKuanBillService.LoadEntities(x => x.UserAdd == uid && x.Del == 0).DefaultIfEmpty().ToList(); List <T_JieKuanBill> sb2 = new List <T_JieKuanBill>(); if (tempJKB.Count <= 1) { sb2.AddRange(tempJKB); } else { sb2 = tempJKB.Where((x, i) => tempJKB.FindIndex(z => z.SkdwName == x.SkdwName) == i).ToList(); } List <BaoXiaoLR> JKBLR = new List <BaoXiaoLR>(); foreach (var d in sb2) { if (d == null || d.SkdwName == null) { continue; } else { BaoXiaoLR jklr = new BaoXiaoLR(); jklr.ID = d.ID; jklr.Text = d.SkdwName; JKBLR.Add(jklr); } } list.AddRange(JKBLR); //users.Where((x, i) => users.FindIndex(z => z.name == x.name) == i).ToList();拉姆达表达式去重 return(Json(list, JsonRequestBehavior.AllowGet)); }