AP Deposit API v2
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
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 New(AutoCount.Authentication.UserSession userSession)
{
AutoCount.ARAP.APDeposit.APDepositCommand cmd =
AutoCount.ARAP.APDeposit.APDepositCommand.Create(userSession, userSession.DBSetting);
AutoCount.ARAP.APDeposit.APDeposit doc = cmd.AddNew();
AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
//Deposit Account
doc.DepositPaymentMethod = "DEPOSIT PAYABLE";
doc.DocDate = new DateTime(2018, 6, 26);
//doc.DocNo = "<<New>>";
doc.CreditorCode = "400-X001";
doc.Description = "AP Deposit";
doc.Attention = "Ken";
//Add payment that is made for this deposit
dtl = doc.AddDetail();
dtl.PaymentMethod = "BANK";
dtl.PaymentAmt = 200M;
try
{
doc.Save();
//Log success
AutoCount.AppMessage.ShowMessage($"New AP Deposit '{doc.DocNo}' is created.");
}
catch (AutoCount.AppException ex)
{
AutoCount.AppMessage.ShowMessage("Error when create new AP Deposit.\n" + ex.Message);
}
}
New AP Deposit with Refund
public void NewWithRefund(AutoCount.Authentication.UserSession userSession)
{
AutoCount.ARAP.APDeposit.APDepositCommand cmd =
AutoCount.ARAP.APDeposit.APDepositCommand.Create(userSession, userSession.DBSetting);
AutoCount.ARAP.APDeposit.APDeposit doc = cmd.AddNew();
AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
AutoCount.ARAP.APDeposit.APDepositRefund refund = null;
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
refund = doc.AddRefund();
refund.DocDate = new DateTime(2018, 6, 25);
refund.Description = "Refund received from Jerry";
refundDtl = refund.AddRefundDetail();
refundDtl.PaymentMethod = "CASH";
refundDtl.PaymentAmount = 50.00M;
try
{
doc.Save();
//Log success
AutoCount.AppMessage.ShowMessage($"New AP Deposit '{doc.DocNo}' is created.");
}
catch (AutoCount.AppException ex)
{
//Log error
AutoCount.AppMessage.ShowMessage("Error when create new AP Deposit.\n" + ex.Message);
}
}
Edit
public void Edit(AutoCount.Authentication.UserSession userSession)
{
string docNo = "PV-000001";
AutoCount.ARAP.APDeposit.APDepositCommand cmd =
AutoCount.ARAP.APDeposit.APDepositCommand.Create(userSession, userSession.DBSetting);
AutoCount.ARAP.APDeposit.APDeposit doc = cmd.Edit(docNo);
AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
if (doc == null)
{
//Log PV-000001 not found
return;
}
doc.ClearRefundDetails();
doc.ClearDetails();
doc.DocDate = new DateTime(2018, 6, 26);
doc.Description = "AP Deposit";
doc.Attention = "Ken";
//Add payment that is made for this deposit
dtl = doc.AddDetail();
dtl.PaymentMethod = "BANK";
dtl.PaymentAmt = 200M;
try
{
doc.Save();
//Log success
AutoCount.AppMessage.ShowMessage($"Edit AP Deposit '{doc.DocNo}' is updated.");
}
catch (AutoCount.AppException ex)
{
AutoCount.AppMessage.ShowMessage($"Error edit AP Deposit {docNo}.\n" + ex.Message);
}
}
Cancel (Void)
public void Cancel(AutoCount.Authentication.UserSession userSession)
{
string docNo = "PV-000001";
AutoCount.ARAP.APDeposit.APDepositCommand cmd =
AutoCount.ARAP.APDeposit.APDepositCommand.Create(userSession, userSession.DBSetting);
try
{
cmd.CancelDocument(docNo);
//Log success
AutoCount.AppMessage.ShowMessage($"AP Deposit {docNo} is cancelled.");
}
catch (AutoCount.AppException ex)
{
AutoCount.AppMessage.ShowMessage($"Fail to cancel AP Deposit {docNo}.\n" + ex.Message);
}
}
Uncancel (Void)
public void UnCancel(AutoCount.Authentication.UserSession userSession)
{
string docNo = "PV-000001";
AutoCount.ARAP.APDeposit.APDepositCommand cmd =
AutoCount.ARAP.APDeposit.APDepositCommand.Create(userSession, userSession.DBSetting);
try
{
cmd.UncancelDocument(docNo);
//Log success
AutoCount.AppMessage.ShowMessage($"AP Deposit {docNo} is uncancelled.");
}
catch (AutoCount.AppException ex)
{
AutoCount.AppMessage.ShowMessage($"Fail to uncancel AP Deposit {docNo}.\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(AutoCount.Authentication.UserSession userSession)
{
string docNo = "PV-000001";
AutoCount.ARAP.APDeposit.APDepositCommand cmd =
AutoCount.ARAP.APDeposit.APDepositCommand.Create(userSession, userSession.DBSetting);
try
{
long? docKey = GetAPDepositDocKey(docNo, userSession.DBSetting);
if (docKey.HasValue)
{
//AP Deposit only provide parameter of DocKey in Delete Command
cmd.Delete(docKey.Value);
//Log success
AutoCount.AppMessage.ShowMessage($"AP Deposit '{docNo}' is deleted.");
}
else
{
//Log unable to locate docNo
AutoCount.AppMessage.ShowMessage($"AP Deposit '{docNo}' is not a valid document no.");
}
}
catch (AutoCount.AppException ex)
{
AutoCount.AppMessage.ShowMessage($"Fail to delete AP Deposit {docNo}.\n" + ex.Message);
}
}
Convert AP Deposit DocNo to DocKey
public long? GetAPDepositDocKey(string docNo, AutoCount.Data.DBSetting dbSetting)
{
object oDocKey = dbSetting.ExecuteScalar("SELECT DocKey FROM APDeposit WHERE DocNo=?", docNo);
return oDocKey == null ? default(long?) : AutoCount.Converter.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
|