AR Debtor v2: Difference between revisions
Content added Content deleted
mNo edit summary |
No edit summary |
||
Line 111: | Line 111: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{SeeAlsoAccountV2}} |
|||
{{SeeAlsoAPIAR}} |
|||
[[Category:Programmer]] |
[[Category:Programmer]] |
Revision as of 07:31, 28 May 2018
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 AR Debtor
public void CreateNewDebtor(AutoCount.Authentication.UserSession userSession, DebtorSource source)
{
string newDebtorCode = GetNewDebtorCode(userSession, source.ControlAccount, source.CompanyName);
if (newDebtorCode == null)
return;
string userId = userSession.LoginUserID;
AutoCount.ARAP.Debtor.DebtorDataAccess cmd = AutoCount.ARAP.Debtor.DebtorDataAccess.Create(userSession, userSession.DBSetting);
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(userSession);
try
{
cmd.SaveDebtor(debtor, userId);
//Log Success
}
catch (AutoCount.AppException ex)
{
//Log fail
}
}
Get Next Debtor Code
public string GetNewDebtorCode(AutoCount.Authentication.UserSession userSession, string controlAccNo, string companyName)
{
try
{
return AutoCount.GL.AccountCodeHelper.Create(userSession.DBSetting)
.GetNextDebtorCode(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.Authentication.UserSession userSession)
{
return AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
.GetString(new AutoCount.RegistryID.LocalCurrencyCode());
}
Class of source data
public class DebtorSource
{
public string ControlAccount { 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 MainEntry(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);
}
Go to top
|
Resources For AutoCount Software Developers
|