ARAP Contra Entry v18

From AutoCount Resource Center
Revision as of 04:49, 11 June 2018 by DanielY (talk | contribs) (Created page with " ==Technical Specification== # Debtor and Creditor must be same currency code # Programmer can assign decimal value to '''NetTotal''' in '''ARAP Contra Entry''' # '''NetTotal'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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));
    }
}

Template:SeeAlsoAccount

Go to menu

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