Ejemplo n.º 1
0
        public static IEnumerable <SelectListItem> GetBankCodeList()
        {
            var countryList = new NetStock.BusinessFactory.BankBO().GetList();

            var selectList = countryList.Select(c =>
                                                new SelectListItem
            {
                Value = c.BankCode,
                Text  = string.Format("{0} - {1}", c.BankCode, c.Name)
            });

            return(new SelectList(selectList, "Value", "Text"));
        }
Ejemplo n.º 2
0
        public ActionResult AddARInvoiceItem(string debtorCode, string accountCode, decimal amount, string bankCode = "")
        {
            ARInvoiceDetail item = new ARInvoiceDetail();

            item.AccountCode = accountCode;

            item.AccountCodeDescription = new NetStock.BusinessFactory.ChartOfAccountBO().GetChartOfAccount(new ChartOfAccount {
                AccountCode = accountCode, BranchID = Utility.SsnBranch
            }).Description;
            item.BaseAmount   = amount;
            item.LocalAmount  = amount;
            item.CurrencyCode = "THB";
            item.TotalAmount  = amount;
            item.Discount     = 0;
            item.DiscountType = "NONE";

            var debtorAccount = new NetStock.BusinessFactory.DebtorBO().GetDebtor(new Debtor {
                DebtorCode = debtorCode
            }).DebtorAccount;

            string bankAccount = "";

            if (!string.IsNullOrWhiteSpace(bankCode))
            {
                bankAccount = new NetStock.BusinessFactory.BankBO().GetBank(new Bank {
                    BankCode = bankCode
                }).BankAccount;
            }
            var whAccount  = Utility.GetDefaultAccountCodes(DefaultAccountCodes.ARWHACCOUNTCODE);
            var vatAccount = Utility.GetDefaultAccountCodes(DefaultAccountCodes.ARVATACCOUNTCODE);
            //arInvoicedetail.CurrencyCodeList = Utility.GetCurrencyItemList();
            //arInvoicedetail.AccountCodeList = Utility.GetAccountCodeItemList();

            /* Debit Credit Account start */
            var    debitCreditObj = Utility.GetAccountType(debtorAccount);
            var    customerDC     = debitCreditObj != null ? (!string.IsNullOrWhiteSpace(debitCreditObj.DebitCredit) ? debitCreditObj.DebitCredit : "DEBIT") : "DEBIT";
            string bankDC         = "";

            if (!string.IsNullOrWhiteSpace(bankDC))
            {
                debitCreditObj = Utility.GetAccountType(bankAccount);
                bankDC         = debitCreditObj != null ? (!string.IsNullOrWhiteSpace(debitCreditObj.DebitCredit) ? debitCreditObj.DebitCredit : "DEBIT") : "DEBIT";
            }

            debitCreditObj = Utility.GetAccountType(whAccount);
            string whDC = debitCreditObj != null ? (!string.IsNullOrWhiteSpace(debitCreditObj.DebitCredit) ? debitCreditObj.DebitCredit : "DEBIT") : "DEBIT";

            debitCreditObj = Utility.GetAccountType(vatAccount);
            string vatDC = debitCreditObj != null ? (!string.IsNullOrWhiteSpace(debitCreditObj.DebitCredit) ? debitCreditObj.DebitCredit : "DEBIT") : "DEBIT";

            debitCreditObj = Utility.GetAccountType(accountCode);
            string accountDC = debitCreditObj != null ? (!string.IsNullOrWhiteSpace(debitCreditObj.DebitCredit) ? debitCreditObj.DebitCredit : "DEBIT") : "DEBIT";

            /* Debit Credit Account end */

            return(Json(new
            {
                Message = "Success",
                ARInvoiceDetail = item,
                DebtorAccount = debtorAccount,
                bankAccount = bankAccount,
                whAccount = whAccount,
                vatAccount = vatAccount,
                customerDebitCredit = customerDC,
                bankDebitCredit = bankDC,
                whDebitCredit = whDC,
                vatDebitCredit = vatDC,
                accountDebitCredit = accountDC
            }, JsonRequestBehavior.AllowGet));


            //arInvoicedetail.CurrencyCodeList = Utility.GetCurrencyItemList();
            //arInvoicedetail.AccountCodeList = Utility.GetAccountCodeItemList();

            //return Json(new { Message = "Success", ARInvoiceDetail = item,DebtorAccount = debtorAccount }, JsonRequestBehavior.AllowGet);
        }