Journal Entry

From AutoCount Resource Center

Technical Specification

  1. Direct posting of Debtor and Creditor to journal entry is not supported.
    Journal Entry for Debtor and Creditor must be created at AR or AP.
  2. Stock Control type of accounts (Stock Balance, Stock Opening and Stock Closing) are not supported in journal entry.
    Balance of stock control accounts are either manual or auto calculated in the system.
  3. Net Total of Debit and Credit must be same amount.
  4. Debit & Credit are not allow to coexist in the same line. Each line is either Debit or Credit.
    • If the source amount is 100 at Debit, and 30 at Credit on the same line, then 70 is placed at Debit.
    Eg. Debit = 100, Credit = 30, then DR = 70
  5. Amount in DR and CR cannot be negative.
    • If the source amount is negative at Debit, then the amount should be placed at Credit.
    Eg. Debit = -100, then CR = 100


References of AutoCount Accounting 1.8, 1.9

BCE.AutoCount.dll
BCE.AutoCount.CommonAccounting.dll
BCE.AutoCount.MainEntry.dll
BCE.Utils.dll
BCE.Utils.UI.dll
BCE.AutoCount.GL.dll


Sample with data model

Create new Journal Entry

Split Amount (Debit & Credit)

public void NewJournalEntry(BCE.Data.DBSetting dbSetting, JournalSource source)
{
    BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(dbSetting);
    BCE.AutoCount.GL.JournalEntry.JournalEntry doc = cmd.AddNew();
    BCE.AutoCount.GL.JournalEntry.JournalEntryDetail dtl = null;

    doc.Description = source.Description;
    doc.CurrencyCode = source.CurrencyCode;
    doc.CurrencyRate = source.CurrencyRate;
    doc.DocNo = source.VoucherNo;
    doc.DocDate = source.VoucherDate;
    //Document Level Inclusive Tax
    doc.InclusiveTax = source.InclusiveTax;

    foreach (JournalDetail jnDtl in source.Details)
    {
        dtl = doc.AddDetail();
        dtl.AccNo = jnDtl.Account;
        dtl.Description = jnDtl.Description;
        dtl.ProjNo = jnDtl.Project;
        dtl.DeptNo = jnDtl.Department;
        dtl.TaxType = jnDtl.GSTCode;
        dtl.SupplyPurchase = jnDtl.GSTSupplyPurchase;
        //Detail Level Inclusive Tax
        dtl.InclusiveTax = jnDtl.InclusiveTax;

        if (jnDtl.DebitAmount.HasValue)
            dtl.DR = jnDtl.DebitAmount.Value;
        else
            dtl.CR = jnDtl.CreditAmount.Value;
    }

    try
    {
        doc.Save();
        //log success
    }
    catch (BCE.Application.AppException ex)
    {
        //log ex.Message
    }
}
When dtl.DR is assigned with a value, system will reset the value of dtl.CR.
Likewise same behavior apply to dtl.CR.
To learn about differences of Document Level & Detail Level Tax Inclusive, see Inclusive GST in Cash Book

Single Amount (Positive & Negative)

Another way to accept value into Debit and Credit with positive or negative amount;

public void NewSingleAmountJournalEntry(BCE.Data.DBSetting dbSetting, SingleAmountJournalSource source)
{
    BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(dbSetting);
    BCE.AutoCount.GL.JournalEntry.JournalEntry doc = cmd.AddNew();
    BCE.AutoCount.GL.JournalEntry.JournalEntryDetail dtl = null;

    //Assign necessary values to master fields

    foreach (SingleAmountJournalDetail jnDtl in source.Details)
    {
        dtl = doc.AddDetail();
        //Assign necessary values to detail fields

        if (jnDtl.Amount > 0)
            dtl.DR = jnDtl.Amount;
        else
            dtl.CR = jnDtl.Amount;
    }

    try
    {
        doc.Save();
        //log success
    }
    catch (BCE.Application.AppException ex)
    {
        //log ex.Message
    }
}

Classes of source

Split Amount (Debit & Credit)

public class JournalSource
{
    public string Description { get; set; }
    public string CurrencyCode { get; set; }
    public decimal CurrencyRate { get; set; }
    public string VoucherNo { get; set; }
    public DateTime VoucherDate { get; set; }
    public bool InclusiveTax { get; set; } = false;
    public List<JournalDetail> Details { get; set; } = new List<JournalDetail>();
}

public class JournalDetail
{
    public string Account { get; set; }
    public string Description { get; set; }
    public string Project { get; set; }
    public string Department { get; set; }
    public decimal? DebitAmount { get; set; }
    public decimal? CreditAmount { get; set; }
    public BCE.AutoCount.Tax.TaxSupplyPurchase GSTSupplyPurchase { get; set; } = BCE.AutoCount.Tax.TaxSupplyPurchase.Supply;
    public string GSTCode { get; set; }
    public bool InclusiveTax { get; set; } = false;
}

Single Amount (Positive & Negative)

public class SingleAmountJournalSource
{
    public string Description { get; set; }
    public string CurrencyCode { get; set; }
    public decimal CurrencyRate { get; set; }
    public string VoucherNo { get; set; }
    public DateTime VoucherDate { get; set; }
    public bool InclusiveTax { get; set; } = false;
    public List<SingleAmountJournalDetail> Details { get; set; } = new List<SingleAmountJournalDetail>();
}

public class SingleAmountJournalDetail
{
    public string Account { get; set; }
    public string Description { get; set; }
    public string Project { get; set; }
    public string Department { get; set; }
    public decimal Amount {get; set;}
    public BCE.AutoCount.Tax.TaxSupplyPurchase GSTSupplyPurchase { get; set; } = BCE.AutoCount.Tax.TaxSupplyPurchase.Supply;
    public string GSTCode { get; set; }
    public bool InclusiveTax { get; set; } = false;
}

Implementation

Split Amount (Debit & Credit)

public MainEntry(BCE.Data.DBSetting dbSetting)
{
    JournalSource newJN = new JournalSource()
    {
        Description = "SALARY OCT 2017",
        CurrencyCode = "MYR",
        CurrencyRate = 1,
        VoucherNo = "<<New>>",
        VoucherDate = new DateTime(2017, 11, 28),
    };

    newJN.Details.Add(new JournalDetail(){ Account = "410-0000", Description = "SALARY OCT 2017", CreditAmount = 11956.00M });
    newJN.Details.Add(new JournalDetail(){ Account = "900-1005", Description = "TOM",             DebitAmount = 5000 });
    newJN.Details.Add(new JournalDetail(){ Account = "900-1005", Description = "JERRY",           DebitAmount = 4800 });
    newJN.Details.Add(new JournalDetail(){ Account = "700-3010", Description = "SALARY OCT 2017", DebitAmount = 1176 });
    newJN.Details.Add(new JournalDetail(){ Account = "700-3015", Description = "SALARY OCT 2017", DebitAmount = 980 });

    NewJournalEntry(dbSetting, newJN);
}

Single Amount (Positive & Negative)

public SingleAmountMainEntry(BCE.Data.DBSetting dbSetting)
{
    JournalSource newJN = new JournalSource()
    {
        Description = "SALARY OCT 2017",
        CurrencyCode = "MYR",
        CurrencyRate = 1,
        VoucherNo = "<<New>>",
        VoucherDate = new DateTime(2017, 11, 28),
    };

    newJN.Details.Add(new JournalDetail(){ Account = "410-0000", Description = "SALARY OCT 2017", Amount = -11956.00M });
    newJN.Details.Add(new JournalDetail(){ Account = "900-1005", Description = "TOM",             Amount = 5000 });
    newJN.Details.Add(new JournalDetail(){ Account = "900-1005", Description = "JERRY",           Amount = 4800 });
    newJN.Details.Add(new JournalDetail(){ Account = "700-3010", Description = "SALARY OCT 2017", Amount = 1176 });
    newJN.Details.Add(new JournalDetail(){ Account = "700-3015", Description = "SALARY OCT 2017", Amount = 980 });

    NewSingleAmountJournalEntry(dbSetting, newJN);
}


See Also

Go to menu

Go to top
Resources For AutoCount Software Developers