Exemplo n.º 1
0
        /// <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);
            }
        }