AP Refund API v2

From AutoCount Resource Center

Technical Specification

  1. AP Refund can knockoff AP Payment and AP Credit Note
  2. Knockoff total amount must be equal or less than the total Payment Amount.

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 New(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.ARAP.APRefund.APRefundDataAccess cmd =
        AutoCount.ARAP.APRefund.APRefundDataAccess.Create(userSession, userSession.DBSetting);
    AutoCount.ARAP.APRefund.APRefundEntity doc = cmd.NewAPRefund();
    AutoCount.ARAP.APRefund.APRefundDTLEntity dtl = null;

    doc.CreditorCode = "400-X001";
    //doc.DocNo = "<<New>>";
    doc.DocDate = new DateTime(2018, 6, 26);
    doc.Description = "Refund Received";

    dtl = doc.NewDetail();
    dtl.PaymentMethod = "BANK";
    dtl.ChequeNo = "CB000287";
    dtl.PaymentAmt = 50M;

    //Knockoff AP Payment or AP Credit Note
    doc.KnockOff(AutoCount.Document.DocumentType.APPayment, "PI-000011", 50);

    try
    {
        cmd.SaveAPRefund(doc, userSession.LoginUserID);
        //Log success
        AutoCount.AppMessage.ShowMessage($"AP Refund '{doc.DocNo}' is created.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log error
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Edit

public void Edit(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "OR-000001";
    AutoCount.ARAP.APRefund.APRefundDataAccess cmd =
        AutoCount.ARAP.APRefund.APRefundDataAccess.Create(userSession, userSession.DBSetting);
    AutoCount.ARAP.APRefund.APRefundEntity doc = cmd.GetAPRefund(docNo);
    AutoCount.ARAP.APRefund.APRefundDTLEntity dtl = null;

    if (doc == null)
    {
        //Log fail to load the specified AP Refund
        return;
    }

    //doc.CreditorCode = "400-X001";
    //doc.DocNo = "<<New>>";
    doc.DocDate = new DateTime(2018, 6, 26);
    doc.Description = "Refund Received";

    doc.ClearKnockOff();
    doc.ClearDetails();

    dtl = doc.NewDetail();
    dtl.PaymentMethod = "BANK";
    dtl.ChequeNo = "CB000287";
    dtl.PaymentAmt = 50M;

    //Knockoff AP Payment or AP Credit Note
    doc.KnockOff(AutoCount.Document.DocumentType.APPayment, "PI-000011", 50);

    try
    {
        cmd.SaveAPRefund(doc, userSession.LoginUserID);
        //Log success
        AutoCount.AppMessage.ShowMessage($"AP Refund '{doc.DocNo}' is updated.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log error
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Cancel (Void)

public void Cancel(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "OR-000001";
    AutoCount.ARAP.APRefund.APRefundDataAccess cmd =
        AutoCount.ARAP.APRefund.APRefundDataAccess.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.CancelAPRefund(docNo, userSession.LoginUserID);
        //Log success
        AutoCount.AppMessage.ShowMessage($"AP Refund '{docNo}' is cancelled.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log error
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Uncancel (Void)

public void UnCancel(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "OR-000001";
    AutoCount.ARAP.APRefund.APRefundDataAccess cmd =
        AutoCount.ARAP.APRefund.APRefundDataAccess.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.UncancelAPRefund(docNo, userSession.LoginUserID);
        //Log success
        AutoCount.AppMessage.ShowMessage($"AP Refund '{docNo}' is uncancelled.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log error
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Delete

public void Delete(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "OR-000001";
    AutoCount.ARAP.APRefund.APRefundDataAccess cmd = 
        AutoCount.ARAP.APRefund.APRefundDataAccess.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.DeleteAPRefund(docNo, userSession.LoginUserID);
        //Log success
        AutoCount.AppMessage.ShowMessage($"AP Refund '{docNo}' is deleted.");
    }
    catch (AutoCount.AppException ex)
    {
        //Log error
        AutoCount.AppMessage.ShowMessage(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

Go to top
Resources For AutoCount Software Developers