AR Deposit: Difference between revisions

2,875 bytes added ,  5 years ago
no edit summary
No edit summary
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1:
==Technical Specification==
{{NavigateDeveloper}}
# '''Deposit Payment Method''' must be a payment method that is created as type of "Deposit" Account in '''GL''' | '''Account Maintenance'''.
===Rules in AR Deposit===
 
 
===Assemblies version 1.8===
<pre>
BCE.AutoCount.ARAP.dll
</pre>
 
<br />
==Assemblies version 1.8, 1.9==
{{BaseReferenceAC18}}
'''BCE.AutoCount.ARAP.dll'''
<br />
==Sample with data model==
===Create new AR Deposit===
<syntaxhighlight lang="csharp">
Line 15:
BCE.AutoCount.ARAP.ARDeposit.ARDeposit doc = cmd.AddNew();
 
if (IsValidDepositMethod(source.DepositMethod, dbSetting))
doc.DocNo = source.DocumentNo;
{
doc.DepositPaymentMethod = source.DepositMethod;
}
else
{
BCE.Application.AppMessage.ShowErrorMessage(string.Format("Invalid Deposit Payment Method of \"{0}\"", source.DepositMethod));
//log error on Deposit Payment Method error
return;
}
 
doc.DocNo = source.DocumentNo ?? doc.DocNo;
doc.DocDate = source.DocumentDate;
doc.Description = source.Description ?? doc.Description;
doc.DepositPaymentMethodCurrencyCode = source.DepositMethodCurrencyCode ?? doc.CurrencyCode;
doc.CurrencyCode = source.CurrencyCode;
doc.DebtorCode = source.CustomerAccount;
doc.DebtorName = source.CustomerName;
Line 28 ⟶ 38:
doc.DeptNo = source.Department;
 
source.DetailPaymentDetail.ForEach(s => AddARDepositDetail(s, doc.AddDetail));
 
try
Line 34 ⟶ 44:
doc.Save();
BCE.Application.AppMessage.ShowMessage(string.Format("{0} is Created.", doc.DocNo));
//Log Success created
}
catch (BCE.Application.AppException ex)
{
BCE.Application.AppMessage.ShowErrorMessage(ex.Message);
//Log Error saving
}
}
Line 65 ⟶ 77:
</syntaxhighlight>
 
====Method to check the validity of (Deposit) Payment Method====
===Classes of Source===
<syntaxhighlight lang="csharp">
private bool IsValidDepositMethod(string depositMethod, BCE.Data.DBSetting dbSetting)
{
return GetDepositPaymentMethod(dbSetting).AsEnumerable()
.Count(r => r.Field<string>("PaymentMethod") == depositMethod) > 0;
}
</syntaxhighlight>
 
====Get Deposit Payment Method Table with AutoCount Lookup Edit Builder====
 
<syntaxhighlight lang="csharp">
private DataTable GetDepositPaymentMethod(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder depositBuilder =
new BCE.AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder();
 
//The return table contains of 3 columns: (1) PaymentMethod, (2) BankAccount, (3) CurrencyCode (in version 1.8.28.184)
return depositBuilder.BuildDataTable(dbSetting);
}
</syntaxhighlight>
 
===Classes of Source (data model)===
<syntaxhighlight lang="csharp">
public class ARDepositSource
Line 73 ⟶ 107:
public string Description { get; set; }
public string DepositMethod { get; set; }
 
/// <summary>
/// Currency Code that is used to pay the deposit
/// </summary>
public string CurrencyCode { get; set; }
public string CustomerAccount { get; set; }
Line 84 ⟶ 117:
public string Project { get; set; }
public string Department { get; set; }
 
/// <summary>
/// IsSecurityDeposit is to decide whether this deposit is subject to GST
//true: not subject to GST and is meant to be refund
/// </summary>
//false: subject to GST and is considered as "Advance Payment"
public bool IsSecurityDeposit { get; set; }
 
public List<ARDepositDetailSource> DetailPaymentDetail = new List<ARDepositDetailSource>();
}
 
Line 101 ⟶ 135:
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; }
}
</syntaxhighlight>
 
===Implementation===
* Deposit without Debtor Code
[[File:ProgrammerNewARDeposit1.PNG|link=]]<br />
* Deposit with Debtor Code
[[File:ProgrammerNewARDeposit2.PNG|link=]]
<syntaxhighlight lang="csharp">
public void MainEntry(BCE.Data.DBSetting dbSetting)
{
//Example of deposit without DebtorCode defined
ARDepositSource newDoc = new ARDepositSource()
{
//DEPOSIT RECEIVED must be a Payment Method created for Deposit Account
DepositMethod = "DEPOSIT RECEIVED",
Description = "DEPOSIT",
DocumentDate = new DateTime(2017, 11, 25)
};
 
newDoc.PaymentDetail.Add(new ARDepositDetailSource()
==See Also==
{
* [[AR Debtor]]
PaymentMethod = "BANK",
* [[AR Invoice]]
ChequeNo = "CHQ00010",
* [[AR Received Payment]]
PaymentBy = "CHEQUE",
* [[AR Debit Note]]
DepositAmount = 500
* [[AR Credit Note]]
});
* [[AR Refund]]
 
* [[AR Deposit]]
NewARDeposit(newDoc, dbSetting);
 
//Example of deposit with Debtor Code
newDoc = new ARDepositSource()
{
//DEPOSIT RECEIVED must be a Payment Method created for Deposit Account
DepositMethod = "DEPOSIT RECEIVED",
CustomerAccount = "300-A001",
Description = "DEPOSIT",
DocumentDate = new DateTime(2017, 11, 26),
Attention = "MR.Tan"
};
 
newDoc.PaymentDetail.Add(new ARDepositDetailSource()
{
PaymentMethod = "BANK",
ChequeNo = "CHQ00010",
PaymentBy = "CHEQUE",
DepositAmount = 800
});
 
NewARDeposit(newDoc, dbSetting);
}
</syntaxhighlight>
 
{{SeeAlsoAPIAccount}}
[[Category:Programmer]]
[[Category:API]]
[[Category:Integrate]]
[[Category:Plug-In]]
{{NavigateDeveloper}}