Programmer AP Creditor v2
Jump to navigation
Jump to search
References of AutoCount Accounting version 2.0
AutoCount.Accounting.dll AutoCount.Accounting.UI.dll AutoCount.dll AutoCount.MainEntry.dll AutoCount.UI.dll AutoCount.ARAP.dll
Create new AP Creditor
public void NewCreditor(AutoCount.Authentication.UserSession userSession, CreditorSource source)
{
string newCreditorCode = GetNewCreditorCode(userSession, source.ControlAccount, source.CompanyName);
if (newCreditorCode == null)
return;
string userId = userSession.LoginUserID;
AutoCount.ARAP.Creditor.CreditorDataAccess cmd =
AutoCount.ARAP.Creditor.CreditorDataAccess.Create(userSession, userSession.DBSetting);
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(userSession.DBSetting);
try
{
cmd.SaveCreditor(creditor, userId);
//Log Success
}
catch (AutoCount.AppException ex)
{
//Log fail
}
}
Get New Creditor Code
public string GetNewCreditorCode(AutoCount.Authentication.UserSession userSession, string controlAccNo, string companyName)
{
try
{
return AutoCount.GL.AccountCodeHelper.Create(userSession.DBSetting)
.GetNextCreditorCode(controlAccNo, companyName);
}
catch (AutoCount.GL.InvalidAutoDebtorCodeFormatException ex)
{
//Log error ex.Message;
}
catch (AutoCount.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(AutoCount.Data.DBSetting dbSetting)
{
return AutoCount.Data.DBRegistry.Create(dbSetting).GetString(new 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===
<syntaxhighlight lang="csharp">
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",
};
NewCreditor(userSession, 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
|