ARAP Contra Entry v2

From AutoCount Resource Center
Jump to navigation Jump to search

Technical Specification

  1. Debtor and Creditor must be same currency code
  2. Programmer can assign decimal value to NetTotal in ARAP Contra Entry
  3. NetTotal must be larger than total knockoff amount(s)

References of AutoCount Accounting version 2.0

AutoCount.Accounting.dll
AutoCount.Accounting.UI.dll
AutoCount.dll
AutoCount.MainEntry.dll
AutoCount.UI.dll
AutoCount.ARAP.dll

API Usage

New

public void NewARAPContra(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.ARAP.Contra.ContraDataAccess cmd =
        AutoCount.ARAP.Contra.ContraDataAccess.Create(userSession, userSession.DBSetting);
    AutoCount.ARAP.Contra.ContraEntity doc = cmd.NewContra();

    doc.DebtorCode = "300-A001";
    doc.CreditorCode = "400-X001";
    doc.DocDate = new DateTime(2018, 6, 5);
    doc.Description = "Generate Test CONTRA";
    doc.JournalType = "GENERAL";
    doc.NetTotal = 100;

    //Knockoff AR Invoice (customer)
    doc.KnockOff(AutoCount.Document.DocumentType.ARInvoice, "I-000001", 100);
    //Knockoff AP Invoice (supplier)
    doc.KnockOff(AutoCount.Document.DocumentType.APInvoice, "PI-000001", 100);

    try
    {
        cmd.SaveContra(doc, userSession.LoginUserID);
        //Log Success
        AutoCount.AppMessage.ShowMessage($"Contra '{doc.DocNo}' is created.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log Fail
        AutoCount.AppMessage.ShowMessage(
            string.Format("Fail to create Contra.\n{0}", ex.Message));
    }
}

Edit

public void EditARAPContra(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.ARAP.Contra.ContraDataAccess cmd =
        AutoCount.ARAP.Contra.ContraDataAccess.Create(userSession, userSession.DBSetting);
    AutoCount.ARAP.Contra.ContraEntity doc = cmd.GetContra("JV-000001");

    if (doc == null)
        return;

    doc.DebtorCode = "300-A001";
    doc.CreditorCode = "400-X001";
    doc.DocDate = new DateTime(2018, 6, 5);
    doc.Description = "Edited Generated ARAP CONTRA";
    doc.JournalType = "GENERAL";
    doc.NetTotal = 80;

    //Knockoff AR Invoice (customer)
    doc.KnockOff(AutoCount.Document.DocumentType.ARInvoice, "I-000001", 80);
    //Knockoff AP Invoice (supplier)
    doc.KnockOff(AutoCount.Document.DocumentType.APInvoice, "PI-000001", 80);

    try
    {
        cmd.SaveContra(doc, userSession.LoginUserID);
        //Log Success
        AutoCount.AppMessage.ShowMessage($"Contra '{doc.DocNo}' is updated");
    }
    catch (AutoCount.AppException ex)
    {
        //Log Fail
        AutoCount.AppMessage.ShowMessage(
            string.Format("Fail to update Contra.\n{0}", ex.Message));
    }
}

Cancel (void)

public void CancelARAPContra(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "JV-000001";
    AutoCount.ARAP.Contra.ContraDataAccess cmd =
        AutoCount.ARAP.Contra.ContraDataAccess.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.CancelContra(docNo, userSession.LoginUserID);
        //Log Success
        AutoCount.AppMessage.ShowMessage($"Contra '{docNo}' is cancelled.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log Fail
        AutoCount.AppMessage.ShowMessage(
            string.Format("Fail to cancel Contra.\n{0}", ex.Message));
    }
}

Delete

public void DeleteARAPContra(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "JV-000001";
    AutoCount.ARAP.Contra.ContraDataAccess cmd =
        AutoCount.ARAP.Contra.ContraDataAccess.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.DeleteContra(docNo, userSession.LoginUserID);
        //Log Success
        AutoCount.AppMessage.ShowMessage($"Contra '{docNo}' is deleted.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log Fail
        AutoCount.AppMessage.ShowMessage(
            string.Format("Fail to delete Contra.\n{0}", ex.Message));
    }
}

See Also

AutoCount Accounting Account API
AR AP
Transactions Version Transactions Version
AR Debtor (Customer) 1.8, 1.9
2.0
AP Creditor (Supplier) 1.8, 1.9
2.0
AR Invoice 1.8, 1.9
2.0
AP Invoice 1.8, 1.9
2.0
AR Received Payment 1.8, 1.9
2.0
AP Payment 1.8, 1.9
2.0
AR Debit Note 1.8, 1.9
2.0
AP Debit Note 1.8, 1.9
2.0
AR Credit Note 1.8, 1.9
2.0
AP Credit Note 1.8, 1.9
2.0
AR Refund 1.8, 1.9
2.0
AP Refund 1.8, 1.9
2.0
AR Deposit 1.8, 1.9
2.0
AP Deposit 1.8, 1.9
2.0
AR Deposit - Create New or Update
with Refund & Forfeit
1.8, 1.9
2.0
A/R and A/P Contra Entry 1.8, 1.9
2.0

Go to menu

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