public async Task <bool> CreateCustomerCashPayment(GeneralLedgerView ledgerView) { try { GeneralLedger .CreateGeneralLedgerByView(ledgerView) .Apply(); CustomerLedger .Apply(); await CustomerLedger .CreateEntityByGeneralLedgerView(ledgerView); CustomerLedger.Apply(); AccountReceivable .UpdateAccountReceivableByGeneralLedgerView(ledgerView) .Apply(); GeneralLedger .UpdateAccountBalances(ledgerView); return(true); } catch (Exception ex) { throw new Exception("CreateCustomerCashPayment", ex); } }
public async Task <bool> PostInvoiceAndDetailToAcctRec(InvoiceView invoiceView) { try { Invoice invoiceNew = await Invoice.Query().MapToEntity(invoiceView); Invoice .AddInvoice(invoiceNew) .Apply(); Invoice invoiceLookup = await Invoice.Query().GetEntityByInvoiceDocument(invoiceView.InvoiceDocument); invoiceView.InvoiceId = invoiceLookup.InvoiceId; //Assign the InvoiceId for (int i = 0; i < invoiceView.InvoiceDetailViews.Count; i++) { invoiceView.InvoiceDetailViews[i].InvoiceId = invoiceLookup.InvoiceId; InvoiceDetail invoiceDetail = await InvoiceDetail.Query().MapToEntity(invoiceView.InvoiceDetailViews[i]); InvoiceDetail.AddInvoiceDetail(invoiceDetail); } InvoiceDetail.Apply(); await AccountReceivable .UpdateAccountReceivableByInvoiceView(invoiceView); AccountReceivable.Apply(); await GeneralLedger .CreateGeneralLedgerByInvoiceView(invoiceView); GeneralLedger.Apply(); AccountReceivable acctRecLookup = await AccountReceivable.Query().GetEntityByPurchaseOrderId(invoiceView.PurchaseOrderId); GeneralLedger.UpdateLedgerBalances(acctRecLookup.DocNumber ?? 0, "OV"); await CustomerLedger .CreateCustomerLedgerByInvoiceView(invoiceView); CustomerLedger.Apply(); return(true); } catch (Exception ex) { throw new Exception("PostInvoiceAndDetailToAcctRec", ex); } }