AP Credit Note
Technical Specification
- Net Total is a read-only field that is calculated from the total amount of detail (APCNDTLEntity).
- Net Total must be positive value
- Knockoff Total Amount must be equal or smaller than Net Total
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 with knockoff AP Invoice
public void New(BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.APCN.APCNDataAccess cmd = BCE.AutoCount.ARAP.APCN.APCNDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.APCN.APCNEntity doc = cmd.NewAPCN();
BCE.AutoCount.ARAP.APCN.APCNDTLEntity dtl = null;
//doc.DocNo = "<<New>>";
doc.CreditorCode = "400-X001";
doc.DocDate = new DateTime(2018, 6, 22);
doc.Description = "Discount";
doc.SupplierCNNo = "DSC-00015";
doc.SupplierInvoiceNo = "BIL-00101";
//Default available values: "PURCHASE", "GENERAL"
//Note that user is able to change the above values
//that is maintained in General Maintenance > Journal Type Maintenance
doc.JournalType = "PURCHASE";
//Default available values: "DISCOUNT", "RETURN"
//Values are maintained in General Maintenance > C/N Type Maintenance
doc.CNType = "DISCOUNT";
//Add a new detail record
dtl = doc.NewDetail();
dtl.AccNo = "520-0000";
dtl.Description = "Item Sale Discount";
dtl.Amount = 50.00M;
//Knockoff AP Invoice or AP Debit Note
//"PI-00001" is AP Invoice Document Number
doc.KnockOff(BCE.AutoCount.Document.DocumentType.APInvoice, "PI-00001", 50M);
try
{
cmd.SaveAPCN(doc, userId);
//Log success
BCE.Application.AppMessage.ShowMessage($"New APCN '{doc.DocNo}' is Created.");
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage("Fail to create new APCN.\n" + ex.Message);
}
}
Edit with knockoff AP Invoice
Load AP C/N with Document No
public void Edit(BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.APCN.APCNDataAccess cmd = BCE.AutoCount.ARAP.APCN.APCNDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.APCN.APCNEntity doc = cmd.GetAPCN("CN-00001");
BCE.AutoCount.ARAP.APCN.APCNDTLEntity dtl = null;
if (doc == null)
{
//log unable to load "CN-00001", or not found
return;
}
//Clear all details of this document
doc.ClearKnockOff();
doc.ClearDetails();
doc.DocDate = new DateTime(2018, 6, 21);
doc.Description = "Discount";
doc.Reason = "Pricing Adjustment";
doc.SupplierCNNo = "DSC-00015";
doc.SupplierInvoiceNo = "BIL-00101";
//Default available values: "PURCHASE", "GENERAL"
//Note that user is able to change the above values
//that is maintained in General Maintenance > Journal Type Maintenance
doc.JournalType = "PURCHASE";
//Default available values: "DISCOUNT", "RETURN"
//Note that user is able to change the above values
doc.CNType = "RETURN";
dtl = doc.NewDetail();
dtl.AccNo = "520-0000";
dtl.Description = "Return of Item A";
dtl.Amount = 50.00M;
//Knockoff AP Invoice or AP Debit Note
//"PI-00001" is AP Invoice Document Number
doc.KnockOff(BCE.AutoCount.Document.DocumentType.APInvoice, "PI-00001", 50M);
try
{
cmd.SaveAPCN(doc, userId);
//Log success
BCE.Application.AppMessage.ShowMessage($"New APCN '{doc.DocNo}' is Created.");
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage("Fail to create new APCN.\n" + ex.Message);
}
}
Load AP C/N with SupplierCNNo
public void EditWithSupplierCreditNoteNo(BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
string supplierCNNo = "DSC-00015";
string creditorCode = "400-X001";
BCE.AutoCount.ARAP.APCN.APCNDataAccess cmd = BCE.AutoCount.ARAP.APCN.APCNDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.APCN.APCNEntity doc = cmd.GetAPCN(supplierCNNo, creditorCode);
BCE.AutoCount.ARAP.APCN.APCNDTLEntity dtl = null;
if (doc == null)
{
//log unable to load "CN-00001", or not found
return;
}
//Clear all details of this document
doc.ClearKnockOff();
doc.ClearDetails();
doc.DocDate = new DateTime(2018, 6, 21);
doc.Description = "Discount";
doc.Reason = "Pricing Adjustment";
doc.SupplierCNNo = supplierCNNo;
doc.SupplierInvoiceNo = "BIL-00101";
//Default available values: "PURCHASE", "GENERAL"
//Note that user is able to change the above values
//that is maintained in General Maintenance > Journal Type Maintenance
doc.JournalType = "PURCHASE";
//Default available values: "DISCOUNT", "RETURN"
//Note that user is able to change the above values
doc.CNType = "RETURN";
dtl = doc.NewDetail();
dtl.AccNo = "520-0000";
dtl.Description = "Return of Item A";
dtl.Amount = 50.00M;
//Knockoff AP Invoice or AP Debit Note
//"PI-00001" is AP Invoice Document Number
doc.KnockOff(BCE.AutoCount.Document.DocumentType.APInvoice, "PI-00001", 50M);
try
{
cmd.SaveAPCN(doc, userId);
//Log success
BCE.Application.AppMessage.ShowMessage($"New APCN '{doc.DocNo}' is Created.");
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage("Fail to create new APCN.\n" + ex.Message);
}
}
Cancel (Void)
public void Cancel(BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.APCN.APCNDataAccess cmd = BCE.AutoCount.ARAP.APCN.APCNDataAccess.Create(dbSetting);
string docNo = "CN-00001";
try
{
cmd.CancelAPCN(docNo, userId);
//cmd.CancelAPCN("DSC-00015", "400-X001", userSession.LoginUserID);
BCE.Application.AppMessage.ShowMessage($"APCN 'docNo' is Created.");
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage($"Fail to cancel APCN {docNo}.\n" + ex.Message);
}
}
Delete
public void Delete(BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.APCN.APCNDataAccess cmd = BCE.AutoCount.ARAP.APCN.APCNDataAccess.Create(dbSetting);
string docNo = "CN-00001";
try
{
cmd.DeleteAPCN(docNo, userId);
BCE.Application.AppMessage.ShowMessage($"APCN 'docNo' is Deleted.");
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage($"Fail to delete APCN {docNo}.\n" + ex.Message);
}
}
Get Document No. from Supplier Invoice No.
public string GetDocNoOfSupplierInvNo(string supplierInvNo, BCE.Data.DBSetting dbSetting)
{
object oDocNo = dbSetting.ExecuteScalar("SELECT DocNo FROM APInvoice WHERE SupplierInvoiceNo=?", supplierInvNo);
//C# 6.0
return oDocNo?.ToString(); //return oDocNo != null ? oDocNo.ToString() : null;
}
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 top
|
Resources For AutoCount Software Developers
|