/// <summary> /// this function records INVOICEACTION and INVOICEACTIONTRANSACTIONS /// </summary> /// <param name="invoiceID"></param> /// <param name="transactions"></param> /*Payment for Invoice*/ public void doINTERNALTransfer(decimal amount) { try { using (var ctx = new AccContexts()) using (var ts = new TransactionScope()) { classes.internalPayment internalPayment = new classes.internalPayment(); internalPayment.createNew(this.receiverEntityID, this.issuerEntityID, amount, this.currencyID); /*Record New Invoice Payment*/ var NewInvoicePayment = new AccountingLib.Models.invoicePayment() { invoiceID = this.invoiceID, paymentID = internalPayment.paymentID }; ctx.invoicePayment.AddObject(NewInvoicePayment); ctx.SaveChanges(); //Record related transctions [for invoice payment] List <int> transactions = new List <int>(); transactions.Add(Transaction.createNew(issuerEntityID, (int)AssetCategories.W, -1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(receiverEntityID, (int)LibCategories.AP, +1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(receiverEntityID, (int)AssetCategories.W, +1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(issuerEntityID, (int)AssetCategories.AR, -1 * amount, this.currencyID)); /*Record Invoice Payment transactions*/ this.RecordInvoicePaymentTransactions(transactions, internalPayment.paymentID, enums.paymentStat.PaidApproved); /*Record Invoice Transaction*/ this.RecordInvoiceTransaction(transactions, enums.invoiceStat.internalPaymant); ts.Complete(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// this function records INVOICEACTION and INVOICEACTIONTRANSACTIONS /// </summary> /// <param name="invoiceID"></param> /// <param name="transactions"></param> /*Payment for Invoice*/ public void doINTERNALTransfer(decimal amount) { try { using (var ctx = new AccContexts()) using (var ts = new TransactionScope()) { classes.internalPayment internalPayment = new classes.internalPayment(); internalPayment.createNew(this.receiverEntityID, this.issuerEntityID, amount, this.currencyID); /*Record New Invoice Payment*/ var NewInvoicePayment = new AccountingLib.Models.invoicePayment() { invoiceID = this.invoiceID, paymentID = internalPayment.paymentID }; ctx.invoicePayment.AddObject(NewInvoicePayment); ctx.SaveChanges(); //Record related transctions [for invoice payment] List <int> transactions = new List<int>(); transactions.Add(Transaction.createNew(issuerEntityID, (int)AssetCategories.W, -1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(receiverEntityID, (int)LibCategories.AP, +1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(receiverEntityID, (int)AssetCategories.W, +1 * amount, this.currencyID)); transactions.Add(Transaction.createNew(issuerEntityID, (int)AssetCategories.AR, -1 * amount, this.currencyID)); /*Record Invoice Payment transactions*/ this.RecordInvoicePaymentTransactions(transactions, internalPayment.paymentID, enums.paymentStat.PaidApproved); /*Record Invoice Transaction*/ this.RecordInvoiceTransaction( transactions, enums.invoiceStat.internalPaymant); ts.Complete(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }