public ActionResult ICS130_DownloadReport()
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                ValidatorUtil validator = new ValidatorUtil();
                var           hand      = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler;
                var           param     = this.GetScreenObject <ICS130_ScreenParameter>();

                string reportPath = "", reportName = "";

                if (param.CachedReportType == ICS130_ScreenParameter.eCacheReportType.Account)
                {
                    if (param.CachedAccountReport == null)
                    {
                        // add by jirawat jannet on 2016-11-08
                        ObjectResultData re = new ObjectResultData();
                        re.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                        re.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS130"
                                           , MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0018);
                        return(Json(re));
                        //throw new HttpException(404, "NotFound");
                    }
                    else
                    {
                        IIncomeDocumentHandler docService = ServiceContainer.GetService <IIncomeDocumentHandler>() as IIncomeDocumentHandler;
                        reportPath = docService.GenerateICS130ForAccount(param.CachedAccountReport, param.CachedPeriodFrom);
                        reportName = "WHTReport_ACC.xlsx";
                    }
                }
                else if (param.CachedReportType == ICS130_ScreenParameter.eCacheReportType.IMS)
                {
                    if (param.CachedIMSReport == null)
                    {
                        // add by jirawat jannet on 2016-11-08
                        ObjectResultData re = new ObjectResultData();
                        re.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                        re.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS130"
                                           , MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0018);
                        return(Json(re));
                        //throw new HttpException(404, "NotFound");
                    }
                    else
                    {
                        IIncomeDocumentHandler docService = ServiceContainer.GetService <IIncomeDocumentHandler>() as IIncomeDocumentHandler;
                        reportPath = docService.GenerateICS130ForIMS(param.CachedIMSReport, param.CachedPeriodFrom, param.CachedPeriodTo);
                        reportName = "WHTReport_IMS.xlsx";
                    }
                }

                if (string.IsNullOrEmpty(reportPath) || !System.IO.File.Exists(reportPath))
                {
                    // add by jirawat jannet on 2016-11-08
                    ObjectResultData re = new ObjectResultData();
                    re.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    re.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS130"
                                       , MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0018);
                    return(Json(re));
                    //throw new HttpException(404, "NotFound");
                }

                var stream = new FileStream(reportPath, FileMode.Open, FileAccess.Read);
                reportPath = null;
                return(File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", reportName));
            }
            catch (Exception ex)
            {
                // add by jirawat jannet on 2016-11-08
                ObjectResultData re = new ObjectResultData();
                re.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                re.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS130"
                                   , MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0018);
                return(Json(re));
                //throw new HttpException(404, "NotFound", ex);
            }
        }