public ContentResult GetManualExpressList(Lib.GridPager pager, string queryStr, string DetailsQuery) { string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value); IQueryable <T_ManualExpress> queryData = db.T_ManualExpress.Where(a => a.Isdelete == 0).AsQueryable(); if (!string.IsNullOrEmpty(DetailsQuery)) { queryData = db.Database.SqlQuery <T_ManualExpress>("select * from T_ManualExpress where ID in (select oid from T_ManualExpressDetail where express like '%" + DetailsQuery + "%'or Remarks like '%" + DetailsQuery + "%')and IsDelete = '0'").AsQueryable(); } if (!string.IsNullOrEmpty(queryStr)) { queryData = queryData.Where(a => a.Reason != null && a.Reason.Contains(queryStr) || a.ApplyName != null && a.ApplyName.Contains(queryStr)); } pager.totalRows = queryData.Count(); queryData = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows); List <T_ManualExpress> list = new List <T_ManualExpress>(); foreach (var item in queryData) { T_ManualExpress i = new T_ManualExpress(); i = item; list.Add(i); } //分页 // List<T_ManualBilling> list = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList(); string json = "{\"total\":" + pager.totalRows + ",\"rows\":" + JsonConvert.SerializeObject(list, Lib.Comm.setTimeFormat()) + "}"; return(Content(json)); }
public ContentResult GetManualExpress(Lib.GridPager pager, string queryStr, string EntryType) { string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value); IQueryable <T_ManualExpress> queryData = db.T_ManualExpress.Where(a => a.ApplyName == Nickname && a.Isdelete == 0).AsQueryable(); if (!string.IsNullOrEmpty(queryStr)) { queryData = queryData.Where(a => a.Reason != null && a.Reason.Contains(queryStr)); } if (!string.IsNullOrEmpty(EntryType)) { queryData = queryData.Where(a => a.EntryType.Contains(EntryType)); } pager.totalRows = queryData.Count(); //分页 queryData = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows); List <T_ManualExpress> list = new List <T_ManualExpress>(); foreach (var item in queryData) { T_ManualExpress i = new T_ManualExpress(); i = item; list.Add(i); } // List<T_ManualBilling> list = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList(); string json = "{\"total\":" + pager.totalRows + ",\"rows\":" + JsonConvert.SerializeObject(list, Lib.Comm.setTimeFormat()) + "}"; return(Content(json)); }
public ActionResult ViewManualExpressReportCheck(int ID) { GetApproveHistory(ID); ViewData["ID"] = ID; T_ManualExpress model = db.T_ManualExpress.SingleOrDefault(a => a.ID == ID); return(View(model)); }
public JsonResult DeleteInvoiceFinance(int ID) { T_ManualExpress model = db.T_ManualExpress.Find(ID); model.Isdelete = 1; db.Entry <T_ManualExpress>(model).State = System.Data.Entity.EntityState.Modified; int i = db.SaveChanges(); // ModularByZP(); return(Json(i, JsonRequestBehavior.AllowGet)); }
public ContentResult GetManualExpressChecken(Lib.GridPager pager, string queryStr) { string name = Server.UrlDecode(Request.Cookies["Name"].Value); string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value); List <T_ManualExpressAppRove> ApproveMod = db.T_ManualExpressAppRove.Where(a => (a.ApproveName == name || a.ApproveName == Nickname) && (a.Status == 1 || a.Status == 2)).ToList(); int[] Arry = new int[ApproveMod.Count]; for (int i = 0; i < ApproveMod.Count; i++) { Arry[i] = int.Parse(ApproveMod[i].Oid.ToString()); } IQueryable <T_ManualExpress> queryData = from r in db.T_ManualExpress where Arry.Contains(r.ID) && r.Isdelete == 0 select r; if (!string.IsNullOrEmpty(queryStr)) { queryData = queryData.Where(a => (a.Reason != null && a.Reason.Contains(queryStr))); } pager.totalRows = queryData.Count(); //分页 queryData = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows); List <T_ManualExpress> list = new List <T_ManualExpress>(); foreach (var item in queryData) { T_ManualExpress i = new T_ManualExpress(); i = item; list.Add(i); } string json = "{\"total\":" + pager.totalRows + ",\"rows\":" + JsonConvert.SerializeObject(list, Lib.Comm.setTimeFormat()) + "}"; return(Content(json)); }
//审核 public JsonResult ManualExpressReportCheck(T_ManualExpress model, string status, string Memo) { using (TransactionScope sc = new TransactionScope()) { int ID = model.ID; T_ManualExpress Invoicemodel = db.T_ManualExpress.SingleOrDefault(a => a.ID == ID && a.Isdelete == 0); if (Invoicemodel == null) { return(Json("数据可能被删除", JsonRequestBehavior.AllowGet)); } T_ManualExpressAppRove modelApprove = db.T_ManualExpressAppRove.FirstOrDefault(a => a.Oid == ID && a.ApproveTime == null); string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value); string result = ""; modelApprove.ApproveName = Nickname; modelApprove.Memo = Memo; modelApprove.ApproveTime = DateTime.Now; modelApprove.Status = int.Parse(status); db.Entry <T_ManualExpressAppRove>(modelApprove).State = System.Data.Entity.EntityState.Modified; int i = db.SaveChanges(); if (i > 0) { if (status == "1") { T_ManualExpressAppRove newApprove = new T_ManualExpressAppRove(); int step = int.Parse(Invoicemodel.Step.ToString()); step++; IQueryable <T_ManualExpressConfig> config = db.T_ManualExpressConfig.AsQueryable(); int stepLength = config.Count();//总共步骤 if (step < stepLength) { Invoicemodel.Status = 0; T_ManualExpressConfig stepMod = db.T_ManualExpressConfig.SingleOrDefault(a => a.Step == step); string nextName = stepMod.Name; newApprove.Memo = ""; newApprove.Oid = ID; newApprove.Status = -1; newApprove.Step = step.ToString(); if (nextName != null) { newApprove.ApproveName = nextName; newApprove.ApproveDName = stepMod.Type; } else { newApprove.ApproveName = stepMod.Type; newApprove.ApproveDName = stepMod.Type; } db.T_ManualExpressAppRove.Add(newApprove); db.SaveChanges(); } else { Invoicemodel.Status = int.Parse(status); } Invoicemodel.Step = step; db.Entry <T_ManualExpress>(Invoicemodel).State = System.Data.Entity.EntityState.Modified; int j = db.SaveChanges(); ModularByZP(); sc.Complete(); if (j > 0) { result = "保存成功"; } else { result = "保存失败"; } } else { //不同意 Invoicemodel.Step = 0; Invoicemodel.Status = 2; db.Entry <T_ManualExpress>(Invoicemodel).State = System.Data.Entity.EntityState.Modified; int j = db.SaveChanges(); //审核流程结束 申请人编辑后插入下一条记录 sc.Complete(); if (j > 0) { result = "保存成功"; } else { result = "保存失败"; } } } else { result = "保存失败"; } return(Json(result, JsonRequestBehavior.AllowGet)); } }
public JsonResult ManualExpressAdd(T_ManualExpress model, string jsonStr, string p_c_a, string Expense) { using (TransactionScope sc = new TransactionScope()) { try { string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value); model.ApplyName = Nickname; model.ApplyDate = DateTime.Now; model.Status = -1; model.Step = 0; model.Isdelete = 0; model.DetailedAddress = p_c_a; db.T_ManualExpress.Add(model); int i = db.SaveChanges(); if (i > 0) { List <T_ManualExpressDetail> details = App_Code.Com.Deserialize <T_ManualExpressDetail>(jsonStr); foreach (var item in details) { string express = item.express; // List<T_ManualExpress> Dmodel = db.T_ManualExpress.Where(a => a.Isdelete !=1).ToList(); List <T_ManualExpressDetail> Dmodel = db.T_ManualExpressDetail.Where(a => a.express == express).ToList(); if (Dmodel.Count > 0) { int[] PIDs = Dmodel.Select(a => a.Oid).ToArray(); List <T_ManualExpress> list = db.T_ManualExpress.Where(a => PIDs.Contains(a.ID) && a.Isdelete == 0).ToList(); if (list.Count > 0) { return(Json(new { State = "cuowu" }, JsonRequestBehavior.AllowGet)); } } item.Oid = model.ID; db.T_ManualExpressDetail.Add(item); } db.SaveChanges(); T_ManualExpressConfig modelconfig = db.T_ManualExpressConfig.SingleOrDefault(a => a.Step == 0 && a.Reason == "1"); T_ManualExpressAppRove AppRoveModel = new T_ManualExpressAppRove(); AppRoveModel.Status = -1; AppRoveModel.Step = "0"; AppRoveModel.ApproveName = Expense; AppRoveModel.ApproveDName = modelconfig.Type; AppRoveModel.Oid = model.ID; db.T_ManualExpressAppRove.Add(AppRoveModel); db.SaveChanges(); } else { return(Json(new { State = "Faile" }, JsonRequestBehavior.AllowGet)); } //ModularByZP(); sc.Complete(); return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet)); } } }
public ContentResult GetManualExpressCheck(Lib.GridPager pager, string queryStr, string DetailsQuery) { string name = Server.UrlDecode(Request.Cookies["Name"].Value); string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value); List <T_ManualExpressGroup> GroupModel = db.T_ManualExpressGroup.Where(a => a.GroupUser != null && (a.GroupUser.Contains(name) || a.GroupUser.Contains(Nickname))).ToList(); string[] shenheName = new string[GroupModel.Count]; for (int z = 0; z < GroupModel.Count; z++) { shenheName[z] = GroupModel[z].GroupName; } List <T_ManualExpressAppRove> ApproveMod = db.T_ManualExpressAppRove.Where(a => (shenheName.Contains(a.ApproveName) || a.ApproveName == name || a.ApproveName == Nickname) && a.ApproveTime == null).ToList(); string arrID = ""; for (int i = 0; i < ApproveMod.Count; i++) { if (i == 0) { arrID += ApproveMod[i].Oid.ToString(); } else { arrID += "," + ApproveMod[i].Oid.ToString(); } } string sql = "select * from T_ManualExpress r where isdelete=0 and (Status = -1 or Status = 0 or Status = 2) "; if (arrID != null && arrID != "") { sql += " and ID in (" + arrID + ")"; } else { sql += " and 1=2"; } IQueryable <T_ManualExpress> queryData = db.Database.SqlQuery <T_ManualExpress>(sql).AsQueryable(); // IQueryable<T_MajorInvoice> queryData = db.T_MajorInvoice.Where(a=>a.).AsQueryable(); if (!string.IsNullOrEmpty(DetailsQuery)) { queryData = db.Database.SqlQuery <T_ManualExpress>("select * from T_ManualExpress where ID in (select oid from T_ManualExpressDetail where express like '%" + DetailsQuery + "%'or Remarks like '%" + DetailsQuery + "%')and IsDelete = '0'").AsQueryable(); } if (!string.IsNullOrEmpty(queryStr)) { queryData = queryData.Where(a => a.Reason != null && a.Reason.Contains(queryStr)); } pager.totalRows = queryData.Count(); queryData = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows); List <T_ManualExpress> list = new List <T_ManualExpress>(); foreach (var item in queryData) { T_ManualExpress i = new T_ManualExpress(); i = item; list.Add(i); } //分页 // List<T_ManualBilling> list = queryData.OrderByDescending(c => c.ID).Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList(); string json = "{\"total\":" + pager.totalRows + ",\"rows\":" + JsonConvert.SerializeObject(list, Lib.Comm.setTimeFormat()) + "}"; return(Content(json)); }