Beispiel #1
0
        private LedgerAccountTransactionBuilder CreditCore(int ledgerAccountNumber, decimal amount, string ledgerReference, string salesTaxJurisdiction)
        {
            var dbLedgerAccount         = m_ctx.LedgerAccount(ledgerAccountNumber);
            var dbLedgerAccountSubtotal = GetLedgerAccountSubtotal(ledgerAccountNumber);

            var dbLedgerTransactionEntry = new LedgerTransactionEntry()
            {
                LedgerTransaction      = m_ledgerTransaction,
                LedgerAccountNumber    = ledgerAccountNumber,
                LedgerAccountSubtotal  = dbLedgerAccountSubtotal,
                TransactionEntryAmount = amount,
                LedgerReference        = ledgerReference,
                SalesTaxJurisdiction   = salesTaxJurisdiction,
                DebitCreditCode        = LedgerAccountCodes.Credit
            };

            _ = m_ctx.LedgerTransactionEntries.Add(dbLedgerTransactionEntry);

            var ledgerAmount = dbLedgerAccount.DebitCreditCode == LedgerAccountCodes.Credit ? amount : -amount;

            dbLedgerAccountSubtotal.Balance          += ledgerAmount;
            dbLedgerAccountSubtotal.UpdateDateTimeUtc = m_utcNow;

            m_creditAmount += amount;

            return(this);
        }
Beispiel #2
0
 public static MLedger_LedgerTransactionEntry MLedger_LedgerTransactionEntry(LedgerTransactionEntry dbLedgerTransactionEntry)
 {
     return(new MLedger_LedgerTransactionEntry()
     {
         LedgerTransactionEntryId = dbLedgerTransactionEntry.LedgerTransactionEntryId,
         LedgerAccountNumber = dbLedgerTransactionEntry.LedgerAccountNumber,
         LedgerAccountName = dbLedgerTransactionEntry.LedgerAccountNumberNavigation.Name,
         DebitCreditCode = dbLedgerTransactionEntry.DebitCreditCode,
         EntryAmount = dbLedgerTransactionEntry.TransactionEntryAmount,
         LedgerReference = dbLedgerTransactionEntry.LedgerReference,
         SalesTaxJurisdiction = dbLedgerTransactionEntry.SalesTaxJurisdiction
     });
 }