AR Deposit: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
(16 intermediate revisions by the same user not shown) | |||
Line 1: | 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=== |
===Create new AR Deposit=== |
||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
Line 15: | Line 15: | ||
BCE.AutoCount.ARAP.ARDeposit.ARDeposit doc = cmd.AddNew(); |
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.DocDate = source.DocumentDate; |
||
doc.Description = source.Description; |
doc.Description = source.Description ?? doc.Description; |
||
doc. |
doc.CurrencyCode = source.CurrencyCode ?? doc.CurrencyCode; |
||
doc.CurrencyCode = source.CurrencyCode; |
|||
doc.DebtorCode = source.CustomerAccount; |
doc.DebtorCode = source.CustomerAccount; |
||
doc.DebtorName = source.CustomerName; |
doc.DebtorName = source.CustomerName; |
||
Line 28: | Line 38: | ||
doc.DeptNo = source.Department; |
doc.DeptNo = source.Department; |
||
source. |
source.PaymentDetail.ForEach(s => AddARDepositDetail(s, doc.AddDetail)); |
||
try |
try |
||
Line 34: | Line 44: | ||
doc.Save(); |
doc.Save(); |
||
BCE.Application.AppMessage.ShowMessage(string.Format("{0} is Created.", doc.DocNo)); |
BCE.Application.AppMessage.ShowMessage(string.Format("{0} is Created.", doc.DocNo)); |
||
//Log Success created |
|||
} |
} |
||
catch (BCE.Application.AppException ex) |
catch (BCE.Application.AppException ex) |
||
{ |
{ |
||
BCE.Application.AppMessage.ShowErrorMessage(ex.Message); |
BCE.Application.AppMessage.ShowErrorMessage(ex.Message); |
||
//Log Error saving |
|||
} |
} |
||
} |
} |
||
Line 65: | Line 77: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== |
====Method to check the validity of (Deposit) Payment Method==== |
||
<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"> |
<syntaxhighlight lang="csharp"> |
||
Line 73: | Line 94: | ||
new BCE.AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder(); |
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); |
return depositBuilder.BuildDataTable(dbSetting); |
||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
===Classes of Source (data model)=== |
|||
===Classes of Source=== |
|||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
public class ARDepositSource |
public class ARDepositSource |
||
Line 88: | Line 107: | ||
public string Description { get; set; } |
public string Description { get; set; } |
||
public string DepositMethod { 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 CurrencyCode { get; set; } |
||
public string CustomerAccount { get; set; } |
public string CustomerAccount { get; set; } |
||
Line 99: | Line 117: | ||
public string Project { get; set; } |
public string Project { get; set; } |
||
public string Department { 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 bool IsSecurityDeposit { get; set; } |
||
public List<ARDepositDetailSource> |
public List<ARDepositDetailSource> PaymentDetail = new List<ARDepositDetailSource>(); |
||
} |
} |
||
Line 116: | Line 135: | ||
public string BankChargeBillNoForGst { get; set; } |
public string BankChargeBillNoForGst { get; set; } |
||
public string PaymentBy { 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; } |
public DateTime? ReturnChequeDate { get; set; } |
||
} |
} |
||
</syntaxhighlight> |
</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:Programmer]] |
||
[[Category:API]] |
[[Category:API]] |
||
[[Category:Integrate]] |
[[Category:Integrate]] |
||
[[Category:Plug-In]] |
[[Category:Plug-In]] |
||
{{NavigateDeveloper}} |
Latest revision as of 07:28, 26 June 2018
Technical Specification
- Deposit Payment Method must be a payment method that is created as type of "Deposit" Account in GL | Account Maintenance.
Assemblies version 1.8, 1.9
BCE.AutoCount.dll BCE.AutoCount.CommonAccounting.dll BCE.AutoCount.MainEntry.dll BCE.Utils.dll BCE.Utils.UI.dll BCE.AutoCount.ARAP.dll
Sample with data model
Create new AR Deposit
public void NewARDeposit(ARDepositSource source, BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.ARDeposit.ARDepositCommand cmd = BCE.AutoCount.ARAP.ARDeposit.ARDepositCommand.Create(dbSetting);
BCE.AutoCount.ARAP.ARDeposit.ARDeposit doc = cmd.AddNew();
if (IsValidDepositMethod(source.DepositMethod, dbSetting))
{
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.CurrencyCode = source.CurrencyCode ?? doc.CurrencyCode;
doc.DebtorCode = source.CustomerAccount;
doc.DebtorName = source.CustomerName;
doc.Attention = source.Attention;
doc.Phone1 = source.Phone;
doc.Fax1 = source.Fax;
doc.ProjNo = source.Project;
doc.DeptNo = source.Department;
source.PaymentDetail.ForEach(s => AddARDepositDetail(s, doc.AddDetail));
try
{
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
}
}
public void AddARDepositDetail(ARDepositDetailSource source , Func<BCE.AutoCount.ARAP.ARDeposit.ARDepositDetail> addDepositDetail)
{
BCE.AutoCount.ARAP.ARDeposit.ARDepositDetail dtl = addDepositDetail();
dtl.PaymentMethod = source.PaymentMethod;
dtl.ChequeNo = source.ChequeNo;
dtl.PaymentAmt = source.DepositAmount;
dtl.BankCharge = source.BankCharge;
dtl.BankChargeTaxType = source.BankChargeTaxCode;
dtl.BankChargeTaxRefNo = source.BankChargeBillNoForGst;
dtl.PaymentBy = source.PaymentBy;
//Returned Cheque
if (source.ReturnChequeDate.HasValue)
{
dtl.IsRCHQ = true;
dtl.RCHQDate = source.ReturnChequeDate.Value;
}
else
{
dtl.IsRCHQ = false;
}
}
Method to check the validity of (Deposit) Payment Method
private bool IsValidDepositMethod(string depositMethod, BCE.Data.DBSetting dbSetting)
{
return GetDepositPaymentMethod(dbSetting).AsEnumerable()
.Count(r => r.Field<string>("PaymentMethod") == depositMethod) > 0;
}
Get Deposit Payment Method Table with AutoCount Lookup Edit Builder
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);
}
Classes of Source (data model)
public class ARDepositSource
{
public string DocumentNo { get; set; }
public DateTime DocumentDate { get; set; } = DateTime.Today.Date;
public string Description { get; set; }
public string DepositMethod { get; set; }
//Currency Code that is used to pay the deposit
public string CurrencyCode { get; set; }
public string CustomerAccount { get; set; }
public string CustomerName { get; set; }
public string Attention { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
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 and is meant to be refund
//false: subject to GST and is considered as "Advance Payment"
public bool IsSecurityDeposit { get; set; }
public List<ARDepositDetailSource> PaymentDetail = new List<ARDepositDetailSource>();
}
public class ARDepositDetailSource
{
public string PaymentMethod { get; set; }
public string ChequeNo { get; set; }
public decimal DepositAmount { get; set; }
public decimal BankCharge { get; set; }
public string BankChargeTaxCode { get; set; }
public string BankChargeBillNoForGst { get; set; }
public string PaymentBy { get; set; }
//If this cheque is returned/bounced cheque
//Set the returned/bounced date. Otherwise it is null
public DateTime? ReturnChequeDate { get; set; }
}
Implementation
- Deposit without Debtor Code
- Deposit with Debtor Code
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()
{
PaymentMethod = "BANK",
ChequeNo = "CHQ00010",
PaymentBy = "CHEQUE",
DepositAmount = 500
});
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);
}
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
|