//Add by Jutarat A. on 05032014
        /// <summary>
        /// Get BillingOfficeDebtSummary list
        /// </summary>
        /// <returns></returns>
        public ActionResult ICS030_LoadGetBillingOfficeDebtSummaryToGrid(ICS030_RegisterData data)
        {
            ICS030_ScreenParameter param = GetScreenObject <ICS030_ScreenParameter>();
            ObjectResultData       res   = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler;
            List <doGetBillingOfficeDebtSummary> _doGetBillingOfficeDebtSummaryList = new List <doGetBillingOfficeDebtSummary>();
            List <OfficeDataDo> _doOfficeDataDo = new List <OfficeDataDo>();

            //  Add by Jirawat Jannet @ 2016-10-10
            #region Init new data model for uing new billing office debt summary table datas

            string localCurrency = MiscellaneousTypeCommon.getCurrencyName(CurrencyUtil.C_CURRENCY_LOCAL);
            string UsCurrency    = MiscellaneousTypeCommon.getCurrencyName(CurrencyUtil.C_CURRENCY_US);

            List <ICS030_DebtActualTableData> _doDebtActualTabledatas = new List <ICS030_DebtActualTableData>();

            #endregion


            try
            {
                data.intMonth = data.RawdtpMonthYear.Month;
                data.intYear  = data.RawdtpMonthYear.Year;

                _doGetBillingOfficeDebtSummaryList = iincomeHandler.GetBillingOfficeDebtSummaryList(data.intMonth, data.intYear);
                _doOfficeDataDo = CommonUtil.dsTransData.dtOfficeData;

                if (_doGetBillingOfficeDebtSummaryList != null && _doGetBillingOfficeDebtSummaryList.Count > 0)
                {
                    foreach (doGetBillingOfficeDebtSummary billingData in _doGetBillingOfficeDebtSummaryList)
                    {
                        string strDisableLinkOfficeFlag = "1";
                        for (int i = 0; i < _doOfficeDataDo.Count; i++)
                        {
                            if (billingData.BillingOfficeCode == _doOfficeDataDo[i].OfficeCode)
                            {
                                strDisableLinkOfficeFlag = "0";
                                break;
                            }
                        }

                        billingData.DisableLinkOfficeFlag = strDisableLinkOfficeFlag;
                    }

                    #region Initial new datas for this table

                    foreach (var item in _doGetBillingOfficeDebtSummaryList)
                    {
                        #region Local currency

                        // local currency line 1
                        _doDebtActualTabledatas.Add(new ICS030_DebtActualTableData()
                        {
                            BillingOffice         = item.BillingOffice,
                            BillingOfficeCode     = item.BillingOfficeCode,
                            DisableLinkOfficeFlag = item.DisableLinkOfficeFlag,
                            BillingOfficeName     = item.BillingOfficeName,
                            Currency                        = localCurrency,
                            AllUnpaidActual                 = item.UnpaidAmountString,
                            AllUnpaidTarget                 = item.TargetAmountAllString,
                            AllUnpaidCompareTotarget        = item.TargetAmountAllShow,
                            UnpaidOver2MonthActual          = item.UnpaidAmount2MonthString,
                            UnpaidOver2MonthTarget          = item.TargetAmount2MonthString,
                            UnpaidOver2MonthCompareTotarget = item.TargetAmount2MonthShow,
                            UnpaidOver6Month                = item.UnpaidAmount6MonthString,

                            UnpaidAmount       = item.UnpaidAmount,
                            UnpaidAmount2Month = item.UnpaidAmount2Month,
                            UnpaidAmount6Month = item.UnpaidAmount6Month,
                            UnpaidDetail       = item.UnpaidDetail,
                            UnpaidDetail2Month = item.UnpaidDetail2Month,
                            UnpaidDetail6Month = item.UnpaidDetail6Month,
                            TargetAmountAll    = item.TargetAmountAll,
                            TargetAmount2Month = item.TargetAmount2Month,
                            TargetDetailAll    = item.TargetDetailAll,
                            TargetDetail2Month = item.TargetDetail2Month
                        });
                        // local currency line 2
                        _doDebtActualTabledatas.Add(new ICS030_DebtActualTableData()
                        {
                            BillingOffice         = item.BillingOffice,
                            BillingOfficeCode     = item.BillingOfficeCode,
                            DisableLinkOfficeFlag = item.DisableLinkOfficeFlag,
                            BillingOfficeName     = item.BillingOfficeName,
                            Currency                        = localCurrency,
                            AllUnpaidActual                 = item.UnpaidDetailString,
                            AllUnpaidTarget                 = item.TargetDetailAllString,
                            AllUnpaidCompareTotarget        = item.TargetDetailAllShow,
                            UnpaidOver2MonthActual          = item.UnpaidDetail2MonthString,
                            UnpaidOver2MonthTarget          = item.TargetDetail2MonthString,
                            UnpaidOver2MonthCompareTotarget = item.TargetDetail2MonthShow,
                            UnpaidOver6Month                = item.UnpaidDetail6MonthString,

                            UnpaidAmount       = 0,
                            UnpaidAmount2Month = 0,
                            UnpaidAmount6Month = 0,
                            UnpaidDetail       = 0,
                            UnpaidDetail2Month = 0,
                            UnpaidDetail6Month = 0,
                            TargetAmountAll    = 0,
                            TargetAmount2Month = 0,
                            TargetDetailAll    = 0,
                            TargetDetail2Month = 0
                        });

                        #endregion

                        #region US Currency

                        // us currency line 1
                        _doDebtActualTabledatas.Add(new ICS030_DebtActualTableData()
                        {
                            BillingOffice         = item.BillingOffice,
                            BillingOfficeCode     = item.BillingOfficeCode,
                            DisableLinkOfficeFlag = item.DisableLinkOfficeFlag,
                            BillingOfficeName     = item.BillingOfficeName,
                            Currency                        = UsCurrency,
                            AllUnpaidActual                 = item.UnpaidAmountUsdString,
                            AllUnpaidTarget                 = item.TargetAmountAllUsdString,
                            AllUnpaidCompareTotarget        = item.TargetAmountAllUsdShow,
                            UnpaidOver2MonthActual          = item.UnpaidAmount2MonthUsdString,
                            UnpaidOver2MonthTarget          = item.TargetAmount2MonthUsdString,
                            UnpaidOver2MonthCompareTotarget = item.TargetAmount2MonthUsdShow,
                            UnpaidOver6Month                = item.UnpaidAmount6MonthUsdString,

                            UnpaidAmount       = item.UnpaidAmountUsd,
                            UnpaidAmount2Month = item.UnpaidAmount2MonthUsd,
                            UnpaidAmount6Month = item.UnpaidAmount6MonthUsd,
                            UnpaidDetail       = item.UnpaidDetailUsd,
                            UnpaidDetail2Month = item.UnpaidDetail2MonthUsd,
                            UnpaidDetail6Month = item.UnpaidDetail6MonthUsd,
                            TargetAmountAll    = item.TargetAmountAllUsd,
                            TargetAmount2Month = item.TargetAmount2MonthUsd,
                            TargetDetailAll    = item.TargetDetailAllUsd,
                            TargetDetail2Month = item.TargetDetail2MonthUsd,
                        });
                        // us currency line 2
                        _doDebtActualTabledatas.Add(new ICS030_DebtActualTableData()
                        {
                            BillingOffice         = item.BillingOffice,
                            BillingOfficeCode     = item.BillingOfficeCode,
                            DisableLinkOfficeFlag = item.DisableLinkOfficeFlag,
                            BillingOfficeName     = item.BillingOfficeName,
                            Currency                        = UsCurrency,
                            AllUnpaidActual                 = item.UnpaidDetailUsdString,
                            AllUnpaidTarget                 = item.TargetDetailAllUsdString,
                            AllUnpaidCompareTotarget        = item.TargetDetailAllUsdShow,
                            UnpaidOver2MonthActual          = item.UnpaidDetail2MonthUsdString,
                            UnpaidOver2MonthTarget          = item.TargetDetail2MonthUsdString,
                            UnpaidOver2MonthCompareTotarget = item.TargetDetail2MonthUsdShow,
                            UnpaidOver6Month                = item.UnpaidDetail6MonthUsdString,

                            UnpaidAmount       = 0,
                            UnpaidAmount2Month = 0,
                            UnpaidAmount6Month = 0,
                            UnpaidDetail       = 0,
                            UnpaidDetail2Month = 0,
                            UnpaidDetail6Month = 0,
                            TargetAmountAll    = 0,
                            TargetAmount2Month = 0,
                            TargetDetailAll    = 0,
                            TargetDetail2Month = 0
                        });

                        #endregion
                    }

                    #endregion
                }

                if (param != null)
                {
                    param.doGetBillingOfficeDebtSummaryList    = _doGetBillingOfficeDebtSummaryList;
                    param.doNewGetBillingOfficeDebtSummaryList = _doDebtActualTabledatas;
                    param.doOfficeDataDo = _doOfficeDataDo;
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
                return(Json(res));
            }

            //res.ResultData = CommonUtil.ConvertToXml<doGetBillingOfficeDebtSummary>(_doGetBillingOfficeDebtSummaryList, "Income\\ICS030_DebtActualTable", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            res.ResultData = CommonUtil.ConvertToXml <ICS030_DebtActualTableData>(_doDebtActualTabledatas, "Income\\ICS030_DebtActualTable", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            return(Json(res));
        }