Ejemplo n.º 1
0
        //สรุปผลงานช่างประจำเดือน
        public ActionResult ReportServices()
        {
            ViewBag.ReportList = "first active";

            ReportServicesViewModel model = new ReportServicesViewModel();

            model.Report = new ReportServices();

            DateTime start = DateExtension.FirstDayOfMonthFromDateTime(DateTime.Now);

            model.DateStart = Convert.ToDateTime(start.AddYears(543).ToString("MM/dd/yyyy"));

            DateTime end = DateExtension.LastDayOfMonthFromDateTime(DateTime.Now);

            model.DateEnd = Convert.ToDateTime(end.AddYears(543).ToString("MM/dd/yyyy"));

            model.Report.Repairs = ReportManager.ReportRepair(start, end);
            model.Report.Claims  = ReportManager.ReportClaim(start, end);


            model.Report.Staffs      = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.SuperStaffs = 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.DateThaiFormat2(start));
            return(View(model));
        }
        public ActionResult ReportServices(ReportServicesViewModel model, FormCollection collection)
        {
            ViewBag.ReportList = "first active";

            DateTime start = model.DateStart;
            model.DateStart = start.AddYears(-543);

            DateTime end = model.DateEnd;
            model.DateEnd = end.AddYears(-543);

            model.Report = new ReportServices();
            model.Report.Repairs = ReportManager.ReportRepair(model.DateStart, model.DateEnd);
            model.Report.Claims = ReportManager.ReportClaim(model.DateStart, model.DateEnd);

            model.Report.Staffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.SuperStaffs = 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.DateThaiFormat2(model.DateStart));
            return View(model);
        }
        public static ReportServicesViewModel ToViewModel(this ReportServicesViewModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new ReportServicesViewModel
            {
                ReportGroupID     = entity.ReportGroupID,
                ReportID          = entity.ReportID,
                ReportModel       = entity.ReportModel,
                ReportName        = entity.ReportName,
                ReportTypeID      = entity.ReportTypeID,
                ReportTypeName    = entity.ReportTypeName,
                ReportURL         = entity.ReportURL,
                ReportDisplayName = entity.ReportDisplayName
            };

            return(model);
        }