public ActionResult AddARInvoiceItem(string documentNo, Int16 itemNo) { ARInvoiceDetail arInvoicedetail = null; if (documentNo == string.Empty || documentNo == null) { arInvoicedetail = new ARInvoiceDetail(); } else { arInvoicedetail = new NetStock.BusinessFactory.ARInvoiceBO().GetARInvoice(new Contract.ARInvoice { DocumentNo = documentNo }) .ARInvoiceDetails.Where(dt => dt.ItemNo == itemNo).FirstOrDefault(); if (arInvoicedetail == null) { arInvoicedetail = new ARInvoiceDetail(); } } arInvoicedetail.CurrencyCodeList = Utility.GetCurrencyItemList(); arInvoicedetail.AccountCodeList = Utility.GetAccountCodeItemList(); //arInvoicedetailsItem.ServiceTypeList = Utility.GetLookupItemList("ServiceType"); return(PartialView("AddARInvoiceItem", arInvoicedetail)); //return PartialView("AddQuotationItem"); }
public bool Delete(string documentNo, DbTransaction parentTransaction) { var arInvoicedetailItem = new ARInvoiceDetail { DocumentNo = documentNo }; return(Delete(arInvoicedetailItem, parentTransaction)); }
public dynamic Post([FromBody] GetOutstandingInvoicesDto getOutstandingInvoicesDto, [FromUri] GetOutstandingInvoiceParameter parameter) { XmlToModelConverter xmlToModelConverter = new XmlToModelConverter(); xmlRequest = this.OutstandingInvoiceService.CreateRequestXml(getOutstandingInvoicesDto, parameter); var response = this.OutstandingInvoiceService.PostXml(parameter, xmlRequest); if (response.IsSuccessStatusCode) { if (parameter.TransactionName.Equals("ARSummary")) { ARSummary openinvoices = new ARSummary(); openinvoices = xmlToModelConverter.Deserialize <ARSummary>(response.Content.ReadAsStringAsync().Result); return(openinvoices); } else if (parameter.TransactionName.Equals("AROpenInvoices")) { AROpenInvoicesResult openinvoicesResult = new AROpenInvoicesResult(); openinvoicesResult.AROpenInvoices = xmlToModelConverter.Deserialize <AROpenInvoices>(response.Content.ReadAsStringAsync().Result); openinvoicesResult.Pagination = new PagingModel(); IQueryable <Invoice> invoiceQuery = openinvoicesResult.AROpenInvoices.Invoice.AsQueryable(); this.OutstandingInvoiceService.GetShiptos(invoiceQuery, getOutstandingInvoicesDto.CustomerNumber); invoiceQuery = string.IsNullOrWhiteSpace(parameter.Sort) ? invoiceQuery.OrderBy <Invoice>("InvoiceDate") : invoiceQuery.OrderBy <Invoice>(parameter.Sort); var pagedResult = this.OutstandingInvoiceService.ApplyPaging <Invoice>((PagingParameterBase)parameter, (PagingResultBase)openinvoicesResult.Pagination, invoiceQuery).ToList(); // Frontend Model AROpenInvoicesResult openinvoices = new AROpenInvoicesResult(); openinvoices.AROpenInvoices = new AROpenInvoices(); openinvoices.AROpenInvoices = openinvoicesResult.AROpenInvoices; openinvoices.PagedOpenInvoices = new AROpenInvoices(); openinvoices.PagedOpenInvoices.Invoice = pagedResult.ToList <Invoice>(); openinvoices.Pagination = new PagingModel(openinvoicesResult.Pagination.Page, openinvoicesResult.Pagination.PageSize, openinvoicesResult.Pagination.DefaultPageSize, openinvoicesResult.Pagination.TotalCount); if (openinvoicesResult.Pagination.Page > 1) { openinvoices.Pagination.PrevPageUri = this.OutstandingInvoiceService.GetLink(openinvoicesResult.Pagination, this.Request, openinvoicesResult.Pagination.Page - 1); } if (openinvoicesResult.Pagination.Page < openinvoicesResult.Pagination.TotalPages) { openinvoices.Pagination.NextPageUri = this.OutstandingInvoiceService.GetLink(openinvoicesResult.Pagination, this.Request, openinvoicesResult.Pagination.Page + 1); } return(openinvoices); } else { ARInvoiceDetail openinvoices = new ARInvoiceDetail(); openinvoices = xmlToModelConverter.Deserialize <ARInvoiceDetail>(response.Content.ReadAsStringAsync().Result); return(openinvoices); } } return(response); }
public ARInvoiceDetail GetARInvoiceDetail(ARInvoiceDetail item) { return((ARInvoiceDetail)ARInvoiceDetailDAL.GetItem <ARInvoiceDetail>(item)); }
public bool DeleteARInvoiceDetail(ARInvoiceDetail item) { return(ARInvoiceDetailDAL.Delete(item)); }
public bool SaveARInvoiceDetail(ARInvoiceDetail newItem) { return(ARInvoiceDetailDAL.Save(newItem)); }
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); }