AP Deposit API: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1:
==Technical Specification==
#'''Forfeit Account''' can be predefined under Tools | Options > G/L | Default Accounts
#Deposit Account (Deposit Payment Method) is a Payment Method that is maintained in '''G/L | Account Maintenance''' & '''General Maintenance | Payment Method Maintenance'''.
#:[[AR Deposit#Method_to_check_the_validity_of_.28Deposit.29_Payment_Method|Method to check the validity of Deposit Payment Method]]
#'''Forfeit Account''' can be predefined under Tools | Options > G/L | Default Accounts
 
==Assemblies version 1.8, 1.9==
Line 46:
 
====New AP Deposit with Refund====
<syntaxhighlight lang="csharp" highlight="19-2627">
public void NewWithRefund(BCE.Data.DBSetting dbSetting)
{
Line 94:
{
BCE.AutoCount.ARAP.APDeposit.APDepositCommand cmd = BCE.AutoCount.ARAP.APDeposit.APDepositCommand.Create(dbSetting);
BCE.AutoCount.ARAP.APDeposit.APDeposit doc = cmd.Edit("PV-00002000002");
BCE.AutoCount.ARAP.APDeposit.APDepositDetail dtl = null;
 
if (doc == null)
{
//log unable to load "PV-00002000002", or not found
return;
}
Line 105:
doc.ClearRefundDetails();
doc.ClearDetails();
 
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);
}
}
</syntaxhighlight>
====Edit AP Deposit with Refund====
<syntaxhighlight lang="csharp">
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";