AR Credit Note

From AutoCount Resource Center
Jump to navigation Jump to search

Technical Specification

  1. Net Total of the document is read-only. The calculation of net total is from amount total.
  2. Knock Off Date must be equal or greater than the document date.
  3. Total of Knock Off Amount must not exceed the amount of Credit Note.
  4. Knock Off Amount of the AR Invoice or AR Debit Note must not exceed its remain outstanding.
  5. CN Type must be specified.
  6. Debit A/C (of Detail) does not allow Debtor or Creditor Account.
    The common reason to select Creditor in Debit A/C of Credit Note is for Contra.
    To do Contra, create A/R and A/P Contra Entry
  7. Debit A/C (of Detail) does not allow Bank or Cash account
    Related to Bank or Cash transaction must be created at AR Received Payment
  8. Debit A/C (of Detail) must be a leaf account


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

API Usage

New

public void NewARCN(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.ARCN.ARCNDataAccess cmd =
        BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(dbSetting);
    BCE.AutoCount.ARAP.ARCN.ARCNEntity doc = cmd.NewARCN();
    BCE.AutoCount.ARAP.ARCN.ARCNDTLEntity dtl = null;

    //doc.DocNo = "CN-Test-0025";
    doc.DocDate = new DateTime(2018, 6, 5);
    doc.Description = "DISCOUNT";
    doc.Reason = "Early Payment discount";
    doc.OurInvoiceNo = "I-000001";
    doc.JournalType = "SALES";
    doc.CNType = "DISCOUNT";

    dtl = doc.NewDetail();
    dtl.AccNo = "520-0000";
    dtl.Description = "DISCOUNT ALLOWED";
    dtl.Amount = 10M;

    //Knockoff AR Invoice
    //If knockoff date is not defined, it follows system settings in Tools | Options
    doc.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, "I-000001", 10);

    try
    {
        cmd.SaveARCN(doc, userId);
        //Log success
        BCE.Application.AppMessage.ShowMessage($"Credit Note {doc.DocNo} Created Successfully.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log Failed
        BCE.Application.AppMessage.ShowMessage(
            string.Format("Fail to create new Credit Note.\n{0}", ex.Message));
    }
}

Edit

public void EditARCN(BCE.Data.DBSetting dbSetting)
{
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.ARCN.ARCNDataAccess cmd =
        BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(dbSetting);
    BCE.AutoCount.ARAP.ARCN.ARCNEntity doc = cmd.GetARCN("CN-Test-0025");
    BCE.AutoCount.ARAP.ARCN.ARCNDTLEntity dtl = null;

    if (doc == null)
        return;

    //doc.DocNo = "CN-Test-0025";
    doc.DocDate = new DateTime(2018, 6, 5);
    doc.Description = "DISCOUNT";
    doc.Reason = "Special Discount";
    doc.OurInvoiceNo = "I-000001";
    doc.JournalType = "SALES";
    doc.CNType = "DISCOUNT";

    doc.ClearDetails();

    dtl = doc.NewDetail();
    dtl.AccNo = "520-0000";
    dtl.Description = "DISCOUNT ALLOWED";
    dtl.Amount = 10M;

    //Knockoff AR Invoice
    //If knockoff date is not defined, it follows system settings in Tools | Options
    doc.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, "I-000001", 10);

    try
    {
        cmd.SaveARCN(doc, userId);
        //Log success
        BCE.Application.AppMessage.ShowMessage($"Credit Note '{doc.DocNo}' Updated Successfully.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log Failed
        BCE.Application.AppMessage.ShowMessage(
            string.Format("Fail to update Credit Note '{0}'.\n{1}", doc.DocNo, ex.Message));
    }
}

Cancel (void)

public void CancelARCN(BCE.Data.DBSetting dbSetting)
{
    string docNo = "CN-Test-0025";
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.ARCN.ARCNDataAccess cmd =
        BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(dbSetting);

    try
    {
        cmd.CancelARCN(docNo, userId);
        //Log success
        BCE.Application.AppMessage.ShowMessage($"Credit Note '{docNo}' is cancelled.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log fail
        BCE.Application.AppMessage.ShowMessage(
            string.Format("Error cancel Credit Note '{0}'.\n{1}", docNo, ex.Message));
    }
}

Delete

public void DeleteARCN(BCE.Data.DBSetting dbSetting)
{
    string docNo = "CN-Test-0025";
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.ARAP.ARCN.ARCNDataAccess cmd =
        BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(dbSetting);

    try
    {
        cmd.DeleteARCN(docNo, userId);
        //Log success
        BCE.Application.AppMessage.ShowMessage($"Credit Note '{docNo}' is deleted.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log fail
        BCE.Application.AppMessage.ShowMessage(
            string.Format("Error delete Credit Note '{0}'.\n{1}", docNo, 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