AP Refund API

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.

Assemblies 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

AP Credit Note API Usage

New

public void New(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.APRefund.APRefundDataAccess cmd = BCE.AutoCount.ARAP.APRefund.APRefundDataAccess.Create(dbSetting);
    BCE.AutoCount.ARAP.APRefund.APRefundEntity doc = cmd.NewAPRefund();
    BCE.AutoCount.ARAP.APRefund.APRefundDTLEntity dtl = null;

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

    dtl = doc.NewDetail();
    dtl.PaymentMethod = "BANK";
    dtl.ChequeNo = "CB00018248";
    dtl.PaymentAmt = 120M;

    //Knockoff Payment
    doc.KnockOff(BCE.AutoCount.Document.DocumentType.APPayment, "PV-00001", 120M);

    try
    {
        cmd.SaveAPRefund(doc, userId);
        //log success
        BCE.Application.AppMessage.ShowMessage($"New AP Refund '{doc.DocNo}' created.");
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
        BCE.Application.AppMessage.ShowMessage("Error create new AP Refund.\n" + ex.Message);
    }
}

Edit

public void Edit(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.APRefund.APRefundDataAccess cmd = BCE.AutoCount.ARAP.APRefund.APRefundDataAccess.Create(dbSetting);
    BCE.AutoCount.ARAP.APRefund.APRefundEntity doc = cmd.GetAPRefund("OR-00001");
    BCE.AutoCount.ARAP.APRefund.APRefundDTLEntity dtl = null;

    if (doc == null)
    {
        //log unable to load "OR-00001", or not found
        return;
    }

    //Clear previous details
    doc.ClearKnockOff();
    doc.ClearDetails();

    doc.DocDate = new DateTime(2018, 6, 23);
    doc.Description = "Refund on Return Goods";

    dtl = doc.NewDetail();
    dtl.PaymentMethod = "BANK";
    dtl.ChequeNo = "CB00018248";
    dtl.PaymentAmt = 120M;

    //Knockoff Payment
    doc.KnockOff(BCE.AutoCount.Document.DocumentType.APPayment, "PV-00001", 120M);

    try
    {
        cmd.SaveAPRefund(doc, userId);
        //log success
        BCE.Application.AppMessage.ShowMessage($"AP Refund '{doc.DocNo}' is updated.");
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
        BCE.Application.AppMessage.ShowMessage("Error edit AP Refund.\n" + ex.Message);
    }
}

Cancel (Void)

public void Cancel(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.APRefund.APRefundDataAccess cmd = BCE.AutoCount.ARAP.APRefund.APRefundDataAccess.Create(dbSetting);

    string docNo = "PV-00001";

    try
    {
        cmd.CancelAPRefund(docNo, userId);
        //log success
        BCE.Application.AppMessage.ShowMessage($"AP Refund '{docNo}' is cancelled.");
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
        BCE.Application.AppMessage.ShowMessage("Error cancel AP Refund.\n" + ex.Message);
    }
}

Delete

public void Delete(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.APRefund.APRefundDataAccess cmd = BCE.AutoCount.ARAP.APRefund.APRefundDataAccess.Create(dbSetting);

    string docNo = "PV-00001";

    try
    {
        cmd.DeleteAPRefund(docNo, userId);
        //log success
        BCE.Application.AppMessage.ShowMessage($"AP Refund '{docNo}' is deleted.");
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
        BCE.Application.AppMessage.ShowMessage("Error delete AP Refund.\n" + 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