AR Credit Note

From AutoCount Resource Center
Revision as of 08:16, 5 June 2018 by DanielY (talk | contribs)

Technical Specification

  1. Knock Off Date must be equal or greater than the document date.
  2. Total of Knock Off Amount must not exceed the amount of Credit Note.
  3. Knock Off Amount of the AR Invoice or AR Debit Note must not exceed its remain outstanding.
  4. CN Type must be specified.
  5. 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


Assemblies version 1.8

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));
    }
}

Template:SeeAlsoAccount

Go to menu

Go to top
Resources For AutoCount Software Developers