Exemple #1
0
        /// <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));
            }
        }