AR Deposit - Create New or Update with Refund & Forfeit: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 1:
==Technical Specification==
{{NavigateDeveloper}}
===Rules# inOne AR Deposit allows only one Refund, and one Payment Voucher &is Forfeit===created.
# One AR Deposit allows only one Refund, and once Payment Voucher is created.
# One AR Deposit allows only one Forfeit
# Refund created in AR Deposit will auto create GL Cash Book Payment Voucher under GL | Cash Book Entry.
<br />
 
===AssembliesReferences of AutoCount Accounting version 1.8=, 1.9==
{{BaseReferenceAC18}}
<pre>
'''BCE.AutoCount.ARAP.dll'''
<br /pre>
==Sample with data model==
 
===Add New or Edit Existing AR Deposit with Deposit Refund and Forfeit===
<syntaxhighlight lang="csharp">
Line 16 ⟶ 15:
BCE.AutoCount.ARAP.ARDeposit.ARDepositCommand cmd = BCE.AutoCount.ARAP.ARDeposit.ARDepositCommand.Create(dbSetting);
BCE.AutoCount.ARAP.ARDeposit.ARDeposit doc = null;
//Only possible to edit a document when document number is provided,
//and exist in the record
if (source.DocumentNo != null)
{
Line 26:
//Add New ARDeposit
doc = cmd.AddNew();
return UpdateARDeposit(doc, source, dbSetting);
}
else
Line 33 ⟶ 32:
doc.ClearDetails();
doc.ClearRefundDetails();
return UpdateARDeposit(doc, source, dbSetting);
}
 
return UpdateARDeposit(doc, source, dbSetting);
}
</syntaxhighlight>
Line 57:
else
{
//BCE.Application.AppMessage.ShowErrorMessage(string.Format("Invalid Deposit Payment Method of \"{0}\"", source.DepositMethod));
//log error on Deposit Payment Method error
return retDocNo;
Line 82:
if (source.Refund == null)
{
//No refund
doc.HasRefund = false;
}
Line 87 ⟶ 88:
{
doc.HasRefund = true;
if (doc.RefundDocNo != null && doc.RefundDocNo == source.Refund.DocumentNo)
{
//Do nothing when no changed in Refund Document number
//and doc.RefundDocNo is not null
}
else if (source.Refund.DocumentNo == null && doc.RefundDocNo.Length == 0)
{
//Reference to version 1.8.28.184, the RefundDocNo is empty string, instead of "<<New>>".
//To ensure that RefundDocNo is running number, set it to "<<New>>"
doc.RefundDocNo = "<<New>>";
}
else
{
//If source.Refund.DocumentNo is not null, assign source to RefundDocNo;
//Otherwise, use the existing RefundDocNo.
doc.RefundDocNo = source.Refund.DocumentNo ?? doc.RefundDocNo;
}
Line 108 ⟶ 115:
if (source.Forfeit == null)
{
//No forfeit
doc.HasForfeited = false;
doc.MasterRow["ForfeitedAmt"] = 0.00M;
Line 116 ⟶ 124:
doc.HasForfeited = true;
doc.ForFeitedAccNo = source.Forfeit.ForfeitAccNo ?? doc.ForFeitedAccNo;
//Reference to version 1.8.28.184, doc.ForfeitedAmt is read only field,
//but it is a required amount when forfeited is true.
//Therefore, in this case we have to direct update the DataRow
doc.MasterRow["ForfeitedAmt"] = source.Forfeit.ForfeitAmount;
doc.ForfeitedDate = source.Forfeit.ForfeitDate;
Line 123 ⟶ 134:
{
doc.Save();
BCE.Application.AppMessage.ShowMessage(string.Format("{0} is Created/Updated.", doc.DocNo));
retDocNo = doc.DocNo;
//BCE.Application.AppMessage.ShowMessage(string.Format("{0} is Created/Updated.", doc.DocNo));
//Log Success created
}
catch (BCE.Application.AppException ex)
{
//BCE.Application.AppMessage.ShowErrorMessage(ex.Message);
//Log Error saving
}
 
//Return null if document is not created or updated.
//If successfully saved, Document number is returned.
return retDocNo;
}
Line 201 ⟶ 214:
new BCE.AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder();
 
//The return table contains of 3 columns: (1) PaymentMethod, (2) BankAccount, (3) CurrencyCode (inReference of version 1.8.28.184)
return depositBuilder.BuildDataTable(dbSetting);
}
Line 215 ⟶ 228:
public string DepositMethod { get; set; }
 
// Currency Code that is used to pay the deposit
public string CurrencyCode { get; set; }
public string CustomerAccount { get; set; }
Line 224 ⟶ 237:
public string Project { get; set; }
public string Department { get; set; }
// IsSecurityDeposit is to decide whether this deposit is subject to GST
// true: not subject to GST anduntil this deposit is meantconvert to bepayment or payment of a refundsale
// false: subject to GST and is considered as "Advance Payment"
public bool IsSecurityDeposit { get; set; }
public ARDepositRefundSource Refund { get; set; }
Line 242 ⟶ 255:
public string BankChargeBillNoForGst { get; set; }
public string PaymentBy { get; set; }
 
/// <summary>
/// If this cheque is returned/bounced cheque
/// Set the returned/bounced date. Otherwise it is null
/// </summary>
public DateTime? ReturnChequeDate { get; set; }
}
Line 319 ⟶ 331:
DepositMethod = "DEPOSIT RECEIVED",
Description = "DEPOSIT",
//Assign an existing document number to "DocumentNo" will edit & update this deposit.
DocumentNo = docNo,
DocumentDate = new DateTime(2017, 11, 25)
Line 360 ⟶ 372:
}
</syntaxhighlight>
<br/>
 
{{SeeAlsoAPIAccount}}
==See Also==
* [[AR Debtor]]
* [[AR Invoice]]
* [[AR Received Payment]]
* [[AR Debit Note]]
* [[AR Credit Note]]
* [[AR Refund]]
* [[AR Deposit]]
* [[AR Deposit - Create New or Update with Refund & Forfeit]]
 
[[Category:Programmer]]
[[Category:API]]
[[Category:Integrate]]
[[Category:Plug-In]]
{{NavigateDeveloper}}