ARAP Contra Entry v18

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 1.8, 1.9

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

API Usage

New

public void NewARAPContra(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.Contra.ContraDataAccess cmd =
        BCE.AutoCount.ARAP.Contra.ContraDataAccess.Create(dbSetting);
    BCE.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(BCE.AutoCount.Document.DocumentType.ARInvoice, "I-000001", 100);
    //Knockoff AP Invoice (supplier)
    doc.KnockOff(BCE.AutoCount.Document.DocumentType.APInvoice, "PI-000001", 100);

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

Edit

public void EditARAPContra(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.Contra.ContraDataAccess cmd =
        BCE.AutoCount.ARAP.Contra.ContraDataAccess.Create(dbSetting);
    BCE.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(BCE.AutoCount.Document.DocumentType.ARInvoice, "I-000001", 80);
    //Knockoff AP Invoice (supplier)
    doc.KnockOff(BCE.AutoCount.Document.DocumentType.APInvoice, "PI-000001", 80);

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

Cancel (void)

public void CancelARAPContra(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    string docNo = "JV-000001";
    BCE.AutoCount.ARAP.Contra.ContraDataAccess cmd =
        BCE.AutoCount.ARAP.Contra.ContraDataAccess.Create(dbSetting);

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

Delete

public void DeleteARAPContra(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    string docNo = "JV-000001";
    BCE.AutoCount.ARAP.Contra.ContraDataAccess cmd =
        BCE.AutoCount.ARAP.Contra.ContraDataAccess.Create(dbSetting);

    try
    {
        cmd.DeleteContra(docNo, userId);
        //Log Success
        BCE.Application.AppMessage.ShowMessage($"Contra '{docNo}' is deleted.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log Fail
        BCE.Application.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