//สรุปรายการซ่อมประจำวัน public ActionResult ReportDay() { ViewBag.ReportList = "first active"; ReportDayViewModel model = new ReportDayViewModel(); model.Report = new ReportDay(); DateTime start = DateTime.Today; model.DateStart = start.AddYears(543); DateTime end = DateTime.Today.AddDays(1); model.DateEnd = Convert.ToDateTime(end.AddYears(543).ToString("MM/dd/yyyy")); model.Report.Repairs = ReportManager.ReportRepairDay(start); model.Report.Claims = ReportManager.ReportClaimDay(start); var workingstatus = WorkingStatusManager.GetAll().Where(m => m.iDefault>=5 && m.iDefault<=7); model.Report.WorkingStatuies = workingstatus.OrderBy(m => m.iDefault).ToList(); model.Report.Insurances = InsuranceManager.GetAll().OrderBy(m => m.sInsuranceName).ToList(); model.Report.TCStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ช่าง").OrderBy(m => m.sStaffName).ToList(); model.Report.STCStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "หัวหน้าช่าง").OrderBy(m => m.sStaffName).ToList(); model.Report.QCStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ฝ่ายตรวจสอบคุณภาพ").OrderBy(m => m.sStaffName).ToList(); ViewBag.ReportHeader = String.Format("รายงานบริการประจำวันที่ {0}", DateExtension.DateThaiFormat(start)); return View(model); }
protected void Page_Load(object sender, EventArgs e) { try { if (!this.IsPostBack) { model = (BookingClaimViewModel)System.Web.HttpContext.Current.Session["BookingViewModel"]; if (model != null) { runRptViewer(); #region Application Setting ReportParameter ApplicationSettingName; ReportParameter ApplicationSettingAddress; ReportParameter ApplicationTel; ReportParameter ApplicationFax; if (model.ApplicationSetting != null) { if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName)) { ApplicationSettingName = new ReportParameter("ApplicationSettingName", model.ApplicationSetting.sApplicationName); } else { ApplicationSettingName = new ReportParameter("ApplicationSettingName", "-"); } if (!String.IsNullOrEmpty(model.ApplicationSetting.vApplicationAddress)) { ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", model.ApplicationSetting.vApplicationAddress); } else { ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-"); } if (!String.IsNullOrEmpty(model.ApplicationSetting.sPhone)) { ApplicationTel = new ReportParameter("ApplicationTel", model.ApplicationSetting.sPhone); } else { ApplicationTel = new ReportParameter("ApplicationTel", "-"); } if (!String.IsNullOrEmpty(model.ApplicationSetting.sFax)) { ApplicationFax = new ReportParameter("ApplicationFax", model.ApplicationSetting.sFax); } else { ApplicationFax = new ReportParameter("ApplicationFax", "-"); } } else { ApplicationSettingName = new ReportParameter("ApplicationSettingName", "-"); ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-"); ApplicationTel = new ReportParameter("ApplicationTel", "-"); ApplicationFax = new ReportParameter("ApplicationFax", "-"); } #endregion #region Customer ReportParameter CustomerName; ReportParameter CustomerMobile; ReportParameter CustomerPhone; if (model.Insurance != null) { if (!String.IsNullOrEmpty(model.Insurance.sInsuranceName)) { CustomerName = new ReportParameter("CustomerName", model.Insurance.sInsuranceName); } else { CustomerName = new ReportParameter("CustomerName", "-"); } if (!String.IsNullOrEmpty(model.Insurance.sMobile)) { CustomerMobile = new ReportParameter("CustomerMobile", model.Insurance.sMobile); } else { CustomerMobile = new ReportParameter("CustomerMobile", "-"); } if (!String.IsNullOrEmpty(model.Insurance.sPhone)) { CustomerPhone = new ReportParameter("CustomerPhone", model.Insurance.sPhone); } else { CustomerPhone = new ReportParameter("CustomerPhone", "-"); } } else { CustomerName = new ReportParameter("CustomerName", "-"); CustomerMobile = new ReportParameter("CustomerMobile", "-"); CustomerPhone = new ReportParameter("CustomerPhone", "-"); } #endregion #region Product ReportParameter ProductType; ReportParameter ProductBrand; ReportParameter ProductModel; if (model.Product != null) { if (!String.IsNullOrEmpty(model.Product.vProductTypeDescription)) { ProductType = new ReportParameter("ProductType", model.Product.vProductTypeDescription); } else { ProductType = new ReportParameter("ProductType", "-"); } if (!String.IsNullOrEmpty(model.Product.vBrandDescription)) { ProductBrand = new ReportParameter("ProductBrand", model.Product.vBrandDescription); } else { ProductBrand = new ReportParameter("ProductBrand", "-"); } if (!String.IsNullOrEmpty(model.Product.sProductModel)) { ProductModel = new ReportParameter("ProductModel", model.Product.sProductModel); } else { ProductModel = new ReportParameter("ProductModel", "-"); } } else { ProductType = new ReportParameter("ProductType", "-"); ProductBrand = new ReportParameter("ProductBrand", "-"); ProductModel = new ReportParameter("ProductModel", "-"); } #endregion #region Claim ReportParameter ReferenceNumber; ReportParameter DateAdd; ReportParameter TimeAdd; ReportParameter Serial; if (model.Claim != null) { if (!String.IsNullOrEmpty(model.Claim.sClaimNo)) { ReferenceNumber = new ReportParameter("ReferenceNumber", model.Claim.sClaimNo); } else { ReferenceNumber = new ReportParameter("ReferenceNumber", "-"); } if (model.Claim.dtDateAdd.HasValue) { DateAdd = new ReportParameter("DateAdd", DateExtension.DateThaiFormat(model.Claim.dtDateAdd.Value)); } else { DateAdd = new ReportParameter("DateAdd", "-"); } if (model.Claim.dtDateAdd.HasValue) { TimeAdd = new ReportParameter("TimeAdd", DateTime.Now.ToString(DateExtension.TimeFormat())); } else { TimeAdd = new ReportParameter("TimeAdd", "-"); } if (!String.IsNullOrEmpty(model.Claim.sSerial)) { Serial = new ReportParameter("Serial", model.Claim.sSerial); } else { Serial = new ReportParameter("Serial", "-"); } } else { ReferenceNumber = new ReportParameter("ReferenceNumber", "-"); DateAdd = new ReportParameter("DateAdd", "-"); TimeAdd = new ReportParameter("TimeAdd", "-"); Serial = new ReportParameter("Serial", "-"); } #endregion ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { ApplicationSettingName, ApplicationSettingAddress, CustomerName, CustomerMobile, ReferenceNumber, ProductType, DateAdd, TimeAdd, ApplicationTel, Serial, ApplicationFax }); Session["BookingViewModel"] = null; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
//รายงานคสามเคลื่อนไหวประจำวัน public ActionResult ReportServiceDay() { ViewBag.ReportList = "first active"; ReportServiceDayViewModel model = new ReportServiceDayViewModel(); model.Report = new ReportServiceDay(); DateTime start = DateTime.Today; model.DateStart = Convert.ToDateTime(start.AddYears(543).ToString("MM/dd/yyyy")); model.Report.Repairs = ReportManager.ReportServiceDay(start); ViewBag.ReportHeader = String.Format("รายงานสรุปความเคลื่อนไหวของฟร้อนต์ประจำวันที่ {0}", DateExtension.DateThaiFormat(start)); return View(model); }
public ActionResult ReportServiceDay(ReportServiceDayViewModel model, FormCollection collection) { ViewBag.ReportList = "first active"; DateTime start = model.DateStart; model.DateStart = start.AddYears(-543); model.Report = new ReportServiceDay(); model.Report.Repairs = ReportManager.ReportServiceDay(model.DateStart); //DateTime DateStart; //if (DateTime.TryParse(Request.Form["DateStart"], out DateStart)) //{ // model.DateStart = DateStart.AddYears(-543); // model.Report = new ReportServiceDay(); // model.Report.Repairs = ReportManager.ReportServiceDay(DateStart); // ViewBag.ReportHeader = String.Format("รายงานสรุปความเคลื่อนไหวของฟร้อนต์ประจำวันที่ {0}", DateExtension.DateThaiFormat(model.DateStart)); //} ViewBag.ReportHeader = String.Format("รายงานสรุปความเคลื่อนไหวของฟร้อนต์ประจำวันที่ {0}", DateExtension.DateThaiFormat(model.DateStart)); return View(model); }
protected void Page_Load(object sender, EventArgs e) { try { if (!this.IsPostBack) { model = (BookingRepairViewModel)System.Web.HttpContext.Current.Session["BookingViewModel"]; if (model != null) { runRptViewer(); #region Application Setting //ReportParameter ApplicationLogo; ReportParameter ApplicationSettingName; ReportParameter ApplicationSettingAddress; ReportParameter ApplicationTel; ReportParameter ApplicationFax; if (model.ApplicationSetting != null) { //if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName)) //{ // ApplicationLogo = new ReportParameter("ApplicationLogo", model.ApplicationSetting.sLogoUrl); //} //else //{ // ApplicationLogo = new ReportParameter("ApplicationLogo", ""); //} if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName)) { ApplicationSettingName = new ReportParameter("ApplicationSettingName", model.ApplicationSetting.sApplicationName); } else { ApplicationSettingName = new ReportParameter("ApplicationSettingName", "-"); } if (!String.IsNullOrEmpty(model.ApplicationSetting.vApplicationAddress)) { ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", model.ApplicationSetting.vApplicationAddress); } else { ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-"); } if (!String.IsNullOrEmpty(model.ApplicationSetting.sPhone)) { ApplicationTel = new ReportParameter("ApplicationTel", model.ApplicationSetting.sPhone); } else { ApplicationTel = new ReportParameter("ApplicationTel", "-"); } if (!String.IsNullOrEmpty(model.ApplicationSetting.sFax)) { ApplicationFax = new ReportParameter("ApplicationFax", model.ApplicationSetting.sFax); } else { ApplicationFax = new ReportParameter("ApplicationFax", "-"); } } else { ApplicationSettingName = new ReportParameter("ApplicationSettingName", "-"); ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-"); ApplicationTel = new ReportParameter("ApplicationTel", "-"); ApplicationFax = new ReportParameter("ApplicationFax", "-"); } #endregion #region Customer ReportParameter CustomerName; ReportParameter CustomerMobile; ReportParameter CustomerPhone; if (model.Customer != null) { if (!String.IsNullOrEmpty(model.Customer.sCustomerName)) { CustomerName = new ReportParameter("CustomerName", model.Customer.sCustomerName); } else { CustomerName = new ReportParameter("CustomerName", "-"); } if (!String.IsNullOrEmpty(model.Customer.sMobile)) { CustomerMobile = new ReportParameter("CustomerMobile", model.Customer.sMobile); } else { CustomerMobile = new ReportParameter("CustomerMobile", "-"); } if (!String.IsNullOrEmpty(model.Customer.sPhone)) { CustomerPhone = new ReportParameter("CustomerPhone", model.Customer.sPhone); } else { CustomerPhone = new ReportParameter("CustomerPhone", "-"); } } else { CustomerName = new ReportParameter("CustomerName", "-"); CustomerMobile = new ReportParameter("CustomerMobile", "-"); CustomerPhone = new ReportParameter("CustomerPhone", "-"); } #endregion #region Product ReportParameter ProductType; ReportParameter ProductBrand; ReportParameter ProductModel; if (model.Product != null) { if (!String.IsNullOrEmpty(model.Product.vProductTypeDescription)) { ProductType = new ReportParameter("ProductType", model.Product.vProductTypeDescription); } else { ProductType = new ReportParameter("ProductType", "-"); } if (!String.IsNullOrEmpty(model.Product.vBrandDescription)) { ProductBrand = new ReportParameter("ProductBrand", model.Product.vBrandDescription); } else { ProductBrand = new ReportParameter("ProductBrand", "-"); } if (!String.IsNullOrEmpty(model.Product.sProductModel)) { ProductModel = new ReportParameter("ProductModel", model.Product.sProductModel); } else { ProductModel = new ReportParameter("ProductModel", "-"); } } else { ProductType = new ReportParameter("ProductType", "-"); ProductBrand = new ReportParameter("ProductBrand", "-"); ProductModel = new ReportParameter("ProductModel", "-"); } #endregion #region Repair ReportParameter ReferenceNumber; ReportParameter DateAdd; ReportParameter TimeAdd; ReportParameter Serial; ReportParameter ProductAccessories; ReportParameter ProductColor; ReportParameter DayWarranty; if (model.Repair != null) { if (!String.IsNullOrEmpty(model.Repair.sRepairNo)) { ReferenceNumber = new ReportParameter("ReferenceNumber", model.Repair.sRepairNo); } else { ReferenceNumber = new ReportParameter("ReferenceNumber", "-"); } if (model.Repair.dtDateAdd.HasValue) { DateAdd = new ReportParameter("DateAdd", DateExtension.DateThaiFormat(model.Repair.dtDateAdd.Value)); } else { DateAdd = new ReportParameter("DateAdd", "-"); } if (model.Repair.dtDateAdd.HasValue) { TimeAdd = new ReportParameter("TimeAdd", DateTime.Now.ToString(DateExtension.TimeFormat())); } else { TimeAdd = new ReportParameter("TimeAdd", "-"); } if (!String.IsNullOrEmpty(model.Repair.sSerial)) { Serial = new ReportParameter("Serial", model.Repair.sSerial); } else { Serial = new ReportParameter("Serial", "-"); } if (!String.IsNullOrEmpty(model.Repair.sProductAccessories)) { ProductAccessories = new ReportParameter("ProductAccessories", model.Repair.sProductAccessories); } else { ProductAccessories = new ReportParameter("ProductAccessories", "-"); } if (!String.IsNullOrEmpty(model.Repair.sColor)) { ProductColor = new ReportParameter("ProductColor", model.Repair.sColor); } else { ProductColor = new ReportParameter("ProductColor", "-"); } if (model.Repair.iDayWarranty.HasValue) { DayWarranty = new ReportParameter("DayWarranty", model.Repair.iDayWarranty.ToString()); } else { DayWarranty = new ReportParameter("DayWarranty", "-"); } } else { ReferenceNumber = new ReportParameter("ReferenceNumber", "-"); DateAdd = new ReportParameter("DateAdd", "-"); TimeAdd = new ReportParameter("TimeAdd", "-"); Serial = new ReportParameter("Serial", "-"); ProductAccessories = new ReportParameter("ProductAccessories", "-"); ProductColor = new ReportParameter("ProductColor", "-"); DayWarranty = new ReportParameter("DayWarranty", "-"); } #endregion ReportParameter InsuranceExpire; if (model.Repair.dtInsuranceExpire != null) { if (model.Repair.dtInsuranceExpire.HasValue) { InsuranceExpire = new ReportParameter("InsuranceExpire", DateExtension.DateThaiFormat(model.Repair.dtInsuranceExpire.Value)); } else { InsuranceExpire = new ReportParameter("InsuranceExpire", "-"); } } else { InsuranceExpire = new ReportParameter("InsuranceExpire", "-"); } ReportParameter DueDate; if (model.Repair.dtDueDate != null) { if (model.Repair.dtDueDate.HasValue) { DueDate = new ReportParameter("DueDate", DateExtension.DateThaiFormat(model.Repair.dtDueDate.Value)); } else { DueDate = new ReportParameter("DueDate", "-"); } } else { DueDate = new ReportParameter("DueDate", "-"); } ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { ApplicationSettingName, ApplicationSettingAddress, CustomerName, CustomerMobile, CustomerPhone, ProductType, ProductBrand, ReferenceNumber, DateAdd, TimeAdd, ApplicationTel, ProductModel, Serial, InsuranceExpire, ProductAccessories, ProductColor, DayWarranty, DueDate, ApplicationFax }); Session["BookingViewModel"] = null; } } } catch (Exception ex) { throw new Exception(ex.Message); } }