Access AR Tutorial

Introduction
After a developer has started the initialization process to consume AutoCount Accounting assemblies, he/she may begin to access the multiple functions that is available inside those same assemblies to execute what ever job that their program wish to do. This tutorial will guide the developer in accessing several AR documents in AutoCount Accounting for creation, modification and deletion purpose. Note: For all the property table, the red entries are compulsory property

 

 

Debtor
To begin writing the code that will allow you to create or modify Debtor information, you will first need to create a DebtorDataAccess object. This object will allow you to have access to database to retrieve, save or delete the debtor information you are modifying. The code below shows how to create the object in your program:

Code Snippet
BCE.AutoCount.ARAP.Debtor.DebtorDataAccess debtorDA = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(myDBSetting);

 

 

Adding A New Debtor

Add Code Snippet

public void AddDebtor()

{

    BCE.AutoCount.ARAP.Debtor.DebtorDataAccess debtorDA = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = debtorDA.NewDebtor();

    debtor.CurrencyCode = “RM”

    debtor.CompanyName = “ABC SDN. BHD.”;

    debtor.ControlAccount = “300-0000″;

    BCE.AutoCount.ARAP.Debtor.BranchEntity branch = debtor.NewBranch();

    branch.BranchCode = “1″;

    branch.BranchName = “1″;

    branch = debtor.NewBranch();

    branch.BranchCode = “2″;

    branch.BranchName = “2″;

    BCE.AutoCount.ARAP.Debtor.ContactEntity contact = debtor.NewContact();

    contact.Title = “Mr”

    contact.Name = “XYZ”;

 

    debtorDA.SaveDebtor(debtor, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Updating A Debtor

Update Code Snippet

public void UpdateDebtor()

{

    BCE.AutoCount.ARAP.Debtor.DebtorDataAccess debtorDA = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = debtorDA.GetDebtor(“300-A001″);

    if (debtor != null)

    {

        debtor.Address1 = “New Address 1″;

 

        debtorDA.SaveDebtor(debtor, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

    }

}

 

 

Deleting A Debtor

Delete Code Snippet

public void DeleteDebtor()

{

    BCE.AutoCount.ARAP.Debtor.DebtorDataAccess debtorDA = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(myDBSetting);

 

    debtorDA.DeleteDebtor(“300-A001″);

}

 

 

Debtor Class Properties
DebtorEntity Properties

Field Name Type(Length) Read-Only Description
AccNo String(12)   The acount number for this debtor
AccountGroup String(12)   The account group that this debtor would be under
Address1 String(40)   The address of the debtor (part 1)
Address2 String(40)   The address of the debtor (part 2)
Address3 String(40)   The address of the debtor (part 3)
Address4 String(40)   The address of the debtor (part 4)
AgingOn String(1)   Enter one of the following: I - Invoice Date or D - Due Date
AreaCode String(12)   The area code of the company
Attention String(40)   The attention assign to this debtor
BranchTable DataTable O Returns the Branch table of this document
CompanyName String(80)   The company name
ContactInfo String   The contact info displayed in report for this document
ContactTable DataTable O Returns the Contact table of this document
ControlAccount String   The control account assign to this debtor
CreatedTimeStamp DateTime O Returns the creation time of the document
CreatedUserID String(10) O Returns the user id that created the record
CreditLimit Decimal(18,4)   The credit limit applied to this debtor
CSBlockMessage String(40)   The message to be displayed when the block status is set to suspend
CSBlockStatus Int   Enter one of the following:
0 - All Disabled
1 - Controlled by credit term with no block when exceed credit limit and block when exceed overdue limit
2 - Controlled by credit term with no block when exceed credit limit and need password when exceed overdue limit
3 - Controlled by credit term with block when exceed credit limit and no block when exceed overdue limit
4 - Controlled by credit term with block when exceed credit and overdue limit
5 - Controlled by credit term with block when exceed credit limit and need password when overdue limit
6 - Controlled by credit term with need password when exceed credit limit and no block when exceed overdue limit
7 - Controlled by credit term with need password when exceed credit limit and block when exceed overdue limit
8 - Controlled by credit term with need password when both exceed credit and overdue limit
9 - Suspend
CurrencyCode String(5)   The currency code assign to this document
Data DataSet O Returns the debtor dataset
DebtorTable DataTable O Returns the debtor table
DebtorType String(20)   The debtor type assign to this debtor
DeliverAddr1 String(40)   The delivery address of this debtor (part 1)
DeliverAddr2 String(40)   The delivery address of this debtor (part 2)
DeliverAddr3 String(40)   The delivery address of this debtor (part 3)
DeliverAddr4 String(40)   The delivery address of this debtor (part 4)
DeliverPostCode String(10)   The delivery postcode of this debtor
Desc2 String(80)   The secondary description assign to this document
DiscountPercent Decimal(18,6)   The discount percentage to be applied to this debtor’s transaction
DisplayTerm String(30)   The display term assign to this debtor
DOBlockMessage String(40)   The message to be displayed when the block status is set to suspend
DOBlockStatus Int   Enter one of the following:
0 - All Disabled
1 - Controlled by credit term with no block when exceed credit limit and block when exceed overdue limit
2 - Controlled by credit term with no block when exceed credit limit and need password when exceed overdue limit
3 - Controlled by credit term with block when exceed credit limit and no block when exceed overdue limit
4 - Controlled by credit term with block when exceed credit and overdue limit
5 - Controlled by credit term with block when exceed credit limit and need password when overdue limit
6 - Controlled by credit term with need password when exceed credit limit and no block when exceed overdue limit
7 - Controlled by credit term with need password when exceed credit limit and block when exceed overdue limit
8 - Controlled by credit term with need password when both exceed credit and overdue limit
9 - Suspend
EmailAddress String(80)   The email address assign for this debtor
ExemptNo String(60)   The exempt number assign for this debtor
ExpiryDate Object   The expired date for the sales tax exemption number
ExternalLink BCE.AutoCount.Common.ExternalLink O Returns the ExternalLink accessor
Fax1 String(25)   The primary fax information for this debtor
Fax2 String(25)   The secondary fax information for this debtor
GLMastTable DataTable O Returns the GLMast table
HasBonusPoint Boolean   The status if this debtor has bonus point assigned to it
IsActive Boolean   The status if this debtor is actively used
IsCalcDiscountOnUnitPrice Boolean   The status if the discount is applied on unit price for this debtor
IsGroupCompany Boolean   The status if the debtor is part of a group
IVBlockMessage String(40)   The message to be displayed when the block status is set to suspend
IVBlockStatus Int   Enter one of the following:
0 - All Disabled
1 - Controlled by credit term with no block when exceed credit limit and block when exceed overdue limit
2 - Controlled by credit term with no block when exceed credit limit and need password when exceed overdue limit
3 - Controlled by credit term with block when exceed credit limit and no block when exceed overdue limit
4 - Controlled by credit term with block when exceed credit and overdue limit
5 - Controlled by credit term with block when exceed credit limit and need password when overdue limit
6 - Controlled by credit term with need password when exceed credit limit and no block when exceed overdue limit
7 - Controlled by credit term with need password when exceed credit limit and block when exceed overdue limit
8 - Controlled by credit term with need password when both exceed credit and overdue limit
9 - Suspend
LastModified DateTime O Returns the last modified time
LastModifiedUserID String(10) O Returns the user id that last modified the record
NatureOfBusiness String(40)   The business nature with this debtor
Note String   The notes assign to this debtor
OpeningBonusPoint Decimal(19,2)   The opening bonus point assign to this debtor
OverdueLimit Decimal(18,4)   The overdue limit assign to this debtor
Phone1 String(25)   The primary phone information for this debtor
Phone2 String(25)   This secondary phone information for this debtor
PostCode String(10)   The postcode for this debtor
PriceCategory String(12)   The price category assign to this debtor
QTBlockMessage String(40)   The message to be displayed when the block status is set to suspend
QTBlockStatus Int   Enter one of the following:
0 - All Disabled
1 - Controlled by credit term with no block when exceed credit limit and block when exceed overdue limit
2 - Controlled by credit term with no block when exceed credit limit and need password when exceed overdue limit
3 - Controlled by credit term with block when exceed credit limit and no block when exceed overdue limit
4 - Controlled by credit term with block when exceed credit and overdue limit
5 - Controlled by credit term with block when exceed credit limit and need password when overdue limit
6 - Controlled by credit term with need password when exceed credit limit and no block when exceed overdue limit
7 - Controlled by credit term with need password when exceed credit limit and block when exceed overdue limit
8 - Controlled by credit term with need password when both exceed credit and overdue limit
9 - Suspend
RegisterNo String(25)   The registration number assign to this debtor
SalesAgent String(12)   The sales agent assign to this debtor
ScriptObject BCE.AutoCount.Scripting.ScriptObject O Returns the script object associated to this debtor entity
SOBlockMessage String(40)   The message to be displayed when the block status is set to suspend
SOBlockStatus Int   Enter one of the following:
0 - All Disabled
1 - Controlled by credit term with no block when exceed credit limit and block when exceed overdue limit
2 - Controlled by credit term with no block when exceed credit limit and need password when exceed overdue limit
3 - Controlled by credit term with block when exceed credit limit and no block when exceed overdue limit
4 - Controlled by credit term with block when exceed credit and overdue limit
5 - Controlled by credit term with block when exceed credit limit and need password when overdue limit
6 - Controlled by credit term with need password when exceed credit limit and no block when exceed overdue limit
7 - Controlled by credit term with need password when exceed credit limit and block when exceed overdue limit
8 - Controlled by credit term with need password when both exceed credit and overdue limit
9 - Suspend
StatementType String(1)   Enter one of the following: O - Open Item, B - Balance Forward or N - No Statement
TaxRegisterNo String(20)   The tax registration number assign to this debtor
TaxType String(14)   The tax type assign to this debtor
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
WebURL String(80)   The web URL assign to this debtor
WithholdingTaxPercent Decimal(18,6)   The withholding tax percent assign to this debtor

 

 

BranchEntity Properties

Field Name Type(Length) Read-Only Description
Address1 String(40)   The address of the branch (part 1)
Address2 String(40)   The address of the branch (part 2)
Address3 String(40)   The address of the branch (part 3)
Address4 String(40)   The address of the branch (part 4)
AreaCode String(12)   The area code for the branch
BranchCode String(20)   The branch code you wish to apply to this branch
BranchName String(80)   The branch name
BranchTable DataTable O Returns the branch table
Contact String(40)   The contact person for the branch
Fax1 String(25)   The primary fax number
Fax2 String(25)   The secondary fax number
IsActive Boolean   The flag that indicates that this branch is actively use
Phone1 String(25)   The primary phone number
Phone2 String(25)   The secondary phone number
PostCode String(10)   The post code for the branch
SalesAgent String(12)   The sales agent assigned to the branch

 

 

ContactEntity Properties

Field Name Type(Length) Read-Only Description
ContactTable DataTable O Returns the contact table
Department String(30)   The department assign to this contact
DirectFax String(25)   The fax number of this contact
DirectPhone String(25)   The direct phone number of this contact
EmailAddress String(80)   The email address assign to this contact
IMAddress String(40)   The instant messaging address assign to this contact
IncludeInContactInfo Boolean   Set to True if you wish to add this contact into the Contact Info that is displayed in report. Set to False if you do not wish to do so
MobilePhone String(25)   The mobile phone number of this contact
Name String(40)   The name of this contact
Title String(40)  
The title assign to this contact

 

 

AR Invoice
Similar to the previous example for Debtor, before creating or modifying any AR Invoice document, a DataAccess object must be created first

Code Snippet
BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess arInvoiceDA = BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(myDBSetting);

 

 

Adding A New AR Invoice

Add Code Snippet

public void AddARInvoice()

{

    BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess arInvoiceDA = BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARInvoice.ARInvoiceEntity arInvoice = arInvoiceDA.NewARInvoice();

 

    // If you want to set your own Invoice No, uncomment the next line, otherwise, the system will use automatic running number.

    // arInvoice.DocNo = “TEST-0001″;

    arInvoice.DebtorCode = “300-A001″;

    arInvoice.DisplayTerm = “Net 30 days”;

 

    // Add one detail item

    BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDTLEntity arInvoiceDetail = arInvoice.NewDetail();

    arInvoiceDetail.AccNo = “500-0000″;

    arInvoiceDetail.Amount = 500;

 

    arInvoiceDA.SaveARInvoice(arInvoice, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Updating The AR Invoice

Code Snippet

public void UpdateARInvoice()

{

    BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess arInvoiceDA = BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARInvoice.ARInvoiceEntity arInvoice = arInvoiceDA.GetARInvoice(“TEST-0001″);

 

    // if arInvoice == null, it means the AR Invoice is not found.

    if (arInvoice == null)

        return;

 

    arInvoice.ClearDetails();

 

    BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDTLEntity arInvoiceDetail = arInvoice.NewDetail();

    arInvoiceDetail.AccNo = “500-0000″;

    arInvoiceDetail.Amount = 600;

 

    arInvoiceDA.SaveARInvoice(arInvoice, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Deleting A AR Invoice

Delete Code Snippet

public void DeleteARInvoice()

{

    BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess arInvoiceDA = BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(myDBSetting);

    arInvoiceDA.DeleteARInvoice(“TEST-0001″);

}

 

 

ARInvoice Class Properties
ARInvoiceEntity Properties

Field Name Type(Length) Read-Only Description
AgingDate DateTime   The aging date assign to the document
ARInvoiceDTLTable DataTable O Returns the ARInvoiceDTL table
ARInvoiceTable DataTable O Returns the ARInvoice table
AutoValue Boolean   Gets or Sets the Auto Value
Cancelled Boolean O Returns true if the document is cancelled
CreatedTimeStamp DateTime O Returns the creation time of the document
CreatedUserID String(10) O Returns the user id that created the record
CurrencyCode String(5)   The currency code assign to the document
CurrencyRate Decimal(18,8)   The currency rate applied to the document
Data DataSet O Returns the AR Invoice dataset
DebtorCode String(12)   The debtor code assign to the document
DecimalSetting BCE.AutoCount.Settings.DecimalSettings O Returns the decimal setting information of the document
Description String(80)   The description for the document
DisplayTerm String(30)   The display term assign to the document
DocDate DateTime   The document date assign to the document
DocKey Long O Returns the document key of the document
DocNo String(20)   The document number for the document
DocNoFormat String   The  document number format to be applied to the document
DueDate DateTime O Returns the document due date
ExTax Decimal(18,4) O Returns the exclusive tax amount
ExternalLink BCE.AutoCount.Common.ExternalLink O Returns the ExternalLink accessor
GeneralSetting BCE.AutoCount.Settings.GeneralSetting O Returns the GeneralSetting accessor
GLTrxID BCE.Data.DBInt64 O Returns the GL Transaction ID
InclusiveTax Boolean   The status if the tax is inclusive or not
IsKIV Boolean   The status if the document is kept in view folder
IsPastInvoice Boolean O Returns true if the document is a past invoice
IsYTDInvoice Boolean O Returns true if the document is a year to date invoice
JournalType String(10)   The journal type assign to the document
LastModified DateTime O Returns the last modified time
LastModifiedUserID String(10) O Returns the user id that last modified the record
LocalExTax Decimal(18,4) O Returns the exclusive tax amount in local currency
LocalNetTotal Decimal(18,4)   The net total amount in local currency
LocalPaymentAmt Decimal(18,4) O Returns the payment amount in local currency
LocalTax Decimal(18,4) O Returns the tax amount in local currency
LocalTotal Decimal(18,4) O Returns the total amount in local currency
LocalTotal2 Decimal(18,4) O Returns the total2 amount in local currency
NetTotal Decimal(18,4) O Returns the net total amount
Note String   The note assign to this document
Outstanding Decimal(18,4) O Returns the outstanding amount
PaymentAmt Decimal(18,4) O Returns the payment amount
RefNo2 String(20)   The secondary reference number to this document
SalesAgent Object(12)   The Sales Agent assigned to this document. Can be set to BCE.Data.DBNull if there is no sales agent assigned to this document. If there is one, enter the string maintained in the SalesAgent table to represent the Sales Agent name
ScriptObject BCE.AutoCount.Scripting.ScriptObject O Returns the script object associated
SourceKey Object   The source key of this document
SourceType String(2)   The source type of this document
Tax Decimal(18,4) O Returns the tax amount
TaxableAmt Decimal(18,4) O Returns the taxable amount
TaxDocNo String(20)   The tax document number assign to this document
Total Decimal(18,4) O Returns the total amount
Total2 Decimal(18,4) O Returns the total2 amount
ToTaxCurrencyRate Decimal(18,4)   The tax currency rate assign to this document
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
UserAuthentication BCE.AutoCount.Authentication.UserAuthentication O Returns the UserAuthentication accessor

 

 

ARInvoiceDTLEntity Properties

Field Name Type(Length) Read-Only Description
AccNo String(12)   The account number assign to this detail record
Amount Decimal(18,4)   The amount of the detail record
ARInvoiceDTLTable DataTable O Returns the ARInvoiceDTL table
DeptNo Object(10)   The department number assign to this record
Description String(100)   The description for this detail record
DtlKey Long O Returns the detail key of the record
KnockOffAmount Decimal(18,4) O Returns the knock off amount
LocalNetAmount Decimal(18,4) O Returns the net amount in local currency
LocalSubTotal Decimal(18,4) O Returns the sub total in local currency
LocalTax Decimal(18,4) O Returns the tax amount in local currency
NetAmount Decimal(18,4) O Returns the net amount
ProjNo Object(10)   The project number assign to this record
Seq Int   The sequence of this detail information. It controls the position of this detail in the document
SourceDtlKey Object   The source detail key for this record
SubTotal Decimal(18,4) O Returns the sub total
Tax Decimal(18,4)   The tax amount of this detail record
TaxableAmt Decimal(18,4)   The taxable amount of this detail record
TaxAdjustment Decimal(18,4)   The tax adjustment of this detail record
TaxExportCountry String(50)   The tax export country assign to this detail record
TaxType Object(14)   The tax type assign to this detail record
ToAccountRate Decimal(18,8)   The To Account Rate assign to this detail record
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor

 

 

AR DN
Similar to the previous example for Debtor, before creating or modifying any AR DN document, a DataAccess object must be created first

Code Snippet

BCE.AutoCount.ARAP.ARDN.ARDNDataAccess arDNDA = BCE.AutoCount.ARAP.ARDN.ARDNDataAccess.Create(myDBSetting);

 

 

Adding A New AR DN

Add Code Snippet

public void AddARDN()

{

    BCE.AutoCount.ARAP.ARDN.ARDNDataAccess arDNDA = BCE.AutoCount.ARAP.ARDN.ARDNDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARDN.ARDNEntity arDN = arDNDA.NewARDN();

 

    // If you want to set your own DN No, uncomment the next line, otherwise, the system will use automatic running number.

    // arDN.DocNo = “TEST-0001″;

    arDN.DebtorCode = “300-A001″;

    arDN.DisplayTerm = “Net 30 days”;

 

    // Add one detail item

    BCE.AutoCount.ARAP.ARDN.ARDNDTLEntity arDNDetail = arDN.NewDetail();

    arDNDetail.AccNo = “500-0000″;

    arDNDetail.Amount = 500;

 

    arDNDA.SaveARDN(arDN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Updating The AR DN

Update Code Snippet

public void UpdateARDN()

{

    BCE.AutoCount.ARAP.ARDN.ARDNDataAccess arDNDA = BCE.AutoCount.ARAP.ARDN.ARDNDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARDN.ARDNEntity arDN = arDNDA.GetARDN(“TEST-0001″);

 

    // if arDN == null, it means the DN is not found.

    if (arDN == null)

        return;

 

    arDN.ClearDetails();

 

    BCE.AutoCount.ARAP.ARDN.ARDNDTLEntity arDNDetail = arDN.NewDetail();

    arDNDetail.AccNo = “500-0000″;

    arDNDetail.Amount = 600;

 

    arDNDA.SaveARDN(arDN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Deleting A AR DN

Delete Code Snippet

public void DeleteARDN()

{

    BCE.AutoCount.ARAP.ARDN.ARDNDataAccess arDNDA = BCE.AutoCount.ARAP.ARDN.ARDNDataAccess.Create(myDBSetting);

    arDNDA.DeleteARDN(“TEST-0001″);

}

 

 

ARDN Class Properties
ARDNEntity Properties

Field Name Type(Length) Read-Only Description
AgingDate DateTime   The aging date assign to the document
ARDNDTLTable DataTable O Returns the ARDNDTL table
ARDNTable DataTable O Returns the ARDN table
AutoValue Boolean   Gets or Sets the Auto Value
Cancelled Boolean O Returns true if the document is cancelled
CreatedTimeStamp DateTime O Returns the creation time of the document
CreatedUserID String(10) O Returns the user id that created the record
CurrencyCode String(5)   The currency code assign to this document
CurrencyRate Decimal(18,8)   The currency rate assign to this document
Data DataSet O Returns the AR Debit Note dataset
DebtorCode String(12)   The debtor code assign to this document
DecimalSetting BCE.AutoCount.Settings.DecimalSettings O Returns the decimal setting information of the document
Description String(80)   The description assign to this document
DisplayTerm String(30)   The display term assign to this document
DNType Object(12)   The debit note type assign to the document
DocDate DateTime   The document date assign to the document
DocKey Long O Returns the document key of the document
DocNo String(20)   The document number for the document
DocNoFormat String   The  document number format to be applied to the document
DueDate DateTime O Returns the document due date
ExTax Decimal(18,4) O Returns the exclusive tax amount
ExternalLink BCE.AutoCount.Common.ExternalLink O Returns the ExternalLink accessor
GeneralSetting BCE.AutoCount.Settings.GeneralSetting O Returns the GeneralSetting accessor
GLTrxID BCE.Data.DBInt64 O Returns the GL Transaction ID
InclusiveTax Boolean   The status if the tax is inclusive or not
IsJournal Boolean   The status if the document is journal
IsKIV Boolean   The status if the document is kept in view folder
IsPastDN Boolean O Returns true if the document is a past debit note
IsYTDDN Boolean O Returns true if the document is a year to date debit note
JEKey Object O Returns the journal entry document key
JournalType String(10)   The journal type assign to this document
LastModified DateTime O Returns the last modified time
LastModifiedUserID String(10) O Returns the user id that last modified the record
LocalExTax Decimal(18,4) O The exclusive tax amount in local currency
LocalNetTotal Decimal(18,4)   The net total amount in local currency
LocalPaymentAmt Decimal(18,4) O Returns the payment amount in local currency
LocalTax Decimal(18,4) O Returns the tax amount in local currency
LocalTotal Decimal(18,4) O Returns the total amount in local currency
LocalTotal2 Decimal(18,4) O Returns the total2 amount in local currency
NetTotal Decimal(18,4) O Returns the net total amount
Note String   The notes assign to this document
OurInvoiceNo String(40)   The our invoice number assign to this document
Outstanding Decimal(18,4) O Returns the outstanding amount
PaymentAmt Decimal(18,4) O Returns the payment amount
Reason String(80)   The reason assign to this document
Ref String(40)   The reference assign to this document
RefNo2 String(20)   The secondary reference number assign to this document
SalesAgent Object(12)   The Sales Agent assigned to this document. Can be set to BCE.Data.DBNull if there is no sales agent assigned to this document. If there is one, enter the string maintained in the SalesAgent table to represent the Sales Agent name
ScriptObject BCE.AutoCount.Scripting.ScriptObject O Returns the script object associated
SourceKey Object   The source key of this document
SourceType String(2)   The source type of this document
Tax Decimal(18,4) O Returns the tax amount
TaxableAmt Decimal(18,4) O Returns the taxable amount
TaxDocNo String(20)   The tax document number assign of this document
Total Decimal(18,4) O Returns the total amount
Total2 Decimal(18,4) O Returns the total2 amount
ToTaxCurrencyRate Decimal(18,8)   The To Tax Currency Rate assign to this document
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
UserAuthentication BCE.AutoCount.Authentication.UserAuthentication O Returns the UserAuthentication accessor
 

 

ARDNDTLEntity Properties

Field Name Type(Length) Read-Only Description
AccNo String(12)   The account number assign to the detail record
Amount Decimal(18,4)   The amount assign to the detail record
ARDNDTLTable DataTable O Returns the ARDNDTL table
DeptNo Object(10)   The department number assign to the detail record
Description String(100)   The description assign to the detail record
DtlKey Long O Returns the detail key of the record
KnockOffAmount Decimal(18,4) O Returns the knock off amount
LocalNetAmount Decimal(18,4) O Returns the net amount in local currency
LocalSubTotal Decimal(18,4) O Returns the sub total in local currency
LocalTax Decimal(18,4) O Returns the tax amount in local currency
NetAmount Decimal(18,4) O Returns the net amount
ProjNo Object(10)   The project number assign to the detail record
Seq Int  
The sequence of this detail information. It controls the position of this detail in the document
SourceDtlKey Object   The source detail key for this detail record
SubTotal Decimal(18,4) O Returns the sub total
Tax Decimal(18,4)   The tax amount assign for this detail record
TaxableAmt Decimal(18,4)   The taxable amount assign for this detail record
TaxAdjustment Decimal(18,4)   The tax adjustment assign for this detail record
TaxExportCountry String(50)   The tax export country assign for this detail record
TaxType Object(14)   The tax type assign for this detail record
ToAccountRate Decimal(18,8)   The To Account Rate for this detail record
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor

 

 

AR CN
Similar to the previous example for Debtor, before creating or modifying any AR CN document, a DataAccess object must be created first

Code Snippet

BCE.AutoCount.ARAP.ARCN.ARCNDataAccess arCNDA = BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(myDBSetting);

 

 

Adding A New AR CN

Add Code Snippet

public void AddARCN()

{

    BCE.AutoCount.ARAP.ARCN.ARCNDataAccess arCNDA = BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARCN.ARCNEntity arCN = arCNDA.NewARCN();

 

    // If you want to set your own CN No, uncomment the next line, otherwise, the system will use automatic running number.

    // arCN.DocNo = “TEST-0001″;

    arCN.DebtorCode = “300-A001″;

 

    // Add one detail item

    BCE.AutoCount.ARAP.ARCN.ARCNDTLEntity arCNDetail = arCN.NewDetail();

    arCNDetail.AccNo = “500-0000″;

    arCNDetail.Amount = 500;

 

    arCN.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, “TEST-0001″, 100);

 

    arCNDA.SaveARCN(arCN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Updating The AR CN

Update Code Snippet

public void UpdateARCN()

{

    BCE.AutoCount.ARAP.ARCN.ARCNDataAccess arCNDA = BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARCN.ARCNEntity arCN = arCNDA.GetARCN(“”);

 

    // if arCN == null, it means the CN is not found.

    if (arCN == null)

        return;

 

    arCN.ClearDetails();

 

    BCE.AutoCount.ARAP.ARCN.ARCNDTLEntity arCNDetail = arCN.NewDetail();

    arCNDetail.AccNo = “500-0000″;

    arCNDetail.Amount = 600;

 

    arCNDA.SaveARCN(arCN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Deleting A AR CN

Delete Code Snippet

public void DeleteARCN()

{

    BCE.AutoCount.ARAP.ARCN.ARCNDataAccess arCNDA = BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(myDBSetting);

    arCNDA.DeleteARCN(“TEST-0001″, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

ARCN Class Properties
ARCNEntity Properties

Field Name Type(Length) Read-Only Description
ARDNDTLTable DataTable O Returns the ARDNDTL table
ARCNKnockOffDetailTable DataTable O Returns the ARCNKnockOffDetail table
ARCNKnockOffTable DataTable O Returns the ARCNKnockOff table
ARDNTable DataTable O Returns the ARDN table
AutoValue Boolean   Gets or Sets the Auto Value
Cancelled Boolean O Returns true if the document is cancelled
CNType Object(12)   The CN Type assign to the document
CreatedTimeStamp DateTime O Returns the creation time of the document
CreatedUserID String(10) O Returns the user id that created the record
CurrencyCode String(5)   The currency code assign to this document
CurrencyRate Decimal(18,8)   The currency rate assign to this document
Data DataSet O Returns the AR Credit Note dataset
DebtorCode String(12)   The debtor code assign to this document
DecimalSetting BCE.AutoCount.Settings.DecimalSettings O Returns the DecimalSetting accessor
Description String(80)   The description assign to this document
DocDate DateTime   The document date assign to the document
DocKey Long O Returns the document key of the document
DocNo String(20)   The document number assign to the document
DocNoFormat String   The  document number format to be applied to the document
InclusiveTax Boolean   The status if the tax is inclusive or not
IsJournal Boolean   The status if the document is a journal
IsKIV Boolean   The status if the document is kept in view folder
IsPastCN Boolean O Returns true if the document is a past credit note
IsYTDCN Boolean O Returns true if the document is a year to date credit note
JEKey Object O Returns the journal entry document key
JournalType String(10)   The journal type of this document
KnockOffAmt Decimal(18,4) O Returns the knock off amount
LastModified DateTime O Returns the last modified time
LastModifiedUserID String(10) O Returns the user id that last modified the record
LocalExTax Decimal(18,4) O Returns the exclusive tax amount in local currency
LocalNetTotal Decimal(18,4)   The net total amount in local currency
LocalTax Decimal(18,4) O Returns the tax amount in local currency
LocalTotal Decimal(18,4) O Returns the total amount in local currency
LocalTotal2 Decimal(18,4) O Returns the total2 amount in local currency
NetTotal Decimal(18,4) O Returns the net total amount
Note String   The note assign to the document
OurInvoiceNo String(40)   The our invoice number assign to this document
Reason String(80)   The reason assign to the document
Ref String(40)   The reference assign to the document
RefNo2 String(20)   The secondary reference number assign to the documen
RefundAmt Decimal O Returns the refund amount
ScriptObject BCE.AutoCount.Scripting.ScriptObject O Returns the script object associated
SourceKey Object   The source key of the document
SourceType String(2)   The source type of the document
Tax Decimal(18,4) O Returns the tax amount
TaxableAmt Decimal(18,4) O Returns the taxable amount
TaxDocNo String(20)   The Tax Document Number assign to the document
Total Decimal(18,4) O Returns the total amount
Total2 Decimal(18,4) O Returns the total2 amount
ToTaxCurrencyRate Decimal(18,8)   The To Tax Currency Rate assign to the document
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
UserAuthentication BCE.AutoCount.Authentication.UserAuthentication O Returns the UserAuthentication accessor

 

 

ARCNDTLEntity Properties

Field Name Type(Length) Read-Only Description
AccNo String(12)   The account number assign to the detail record
Amount Decimal(18,4)   The amount assign to the detail record
ARCNDTLTable DataTable O Returns the ARCNDTL table
DeptNo Object(10)   The department number assign to the detail record
Description String(100)   The description assign to the detail record
DtlKey Long O Returns the detail key of the record
KnockOffAmount Decimal(18,4) O Returns the knock off amount
LocalNetAmount Decimal(18,4) O Returns the net amount in local currency
LocalSubTotal Decimal(18,4) O Returns the sub total in local currency
LocalTax Decimal(18,4) O Returns the tax amount in local currency
NetAmount Decimal(18,4) O Returns the net amount
ProjNo Object(10)   The project number assign to the detail record
Seq Int   The sequence of this detail information. It controls the position of this detail in the document
SourceDtlKey Object   The source detail key for this detail record
SubTotal Decimal(18,4) O Returns the sub total
Tax Decimal(18,4)   The tax amount assign for the detail record
TaxableAmt Decimal(18,4)   The taxable amount assign for the detail record
TaxAdjustment Decimal(18,4)   The tax adjustment assign for the detail record
TaxExportCountry String(5)   The Tax Export Country assign for the detail record
TaxType Object(14)   The Tax Type assign for the detail record
ToAccountRate Decimal(18,8)   The To Account Rate assign for the detail record
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor

 

 

AR Payment
Similar to the previous example for Debtor, before creating or modifying any AR Payment document, a DataAccess object must be created first

Code Snippet

BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(myDBSetting);

 

 

Adding A New AR Payment

Add Code Snippet

public void AddARPayment()

{

    BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPayment = arPaymentDA.NewARPayment();

 

    // If you want to set your own Payment No, uncomment the next line, otherwise, the system will use automatic running number.

    // arPayment.DocNo = “TEST-0001″;

    arPayment.DebtorCode = “300-A001″;

 

    // Add one detail item

    BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetail = arPayment.NewDetail();

    arPaymentDetail.PaymentMethod = “CASH”;

    arPaymentDetail.PaymentAmt = 100;

    arPaymentDetail.ChequeNo = “MBB 123456″;

 

    arPayment.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, “TEST-0001″, 100);

 

    arPaymentDA.SaveARPayment(arPayment, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Updating The AR Payment

Update Code Snippet

public void UpdateARPayment()

{

    BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(myDBSetting);

 

    BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPayment = arPaymentDA.GetARPayment(“TEST-0001″);

 

    // if arPayment == null, it means the AR Payment is not found.

    if (arPayment == null)

        return;

 

    arPayment.ClearDetails();

 

    BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetail = arPayment.NewDetail();

    arPaymentDetail.PaymentMethod = “CARD”;

    arPaymentDetail.PaymentAmt = 600;

 

    arPaymentDA.SaveARPayment(arPayment, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Deleting A AR Payment

Delete Code Snippet

public void DeleteARPayment()

{

    BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(myDBSetting);

    arPaymentDA.DeleteARPayment(“TEST-0001″, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

ARPayment Class Properties
ARPaymentEntity Properties

Field Name Type(Length) Read-Only Description
ARBadDebtRecoveryDocTable DataTable O Returns the ARBadDebtRecoveryDoc table
ARPaymentDTLTable DataTable O Returns the ARPaymentDTL table
ARPaymentKnockOffDetailTable DataTable O Returns the ARPaymentKnockOffDetail table
ARPaymentKnockOffTable DataTable O Returns the ARPaymentKnockOff table
ARPaymentTable DataTable O Returns the ARPayment table
Cancelled DataTable O Returns true if the document is cancelled
CBKey Object O Returns the cash book document key
CNDocNoFormat String   The CN Document No Format assign to the document
CreatedTimeStamp DateTime O Returns the creation time of the document
CreatedUserID String(10) O Returns the user id that created the record
CurrencyCode String(5)   The currency code assign to this document
Data DataSet O Returns the AR Payment dataset
DebtorCode String(12)   The debtor code assign to the document
DecimalSetting BCE.AutoCount.Settings.DecimalSettings O Returns the DecimalSetting accessor
DeptNo Object(10)   The department number assign to the document
Description String(80)   The description assign to the document
DocDate DateTime   The document date assign to the document
DocKey Long O Returns the document key of the document
DocNo String(20)   The document number assign to the document
DocNo2 String(25)   The secondary document number assign to the document
DocNoFormat String   The document number format assign to the document
ExternalLink BCE.AutoCount.Common.ExternalLink O Returns the ExternalLink accessor
GeneralSetting BCE.AutoCount.Settings.GeneralSetting O Returns the GeneralSetting accessor
GLTrxID BCE.Data.DBInt64 O Returns the GL Transaction ID
IsKIV Boolean   The status if the document is kept in view folder
IsPastPayment Boolean O Returns true if the document is a past payment
IsYTDPayment Boolean O Returns true if the document is a year to date payment
KnockOffAmt Decimal(18,4) O Returns the knock off amount
LastModified DateTime O Returns the last modified time
LastModifiedUserID String(10) O Returns the user id that last modified the record
LocalPaymentAmt Decimal(18,4)   The payment amount in local currency
Note String   The notes assign to the document
PaymentAmt Decimal(18,4) O Returns the payment amount
ProjNo Object(10)   The project number assign to the document
ReferCNDocDate DateTime   The referred CN document date assign to the document
ReferCNDocKey Object   The referred CN document key assign to the document
ReferCNDocNo String(20)   The referred CN document number assign to the document
RefundAmt Decimal(18,4) O Returns the refund amount
ScriptObject BCE.AutoCount.Scripting.ScriptObject O Returns the script object associated
SourceKey Object  
The source key of the document
SourceType String(2)   The source type of the document
ToDebtorRate Decimal(18,8)   The To Debtor Rate assign to the document
ToHomeRate Decimal(18,8)   The To Home Rate assign to the document
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
UserAuthentication BCE.AutoCount.Authentication.UserAuthentication O Returns the UserAuthentication accessor

 

 

ARPaymentDTLEntity Properties

Field Name Type(Length) Read-Only Description
ARPaymentDTLTable DataTable O Returns the ARPaymentDTL table
BankCharge Decimal(18,4)   The bank charge amount assign to the detail
BankChargeDeptNo Object(10)   The bank charge department number assign to the detail
BankChargeProjNo Object(10)   The bank charge project number assign to the detail
ChequeNo String(20)   The cheque number assign to the detail
DebtorPaymentAmt Decimal(18,4) O Returns the debtor payment amount
DepositDocKey Object   The deposit document key assign to the detail
DtlKey Long O Returns the detail key of the record
FloatDay Int   The float day assign to the detail record
IsRCHQ Boolean   The status assign to show if the cheque is a return cheque
LocalPaymentAmt Decimal(18,4) O Returns the payment amount in local currency
PaymentAmt Decimal(18,4)   The payment amount in local currency
PaymentBy String(20)   The payment by assign to the detail record
PaymentMethod String(20)   The payment method assign to the detail record
RCHQDate Object   The return cheque date assign to the detail record
Seq Int   The sequence of this detail information. It controls the position of this detail in the document
ToBankRate Decimal(18,8)   The To Bank Rate assign to the detail record
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
WithholdingTax Decimal(18,4)   The withholding tax assign to the detail record

 

 

Full Example

Code Snippet

using System;

using System.Data;

using BCE.Data;

 

namespace AccessingAccounting

{

    ///<summary>

    /// AccessAR demos how to access AR in AutoCount 2006 via code.

    ///</summary>

    public class AccessAR

    {

        private DBSetting myDBSetting;

 

        public AccessAR(DBSetting dbSetting)

        {

            myDBSetting = dbSetting;

        }

 

        #region Accessing Debtor

        public void AddDebtor()

        {

            BCE.AutoCount.ARAP.Debtor.DebtorDataAccess debtorDA = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = debtorDA.NewDebtor();

            debtor.CurrencyCode = “RM”;

            debtor.CompanyName = “ABC SDN. BHD.”;

            debtor.ControlAccount = “300-0000″;

            BCE.AutoCount.ARAP.Debtor.BranchEntity branch = debtor.NewBranch();

            branch.BranchCode = “1″;

            branch.BranchName = “1″;

            branch = debtor.NewBranch();

            branch.BranchCode = “2″;

            branch.BranchName = “2″;

            BCE.AutoCount.ARAP.Debtor.ContactEntity contact = debtor.NewContact();

            contact.Title = “Mr”;

            contact.Name = “XYZ”;

 

            debtorDA.SaveDebtor(debtor, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void UpdateDebtor()

        {

            BCE.AutoCount.ARAP.Debtor.DebtorDataAccess debtorDA = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.Debtor.DebtorEntity debtor = debtorDA.GetDebtor(“300-A001″);

            if (debtor != null)

            {

                debtor.Address1 = “New Address 1″;

 

                debtorDA.SaveDebtor(debtor, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

            }

        }

 

        public void DeleteDebtor()

        {

            BCE.AutoCount.ARAP.Debtor.DebtorDataAccess debtorDA = BCE.AutoCount.ARAP.Debtor.DebtorDataAccess.Create(myDBSetting);

 

            debtorDA.DeleteDebtor(“300-A001″);

        }

        #endregion

 

        #region Accessing ARInvoice

        public void AddARInvoice()

        {

            BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess arInvoiceDA = BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARInvoice.ARInvoiceEntity arInvoice = arInvoiceDA.NewARInvoice();

 

            // If you want to set your own Invoice No, uncomment the next line, otherwise, the system will use automatic running number.

            // arInvoice.DocNo = “TEST-0001″;

            arInvoice.DebtorCode = “300-A001″;

            arInvoice.DisplayTerm = “Net 30 days”;

 

            // Add one detail item

            BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDTLEntity arInvoiceDetail = arInvoice.NewDetail();

            arInvoiceDetail.AccNo = “500-0000″;

            arInvoiceDetail.Amount = 500;

 

            arInvoiceDA.SaveARInvoice(arInvoice, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void UpdateARInvoice()

        {

            BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess arInvoiceDA = BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARInvoice.ARInvoiceEntity arInvoice = arInvoiceDA.GetARInvoice(“TEST-0001″);

 

            // if arInvoice == null, it means the AR Invoice is not found.

            if (arInvoice == null)

                return;

 

            arInvoice.ClearDetails();

 

            BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDTLEntity arInvoiceDetail = arInvoice.NewDetail();

            arInvoiceDetail.AccNo = “500-0000″;

            arInvoiceDetail.Amount = 600;

 

            arInvoiceDA.SaveARInvoice(arInvoice, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void DeleteARInvoice()

        {

            BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess arInvoiceDA = BCE.AutoCount.ARAP.ARInvoice.ARInvoiceDataAccess.Create(myDBSetting);

            arInvoiceDA.DeleteARInvoice(“TEST-0001″);

        }

        #endregion

 

        #region Accessing ARDN

        public void AddARDN()

        {

            BCE.AutoCount.ARAP.ARDN.ARDNDataAccess arDNDA = BCE.AutoCount.ARAP.ARDN.ARDNDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARDN.ARDNEntity arDN = arDNDA.NewARDN();

 

            // If you want to set your own DN No, uncomment the next line, otherwise, the system will use automatic running number.

            // arDN.DocNo = “TEST-0001″;

            arDN.DebtorCode = “300-A001″;

            arDN.DisplayTerm = “Net 30 days”;

 

            // Add one detail item

            BCE.AutoCount.ARAP.ARDN.ARDNDTLEntity arDNDetail = arDN.NewDetail();

            arDNDetail.AccNo = “500-0000″;

            arDNDetail.Amount = 500;

 

            arDNDA.SaveARDN(arDN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void UpdateARDN()

        {

            BCE.AutoCount.ARAP.ARDN.ARDNDataAccess arDNDA = BCE.AutoCount.ARAP.ARDN.ARDNDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARDN.ARDNEntity arDN = arDNDA.GetARDN(“TEST-0001″);

 

            // if arDN == null, it means the DN is not found.

            if (arDN == null)

                return;

 

            arDN.ClearDetails();

 

            BCE.AutoCount.ARAP.ARDN.ARDNDTLEntity arDNDetail = arDN.NewDetail();

            arDNDetail.AccNo = “500-0000″;

            arDNDetail.Amount = 600;

 

            arDNDA.SaveARDN(arDN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void DeleteARDN()

        {

            BCE.AutoCount.ARAP.ARDN.ARDNDataAccess arDNDA = BCE.AutoCount.ARAP.ARDN.ARDNDataAccess.Create(myDBSetting);

            arDNDA.DeleteARDN(“TEST-0001″);

        }

        #endregion

 

        #region Accessing ARCN

        public void AddARCN()

        {

            BCE.AutoCount.ARAP.ARCN.ARCNDataAccess arCNDA = BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARCN.ARCNEntity arCN = arCNDA.NewARCN();

 

            // If you want to set your own CN No, uncomment the next line, otherwise, the system will use automatic running number.

            // arCN.DocNo = “TEST-0001″;

            arCN.DebtorCode = “300-A001″;

 

            // Add one detail item

            BCE.AutoCount.ARAP.ARCN.ARCNDTLEntity arCNDetail = arCN.NewDetail();

            arCNDetail.AccNo = “500-0000″;

            arCNDetail.Amount = 500;

 

            arCN.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, “TEST-0001″, 100);

 

            arCNDA.SaveARCN(arCN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void UpdateARCN()

        {

            BCE.AutoCount.ARAP.ARCN.ARCNDataAccess arCNDA = BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARCN.ARCNEntity arCN = arCNDA.GetARCN(“”);

            // if arCN == null, it means the CN is not found.

            if (arCN == null)

                return;

 

            arCN.ClearDetails();

 

            BCE.AutoCount.ARAP.ARCN.ARCNDTLEntity arCNDetail = arCN.NewDetail();

            arCNDetail.AccNo = “500-0000″;

            arCNDetail.Amount = 600;

 

            arCNDA.SaveARCN(arCN, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void DeleteARCN()

        {

            BCE.AutoCount.ARAP.ARCN.ARCNDataAccess arCNDA = BCE.AutoCount.ARAP.ARCN.ARCNDataAccess.Create(myDBSetting);

            arCNDA.DeleteARCN(“TEST-0001″, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

        #endregion

 

        #region Accessing ARPayment

        public void AddARPayment()

        {

            BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPayment = arPaymentDA.NewARPayment();

 

            // If you want to set your own Payment No, uncomment the next line, otherwise, the system will use automatic running number.

            // arPayment.DocNo = “TEST-0001″;

            arPayment.DebtorCode = “300-A001″;

 

            // Add one detail item

            BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetail = arPayment.NewDetail();

            arPaymentDetail.PaymentMethod = “CASH”;

            arPaymentDetail.PaymentAmt = 100;

            arPaymentDetail.ChequeNo = “MBB 123456″;

 

            arPayment.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, “TEST-0001″, 100);

 

            arPaymentDA.SaveARPayment(arPayment, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void UpdateARPayment()

        {

            BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(myDBSetting);

 

            BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPayment = arPaymentDA.GetARPayment(“TEST-0001″);

 

            // if arPayment == null, it means the AR Payment is not found.

            if (arPayment == null)

                return;

 

            arPayment.ClearDetails();

 

            BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetail = arPayment.NewDetail();

            arPaymentDetail.PaymentMethod = “CARD”;

            arPaymentDetail.PaymentAmt = 600;

 

            arPaymentDA.SaveARPayment(arPayment, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void DeleteARPayment()

        {

            BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(myDBSetting);

            arPaymentDA.DeleteARPayment(“TEST-0001″, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

        #endregion

    }

}