Journal Entry: Difference between revisions

From AutoCount Resource Center
mNo edit summary
mNo edit summary
Line 3: Line 3:
 
# Net Total of Debit and Credit must be same amount.
 
# Net Total of Debit and Credit must be same amount.
 
# Debit & Credit are not allow to coexist in the same line. Each line is either Debit or Credit.
 
# 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 at same line, then 70 is placed at Debit.
+
#*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
 
#:Eg. Debit = 100, Credit = 30, then DR = 70
 
# Amount in DR and CR cannot be negative.
 
# Amount in DR and CR cannot be negative.

Revision as of 08:07, 30 November 2017

Go to menu

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


Rules in Cash Book Entry

  1. Net Total of Debit and Credit must be same amount.
  2. 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
  3. 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


Assemblies version 1.8

BCE.AutoCount.dll
BCE.AutoCount.GL.dll

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
    }
}
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(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;} = 0;
    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

ProgCBJournal1.PNG

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