AR Debtor: Difference between revisions
Content added Content deleted
mNo edit summary |
No edit summary |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Technical Specification== |
|||
===References of AutoCount Accounting version 1.8=== |
|||
# Edit and amend '''AccNo''' is not allowed |
|||
# Deletion is not allowed, when '''AccNo''' has been referred. |
|||
==References of AutoCount Accounting version 1.8, 1.9== |
|||
{{BaseReferenceAC18}} |
{{BaseReferenceAC18}} |
||
'''BCE.AutoCount.ARAP.dll''' |
'''BCE.AutoCount.ARAP.dll''' |
||
== |
==Load Data with API== |
||
===Single Record=== |
|||
Load one debtor by specifying the DebtorCode (AccNo). |
|||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
public void |
public void ExampleOfSingleDebtorRecord(string accNo, BCE.Data.DBSetting dbset) |
||
{ |
{ |
||
BCE.AutoCount.Data.DebtorRecord debtorRec = BCE.AutoCount.Data.CommonRecordUtils.GetDebtor(dbset, accNo); |
|||
string newDebtorCode = GetNewDebtorCode(dbSetting, source.ControlAccount, source.CompanyName); |
|||
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== |
|||
===New=== |
|||
*When create new customer, '''ControlAccount''' and '''AccNo''' are required. |
|||
*Control Account can be determined at '''GL | Account Maintenance''', where the '''SpecialAccType''' is '''SDC''' |
|||
<syntaxhighlight lang="csharp"> |
|||
public void NewDebtor(BCE.Data.DBSetting dbSetting) |
|||
{ |
|||
string customerName = "CALIFORNIA SB"; |
|||
//300-0000 is the default ControlAccount. |
|||
//However it is not a fixed account code, which the code can be changed by user |
|||
string newDebtorCode = GetNewDebtorCode(dbSetting, "300-0000", customerName); |
|||
if (newDebtorCode == null) |
if (newDebtorCode == null) |
||
return; |
return; |
||
Line 15: | Line 86: | ||
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.NewDebtor(); |
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.NewDebtor(); |
||
debtor.ControlAccount = |
debtor.ControlAccount = "300-0000"; |
||
debtor.AccNo = newDebtorCode; |
debtor.AccNo = newDebtorCode; |
||
debtor.CompanyName = |
debtor.CompanyName = customerName; |
||
debtor.Address1 = |
debtor.Address1 = "1, Jalan SS 1/1,"; |
||
debtor.Address2 = |
debtor.Address2 = "Taman Gembira,"; |
||
debtor.Address3 = |
debtor.Address3 = "Selangor Darah Ehsan,"; |
||
debtor.Address4 = |
debtor.Address4 = "41300 Malaysia."; |
||
debtor.Phone1 = |
debtor.Phone1 = "603-719 1992"; |
||
debtor.Phone2 = |
debtor.Phone2 = "016-221 2222"; |
||
debtor.Attention = |
debtor.Attention = "Ben"; |
||
debtor.EmailAddress = |
debtor.EmailAddress = "ben@calimail.com"; |
||
debtor.CurrencyCode = AccountBookLocalCurrency(dbSetting); |
debtor.CurrencyCode = AccountBookLocalCurrency(dbSetting); |
||
Line 31: | Line 102: | ||
{ |
{ |
||
cmd.SaveDebtor(debtor, userId); |
cmd.SaveDebtor(debtor, userId); |
||
BCE.Application.AppMessage.ShowMessage(string.Format("New customer code '{0}' is added.", newDebtorCode)); |
|||
//Log Success |
|||
} |
} |
||
catch (BCE.Application.AppException ex) |
catch (BCE.Application.AppException ex) |
||
{ |
{ |
||
//Log fail |
//Log fail |
||
BCE.Application.AppMessage.ShowMessage( |
|||
string.Format("Fail to create customer '{0}'.\n{1}", customerName, ex.Message)); |
|||
} |
} |
||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== |
===Edit/Update=== |
||
*Amend the profile of a customer. |
|||
*Changing of customer's '''AccNo''' is '''not allowed''' |
|||
<syntaxhighlight lang="csharp"> |
|||
public void EditDebtor(string debtorCode, BCE.Data.DBSetting dbSetting) |
|||
{ |
|||
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID; |
|||
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting); |
|||
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.GetDebtor(debtorCode); |
|||
//debtor is null, when debtorCode is not found |
|||
if (debtor == null) |
|||
return; |
|||
debtor.CompanyName = "CALIFORNIA SB"; |
|||
debtor.Address1 = "1, Jalan SS 1/1,"; |
|||
debtor.Address2 = "Taman Gembira,"; |
|||
debtor.Address3 = "Selangor Darah Ehsan,"; |
|||
debtor.Address4 = "41300 Malaysia."; |
|||
debtor.Phone1 = "603-719 1992"; |
|||
debtor.Phone2 = "016-221 2222"; |
|||
debtor.Attention = "Ben"; |
|||
debtor.EmailAddress = "ben@calimail.com"; |
|||
debtor.CurrencyCode = AccountBookLocalCurrency(dbSetting); |
|||
try |
|||
{ |
|||
cmd.SaveDebtor(debtor, userId); |
|||
BCE.Application.AppMessage.ShowMessage(string.Format("Customer '{0}' has been updated.", debtor.AccNo)); |
|||
} |
|||
catch (BCE.Application.AppException ex) |
|||
{ |
|||
//Log fail |
|||
BCE.Application.AppMessage.ShowMessage( |
|||
string.Format("Fail to update customer '{0}'.\n{1}", debtor.CompanyName, ex.Message)); |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
====Inactive==== |
|||
*Customer whom has been set to '''Inactive''' will not appear in customer selection of new transaction. |
|||
<syntaxhighlight lang="csharp"> |
|||
public void SetCustomerToInactive(string debtorCode, BCE.Data.DBSetting dbSetting) |
|||
{ |
|||
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID; |
|||
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting); |
|||
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.GetDebtor(debtorCode); |
|||
debtor.IsActive = false; |
|||
try |
|||
{ |
|||
cmd.SaveDebtor(debtor, userId); |
|||
BCE.Application.AppMessage.ShowMessage(string.Format("Customer '{0}' is now Inactive.", debtor.AccNo)); |
|||
} |
|||
catch (BCE.Application.AppException ex) |
|||
{ |
|||
//Log fail |
|||
BCE.Application.AppMessage.ShowMessage( |
|||
string.Format("Fail to update customer '{0}'.\n{1}", debtor.CompanyName, ex.Message)); |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
===Delete=== |
|||
*Customer can only be deleted when the customer is not being referred in transaction and document. |
|||
*If the customer is not allowed to be deleted, set the customer status to '''Inactive'''. |
|||
<syntaxhighlight lang="csharp"> |
|||
public void DeleteDebtor(string debtorCode, BCE.Data.DBSetting dbSetting) |
|||
{ |
|||
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting); |
|||
try |
|||
{ |
|||
cmd.DeleteDebtor(debtorCode); |
|||
BCE.Application.AppMessage.ShowMessage(string.Format("Customer code '{0}' is deleted.", debtorCode)); |
|||
} |
|||
catch (BCE.Application.AppException ex) |
|||
{ |
|||
//Log fail |
|||
BCE.Application.AppMessage.ShowMessage( |
|||
string.Format("Fail to delete customer code '{0}'", debtorCode)); |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
<br /><br /> |
|||
==Auto Generate New Debtor Code== |
|||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
public string GetNewDebtorCode(BCE.Data.DBSetting dbSetting, string controlAccNo, string companyName) |
public string GetNewDebtorCode(BCE.Data.DBSetting dbSetting, string controlAccNo, string companyName) |
||
Line 62: | Line 222: | ||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
<br /> |
|||
==Get Local Currency Code== |
|||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
public string AccountBookLocalCurrency(BCE.Data.DBSetting dbSetting) |
public string AccountBookLocalCurrency(BCE.Data.DBSetting dbSetting) |
||
{ |
{ |
||
return BCE.Data.DBRegistry.Create(dbSetting).GetString(new BCE.AutoCount.RegistryID.LocalCurrencyCode()); |
return BCE.Data.DBRegistry.Create(dbSetting).GetString(new BCE.AutoCount.RegistryID.LocalCurrencyCode()); |
||
} |
|||
</syntaxhighlight> |
|||
<br /><br /> |
|||
==Sample with Data Model== |
|||
===Create new AR Debtor=== |
|||
<syntaxhighlight lang="csharp"> |
|||
public void CreateNewDebtor(BCE.Data.DBSetting dbSetting, DebtorSource source) |
|||
{ |
|||
string newDebtorCode = GetNewDebtorCode(dbSetting, source.ControlAccount, source.CompanyName); |
|||
if (newDebtorCode == null) |
|||
return; |
|||
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID; |
|||
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting); |
|||
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.NewDebtor(); |
|||
debtor.ControlAccount = source.ControlAccount; |
|||
debtor.AccNo = newDebtorCode; |
|||
debtor.CompanyName = source.CompanyName; |
|||
debtor.Address1 = source.Addr1; |
|||
debtor.Address2 = source.Addr2; |
|||
debtor.Address3 = source.Addr3; |
|||
debtor.Address4 = source.Addr4; |
|||
debtor.Phone1 = source.Phone; |
|||
debtor.Phone2 = source.Mobile; |
|||
debtor.Attention = source.ContactPerson; |
|||
debtor.EmailAddress = source.Email; |
|||
debtor.CurrencyCode = AccountBookLocalCurrency(dbSetting); |
|||
try |
|||
{ |
|||
cmd.SaveDebtor(debtor, userId); |
|||
//Log Success |
|||
} |
|||
catch (BCE.Application.AppException ex) |
|||
{ |
|||
//Log fail |
|||
} |
|||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Line 91: | Line 290: | ||
===Implementation=== |
===Implementation=== |
||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
public |
public void Implementation(BCE.Data.DBSetting dbSetting) |
||
{ |
{ |
||
DebtorSource newDebtor = new DebtorSource() |
DebtorSource newDebtor = new DebtorSource() |
||
Line 111: | Line 310: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{SeeAlsoAPIAccount}} |
|||
{{SeeAlsoAccount}} |
|||
[[Category:Programmer]] |
[[Category:Programmer]] |
||
[[Category:API]] |
[[Category:API]] |
Latest revision as of 04:05, 15 July 2019
Technical Specification
- Edit and amend AccNo is not allowed
- Deletion is not allowed, when AccNo has been referred.
References of AutoCount Accounting 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
Load Data with API
Single Record
Load one debtor by specifying the DebtorCode (AccNo).
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;
}
}
Multiple Records with Filter
Load more than one debtor.
Programmer can specify which columns to load, while defining the filter of which debtor to be loaded.
This example shows how to load debtor that was modified since a specific date.
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);
}
API Usage
New
- When create new customer, ControlAccount and AccNo are required.
- Control Account can be determined at GL | Account Maintenance, where the SpecialAccType is SDC
public void NewDebtor(BCE.Data.DBSetting dbSetting)
{
string customerName = "CALIFORNIA SB";
//300-0000 is the default ControlAccount.
//However it is not a fixed account code, which the code can be changed by user
string newDebtorCode = GetNewDebtorCode(dbSetting, "300-0000", customerName);
if (newDebtorCode == null)
return;
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.NewDebtor();
debtor.ControlAccount = "300-0000";
debtor.AccNo = newDebtorCode;
debtor.CompanyName = customerName;
debtor.Address1 = "1, Jalan SS 1/1,";
debtor.Address2 = "Taman Gembira,";
debtor.Address3 = "Selangor Darah Ehsan,";
debtor.Address4 = "41300 Malaysia.";
debtor.Phone1 = "603-719 1992";
debtor.Phone2 = "016-221 2222";
debtor.Attention = "Ben";
debtor.EmailAddress = "ben@calimail.com";
debtor.CurrencyCode = AccountBookLocalCurrency(dbSetting);
try
{
cmd.SaveDebtor(debtor, userId);
BCE.Application.AppMessage.ShowMessage(string.Format("New customer code '{0}' is added.", newDebtorCode));
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage(
string.Format("Fail to create customer '{0}'.\n{1}", customerName, ex.Message));
}
}
Edit/Update
- Amend the profile of a customer.
- Changing of customer's AccNo is not allowed
public void EditDebtor(string debtorCode, BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.GetDebtor(debtorCode);
//debtor is null, when debtorCode is not found
if (debtor == null)
return;
debtor.CompanyName = "CALIFORNIA SB";
debtor.Address1 = "1, Jalan SS 1/1,";
debtor.Address2 = "Taman Gembira,";
debtor.Address3 = "Selangor Darah Ehsan,";
debtor.Address4 = "41300 Malaysia.";
debtor.Phone1 = "603-719 1992";
debtor.Phone2 = "016-221 2222";
debtor.Attention = "Ben";
debtor.EmailAddress = "ben@calimail.com";
debtor.CurrencyCode = AccountBookLocalCurrency(dbSetting);
try
{
cmd.SaveDebtor(debtor, userId);
BCE.Application.AppMessage.ShowMessage(string.Format("Customer '{0}' has been updated.", debtor.AccNo));
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage(
string.Format("Fail to update customer '{0}'.\n{1}", debtor.CompanyName, ex.Message));
}
}
Inactive
- Customer whom has been set to Inactive will not appear in customer selection of new transaction.
public void SetCustomerToInactive(string debtorCode, BCE.Data.DBSetting dbSetting)
{
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.GetDebtor(debtorCode);
debtor.IsActive = false;
try
{
cmd.SaveDebtor(debtor, userId);
BCE.Application.AppMessage.ShowMessage(string.Format("Customer '{0}' is now Inactive.", debtor.AccNo));
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage(
string.Format("Fail to update customer '{0}'.\n{1}", debtor.CompanyName, ex.Message));
}
}
Delete
- Customer can only be deleted when the customer is not being referred in transaction and document.
- If the customer is not allowed to be deleted, set the customer status to Inactive.
public void DeleteDebtor(string debtorCode, BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting);
try
{
cmd.DeleteDebtor(debtorCode);
BCE.Application.AppMessage.ShowMessage(string.Format("Customer code '{0}' is deleted.", debtorCode));
}
catch (BCE.Application.AppException ex)
{
//Log fail
BCE.Application.AppMessage.ShowMessage(
string.Format("Fail to delete customer code '{0}'", debtorCode));
}
}
Auto Generate New Debtor Code
public string GetNewDebtorCode(BCE.Data.DBSetting dbSetting, string controlAccNo, string companyName)
{
try
{
return BCE.AutoCount.Common.AccountCodeHelper.Create(dbSetting)
.GetNextDebtorCode(controlAccNo, companyName);
}
catch (BCE.AutoCount.Common.InvalidAutoDebtorCodeFormatException ex)
{
//Log error ex.Message;
}
catch (BCE.Data.DataAccessException ex)
{
//Log error ex.Message;
}
//If the catch throw out exception, then return null is not necessary.
return null;
}
Get Local Currency Code
public string AccountBookLocalCurrency(BCE.Data.DBSetting dbSetting)
{
return BCE.Data.DBRegistry.Create(dbSetting).GetString(new BCE.AutoCount.RegistryID.LocalCurrencyCode());
}
Sample with Data Model
Create new AR Debtor
public void CreateNewDebtor(BCE.Data.DBSetting dbSetting, DebtorSource source)
{
string newDebtorCode = GetNewDebtorCode(dbSetting, source.ControlAccount, source.CompanyName);
if (newDebtorCode == null)
return;
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess cmd = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = cmd.NewDebtor();
debtor.ControlAccount = source.ControlAccount;
debtor.AccNo = newDebtorCode;
debtor.CompanyName = source.CompanyName;
debtor.Address1 = source.Addr1;
debtor.Address2 = source.Addr2;
debtor.Address3 = source.Addr3;
debtor.Address4 = source.Addr4;
debtor.Phone1 = source.Phone;
debtor.Phone2 = source.Mobile;
debtor.Attention = source.ContactPerson;
debtor.EmailAddress = source.Email;
debtor.CurrencyCode = AccountBookLocalCurrency(dbSetting);
try
{
cmd.SaveDebtor(debtor, userId);
//Log Success
}
catch (BCE.Application.AppException ex)
{
//Log fail
}
}
Class of source data
public class DebtorSource
{
public string ControlAccount { get; set; }
public string DebtorCode { get; set; }
public string CompanyName { get; set; }
public string Addr1 { get; set; }
public string Addr2 { get; set; }
public string Addr3 { get; set; }
public string Addr4 { get; set; }
public string Phone { get; set; }
public string Mobile { get; set; }
public string ContactPerson { get; set; }
public string Email { get; set; }
}
Implementation
public void Implementation(BCE.Data.DBSetting dbSetting)
{
DebtorSource newDebtor = new DebtorSource()
{
ControlAccount = "300-0000",
CompanyName = "CALIFORNIA SB",
Addr1 = "1, Jalan SS 1/1,",
Addr2 = "Taman Gembira,",
Addr3 = "Selangor Darah Ehsan,",
Addr4 = "41300 Malaysia.",
Phone = "603-719 1992",
Mobile = "016-221 2222",
ContactPerson = "Ben",
Email = "ben@calimail.com",
};
CreateNewDebtor(dbSetting, newDebtor);
}
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
|