public ActionResult IVS286_SearchData(doIVS286SearchCondition searchParam)
        {
            IVS286_ScreenParameter param = GetScreenObject <IVS286_ScreenParameter>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (CommonUtil.IsNullAllField(searchParam))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else
                {
                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    var lst = service.GetStockReport_InProcess(searchParam);
                    CommonUtil.MappingObjectLanguage <dtInProcessReport>(lst);
                    param.LastSearchParam = searchParam;
                    res.ResultData        = CommonUtil.ConvertToXml(lst, @"Inventory\IVS286_SearchResult", CommonUtil.GRID_EMPTY_TYPE.VIEW);
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        /// <summary>
        /// Checking user's permission.
        /// </summary>
        /// <param name="param">Screen's parameter.</param>
        /// <returns>Return ActionResult of the screen.</returns>
        public ActionResult IVS286_Authority(IVS286_ScreenParameter param)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                ICommonHandler srvCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                if (srvCommon.IsSystemSuspending())
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    //res.ResultData = MessageUtil.MessageList.MSG0049.ToString();
                    return(Json(res));
                }

                if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_IN_STOCK_REPORT, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    //res.ResultData = MessageUtil.MessageList.MSG0053.ToString();
                    return(Json(res));
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(InitialScreenEnvironment <IVS286_ScreenParameter>("IVS286", param, res));
        }
        public ActionResult IVS286_Download()
        {
            IVS286_ScreenParameter param = GetScreenObject <IVS286_ScreenParameter>();

            if (!string.IsNullOrEmpty(param.PendingDownloadFilePath))
            {
                var stream = new FileStream(param.PendingDownloadFilePath, FileMode.Open, FileAccess.Read);
                param.PendingDownloadFilePath = null;
                return(File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", param.PendingDownloadFileName));
            }
            else
            {
                ObjectResultData res = new ObjectResultData();
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(new FileNotFoundException("Report file not found.", param.PendingDownloadFilePath));
                return(Json(res));
            }
        }
        public ActionResult IVS286_GenerateReportSummary(doIVS286SearchCondition reportParam)
        {
            IVS286_ScreenParameter param = GetScreenObject <IVS286_ScreenParameter>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                if (reportParam.ContractCodeSelected == null || reportParam.ContractCodeSelected.Length == 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else
                {
                    if (param.LastSearchParam == null)
                    {
                        param.LastSearchParam = reportParam;
                    }

                    IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    var lst = service.GetStockReport_InProcess(new doIVS286SearchCondition()
                    {
                        ReportType           = param.LastSearchParam.ReportType,
                        ContractCode         = null,
                        ProcessDate          = param.LastSearchParam.ProcessDate,
                        ContractCodeSelected = reportParam.ContractCodeSelected,
                    });
                    IInventoryDocumentHandler docService = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler;
                    param.PendingDownloadFilePath = docService.GenerateIVS286InProcessReportSummary(param.LastSearchParam.ReportType, lst, param.LastSearchParam);
                    param.PendingDownloadFileName = "InprocessReport.xlsx";
                    res.ResultData = true;
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        public ActionResult IVS286_GetDetail(doIVS286SearchCondition searchParam)
        {
            IVS286_ScreenParameter param = GetScreenObject <IVS286_ScreenParameter>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                IInventoryHandler service = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                var lst = service.GetStockReport_InProcess_Detail(searchParam);
                CommonUtil.MappingObjectLanguage <dtInProcessReportDetail>(lst);
                res.ResultData = CommonUtil.ConvertToXml(lst, @"Inventory\IVS286_Detail", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }