public ActionResult Create(ProcessPayViewModel model) { if (ModelState.IsValid) { var ProcessPay = new Domain.Staff.Entities.ProcessPay(); AutoMapper.Mapper.Map(model, ProcessPay); ProcessPay.IsDeleted = false; ProcessPay.CreatedUserId = WebSecurity.CurrentUserId; ProcessPay.ModifiedUserId = WebSecurity.CurrentUserId; ProcessPay.CreatedDate = DateTime.Now; ProcessPay.ModifiedDate = DateTime.Now; ProcessPayRepository.InsertProcessPay(ProcessPay); var prefix1 = Erp.BackOffice.Helpers.Common.GetSetting("prefixOrderNo_ProcessPay"); ProcessPay.CodePay = Erp.BackOffice.Helpers.Common.GetCode(prefix1, ProcessPay.Id); ProcessPayRepository.UpdateProcessPay(ProcessPay); if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True") { ViewBag.closePopup = "true"; model.Id = ProcessPay.Id; return(View(model)); } } return(View(model)); }
public ViewResult Create(int?StaffId) { var model = new ProcessPayViewModel(); model.StaffId = StaffId; return(View(model)); }
string bill(ProcessPayViewModel model) { //lấy thông tin var company = Erp.BackOffice.Helpers.Common.GetSetting("companyName"); //var BranchName = Erp.BackOffice.Helpers.Common.CurrentUser.BranchName; var staff = staffsRepository.GetStaffsById(model.StaffId.Value); var address = Erp.BackOffice.Helpers.Common.GetSetting("addresscompany"); var phone = Erp.BackOffice.Helpers.Common.GetSetting("phonecompany"); var fax = Erp.BackOffice.Helpers.Common.GetSetting("faxcompany"); //lấy template phiếu xuất. var template = templatePrintRepository.GetAllTemplatePrint().Where(x => x.Code.Contains("ProcessPay")).OrderByDescending(x => x.CreatedDate).FirstOrDefault(); //truyền dữ liệu vào template. model.Content = template.Content; model.Content = model.Content.Replace("{StaffName}", staff.Name); //model.Content = model.Content.Replace("{Code}", staff.Name); model.Content = model.Content.Replace("{Day}", model.DayDecision.Value.Day.ToString()); model.Content = model.Content.Replace("{Month}", model.DayDecision.Value.Month.ToString()); model.Content = model.Content.Replace("{Year}", model.DayDecision.Value.Year.ToString()); model.Content = model.Content.Replace("{EffectiveDay}", model.DayEffective.Value.Day.ToString()); model.Content = model.Content.Replace("{EffectiveMonth}", model.DayEffective.Value.Month.ToString()); model.Content = model.Content.Replace("{EffectiveYear}", model.DayEffective.Value.Year.ToString()); model.Content = model.Content.Replace("{BasicPay}", Erp.BackOffice.Helpers.Common.PhanCachHangNgan(model.BasicPay)); model.Content = model.Content.Replace("{BasicPayText}", Erp.BackOffice.Helpers.Common.ChuyenSoThanhChu(model.BasicPay.Value.ToString())); model.Content = model.Content.Replace("{System.AddressCompany}", address); model.Content = model.Content.Replace("{System.PhoneCompany}", phone); model.Content = model.Content.Replace("{System.Fax}", fax); model.Content = model.Content.Replace("{System.CompanyName}", company); //model.Content = model.Content.Replace("{System.AddressCompany}", BranchName); return(model.Content); }
public ActionResult Edit(ProcessPayViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var ProcessPay = ProcessPayRepository.GetProcessPayById(model.Id); AutoMapper.Mapper.Map(model, ProcessPay); ProcessPay.ModifiedUserId = WebSecurity.CurrentUserId; ProcessPay.ModifiedDate = DateTime.Now; ProcessPayRepository.UpdateProcessPay(ProcessPay); if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True") { ViewBag.closePopup = "true"; return(View(model)); } } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ContentResult ContentProcessPay(string Code, int?StaffId, string DayDecision, string DayEffective, int BasicPay) { var model = new ProcessPayViewModel(); model.CodePay = Code; model.StaffId = StaffId; model.DayDecision = Convert.ToDateTime(DayDecision); model.DayEffective = Convert.ToDateTime(DayEffective); model.BasicPay = BasicPay; model.Content = bill(model); return(Content(model.Content)); }
public ActionResult Print(int?Id) { var ProcessPay = ProcessPayRepository.GetProcessPayById(Id.Value); if (ProcessPay != null && ProcessPay.IsDeleted != true) { var model = new ProcessPayViewModel(); AutoMapper.Mapper.Map(ProcessPay, model); return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }