AR Debtor: Difference between revisions

2,547 bytes added ,  4 years ago
no edit summary
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 6:
{{BaseReferenceAC18}}
'''BCE.AutoCount.ARAP.dll'''
 
==Load Data with API==
===Single Record===
Load one debtor by specifying the DebtorCode (AccNo).
<syntaxhighlight lang="csharp">
public void ExampleOfSingleDebtorRecord(string accNo, BCE.Data.DBSetting dbset)
{
BCE.AutoCount.Data.DebtorRecord debtorRec = BCE.AutoCount.Data.CommonRecordUtils.GetDebtor(dbset, accNo);
if (debtorRec != null)
{
string companyName = debtorRec.CompanyName;
string addr1 = debtorRec.Address1;
string addr2 = debtorRec.Address2;
string addr3 = debtorRec.Address3;
string addr4 = debtorRec.Address4;
string attention = debtorRec.Attention;
string phone = debtorRec.Phone1;
decimal creditLimit = debtorRec.CreditLimit;
decimal overdueLimit = debtorRec.OverdueLimit;
}
}
</syntaxhighlight>
 
===Multiple Records with Filter===
Load more than one debtor.<br/>
Programmer can specify which columns to load, while defining the filter of which debtor to be loaded.<br/>
This example shows how to load debtor that was modified since a specific date.<br/>
<syntaxhighlight lang="csharp">
public System.Data.DataTable GetModifiedDebtorData(DateTime filterFromDate, BCE.Data.DBSetting dbset)
{
//Create a DataAccess object of Debtor
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd =
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbset);
 
//Create debtor data loading criteria
BCE.AutoCount.SearchFilter.SearchCriteria loadDebtorCriteria =
new BCE.AutoCount.SearchFilter.SearchCriteria();
 
//SearchCriteria requires a SearchFilter
//Create the SearchFilter by Range
BCE.AutoCount.SearchFilter.Filter filterLastModified =
new BCE.AutoCount.SearchFilter.Filter("a", "LastModified");
filterLastModified.Type = BCE.AutoCount.SearchFilter.FilterType.ByRange;
 
//When .To is not define, the filter is from the lastModifiedDate onwards
filterLastModified.From = filterFromDate;
//When a range of date that requires "to date", assign .To to implement from...to.
//filterLastModified.To = new DateTime(2018, 12, 31);
 
//Add the Filter to Criteria
//Can support more than one filter
loadDebtorCriteria.AddFilter(filterLastModified);
 
//fields to be loaded into DataTable
string[] columns = { "AccNo", "CompanyName", "Address1", "Address2",
"DeliverAddr1", "DeliverAddr2", "Attention", "Phone1", "AreaCode", "SalesAgent", "EmailAddress", "CreditLimit", "LastModified"};
 
return cmd.LoadDebtorData(columns, loadDebtorCriteria);
}
</syntaxhighlight>
 
==API Usage==