AP Deposit API: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1:
==Technical Specification==
#Deposit Account (Deposit Payment Method) is mandatory field
#'''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 20 ⟶ 21:
//must check the Deposit setting in General Maintenance > Payment Method Maintenance,
//to get correct value
doc.DepositPaymentMethod = "DEPOSIT RECEIVEDPAYABLE";
doc.DocDate = new DateTime(2018, 6, 25);
doc.CreditorCode = "400-X001";
Line 46 ⟶ 47:
 
====New AP Deposit with Refund====
<syntaxhighlight lang="csharp" highlight="19-2627">
public void NewWithRefund(BCE.Data.DBSetting dbSetting)
{
Line 54 ⟶ 55:
BCE.AutoCount.ARAP.APDeposit.APDepositRefundDetail refundDtl = null;
 
doc.DepositPaymentMethod = "DEPOSIT RECEIVEDPAYABLE";
doc.DocDate = new DateTime(2018, 6, 25);
doc.CreditorCode = "400-X001";
Line 94 ⟶ 95:
{
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 ⟶ 106:
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);
}
}
</syntaxhighlight lang="csharp">
====Edit AP Deposit with Refund====
<syntaxhighlight lang="csharp" highlight="17-18">
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";
Line 154 ⟶ 207:
 
===Delete===
*The '''Delete''' method does not provide parameter of '''DocNo'''
<syntaxhighlight lang="csharp">
*:Function '''GetAPDepositDocKey''' is to [[AP_Deposit_API#Convert_AP_Deposit_DocNo_to_DocKey|Convert AP Deposit DocNo to '''DocKey''']]
<syntaxhighlight lang="csharp" highlight="9">
public void Delete(BCE.Data.DBSetting dbSetting)
{
Line 169 ⟶ 224:
cmd.Delete(docKey.Value);
//Log success
BCE.Application.AppMessage.ShowMessage($"AP Deposit '{docNo}' is cancelleddeleted.");
}
else
{
//Log unable to locate docNo
BCE.Application.AppMessage.ShowMessage($"AP Deposit '{docNo}' is not a valid document no.");
}
}
Line 175 ⟶ 235:
{
//Log error
BCE.Application.AppMessage.ShowMessage("Error when canceldeleting AP Deposit.\n" + ex.Message);
}
}