Journal Entry v2

From AutoCount Resource Center
Jump to navigation Jump to search

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 2.0

AutoCount.Accounting.dll
AutoCount.Accounting.UI.dll
AutoCount.dll
AutoCount.MainEntry.dll
AutoCount.UI.dll
AutoCount.GL.dll



Sample with data model

Create new Journal Entry

Split Amount (Debit & Credit)

public void NewJournalEntry(AutoCount.Authentication.UserSession userSession, JournalSource source)
{
    AutoCount.GL.JournalEntry.JournalEntryCommand cmd = AutoCount.GL.JournalEntry.JournalEntryCommand.Create(userSession, userSession.DBSetting);

    AutoCount.GL.JournalEntry.JournalEntry doc = cmd.AddNew();
    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 (AutoCount.AppException ex)
    {
        //log ex.Message
    }
}
Tips icons.png When dtl.DR is assigned with a value, system will reset the value of dtl.CR.
Likewise same behavior apply to dtl.CR.
Tips icons.png 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(UserSession userSession, SingleAmountJournalSource source)
{
    AutoCount.GL.JournalEntry.JournalEntryCommand cmd = AutoCount.GL.JournalEntry.JournalEntryCommand.Create(userSession, userSession.DBSetting);
    AutoCount.GL.JournalEntry.JournalEntry doc = cmd.AddNew();
    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 (AutoCount.AppException ex)
    {
        //log ex.Message
    }
}

Classes of source (data model)

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 AutoCount.Tax.TaxSupplyPurchase GSTSupplyPurchase { get; set; } = 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 AutoCount.Tax.TaxSupplyPurchase GSTSupplyPurchase { get; set; } = AutoCount.Tax.TaxSupplyPurchase.Supply;
    public string GSTCode { get; set; }
    public bool InclusiveTax { get; set; } = false;
}

Implementation

ProgGLJournal1v2.PNG

Split Amount (Debit & Credit)

public MainEntry(AutoCount.Authentication.UserSession userSession)
{
    JournalSource newJN = new JournalSource()
    {
        Description = "SALARY APRIL 2018",
        CurrencyCode = "MYR",
        CurrencyRate = 1,
        VoucherNo = "<<New>>",
        VoucherDate = new DateTime(2018, 04, 30),
    };

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

    NewJournalEntry(userSession, newJN);
}

Single Amount (Positive & Negative)

public SingleAmountMainEntry(AutoCount.Authentication.UserSession userSession)
{
    JournalSource newJN = new JournalSource()
    {
        Description = "SALARY APRIL 2018",
        CurrencyCode = "MYR",
        CurrencyRate = 1,
        VoucherNo = "<<New>>",
        VoucherDate = new DateTime(2018, 04, 30),
    };

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

    NewSingleAmountJournalEntry(userSession, newJN);
}


See Also

Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers