Programmer AP Creditor
References of AutoCount Accounting version 1.8
BCE.AutoCount.dll BCE.AutoCount.CommonAccounting.dll BCE.AutoCount.MainEntry.dll BCE.Utils.dll BCE.Utils.UI.dll BCE.AutoCount.ARAP.dll
Create new AP Creditor
public void CreateNewCreditor(BCE.Data.DBSetting dbSetting, CreditorSource source)
{
string newCreditorCode = GetNewCreditorCode(dbSetting, source.ControlAccount, source.CompanyName);
if (newCreditorCode == null)
return;
string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.Creditor.CreditorDataAccess cmd = BCE.AutoCount.ARAP.Creditor.CreditorDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.Creditor.CreditorEntity creditor = cmd.NewCreditor();
creditor.ControlAccount = source.ControlAccount;
creditor.AccNo = newCreditorCode;
creditor.CompanyName = source.CompanyName;
creditor.Address1 = source.Addr1;
creditor.Address2 = source.Addr2;
creditor.Address3 = source.Addr3;
creditor.Address4 = source.Addr4;
creditor.Phone1 = source.Phone;
creditor.Phone2 = source.Mobile;
creditor.Attention = source.ContactPerson;
creditor.EmailAddress = source.Email;
creditor.CurrencyCode = AccountBookLocalCurrency(dbSetting);
try
{
cmd.SaveCreditor(creditor, userId);
//Log Success
}
catch (BCE.Application.AppException ex)
{
//Log fail
}
}
Get New Creditor Code
public string GetNewCreditorCode(BCE.Data.DBSetting dbSetting, string controlAccNo, string companyName)
{
try
{
return BCE.AutoCount.Common.AccountCodeHelper.Create(dbSetting)
.GetNextCreditorCode(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());
}
Class of source data
public class CreditorSource
{
public string ControlAccount { get; set; }
public string CreditorCode { 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 TesterMain(BCE.Data.DBSetting dbSetting)
{
CreditorSource newCreditor = new CreditorSource()
{
ControlAccount = "400-0000",
//CreditorCode = "410C001", //Ignore CreditorCode, if let system auto assign
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",
};
CreateNewCreditor(dbSetting, newCreditor);
}
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
|