public ActionResult PurgeHistoryReport(CMSReportViewModels model, ServiceResult msgresult)
        {
            var uService = new UserService();
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0016);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            model.Modify = prole.Modify;
            model.View   = prole.View;
            model.result = msgresult; // return result from http post
            var cmsService = new CMSService();
            var cbService  = new ComboService();
            var hasCri     = new ComboCriteria()
            {
                Date_Delivered = true, Delivery_Order_No = true
            };

            model.purgelist = new List <CMS_Purge>();

            if (!string.IsNullOrEmpty(model.Date_From) || !string.IsNullOrEmpty(model.Date_To) || !string.IsNullOrEmpty(model.Drum_Code))
            {
                var cri = new CMSCriteria();
                cri.Date_From            = model.Date_From;
                cri.Date_To              = model.Date_To;
                cri.Drum_Code            = model.Drum_Code;
                cri.Drum_Code_Have_Value = true;
                var result = cmsService.GetCMSPurge(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.purgelist = result.Object as List <CMS_Purge>;
                }

                cri = new CMSCriteria();
                cri.Drum_Code_Have_Value = true;
                var result2 = cmsService.GetCMSPurge(cri);
                if (result2.Code == ReturnCode.SUCCESS)
                {
                    model.purgelistAll = result2.Object as List <CMS_Purge>;
                }
            }
            return(View(model));
        }
        public ActionResult InventoryReport(CMSReportViewModels model, ServiceResult msgresult)
        {
            var uService = new UserService();
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0016);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            model.Modify = prole.Modify;
            model.View   = prole.View;
            model.result = msgresult; // return result from http post
            var cmsService = new CMSService();
            var cbService  = new ComboService();
            var hasCri     = new ComboCriteria()
            {
                Date_Charged = true
            };

            model.cSortlist = cbService.LstSortAction(false, hasCri);

            model.cProductCodelist = cbService.LstProductByCode(true);


            model.chargelist = new List <CMS_Charge>();

            if (!string.IsNullOrEmpty(model.Lot_No) || !string.IsNullOrEmpty(model.Drum_Code) || !string.IsNullOrEmpty(model.Product_Code))
            {
                var cri = new CMSCriteria();
                cri.Lot_No               = model.Lot_No;
                cri.Drum_Code            = model.Drum_Code;
                cri.Product_Code         = model.Product_Code;
                cri.Not_Yet_Deliver      = true;
                cri.Sort_By              = model.Sort_By;
                cri.Drum_Code_Have_Value = true;
                var result = cmsService.GetCMSCharge(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.chargelist = result.Object as List <CMS_Charge>;
                }

                cri = new CMSCriteria();
                cri.Drum_Code_Have_Value = true;
                var result2 = cmsService.GetCMSCharge(cri);
                if (result2.Code == ReturnCode.SUCCESS)
                {
                    model.chargelistAll = result2.Object as List <CMS_Charge>;
                }
            }
            return(View(model));
        }