public ActionResult GetSerialPayments(string Pattern) { IPublishInvoiceService _PubIn = IoC.Resolve <IPublishInvoiceService>(); Company currentCom = ((EInvoiceContext)FXContext.Current).CurrentCompany; var pu = _PubIn.LstBySerial(currentCom.id, Pattern, 1); return(Json(new { pu })); }
public ActionResult Index(PaymentModel model, int?page, int?Pagesize) { IPublishInvoiceService _PubIn = IoC.Resolve <IPublishInvoiceService>(); Company currentCom = ((EInvoiceContext)FXContext.Current).CurrentCompany; IList <string> lstPubinv = _PubIn.LstByPattern(currentCom.id, 2); if (lstPubinv.Count == 0) // chưa đăng ký mẫu hóa đơn { Messages.AddErrorFlashMessage(Resources.Message.MNullInvInLst); return(RedirectToAction("Index", "Publish")); } if (model == null) { model = new PaymentModel(); } if (String.IsNullOrEmpty(model.Pattern)) { model.Pattern = lstPubinv[0]; // mặc định lấy pattern đầu tiên } model.PatternList = new SelectList(lstPubinv); List <string> se = _PubIn.LstBySerial(currentCom.id, model.Pattern, 1); model.SerialList = new SelectList(se); int defautPagesize = Pagesize.HasValue ? Convert.ToInt32(Pagesize) : 10; int currentPageIndex = page.HasValue ? page.Value - 1 : 0; int totalRecords = 0; IInvoiceService IInvSrv = InvServiceFactory.GetService(model.Pattern, currentCom.id); IList <IInvoice> lstInv; if (model.InvNo.HasValue && model.InvNo > 0) // lấy hóa đơn theo số, sêri { IInvoice Invoice = IInvSrv.GetByNo(currentCom.id, model.Pattern, model.Serial, model.InvNo.Value); lstInv = new List <IInvoice>(); if (Invoice != null) { lstInv.Add(Invoice); } totalRecords = 1; } else // tìm theo tham số khác { DateTime?DateFrom = null; DateTime?DateTo = null; if (!string.IsNullOrWhiteSpace(model.FromDate)) { DateFrom = DateTime.ParseExact(model.FromDate, "dd/MM/yyyy", null); } if (!string.IsNullOrWhiteSpace(model.ToDate)) { DateTo = DateTime.ParseExact(model.ToDate, "dd/MM/yyyy", null); } if (model.PaymentStatus >= 0) { lstInv = IInvSrv.SearchPayment(currentCom.id, model.Pattern, model.Serial, model.nameCus, model.code, DateFrom, DateTo, currentPageIndex, defautPagesize, out totalRecords, (Payment)model.PaymentStatus); } else { lstInv = IInvSrv.SearchPayment(currentCom.id, model.Pattern, model.Serial, model.nameCus, model.code, DateFrom, DateTo, currentPageIndex, defautPagesize, out totalRecords); } } model.PageListINV = new PagedList <IInvoice>(lstInv, currentPageIndex, defautPagesize, totalRecords); return(View(model)); }
public ActionResult Index(CusSignIndexModel model, int?page, int?Pagesize) { Company currentCom = ((EInvoiceContext)FXContext.Current).CurrentCompany; IPublishInvoiceService _PubIn = IoC.Resolve <IPublishInvoiceService>(); IList <string> lstPattern = _PubIn.LstByPattern(currentCom.id, 2); model.lstpattern = new SelectList(lstPattern); if (lstPattern.Count == 0) { Messages.AddErrorFlashMessage(Resources.Message.MInv_SMesNoPubAccess); return(RedirectToAction("/")); } if (model == null) { model = new CusSignIndexModel(); } //khoi tao khi pattern rong if (string.IsNullOrEmpty(model.Pattern)) { model.Pattern = lstPattern[0]; } IList <IInvoice> lstInv; //tham so phan trang int defautPagesize = Pagesize.HasValue ? Convert.ToInt32(Pagesize) : 10; int currentPageIndex = page.HasValue ? page.Value - 1 : 0; int totalRecords = 0; //su dung khoi tao service IInvoiceService IInvSrv = InvServiceFactory.GetService(model.Pattern, currentCom.id); decimal No; decimal.TryParse(model.InvNo, out No); if (No == 0) { No = -1; } //tim kiem theo mot hoa don theo so hoa don if (!string.IsNullOrWhiteSpace(model.InvNo)) { IInvoice Invoice = IInvSrv.GetByNo(currentCom.id, model.Pattern, model.Serial, No); lstInv = new List <IInvoice>(); if (Invoice != null) { lstInv.Add(Invoice); } lstInv = lstInv.Where(x => x.CusSignStatus != cusSignStatus.NocusSignStatus && x.CusSignStatus != cusSignStatus.ViewNocusSignStatus).ToList(); totalRecords = lstInv.Count; } //tim kiem danh sach hoa don voi cac tham so con lai else { DateTime?DateFrom = null; DateTime?DateTo = null; if (!string.IsNullOrWhiteSpace(model.FromDate)) { DateFrom = DateTime.ParseExact(model.FromDate, "dd/MM/yyyy", null); } if (!string.IsNullOrWhiteSpace(model.ToDate)) { DateTo = DateTime.ParseExact(model.ToDate, "dd/MM/yyyy", null); } if (model.SignStatus == 0) { lstInv = IInvSrv.SearchByCusSign(currentCom.id, model.Pattern, model.Serial, DateFrom, DateTo, null, currentPageIndex, defautPagesize, out totalRecords, cusSignStatus.NoSignStatus, cusSignStatus.ViewNoSignStatus); } else if (model.SignStatus == 1) { lstInv = IInvSrv.SearchByCusSign(currentCom.id, model.Pattern, model.Serial, DateFrom, DateTo, null, currentPageIndex, defautPagesize, out totalRecords, cusSignStatus.SignStatus); } else { lstInv = IInvSrv.SearchByCusSign(currentCom.id, model.Pattern, model.Serial, DateFrom, DateTo, null, currentPageIndex, defautPagesize, out totalRecords, cusSignStatus.NoSignStatus, cusSignStatus.SignStatus, cusSignStatus.ViewNoSignStatus); } } log.Info("Infomation Search = pattern = " + model.Pattern + "| status = " + model.SignStatus + "| FromDate = " + model.FromDate + "| ToDate =" + model.ToDate); List <string> olstserial = _PubIn.LstBySerial(currentCom.id, model.Pattern, 1); model.lstserial = new SelectList(olstserial); model.PageListCusSign = new PagedList <IInvoice>(lstInv, currentPageIndex, defautPagesize, totalRecords); model.defautPagesize = defautPagesize; return(View(model)); }