/// <summary> /// Get auto transfer bank file list (csv) /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult BLS080_SearchResponse(BLS080_SearchCondition cond) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; List <dtDownloadAutoTransferBankFile> list = new List <dtDownloadAutoTransferBankFile>(); try { // Check required field. //if (ModelState.IsValid == false) //{ // ValidatorUtil.BuildErrorMessage(res, this); // if (res.IsError) // return Json(res); //} if (CommonUtil.IsNullAllField(cond)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006); } IBillingHandler handlerBilling = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; list = handlerBilling.GetDownloadAutoTransferBankFile(cond.SecomAccountID, cond.AutoTranferDateFrom, cond.AutoTranferDateTo, cond.GeneateDateFrom, cond.GeneateDateTo); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } res.ResultData = CommonUtil.ConvertToXml <dtDownloadAutoTransferBankFile>(list, "Billing\\BLS080_SearchResult", CommonUtil.GRID_EMPTY_TYPE.SEARCH); return(Json(res)); }
/// <summary> /// Generate install billing OCC combobox /// </summary> /// <param name="helper"></param> /// <param name="id"></param> /// <param name="ContractCode"></param> /// <param name="attribute"></param> /// <param name="include_idx0"></param> /// <returns></returns> public static MvcHtmlString InstallBillingOCCComboBox(this HtmlHelper helper, string id, string ContractCode = null, object attribute = null, bool include_idx0 = true) { List <tbt_BillingBasic> lst = new List <tbt_BillingBasic>(); try { IBillingHandler handle = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; lst = handle.GetTbt_BillingBasicListData(ContractCode); //var sortedList = from p in lst // orderby p.BillingOCC // select p; var sortedList = (from t in lst orderby t.BillingOCC group t by new { BillingOCC = t.BillingOCC } into g select g.FirstOrDefault()); lst = sortedList.ToList <tbt_BillingBasic>(); } catch { lst = new List <tbt_BillingBasic>(); } return(CommonUtil.CommonComboBox <tbt_BillingBasic>(id, lst, "BillingOCC", "BillingOCC", attribute)); }
/// <summary> /// Generate revenue no. and save revenue information to DB. /// </summary> /// <param name="_dotbt_Revenue"></param> /// <returns></returns> public tbt_Revenue RegisterRevenue(tbt_Revenue _dotbt_Revenue) { try { IBillingHandler iBillingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; _dotbt_Revenue.RevenueNo = iBillingHandler.GetNextRunningNoByTypeMonthYear(RunningType.C_RUNNING_TYPE_REVENUE); //set CreateDate, CreateBy, UpdateDate and UpdateBy _dotbt_Revenue.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; _dotbt_Revenue.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; _dotbt_Revenue.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; _dotbt_Revenue.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; if (InsertTbt_Revenue(_dotbt_Revenue) == 0) { return(null); } else { return(_dotbt_Revenue); } } catch (Exception) { throw; } }
public ActionResult BLP020_GenerateReport(string strInvoiceNo) { ObjectResultData res = new ObjectResultData(); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; IBillingDocumentHandler billingDocumentHandler = ServiceContainer.GetService <IBillingDocumentHandler>() as IBillingDocumentHandler; try { // Comment by Jirawat Jannet //List<tbt_TaxInvoice> taxInvoiceList = billingHandler.GetTbt_TaxInvoice(strInvoiceNo); //if (taxInvoiceList != null && taxInvoiceList.Count > 0) //{ // billingDocumentHandler.GenerateBLR020FilePath(taxInvoiceList[0].TaxInvoiceNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, taxInvoiceList[0].CreateDate.Value); //} throw new Exception("กำลังดำเนินการแก้ไข report BLR020"); //ICommonHandler comHandler = ServiceContainer.GetService<ICommonHandler>() as ICommonHandler; //List<tbt_DocumentList> documentList = comHandler.GetTbt_DocumentList(null, null, null); //if (documentList != null && documentList.Count > 0) //{ // foreach (tbt_DocumentList data in documentList) // { // billingDocumentHandler.GenerateBLR020FilePath(data.DocumentNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, data.CreateDate.Value); // } //} } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Get billing detail for combine /// </summary> /// <returns></returns> public ActionResult BLS071_GetBillingDetailForCombine() { ObjectResultData res = new ObjectResultData(); BLS071_ScreenParameter param = GetScreenObject <BLS071_ScreenParameter>(); try { List <BLS071_BillingDetail> doBillingDetail = new List <BLS071_BillingDetail>(); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; CommonUtil cm = new CommonUtil(); if (param.dtOldBillingDetailList.Count > 0) { string strBillingTargetCode_long = cm.ConvertBillingTargetCode(param.doBillingTarget.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); string strBillingTypeCode = param.dtOldBillingDetailList[0].BillingTypeCode; List <doBillingDetail> doBillingDetailForCombineList = handler.GetBillingDetailForCombine(strBillingTargetCode_long, strBillingTypeCode, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US, param.currencyCode); List <doMiscTypeCode> lst = new List <doMiscTypeCode>(); ICommonHandler hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; lst = hand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); foreach (var d in doBillingDetailForCombineList) { if (string.IsNullOrEmpty(d.BillingAmountCurrencyType)) { d.BillingAmountCurrencyType = "1"; } if (d.BillingAmountCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { d.BillingAmount = d.BillingAmountUsd; } if (d.BillingAmount == null) { d.BillingAmount = 0; } d.BillingAmountCurrencyTypeName = lst.Where(m => m.ValueCode == d.BillingAmountCurrencyType).Select(m => m.ValueDisplayEN).FirstOrDefault(); } doBillingDetail = CommonUtil.ClonsObjectList <doBillingDetail, BLS071_BillingDetail>(doBillingDetailForCombineList); } param.doBillingDetailForCombineList = doBillingDetail; res.ResultData = CommonUtil.ConvertToXml <BLS071_BillingDetail>(doBillingDetail, "Billing\\BLS071_BillingDetail", CommonUtil.GRID_EMPTY_TYPE.VIEW); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult BLP010_GenerateReportFromTable() { ObjectResultData res = new ObjectResultData(); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; IBillingDocumentHandler billingDocumentHandler = ServiceContainer.GetService <IBillingDocumentHandler>() as IBillingDocumentHandler; res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.ResultData = true; try { List <string> lstInvoiceNo = billingHandler.GetTbt_InvoiceReprint(); foreach (string invoiceno in lstInvoiceNo) { try { billingDocumentHandler.GenerateBLR010FilePath(invoiceno, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, DateTime.Now); } catch (Exception ex) { res.ResultData = false; res.AddErrorMessage(ex); } } } catch (Exception ex) { res.ResultData = false; res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult BLP010_GenerateReport(string strInvoiceNo) { ObjectResultData res = new ObjectResultData(); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; IBillingDocumentHandler billingDocumentHandler = ServiceContainer.GetService <IBillingDocumentHandler>() as IBillingDocumentHandler; try { List <tbt_Invoice> invoiceList = billingHandler.GetTbt_Invoice(strInvoiceNo, null).OrderByDescending(t => t.InvoiceOCC).ToList <tbt_Invoice>(); if (invoiceList != null && invoiceList.Count > 0) { billingDocumentHandler.GenerateBLR010FilePath(invoiceList[0].InvoiceNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, invoiceList[0].CreateDate.Value); } //ICommonHandler comHandler = ServiceContainer.GetService<ICommonHandler>() as ICommonHandler; //List<tbt_DocumentList> documentList = comHandler.GetTbt_DocumentList(null, null, null); //if (documentList != null && documentList.Count > 0) //{ // foreach (tbt_DocumentList data in documentList) // { // billingDocumentHandler.GenerateBLR010FilePath(data.DocumentNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, data.CreateDate.Value); // } //} } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public PatientBilling( IBillingHandlerByInsuranceSelector billingHandlerSelector, IBillingHandler directPatientBilling) { _billingHandlerSelector = billingHandlerSelector; _directPatientBilling = directPatientBilling; }
/// <summary> /// Getting billing type detail list for load to grid /// </summary> /// <param name="BillingOCC"></param> /// <returns></returns> public ActionResult CMS420_LoadGridBillingTypeDetail(string BillingOCC) { ObjectResultData res = new ObjectResultData(); try { CMS420_ScreenParameter param = GetScreenObject <CMS420_ScreenParameter>(); CommonUtil cm = new CommonUtil(); string strContractCode_short = param.ContractCode; string strContractCode = cm.ConvertContractCode(strContractCode_short, CommonUtil.CONVERT_TYPE.TO_LONG); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <doBillingTypeDetailList> billingTypeDetailListData = billingHandler.GetBillingTypeDetailList(strContractCode, BillingOCC); CommonUtil.MappingObjectLanguage <doBillingTypeDetailList>(billingTypeDetailListData); if (billingTypeDetailListData == null) { billingTypeDetailListData = new List <doBillingTypeDetailList>(); } string xml = CommonUtil.ConvertToXml <doBillingTypeDetailList>(billingTypeDetailListData, "Common\\CMS420_BillingTypeDetail", CommonUtil.GRID_EMPTY_TYPE.SEARCH); res.ResultData = xml; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Function for generate credit note no. and save credit note information to DB. /// </summary> /// <param name="_dotbt_CreditNote">credit note information</param> /// <returns></returns> public tbt_CreditNote RegisterCreditNote(tbt_CreditNote _dotbt_CreditNote) { try { IBillingHandler iBillingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; _dotbt_CreditNote.CreditNoteNo = iBillingHandler.GetNextRunningNoByTypeMonthYear(RunningType.C_RUNNING_TYPE_CREDIT_NOTE, CommonUtil.dsTransData.dtUserData.EmpNo, _dotbt_CreditNote.CreditNoteDate == null ? CommonUtil.dsTransData.dtOperationData.ProcessDateTime : _dotbt_CreditNote.CreditNoteDate.Value); //set CreateDate, CreateBy, UpdateDate and UpdateBy _dotbt_CreditNote.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; _dotbt_CreditNote.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; _dotbt_CreditNote.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; _dotbt_CreditNote.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; _dotbt_CreditNote.CancelFlag = false; if (InsertTbt_CreditNote(_dotbt_CreditNote) == 0) { return(null); } else { return(_dotbt_CreditNote); } } catch (Exception) { throw; } }
/// <summary> /// Retrieve receipt information of specific receipt no. /// </summary> /// <param name="param">receipt no.</param> /// <returns></returns> public ActionResult ICS060_GetReceipt(ICS060_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; doReceipt doReceipt; try { //Validate receipt business doReceipt = ICS060_ValidateReceiptBusiness(param, res); if (res.IsError || doReceipt == null) { return(Json(res)); } //Pass, Set doReceipt ICS060_ReceiptInformation result = new ICS060_ReceiptInformation(); result.doReceipt = doReceipt; //Set cancel method IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; IIncomeHandler incomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; // Add By Sommai P., Oct 31, 2013 bool isIssuedTaxInvoice = billingHandler.CheckInvoiceIssuedTaxInvoice(doReceipt.InvoiceNo, doReceipt.InvoiceOCC); bool isCancelTaxInvoiceOption = incomeHandler.CheckCancelTaxInvoiceOption(doReceipt.InvoiceNo, doReceipt.InvoiceOCC); // Add By Sommai P., Oct 31, 2013 string filterValueCode = "%"; if (isIssuedTaxInvoice == false || isCancelTaxInvoiceOption == false) // Modify By Sommai P., Oct 31, 2013 { filterValueCode = CancelReceiptTarget.C_CANCEL_RECEIPT_ONLY; } ICommonHandler commonHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CANCEL_RECEIPT_TARGET, ValueCode = filterValueCode } }; ICommonHandler hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> lst = hand.GetMiscTypeCodeList(miscs); ComboBoxModel cboModel = new ComboBoxModel(); cboModel.SetList <doMiscTypeCode>(lst, "ValueDisplay", "ValueCode"); result.CancelMethodComboBoxModel = cboModel; res.ResultData = result; return(Json(res)); } catch (Exception ex) { res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); return(Json(res)); } }
public void CMW030_DownloadBLR060CsvReport(DateTime?GenerateDateFrom, DateTime?GenerateDateTo) { ObjectResultData res = new ObjectResultData(); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; var datas = billingHandler.GetRptInvoiceIssueList(GenerateDateFrom, GenerateDateTo); MemoryStream csv = CSVCreator.CreateCSVSteam <doGetRptInvoiceIssueList>(datas, "Common\\CMS030_BLR060Csv"); string fName = string.Format("{0}BLR060_{1}-{2}.csv" , DateTime.Now.ToString("yyyyMM"), GenerateDateFrom.Value.ToString("yyyyMMdd"), GenerateDateTo.Value.ToString("yyyyMMdd")); this.DownloadCSVFile(fName, csv.ToArray()); }
public ActionResult CMS421() { ObjectResultData res = new ObjectResultData(); try { CMS421_ScreenParameter param = GetScreenObject <CMS421_ScreenParameter>(); CommonUtil cm = new CommonUtil(); string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <dtTbt_AutoTransferBankAccountForView> listAutoTransferBankAccountData = handler.GetTbt_AutoTransferBankAccountForView(strContractCode, param.BillingOCC); ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (listAutoTransferBankAccountData.Count > 0) { //Misc mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(listAutoTransferBankAccountData.ToArray <dtTbt_AutoTransferBankAccountForView>()); handlerCommon.MiscTypeMappingList(miscMapping); } if (listAutoTransferBankAccountData.Count > 0) { ViewBag.txtBillingCode = listAutoTransferBankAccountData[0].BillingCode_Short; ViewBag.txtBillingClientCode = listAutoTransferBankAccountData[0].BillingClientCode_Short; ViewBag.txtBillingClientNameEN = listAutoTransferBankAccountData[0].FullNameEN; ViewBag.txtBillingClientNameLC = listAutoTransferBankAccountData[0].FullNameLC; ViewBag.txtAutoTransferAccountName = listAutoTransferBankAccountData[0].AccountName; ViewBag.txtBankBranch = listAutoTransferBankAccountData[0].BankNameEN + "/" + listAutoTransferBankAccountData[0].BankBranchNameEN; ViewBag.txtAccountType = listAutoTransferBankAccountData[0].AccountTypeName; ViewBag.txtAccountNo = listAutoTransferBankAccountData[0].AccountNo_ForView; // Edit by Narupon W. 28/05/2012 ViewBag.txtAutoTransferDate = listAutoTransferBankAccountData[0].AutoTransferDate; ViewBag.txtLastAutoTransferResult = listAutoTransferBankAccountData[0].LastestResultName; } return(View()); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Force issue receipt pdf report of specific invoice information /// </summary> /// <param name="doInvoice">invoice information</param> /// <param name="issueInvoiceDate">issue invoice date</param> /// <param name="validator"></param> /// <returns></returns> public string ICS050_IssueReceipt(doInvoice doInvoice, DateTime issueInvoiceDate, ValidatorUtil validator) { //Issue receipt IIncomeHandler incomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; tbt_Receipt doReceipt = incomeHandler.ForceIssueReceipt(doInvoice, issueInvoiceDate); if (doReceipt != null) { IIncomeDocumentHandler incomeDocumentHandler = ServiceContainer.GetService <IIncomeDocumentHandler>() as IIncomeDocumentHandler; //ICR010 Receipt report //string pdfFilePath = string.Empty; // Comment by Jirawat Jannet @ 2016-10-17 string pdfFilePath = incomeDocumentHandler.GenerateICR010FilePath(doReceipt.ReceiptNo , CommonUtil.dsTransData.dtUserData.EmpNo , CommonUtil.dsTransData.dtOperationData.ProcessDateTime); if (doInvoice.BillingTypeCode == BillingType.C_BILLING_TYPE_DEPOSIT && doReceipt.AdvanceReceiptStatus == AdvanceReceiptStatus.C_INC_ADVANCE_RECEIPT_STATUS_NOT) { IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; bool isSuccess = billingHandler.UpdateReceiptNoDepositFee(doInvoice.InvoiceNo, doReceipt.ReceiptNo , CommonUtil.dsTransData.dtUserData.EmpNo , CommonUtil.dsTransData.dtOperationData.ProcessDateTime); if (!isSuccess) { //Cannot issue receipt validator.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS050" , MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7010 , "InvoiceNo", "lblInvoiceNo", "InvoiceNo"); return(null); } } //Success return(pdfFilePath); } else { validator.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS050" , MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7010 , "InvoiceNo", "lblInvoiceNo", "InvoiceNo"); return(null); } }
/// <summary> /// Get billing target for view /// </summary> /// <param name="BillingTargetCode">Billing target code</param> /// <returns></returns> public ActionResult CMS470_GetBillingTargetForView(string BillingTargetCode) { ObjectResultData res = new ObjectResultData(); CommonUtil cm = new CommonUtil(); try { IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; string strBillingTargetCode = cm.ConvertBillingTargetCode(BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); List <dtTbt_BillingTargetForView> lst = handler.GetTbt_BillingTargetForView(strBillingTargetCode, MiscType.C_CUST_TYPE); res.ResultData = lst; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Retrieve invoice information of specific invoice no. /// </summary> /// <param name="invoiceNo">invoice no.</param> /// <param name="res"></param> /// <returns></returns> private doInvoice ICS040_GetInvoice(string invoiceNo, ObjectResultData res) { IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; ValidatorUtil validator = new ValidatorUtil(); doInvoice doInvoice = billingHandler.GetInvoice(invoiceNo); if (doInvoice == null) { validator.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS040" , MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7003 , "InvoiceNo", "lblInvoiceNo", "InvoiceNo"); ValidatorUtil.BuildErrorMessage(res, validator, null); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; return(null); } return(doInvoice); }
//ICP010 /// <summary> /// Function for issue a receipt for paid invoice (after payment matched) (Used by batch). /// </summary> /// <param name="doInvoice">invoice information</param> /// <param name="receiptDate">receipt date</param> /// <param name="batchId">batch id</param> /// <param name="batchDate">batch datetime</param> /// <returns></returns> public tbt_Receipt IssueReceipt(doInvoice doInvoice, DateTime receiptDate, string batchId, DateTime batchDate, bool isWriteTransLog = true) //Add (isWriteTransLog) by Jutarat A. on 07062013 { IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; //call running no for batch process string receiptNo = billingHandler.GetNextRunningNoByTypeMonthYear(RunningType.C_RUNNING_TYPE_RECEIPT, batchId, receiptDate /*batchDate*/); //Edit by Patcharee T. For issue Reciept no. in month of receiptDate 11-Jun-2013 //Determin receipt issue flag bool receiptIssueFlag = doInvoice.IssueReceiptTiming == IssueRecieptTime.C_ISSUE_REC_TIME_NOT_ISSUE ? false : true; tbt_Receipt doReceipt = new tbt_Receipt() { ReceiptNo = receiptNo, ReceiptDate = receiptDate, BillingTargetCode = doInvoice.BillingTargetCode, InvoiceNo = doInvoice.InvoiceNo, InvoiceOCC = doInvoice.InvoiceOCC, ReceiptAmount = (doInvoice.PaidAmountIncVat ?? 0) + (doInvoice.RegisteredWHTAmount ?? 0), AdvanceReceiptStatus = AdvanceReceiptStatus.C_INC_ADVANCE_RECEIPT_STATUS_NOT, ReceiptIssueFlag = receiptIssueFlag, CancelFlag = false, CreateDate = batchDate, CreateBy = batchId, UpdateDate = batchDate, UpdateBy = batchId }; List <tbt_Receipt> receipts = new List <tbt_Receipt>(); receipts.Add(doReceipt); List <tbt_Receipt> result = this.InsertTbt_Receipt(receipts, isWriteTransLog); //Add (isWriteTransLog) by Jutarat A. on 07062013 if (result != null && result.Count > 0) { bool isSuccess = billingHandler.UpdateReceiptNo(doInvoice.InvoiceNo, doInvoice.InvoiceOCC, receiptNo, batchId, batchDate); //Success if (isSuccess) { return(result[0]); } } //all fail, No insert data return(null); }
/// <summary> /// Check suspend, authority and resume of CMS410 /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CMS410_Authority(CMS410_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { // Check permission if (CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_BILLING_TARGET_INFORMATION, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } // is parameter OK ? if (CommonUtil.IsNullOrEmpty(param.BillingTargetCode)) { //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0040); res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0154); return(Json(res)); } // Check data exist CommonUtil cm = new CommonUtil(); string strBillingTargetCode = cm.ConvertBillingTargetCode(param.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <dtTbt_BillingTargetForView> billingTargetData = handler.GetTbt_BillingTargetForView(strBillingTargetCode, MiscType.C_CUST_TYPE); if (billingTargetData != null) { if (billingTargetData.Count == 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); // data not found return(Json(res)); } } return(InitialScreenEnvironment <CMS410_ScreenParameter>("CMS410", param, res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Initialize screen of CMS422 /// </summary> /// <returns></returns> public ActionResult CMS422() { ObjectResultData res = new ObjectResultData(); try { CMS422_ScreenParameter param = GetScreenObject <CMS422_ScreenParameter>(); CommonUtil cm = new CommonUtil(); string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); string strBillingOCC = param.BillingOCC; IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <dtTbt_CreditCardForView> listCreditCardForView = handler.GetTbt_CreditCardForView(strContractCode, strBillingOCC); ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (listCreditCardForView.Count > 0) { ViewBag.txtBillingCode = listCreditCardForView[0].BillingCode_short; ViewBag.txtBillingClientCode = listCreditCardForView[0].BillingClientCode_Short; ViewBag.txtBillingClientNameLC = listCreditCardForView[0].FullNameLC; ViewBag.txtBillingClientNameEN = listCreditCardForView[0].FullNameEN; ViewBag.txtCreditCardType = listCreditCardForView[0].CreditCardTypeName; ViewBag.txtCardName = listCreditCardForView[0].CardName; ViewBag.txtCreditCardCompany = listCreditCardForView[0].CreditCardCompanyName; ViewBag.txtCreditCardNo = listCreditCardForView[0].CreditCardNo_ForView; // listCreditCardForView[0].CreditCardNo; // Edit by Narupon W. 28/08/2012 ViewBag.txtExpireDate = listCreditCardForView[0].ExpireDate; //ViewBag.txtTransferDate = CommonUtil.TextDate(listCreditCardForView[0].AutoTransferDate); ViewBag.txtTransferDate = listCreditCardForView[0].AutoTransferDateForView; } return(View()); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Getting billing type detail list for load to grid with initial /// </summary> /// <returns></returns> public ActionResult CMS420_LoadGridBillingTypeDetailWithInitial() { ObjectResultData res = new ObjectResultData(); try { CMS420_ScreenParameter param = GetScreenObject <CMS420_ScreenParameter>(); CommonUtil cm = new CommonUtil(); string strContractCode_short = param.ContractCode; string strContractCode = cm.ConvertContractCode(strContractCode_short, CommonUtil.CONVERT_TYPE.TO_LONG); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); List <doBillingTypeDetailList> billingTypeDetailListData = billingHandler.GetBillingTypeDetailList(strContractCode, param.BillingOCC); CommonUtil.MappingObjectLanguage <doBillingTypeDetailList>(billingTypeDetailListData); if (billingTypeDetailListData == null) { billingTypeDetailListData = new List <doBillingTypeDetailList>(); } string xml = CommonUtil.ConvertToXml <doBillingTypeDetailList>(billingTypeDetailListData, "Common\\CMS420_BillingTypeDetail", CommonUtil.GRID_EMPTY_TYPE.SEARCH); res.ResultData = xml; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Update receipt status that has been register with a payment. (sp_IC_UpdateAdvanceReceiptRegisterPayment) /// </summary> /// <param name="receiptNo">receipt no.</param> /// <returns></returns> public List <tbt_Payment> RegisterPayment(List <tbt_Payment> payments) { IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; string paymentTranNo = string.Empty; foreach (var item in payments) { paymentTranNo = handler.GetNextRunningNoByTypeMonthYear(RunningType.C_RUNNING_TYPE_PAYMENT_TRANS); item.PaymentTransNo = paymentTranNo; item.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; item.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; item.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; item.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; } List <tbt_Payment> result = this.InsertTbt_Payment(CommonUtil.ConvertToXml_Store <tbt_Payment>(payments)); if (result.Count == payments.Count) { foreach (var item in result) { if (!CommonUtil.IsNullOrEmpty(item.RefAdvanceReceiptNo)) { if (!UpdateAdvanceReceiptRegisterPayment(item.RefAdvanceReceiptNo)) { //Fail return(null); } } } } else { //Fail return(null); } //Success return(result); }
/// <summary> /// canceling credit note. /// </summary> public bool CancelCreditNote(tbt_BillingBasic _doBillingBasic, doGetCreditNote _doGetCreditNote) { try { IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; decimal CNAmountExcVAT = _doGetCreditNote.CreditAmountIncVAT - (_doGetCreditNote.CreditVATAmount ?? 0); decimal CNAmountExcVATUsd = _doGetCreditNote.CreditAmountIncVATUsd - (_doGetCreditNote.CreditVATAmountUsd ?? 0); //Add by Pachara S. 15032017 string CNAmountExcVATCurrencyType; if (_doGetCreditNote.CreditAmountIncVATCurrencyType == null) { CNAmountExcVATCurrencyType = _doGetCreditNote.CreditVATAmountCurrencyType; } else { CNAmountExcVATCurrencyType = _doGetCreditNote.CreditAmountIncVATCurrencyType; } decimal?decBalanceDeposit = 0; decimal?decBalanceDepositUsd = 0; string decBalanceDepositCurrencyType = CurrencyUtil.C_CURRENCY_LOCAL; billingHandler.UpdateBalanceDepositOfBillingBasic(_doBillingBasic.ContractCode, _doBillingBasic.BillingOCC , CNAmountExcVAT, CNAmountExcVATUsd, "1", out decBalanceDeposit, out decBalanceDepositUsd, out decBalanceDepositCurrencyType); // add by Jirawat Jannet @2016-10-05 ยังไม่ถูก แก้ด้วย if (decBalanceDeposit < 0) // Incase of null is not happen { return(false); } else { bool blnSuccess = billingHandler.InsertDepositFeeCancelRefund(_doBillingBasic.ContractCode, _doBillingBasic.BillingOCC, _doGetCreditNote.CreditNoteNo, CNAmountExcVAT, CNAmountExcVATUsd, CNAmountExcVATCurrencyType); return(blnSuccess); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Check suspend, authority and resume of CMS422 /// </summary> /// <param name="param">Screen parameter</param> /// <returns></returns> public ActionResult CMS422_Authority(CMS422_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { //Check permission //if (CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_CREDIT_CARD_INFORMATION, FunctionID.C_FUNC_ID_VIEW) == false) //{ // res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); // return Json(res); //} // is parameter OK ? if (CommonUtil.IsNullOrEmpty(param.ContractCode) && CommonUtil.IsNullOrEmpty(param.BillingOCC)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0040); return(Json(res)); } // check data exist CommonUtil cm = new CommonUtil(); string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); string strBillingOCC = param.BillingOCC; IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <dtTbt_CreditCardForView> listCreditCardForView = handler.GetTbt_CreditCardForView(strContractCode, strBillingOCC); if (listCreditCardForView.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } return(InitialScreenEnvironment <CMS422_ScreenParameter>("CMS422", param, res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Get header data of screen BLS090 /// </summary> /// <param name="ContractCode"></param> /// <returns></returns> public ActionResult BLS090_GetHeader(string ContractCode) { CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; List <dtBillingContract> list = new List <dtBillingContract>(); try { BLS090_ScreenParameter param = GetScreenObject <BLS090_ScreenParameter>(); if (CommonUtil.IsNullOrEmpty(ContractCode)) { string lblContractCode = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_BILLING, "BLS090", "lblContractCode"); res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { lblContractCode }, new string[] { "ContractCode" }); return(Json(res)); } //string strContract_long = cm.ConvertContractCode(ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); string strContract_long = cm.ConvertBillingCode(ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); IBillingHandler handlerBilling = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; list = handlerBilling.GetBillingContract(strContract_long, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US); if (list.Count > 0) { var detailList = handlerBilling.GetBillingBasicForRentalList(strContract_long); if (detailList.Count > 0) { param.DetailData = detailList; // Akat K. : ContractFee get from OrderContractFee (see sp_BL_GetBillingContract) var sumOfFee = detailList.Sum(m => m.MonthlyBillingAmount); //list[0].ContractFeeForDisplay = CommonUtil.TextNumeric(sumOfFee, 2); //list[0].ContractFee = sumOfFee; param.TotalFee = sumOfFee; list[0].ContractFeeForDisplay = CommonUtil.TextNumeric(list[0].ContractFee, 2); list[0].TotalFee = sumOfFee; list[0].TotalFeeForDisplay = CommonUtil.TextNumeric(sumOfFee, 2); list[0].details = detailList; param.OrderContractFee = list[0].ContractFee; //list[0].ContractFeeCurrency = MiscellaneousTypeUtil.getCurrenctName(list[0].ContractFeeCurrency) + " " + list[0].ContractFee?.ToString("#,##0.00"); ViewBag.Currency = MiscellaneousTypeCommon.getCurrencyName(list[0].ContractFeeCurrencyType); res.ResultData = list[0]; } else { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6082, new string[] { "lblContractCode" }, new string[] { "ContractCode" }); } } else { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6057, new string[] { "lblContractCode" }, new string[] { "ContractCode" }); } } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Register input data to database (BLS090) /// </summary> /// <returns></returns> public ActionResult BLS090_Confirm() { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; List <dtBillingContract> list = new List <dtBillingContract>(); try { // Is suspend ? ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (handlerCommon.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } BLS090_ScreenParameter param = GetScreenObject <BLS090_ScreenParameter>(); IBillingHandler handlerBilling = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; if (param.RegisterData == null) { param.RegisterData = new List <BLS090_DetailData>(); } var updateList = (from p in param.RegisterData where p.MonthlyBillingAmount != p.NewBillingFee || p.MonthlyBillingAmountCurrencyType != p.NewMonthlyBillingAmountCurrency select p).ToList <BLS090_DetailData>(); // Prepare List <tbt_BillingBasic> billiingBasicList = new List <tbt_BillingBasic>(); tbt_BillingBasic billiingBasic; List <tbt_MonthlyBillingHistory> billingHistoryList_ForInsert = new List <tbt_MonthlyBillingHistory>(); List <tbt_MonthlyBillingHistory> billingHistoryList_ForUpdate = new List <tbt_MonthlyBillingHistory>(); tbt_MonthlyBillingHistory billingHistory; foreach (var item in updateList) { decimal?amount = null; decimal?amountUS = null; if (item.NewMonthlyBillingAmountCurrency == CurrencyUtil.C_CURRENCY_LOCAL) { amount = item.NewBillingFee; } else { amountUS = item.NewBillingFee; } // Billig basic billiingBasic = new tbt_BillingBasic() { ContractCode = item.ContractCode, BillingOCC = item.BillingOCC, StopBillingFlag = (Convert.ToDecimal(item.NewBillingFee) <= 0), // *** //MonthlyBillingAmount = item.NewBillingFee, // *** MonthlyBillingAmount = amount, // add by jirawat jannet @ 2016-08-29 MonthlyBillingAmountUsd = amountUS, // add by jirawat jannet @ 2016-08-29 UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo, UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime, MonthlyBillingAmountCurrencyType = item.NewMonthlyBillingAmountCurrency }; billiingBasicList.Add(billiingBasic); // Billing history var lastBillingHistory = handlerBilling.GetLastBillingHistory(item.ContractCode, item.BillingOCC, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US); if (lastBillingHistory.Count > 0) { // Case UPDATE. var billingHistory_update = lastBillingHistory[0]; billingHistory_update.MonthlyBillingAmount = amount;// item.NewBillingFee; // *** billingHistory_update.MonthlyBillingAmountUsd = amountUS; billingHistory_update.MonthlyBillingAmountCurrencyType = item.NewMonthlyBillingAmountCurrency; billingHistory_update.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; billingHistory_update.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; billingHistoryList_ForUpdate.Add(billingHistory_update); } else { // Case CREATE. billingHistory = new tbt_MonthlyBillingHistory() { ContractCode = item.ContractCode, BillingOCC = item.BillingOCC, MonthlyBillingAmount = item.NewBillingFee, // *** BillingStartDate = DateTime.Now, CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime, CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo, UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime, UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo }; billingHistoryList_ForInsert.Add(billingHistory); } } // TODO : (Narupon W.) , Uncomment as finally using (TransactionScope scope = new TransactionScope()) { try { // Save to DB !! handlerBilling.UpdateMonthlyBillingAmount(billiingBasicList); // Case Create. handlerBilling.InsertTbt_MonthlyBillingHistory(CommonUtil.ConvertToXml_Store(billingHistoryList_ForInsert)); // Case Update. handlerBilling.UpdateTbt_MonthlyBillingHistoryData(CommonUtil.ConvertToXml_Store(billingHistoryList_ForUpdate)); scope.Complete(); } catch (Exception ex) { scope.Dispose(); throw ex; } } res.ResultData = "1"; res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION_OK; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046, null, null); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Confirm billing target data /// </summary> /// <param name="doTbmBillingClient"></param> /// <param name="doTbtBillingTarget"></param> /// <returns></returns> public ActionResult BLS010_ConfirmBillingTargetData(SECOM_AJIS.DataEntity.Master.tbm_BillingClient doTbmBillingClient, tbt_BillingTarget doTbtBillingTarget) //public ActionResult BLS010_ConfirmBillingTargetData(BLS010_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); CommonUtil comUtil = new CommonUtil(); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; SECOM_AJIS.DataEntity.Master.IBillingMasterHandler handlerMaster = ServiceContainer.GetService <SECOM_AJIS.DataEntity.Master.IBillingMasterHandler>() as SECOM_AJIS.DataEntity.Master.IBillingMasterHandler; string strBillingClientCode = null; string strBillingTargetCode = null; BLS010_ScreenParameter sParam = GetScreenObject <BLS010_ScreenParameter>(); // tbm_BillingClient doTbmBillingClient = param.doTbmBillingClientParam; // tbt_BillingTarget doTbtBillingTarget = param.doTbt_BillingTarget; try { ///////// Check Suspending ////////// ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (chandler.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } /////// Check permission ////////// if (!CheckUserPermission(ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //clone tbtBillingClientData to tbm_billingcliebtData doTbmBillingClient = CommonUtil.CloneObject <SECOM_AJIS.DataEntity.Master.dtBillingClientData, SECOM_AJIS.DataEntity.Master.tbm_BillingClient>(sParam.doBillingClient); doTbmBillingClient.BillingClientCode = comUtil.ConvertBillingClientCode(doTbmBillingClient.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG); doTbtBillingTarget.BillingClientCode = comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG); //validatebusiness tbt_BillingTarget tmpTbtBillingTarget = new tbt_BillingTarget(); if (!CommonUtil.IsNullOrEmpty(doTbmBillingClient.BillingClientCode)) { List <tbt_BillingTarget> lst = new List <tbt_BillingTarget>(); lst = handler.GetTbt_BillingTarget(null, doTbmBillingClient.BillingClientCode, doTbtBillingTarget.BillingOfficeCode); if (lst.Count > 0) { tmpTbtBillingTarget = lst[0]; } else { tmpTbtBillingTarget = null; } if (tmpTbtBillingTarget != null) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6002, new string[] { comUtil.ConvertBillingTargetCode(tmpTbtBillingTarget.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT) }, null); return(Json(res)); } } var tmpdoTbmBillingClient = CommonUtil.CloneObject <tbm_BillingClient, tbm_BillingClient>(doTbmBillingClient); var tmpdoTbtBillingTarget = CommonUtil.CloneObject <tbt_BillingTarget, tbt_BillingTarget>(doTbtBillingTarget); //register new billing target using (TransactionScope scope = new TransactionScope()) { //7.3.4 if (CommonUtil.IsNullOrEmpty(tmpdoTbtBillingTarget.BillingClientCode)) { strBillingClientCode = handlerMaster.ManageBillingClient(tmpdoTbmBillingClient); tmpdoTbtBillingTarget.BillingClientCode = strBillingClientCode; } //7.3.5 create billing target strBillingTargetCode = handler.CreateBillingTarget(tmpdoTbtBillingTarget); tmpdoTbtBillingTarget.BillingTargetCode = comUtil.ConvertBillingClientCode(strBillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); tmpdoTbmBillingClient.BillingClientCode = comUtil.ConvertBillingClientCode(tmpdoTbmBillingClient.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_SHORT); scope.Complete(); doTbmBillingClient = CommonUtil.CloneObject <tbm_BillingClient, tbm_BillingClient>(tmpdoTbmBillingClient); doTbtBillingTarget = CommonUtil.CloneObject <tbt_BillingTarget, tbt_BillingTarget>(tmpdoTbtBillingTarget); } doTbtBillingTarget.BillingClientCode = comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_SHORT); sParam.doTbt_BillingTarget = doTbtBillingTarget; res.ResultData = doTbtBillingTarget; res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION_OK; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046, null, null); return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Register billing target /// </summary> /// <param name="doTbtBillingTarget"></param> /// <param name="doBillingClientDdata"></param> /// <returns></returns> public ActionResult BLS010_RegisterData(tbt_BillingTarget doTbtBillingTarget, dtBillingClientData doBillingClientDdata) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ValidatorUtil validator = new ValidatorUtil(); CommonUtil comUtil = new CommonUtil(); try { BLS010_ScreenParameter sParam = GetScreenObject <BLS010_ScreenParameter>(); BLS010_ScreenInputValidate obj = new BLS010_ScreenInputValidate(); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <string> lstParam = new List <string>(); List <string> lstControl = new List <string>(); ///////// Check Suspending ////////// ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (chandler.IsSystemSuspending()) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } /////// Check permission ////////// if (!CheckUserPermission(ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, FunctionID.C_FUNC_ID_OPERATE)) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //if (sParam.doBillingClientList == null) //{ // res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { "lblBillingClientCode" }, new string[] { "lblBillingClientCode" }); // res.AddErrorMessage(MessageUtil.MODULE_BILLING, // ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, // MessageUtil.MODULE_COMMON, // MessageUtil.MessageList.MSG0007, // new string[] { "lblBillingClientCode" }, // new string[] { "lblBillingClientCode" }); // return Json(res); //} ////////////////5.2 Check mandatory //if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].BillingClientCode)) //{ // if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].NameEN)) // { // lstParam.Add("lblNameEnglish"); // lstControl.Add("FullNameEN"); // } // if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].NameLC)) // { // lstParam.Add("lblNameLocal"); // lstControl.Add("FullNameEN"); // } // if (CommonUtil.IsNullOrEmpty(sParam.doBillingClientList[0].CustTypeCode)) // { // lstParam.Add("lblCustTypeCode"); // lstControl.Add("CustTypeName"); // } //} // Modify by siripoj 06-06-12 if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.BillingClientCode)) { if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.NameEN)) { lstParam.Add("lblNameEnglish"); lstControl.Add("FullNameEN"); } // 2017.02.15 delete matsuda start //if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.NameLC)) //{ // lstParam.Add("lblNameLocal"); // lstControl.Add("FullNameLC"); //} // 2017.02.15 delete matsuda end if (CommonUtil.IsNullOrEmpty(doBillingClientDdata.CustTypeCode)) { lstParam.Add("lblCustTypeCode"); lstControl.Add("CustTypeName"); } } if (CommonUtil.IsNullOrEmpty(doTbtBillingTarget.BillingOfficeCode)) { lstParam.Add("lblBillingOffice"); lstControl.Add("BillingOfficeCode"); } if (lstParam.Count > 0 && lstControl.Count > 0) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG0007, lstParam.ToArray(), lstControl.ToArray()); res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, lstParam.ToArray(), lstControl.ToArray()); return(Json(res)); } //Clone Data //obj = CommonUtil.CloneObject<dtBillingClientData, BLS010_ScreenInputValidate>(sParam.doBillingClientList[0]); //obj.BillingOfficeCode = doTbtBillingTarget.BillingOfficeCode; ////////////////5.2 Check mandatory //ValidatorUtil.BuildErrorMessage(res, this, new object[] { obj }); //if (res.IsError) //{ // return Json(res); //} ///////////////5.3 Validate Business //doTbtBillingTarget = CommonUtil.CloneObject<dtBillingClientData, tbt_BillingTarget>(sParam.doBillingClientList[0]); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // Modify by Siripoj 06-06-12 //doTbtBillingTarget.BillingClientCode = sParam.doBillingClientList[0].BillingClientCode; doTbtBillingTarget.BillingClientCode = doBillingClientDdata.BillingClientCode; if (CommonUtil.IsNullOrEmpty(doTbtBillingTarget.IssueInvMonth)) { doTbtBillingTarget.IssueInvMonth = 0; } if (doTbtBillingTarget.IssueInvMonth > 60) { //res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6001, new string[] { "IssueInvTime" }, new string[] { "IssueInvTime" }); res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6001, new string[] { "lblIssueInvoiceTiming" }, new string[] { "IssueInvMonth" }); return(Json(res)); } if (!CommonUtil.IsNullOrEmpty(doTbtBillingTarget.BillingClientCode)) { List <tbt_BillingTarget> lst = new List <tbt_BillingTarget>(); lst = handler.GetTbt_BillingTarget(null, comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG), doTbtBillingTarget.BillingOfficeCode); if (lst.Count > 0) { doTbtBillingTarget = lst[0]; } else { doTbtBillingTarget = null; } //doTbtBillingTarget = handler.GetTbt_BillingTarget(null, comUtil.ConvertBillingClientCode(doTbtBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG), doTbtBillingTarget.BillingOfficeCode); if (doTbtBillingTarget != null) { res.AddErrorMessage(MessageUtil.MODULE_BILLING, ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET, MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6002, new string[] { comUtil.ConvertBillingTargetCode(doTbtBillingTarget.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT) }, new string[] { "BillingClientCodeView" }); return(Json(res)); } } res.ResultData = true; sParam.doBillingClient = doBillingClientDdata; sParam.doTbt_BillingTarget = doTbtBillingTarget; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Mothod for download document (PDF) and write history to download log /// </summary> /// <param name="strDocumentNo"></param> /// <param name="documentOCC"></param> /// <param name="strDocumentCode"></param> /// <param name="fileName"></param> /// <returns></returns> public ActionResult CMS030_DownloadPdfAndWriteLog(string strDocumentNo, string documentOCC, string strDocumentCode, string fileName) { ObjectResultData res = new ObjectResultData(); CMS030_ScreenParameter sParam = GetScreenObject <CMS030_ScreenParameter>(); //Add by Jutarat A. on 17082012 using (TransactionScope t = new TransactionScope()) { try { // doDocumentDownloadLog doDocumentDownloadLog cond = new doDocumentDownloadLog(); cond.DocumentNo = strDocumentNo; cond.DocumentCode = strDocumentCode; cond.DownloadDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; cond.DownloadBy = CommonUtil.dsTransData.dtUserData.EmpNo; cond.DocumentOCC = documentOCC; ILogHandler handlerLog = ServiceContainer.GetService <ILogHandler>() as ILogHandler; int isOK = handlerLog.WriteDocumentDownloadLog(cond); //Update firstIssueFlag for invoice report if (cond.DocumentCode == ReportID.C_REPORT_ID_INVOICE) { IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; billingHandler.UpdateFirstIssue(cond.DocumentNo, cond.DocumentOCC, cond.DownloadDate.Value, CommonUtil.dsTransData.dtUserData.EmpNo); } IDocumentHandler handlerDoc = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler; Stream reportStream = handlerDoc.GetDocumentReportFileStream(fileName); FileInfo fileinfo = new FileInfo(fileName); if (fileinfo.Extension.ToUpper().Equals(".CSV")) { //Modify by Jutarat A. on 17082012 //FileStreamResult result = File(reportStream, "text/csv"); //result.FileDownloadName = fileinfo.Name; //t.Complete(); //return result; sParam.FileName = fileinfo.Name; sParam.StreamReport = reportStream; res.ResultData = true; t.Complete(); return(Json(res)); //End Modify } else { t.Complete(); return(File(reportStream, "application/pdf")); } } catch (Exception ex) { t.Dispose(); res.AddErrorMessage(ex); return(Json(res)); } } }
/// <summary> /// Get searach result of document data /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CMS030_SearchResponse(doDocumentDataCondition cond) { CommonUtil c = new CommonUtil(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; List <dtDocumentData> list = new List <dtDocumentData>(); //List<dtDocumentData> vw_list = new List<dtDocumentData>(); try { cond.QuotationTargetCode = c.ConvertQuotationTargetCode(cond.QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); //cond.ProjectCode = c.ConvertProjectCode(cond.ProjectCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.ContractCode = c.ConvertContractCode(cond.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.BillingTargetCode = c.ConvertBillingTargetCode(cond.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_CONTRACT) { cond.DocumentNo = ConvertDocumentNo(cond.DocumentNo, CommonUtil.CONVERT_TYPE.TO_LONG.ToString()); } if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_INCOME) { if (cond.DocumentCode == "BLR060") { List <string> fieldName = new List <string>(); List <string> controlName = new List <string>(); List <string> realFieldName = new List <string>(); if (CommonUtil.IsNullOrEmpty(cond.GenerateDateFrom)) { fieldName.Add("lblGenerateDate"); controlName.Add("GenerateDateFrom"); } if (CommonUtil.IsNullOrEmpty(cond.GenerateDateTo)) { fieldName.Add("lblGenerateDate"); controlName.Add("GenerateDateTo"); } foreach (var rawFieldName in fieldName.Distinct()) { realFieldName.Add(CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, "CMS030", rawFieldName)); } if ((realFieldName.Count > 0) || (controlName.Count > 0)) { if ((realFieldName.Count > 0) && (controlName.Count > 0)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, realFieldName.ToArray(), controlName.ToArray()); } res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } } } if (cond.DocumentType == null || cond.DocumentCode == null) { //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0098); } else { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IDocumentHandler handler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler; list = handler.GetDocumentDataList(cond); //vw_list = CommonUtil.ConvertObjectbyLanguage<dtDocumentData, dtDocumentData>(list, // "ConOfficeCodeName", // "OperOfficeCodeName", // "BillOfficeCodeName", // "IssueOfficeCodeName", // "DocumentName" // ); // Misc Mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(list.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); // Language Mapping CommonUtil.MappingObjectLanguage <dtDocumentData>(list); if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_CONTRACT) { foreach (var item in list) { item.DocumentNo = ConvertDocumentNo(item.DocumentNo, CommonUtil.CONVERT_TYPE.TO_SHORT.ToString()); } } } } catch (Exception ex) { list = new List <dtDocumentData>(); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } if (cond.Mode == 0) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 1) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode1", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 2) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode2", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 3) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode3", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 4) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode4", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 5) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode5", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 6) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode6", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 7) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode7_CMR020", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 8) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode8", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 9) { IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; var datas = billingHandler.GetRptInvoiceIssueList(cond.GenerateDateFrom, cond.GenerateDateTo); List <dtDocumentData> ls = new List <dtDocumentData>(); if (datas != null && datas.Count > 0) { ls.Add(new dtDocumentData() { GenerateDateFrom = cond.GenerateDateFrom, GenerateDateTo = cond.GenerateDateTo }); } res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(ls, "Common\\CMS030_Mode9", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } return(Json(res)); }
/// <summary> /// Event when click confirm cancel button, this function will cancel the issued receipt information of specific receipt no. to the system. /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult ICS060_cmdConfirmCancel(ICS060_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; doReceipt doReceipt; try { if (IsSuspend(res)) { return(Json(res)); } if (!ICS060_IsAllowOperate(res)) { return(Json(res)); } //Validate receipt business doReceipt = ICS060_ValidateReceiptBusiness(param, res); if (res.IsError || doReceipt == null) { return(Json(res)); } //Connect db using (TransactionScope scope = new TransactionScope()) { try { //Cancel receipt IIncomeHandler incomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler; bool isSuccess = incomeHandler.CancelReceipt(doReceipt); if (!isSuccess) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7031, null); } IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; //Get Invoice doInvoice doInvoice = billingHandler.GetInvoice(doReceipt.InvoiceNo); if (doInvoice == null) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7031, null); } //string invoiceType = billingHandler.GetInvoiceType(doInvoice.BillingTypeCode); //if ((invoiceType == InvoiceType.C_INVOICE_TYPE_DEPOSIT || invoiceType == InvoiceType.C_INVOICE_TYPE_SERVICE) // && (doInvoice.IssueReceiptTiming != IssueRecieptTime.C_ISSUE_REC_TIME_SAME_INV // || (doInvoice.IssueReceiptTiming == IssueRecieptTime.C_ISSUE_REC_TIME_SAME_INV // && doInvoice.PaymentMethod == PaymentMethod.C_PAYMENT_METHOD_MESSENGER_TRANSFER))) bool isIssuedTaxInvoice = billingHandler.CheckInvoiceIssuedTaxInvoice(doReceipt.InvoiceNo, doReceipt.InvoiceOCC); if (isIssuedTaxInvoice == true) { if (param.CancelMethod == CancelReceiptTarget.C_CANCEL_TAX_INVOICE_RECEIPT) { //Cancel tax invoice (Update cancel flag only) isSuccess = billingHandler.CancelTaxInvoice(doReceipt.TaxInvoiceNo); if (!isSuccess) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7032, null); } } else { //Clear receipt no. isSuccess = billingHandler.UpdateReceiptNo(doReceipt.InvoiceNo, doReceipt.InvoiceOCC, null); if (!isSuccess) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7032, null); } } } //Clear receipt no, invoice no of deposit fee if (doInvoice.BillingTypeCode == BillingType.C_BILLING_TYPE_DEPOSIT && (doReceipt.AdvanceReceiptStatus == AdvanceReceiptStatus.C_INC_ADVANCE_RECEIPT_STATUS_NOT || doReceipt.AdvanceReceiptStatus == AdvanceReceiptStatus.C_INC_ADVANCE_RECEIPT_STATUS_PAID)) { isSuccess = billingHandler.UpdateReceiptNoDepositFeeCancelReceipt(doInvoice.InvoiceNo, doReceipt.ReceiptNo , CommonUtil.dsTransData.dtUserData.EmpNo , CommonUtil.dsTransData.dtOperationData.ProcessDateTime); if (!isSuccess) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7032, null); } } //Show attention in case of paid receipt if (doReceipt.AdvanceReceiptStatus == SECOM_AJIS.Common.Util.ConstantValue.AdvanceReceiptStatus.C_INC_ADVANCE_RECEIPT_STATUS_NOT || doReceipt.AdvanceReceiptStatus == SECOM_AJIS.Common.Util.ConstantValue.AdvanceReceiptStatus.C_INC_ADVANCE_RECEIPT_STATUS_PAID) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION_OK; res.AddErrorMessage(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7030); } //Success scope.Complete(); res.ResultData = "1"; } catch (Exception ex) { scope.Dispose(); throw ex; } } } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }