AR Credit Note v2

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

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 NewARCreditNote(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.ARAP.ARCN.ARCNDataAccess cmd = AutoCount.ARAP.ARCN.ARCNDataAccess.Create(userSession, userSession.DBSetting);
    AutoCount.ARAP.ARCN.ARCNEntity doc = cmd.NewARCN();
    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();
    //Debit A/C (of detail)
    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(AutoCount.Document.DocumentType.ARInvoice, "I-000001", 10);

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

Edit

public void EditARCreditNote(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.ARAP.ARCN.ARCNDataAccess cmd = AutoCount.ARAP.ARCN.ARCNDataAccess.Create(userSession, userSession.DBSetting);
    AutoCount.ARAP.ARCN.ARCNEntity doc = cmd.GetARCN("CN-000001");
    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(AutoCount.Document.DocumentType.ARInvoice, "I-000001", 10);

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

Void (Cancel)

public void CancelARCreditNote(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "CN-000001";
    AutoCount.ARAP.ARCN.ARCNDataAccess cmd = AutoCount.ARAP.ARCN.ARCNDataAccess.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.CancelARCN(docNo, userSession.LoginUserID);
        AutoCount.AppMessage.ShowMessage($"{docNo} is cancelled.");
    }
    catch (AutoCount.AppException ex)
    {
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Delete

public void DeleteARCreditNote(AutoCount.Authentication.UserSession userSession)
{
    string docNo = "CN-000001";
    AutoCount.ARAP.ARCN.ARCNDataAccess cmd = AutoCount.ARAP.ARCN.ARCNDataAccess.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.DeleteARCN(docNo, userSession.LoginUserID);
        AutoCount.AppMessage.ShowMessage($"{docNo} is deleted.");
    }
    catch (AutoCount.AppException ex)
    {
        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

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