/// <summary> /// Retrieve unpaid detail dept summary information list by invoice of specific screen mode and search criteria information /// </summary> /// <param name="data">Search criteria from link</param> /// <returns></returns> public ActionResult ICS030_LoadGetUnpaidDetailDebtSummaryByInvoiceData(ICS030_RegisterData data) { ICS030_ScreenParameter param = GetScreenObject <ICS030_ScreenParameter>(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; List <doGetUnpaidDetailDebtSummary> _doGetUnpaidDetailDebtSummaryList = new List <doGetUnpaidDetailDebtSummary>(); try { if (param != null) { data.intMonth = data.RawdtpMonthYear.Month; data.intYear = data.RawdtpMonthYear.Year; IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; _doGetUnpaidDetailDebtSummaryList = iincomeHandler.GetUnpaidDetailDebtSummaryByInvoiceList( data.strInvoiceNo, (int?)Convert.ToInt32(data.strInvoiceOCC), data.strOfficeCode); //Add (strOfficeCode) by Jutarat A. on 11042014 foreach (var item in _doGetUnpaidDetailDebtSummaryList) { if (item.DebtTracingRegistered == 1) { item.DebtTracingRegisteredGridFormat = param.conYes; } else { item.DebtTracingRegisteredGridFormat = param.conNo; } } // Save RegisterData in session param.RegisterData = data; } } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); return(Json(res)); } res.ResultData = CommonUtil.ConvertToXml <doGetUnpaidDetailDebtSummary>(_doGetUnpaidDetailDebtSummaryList, "Income\\ICS030_ListOfUnPaidByBillingTarget", CommonUtil.GRID_EMPTY_TYPE.VIEW); return(Json(res)); }
public ActionResult ICS033() { ICS033_ScreenParameter param = GetScreenObject <ICS033_ScreenParameter>(); if (param != null) { #region Billing detail ViewBag.BillingOfficeCode = param.BillingOfficeCode; ViewBag.BillingOfficeName = param.BillingOfficeName; ViewBag.BillingClientNameEN = param.BillingClientNameEN; ViewBag.BillingClientNameLC = param.BillingClientNameLC; ViewBag.BillingClientAddressEN = param.BillingClientAddressEN; ViewBag.BillingClientAddressLC = param.BillingClientAddressLC; ViewBag.BillingClientTelNo = param.BillingClientTelNo; ViewBag.ContactPersonName = param.ContactPersonName; ViewBag.Mode = param.Mode; ViewBag.BillingTargetCode = param.BillingTargetCode; ViewBag.InvoiceNo = param.InvoiceNo; ViewBag.InvoiceOCC = param.InvoiceOCC; ViewBag.BillingCode = param.BillingCode; #endregion #region Unpaid billing detail list #region Get data IIncomeHandler incomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; if (param.Mode == ICS033_ScreenCallerMode.GetByBillingTarget) { string billingTargetCodeLongFormat = new CommonUtil().ConvertBillingTargetCode(param.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); param.UnpaidDetailDebtSummary = incomeHandler.GetUnpaidDetailDebtSummaryByBillingTargetList(billingTargetCodeLongFormat); } else if (param.Mode == ICS033_ScreenCallerMode.GetByInvoice) { param.UnpaidDetailDebtSummary = incomeHandler.GetUnpaidDetailDebtSummaryByInvoiceList(param.InvoiceNo, param.InvoiceOCC); } else if (param.Mode == ICS033_ScreenCallerMode.GetByBillingCode) { param.UnpaidDetailDebtSummary = incomeHandler.GetUnpaidDetailDebtSummaryByBillingCodeList(param.BillingCode); } #endregion #region Display Yes/No format string yesDisplay = string.Empty; string noDisplay = string.Empty; List <doMiscTypeCode> miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_FLAG_DISPLAY, ValueCode = "%" } }; ICommonHandler hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> lst = hand.GetMiscTypeCodeList(miscs); foreach (doMiscTypeCode l in lst) { if (l.ValueCode == FlagDisplay.C_FLAG_DISPLAY_NO) { yesDisplay = l.ValueDisplay; } if (l.ValueCode == FlagDisplay.C_FLAG_DISPLAY_YES) { noDisplay = l.ValueDisplay; } } foreach (doGetUnpaidDetailDebtSummary item in param.UnpaidDetailDebtSummary) { if (item.DebtTracingRegistered == 1) { item.DebtTracingRegisteredGridFormat = noDisplay; } else { item.DebtTracingRegisteredGridFormat = yesDisplay; } } #endregion #endregion #region Calculate total unpaid decimal unpaidAmount = 0; decimal unpaidAmountUs = 0; if (param.UnpaidDetailDebtSummary != null) { unpaidAmount = param.UnpaidDetailDebtSummary.Sum(d => d.BillingAmount).GetValueOrDefault(); unpaidAmountUs = param.UnpaidDetailDebtSummary.Sum(d => d.BillingAmountUsd).GetValueOrDefault(); } ViewBag.UnpaidAmountString = unpaidAmount.ToString("N2"); ViewBag.unpaidAmountUsString = unpaidAmountUs.ToString("N2"); #endregion // add by Jirawat Jannet @ 2016-10-17 #region Currency Type ViewBag.CurrencyTypeLocalName = MiscellaneousTypeCommon.getCurrencyName(CurrencyUtil.C_CURRENCY_LOCAL); ViewBag.CurrencyTypeUsName = MiscellaneousTypeCommon.getCurrencyName(CurrencyUtil.C_CURRENCY_US); #endregion } return(View()); }