2,743
edits
No edit summary |
No edit summary |
||
(17 intermediate revisions by the same user not shown) | |||
Line 1:
==Technical Specification==
# '''Deposit Payment Method''' must be a payment method that is created as type of "Deposit" Account in '''GL''' | '''Account Maintenance'''.
<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.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.
doc.DebtorCode = source.CustomerAccount;
doc.DebtorName = source.CustomerName;
Line 28 ⟶ 38:
doc.DeptNo = source.Department;
source.
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====
<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; }
//
public string CurrencyCode { get; set; }
public string CustomerAccount { get; set; }
Line 84 ⟶ 117:
public string Project { get; set; }
public string Department { get; set; }
//
//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>
}
Line 101 ⟶ 135:
public string BankChargeBillNoForGst { get; set; }
public string PaymentBy { get; set; }
//
//
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()
{
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);
}
</syntaxhighlight>
{{SeeAlsoAPIAccount}}
[[Category:Programmer]]
[[Category:API]]
[[Category:Integrate]]
[[Category:Plug-In]]
{{NavigateDeveloper}}
|