AP Deposit API
Technical Specification
- Deposit Account (Deposit Payment Method) is mandatory field
- Deposit Account (Deposit Payment Method) is a Payment Method that is maintained in G/L | Account Maintenance & General Maintenance | Payment Method Maintenance.
- Forfeit Account can be predefined under Tools | Options > G/L | Default Accounts
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)
{
BCE.AutoCount.ARAP.APDeposit.APDepositCommand cmd = BCE.AutoCount.ARAP.APDeposit.APDepositCommand.Create(dbSetting);
BCE.AutoCount.ARAP.APDeposit.APDeposit doc = cmd.AddNew();
BCE.AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
//The value of Deposit Payment Method is defined by user,
//must check the Deposit setting in General Maintenance > Payment Method Maintenance,
//to get correct value
doc.DepositPaymentMethod = "DEPOSIT PAYABLE";
doc.DocDate = new DateTime(2018, 6, 25);
doc.CreditorCode = "400-X001";
doc.Attention = "Jerry";
doc.Description = "Deposit to ordering of books";
//Add a payment that is made for this deposit
dtl = doc.AddDetail();
dtl.PaymentMethod = "BANK";
dtl.PaymentAmt = 200M;
try
{
doc.Save();
//Log success
BCE.Application.AppMessage.ShowMessage($"New AP Deposit '{doc.DocNo}' is created.");
}
catch (BCE.Application.AppException ex)
{
//Log error
BCE.Application.AppMessage.ShowMessage("Error when create new AP Deposit.\n" + ex.Message);
}
}
New AP Deposit with Refund
public void NewWithRefund(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.APDeposit.APDepositCommand cmd = BCE.AutoCount.ARAP.APDeposit.APDepositCommand.Create(dbSetting);
BCE.AutoCount.ARAP.APDeposit.APDeposit doc = cmd.AddNew();
BCE.AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
BCE.AutoCount.ARAP.APDeposit.APDepositRefundDetail refundDtl = null;
doc.DepositPaymentMethod = "DEPOSIT PAYABLE";
doc.DocDate = new DateTime(2018, 6, 25);
doc.CreditorCode = "400-X001";
doc.Attention = "Jerry";
doc.Description = "Deposit to ordering of books";
//Add a payment that is made for this deposit
dtl = doc.AddDetail();
dtl.PaymentMethod = "BANK";
dtl.PaymentAmt = 200M;
//Refund
doc.HasRefund = true;
//Assign RefundDocNo if not using running number
//doc.RefundDocNo = "<<New>>";
doc.RefundDate = new DateTime(2018, 7, 20);
refundDtl = doc.AddRefundDetail();
refundDtl.PaymentMethod = "BANK";
refundDtl.ChequeNo = "MB8294758";
refundDtl.PaymentAmount = 50M; //refund 50
try
{
doc.Save();
//Log success
BCE.Application.AppMessage.ShowMessage($"New AP Deposit '{doc.DocNo}' is created.");
}
catch (BCE.Application.AppException ex)
{
//Log error
BCE.Application.AppMessage.ShowMessage("Error when create new AP Deposit.\n" + ex.Message);
}
}
Edit
public void Edit(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.APDeposit.APDepositCommand cmd = BCE.AutoCount.ARAP.APDeposit.APDepositCommand.Create(dbSetting);
BCE.AutoCount.ARAP.APDeposit.APDeposit doc = cmd.Edit("PV-000002");
BCE.AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
if (doc == null)
{
//log unable to load "PV-000002", or not found
return;
}
doc.ClearRefundDetails();
doc.ClearDetails();
doc.DepositPaymentMethod = "DEPOSIT PAYABLE";
doc.DocDate = new DateTime(2018, 6, 25);
doc.CreditorCode = "400-X001";
doc.Attention = "Jerry";
doc.Description = "Deposit to ordering of books";
//Add a payment that is made for this deposit
dtl = doc.AddDetail();
dtl.PaymentMethod = "BANK";
dtl.PaymentAmt = 200M;
try
{
doc.Save();
//Log success
BCE.Application.AppMessage.ShowMessage($"Updated AP Deposit '{doc.DocNo}'.");
}
catch (BCE.Application.AppException ex)
{
//Log error
BCE.Application.AppMessage.ShowMessage("Error when edit AP Deposit.\n" + ex.Message);
}
}
Edit AP Deposit with Refund
public void EditWithRefund(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.APDeposit.APDepositCommand cmd = BCE.AutoCount.ARAP.APDeposit.APDepositCommand.Create(dbSetting);
BCE.AutoCount.ARAP.APDeposit.APDeposit doc = cmd.Edit("PV-000005");
BCE.AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
BCE.AutoCount.ARAP.APDeposit.APDepositRefundDetail refundDtl = null;
if (doc == null)
{
//log unable to load "PV-000005", or not found
return;
}
doc.ClearRefundDetails();
doc.ClearDetails();
//Refund
doc.HasRefund = false;
//Assign RefundDocNo if not using running number
//doc.RefundDocNo = "<<New>>";
//doc.RefundDate = new DateTime(2018, 7, 20);
//refundDtl = doc.AddRefundDetail();
//refundDtl.PaymentMethod = "BANK";
//refundDtl.ChequeNo = "MB8294758";
//refundDtl.PaymentAmount = 50M; //refund 50
doc.DepositPaymentMethod = "DEPOSIT RECEIVED";
doc.DocDate = new DateTime(2018, 6, 25);
doc.CreditorCode = "400-X001";
doc.Attention = "Jerry";
doc.Description = "Deposit to ordering of books";
//Add a payment that is made for this deposit
dtl = doc.AddDetail();
dtl.PaymentMethod = "BANK";
dtl.PaymentAmt = 200M;
try
{
doc.Save();
//Log success
BCE.Application.AppMessage.ShowMessage($"Updated AP Deposit '{doc.DocNo}'.");
}
catch (BCE.Application.AppException ex)
{
//Log error
BCE.Application.AppMessage.ShowMessage("Error when edit AP Deposit.\n" + ex.Message);
}
}
Cancel (Void)
public void Cancel(BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
string docNo = "PV-00002";
BCE.AutoCount.ARAP.APDeposit.APDepositCommand cmd = BCE.AutoCount.ARAP.APDeposit.APDepositCommand.Create(dbSetting);
try
{
cmd.CancelDocument(docNo, userId);
//Log success
BCE.Application.AppMessage.ShowMessage($"AP Deposit '{docNo}' is cancelled.");
}
catch (BCE.Application.AppException ex)
{
//Log error
BCE.Application.AppMessage.ShowMessage("Error when cancel AP Deposit.\n" + ex.Message);
}
}
Delete
- The Delete method does not provide parameter of DocNo
- Function GetAPDepositDocKey is to Convert AP Deposit DocNo to DocKey
public void Delete(BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
string docNo = "PV-00002";
BCE.AutoCount.ARAP.APDeposit.APDepositCommand cmd = BCE.AutoCount.ARAP.APDeposit.APDepositCommand.Create(dbSetting);
try
{
long? docKey = GetAPDepositDocKey(docNo, dbSetting);
if (docKey.HasValue)
{
//AP Deposit only provide parameter of DocKey in Delete Command
cmd.Delete(docKey.Value);
//Log success
BCE.Application.AppMessage.ShowMessage($"AP Deposit '{docNo}' is deleted.");
}
else
{
//Log unable to locate docNo
BCE.Application.AppMessage.ShowMessage($"AP Deposit '{docNo}' is not a valid document no.");
}
}
catch (BCE.Application.AppException ex)
{
//Log error
BCE.Application.AppMessage.ShowMessage("Error when deleting AP Deposit.\n" + ex.Message);
}
}
Convert AP Deposit DocNo to DocKey
public long? GetAPDepositDocKey(string docNo, BCE.Data.DBSetting dbSetting)
{
object oDocKey = dbSetting.ExecuteScalar("SELECT DocKey FROM APDeposit WHERE DocNo=?", docNo);
return oDocKey == null ? default(long?) : BCE.Data.Convert.ToInt64(oDocKey);
}
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
|