checkout/checkout = http://www.ipohonline.biz/cart account/register = http://www.ipohonline.biz/register product/category = http://www.ipohonline.biz/category product/search = http://www.ipohonline.biz/search checkout/cart = http://www.ipohonline.biz/checkout account/wishlist = http://www.ipohonline.biz/wishlist product/product = http://www.ipohonline.biz/product product/special = http://www.ipohonline.biz/special information/information = http://www.ipohonline.biz/information common/home = http://www.ipohonline.biz
Access GL Tutorial

 Introduction
In this tutorial, you will learn about accessing a GL document via code. In the first part of the tutorial, an example on how to programmatically add, edit and delete a Cash Book Entry will be shown while in the second part of the tutorial, an example on how to programmatically add, edit and delete a Journal Entry document will be shown. Note: For all the property table, the red entries are compulsory property 

 

 

Cash Book Entry
Start by creating a CashBookCommand object. This CashBookCommand works as a data access bridge to your database allowing you to retrieve, save or delete the Cash Book Entry information you are modifying. The code below shows how to create the object in your code:

Code Snippet
BCE.AutoCount.GL.CashBook.CashBookCommand cmd = BCE.AutoCount.GL.CashBook.CashBookCommand.Create(myDBSetting);

 

 

Adding A New Cash Book Entry

Add Code Snippet

public void AddCashBook()

{

    BCE.AutoCount.GL.CashBook.CashBookCommand cmd = BCE.AutoCount.GL.CashBook.CashBookCommand.Create(myDBSetting);

 

    BCE.AutoCount.GL.CashBook.CashBook doc = cmd.AddNew(BCE.AutoCount.GL.CashBook.CashBookType.CashPayment);

 

    doc.DealWith = “WATER & ELECTRICITY FOR SEP 06″;

    BCE.AutoCount.GL.CashBook.CashBookPaymentDetail paymentDetail = doc.AddPaymentDetail();

    paymentDetail.PaymentMethod = “CASH”;

    paymentDetail.PaymentAmount = 200;

    paymentDetail.ChequeNo = “MBB 124323″;

 

    BCE.AutoCount.GL.CashBook.CashBookDetail detail = doc.AddDetail();

    detail.AccNo = “900-1000″;

    detail.Amount = 200;

 

    doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Editing A Cash Book Entry

Edit Code Snippet

public void EditCashBook()

{

    BCE.AutoCount.GL.CashBook.CashBookCommand cmd = BCE.AutoCount.GL.CashBook.CashBookCommand.Create(myDBSetting);

 

    BCE.AutoCount.GL.CashBook.CashBook doc = cmd.Edit(“OR-000001″);

 

    if (doc == null)

        return;

 

    doc.ClearPaymentDetails();

    doc.ClearDetails();

 

    BCE.AutoCount.GL.CashBook.CashBookPaymentDetail paymentDetail = doc.AddPaymentDetail();

    paymentDetail.PaymentMethod = “CASH”;

    paymentDetail.PaymentAmount = 500;

 

    BCE.AutoCount.GL.CashBook.CashBookDetail detail = doc.AddDetail();

    detail.AccNo = “900-1000″;

    detail.Amount = 500;

 

    doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Deleting A Cash Book Entry

Delete Code Snippet

public void DeleteCashBook()

{

    BCE.AutoCount.GL.CashBook.CashBookCommand cmd = BCE.AutoCount.GL.CashBook.CashBookCommand.Create(myDBSetting);

    cmd.Delete(“OR-00001″);

}

 

 

Cash Book Class Properties
Cash Book Properties

Field Name Type(Length) Read-Only Description
Action BCE.AutoCount.GL.CashBook.CashBookAction O Returns The CashBookAction Object
Cancelled Boolean O Returns True If The Document Is Cancelled
CashBookDataSet DataSet O Returns The CashBook Dataset
Command BCE.AutoCount.GL.CashBook.CashBookCommand O Returns The CashBookCommand Object
CreatedTimeStamp BCE.Data.DBDateTime O Returns The Creation Time Of The Document
CreatedUserID BCE.Data.DBString(10) O Returns The User Id That Created The Record
CurrencyCode BCE.Data.DBString(5)   The Currency Code Assign To The Document
CurrencyRate Decimal(18,8)   The Currency Rate Assign To The Document
DataTableDetail DataTable O Returns The Detail Table
DataTableMaster DataTable O Returns The Master Table
DataTablePayment DataTable O Returns The Payment Table
DealWith BCE.Data.DBString(80)   The Deal With Assign To The Document
Description BCE.Data.DBString(80)   The Description Assign To The Document
DetailCount Int O Returns The Detail Count
DocDate BCE.Data.DBDateTime   The Document Date Assign To The Document
DocKey Long O Returns The Document Key Of The Document
DocNo BCE.Data.DBString(20)   The Document Number Assign To The Document
DocNo2 BCE.Data.DBString(25)   The Secondary Document Number Assign To The Document
DocNoFormatName String   The Document Number Format Name Assign To The Document
DocType CashBookType   The document type assign to the document
EnableAutoUpdateFirstPaymentAmount Boolean   The status to enable the auto update at first payment amount
ExternalLink BCE.AutoCount.Common.ExternalLink O Returns the ExternalLink accessor
ExternalLinkText BCE.Data.DBString   The ExternalLink text assign to the document
GLTrxID BCE.Data.DBInt64   The GL transaction ID assign to the document
InclusiveTax Boolean O The status flag to show if its inclusive tax
IsDocNoFormatFollowPaymentMethod Boolean O The status flag to use the document number format follow the payment method fucntion
LastModified BCE.Data.DBDateTime O Returns the last modified time
LastModifiedUserID BCE.Data.DBString(10) O Returns the user id that last modified the record
LocalTotalExTax BCE.Data.DBDecimal(18,4) O Returns the total exclusive tax in local currency
MasterRow DataRow O Returns the master row
NetTotal BCE.Data.DBDecimal(18,4) O Returns the net total
Note BCE.Data.DBString   The notes assign to the document
PaymentCount Int O Returns the payment count
PayTo BCE.Data.DBString   The Pay To assign to the document
PostDetailDesc Boolean   The status flag to post the detail description
PrintCount Short O Returns the print count
ReceiveFrom BCE.Data.DBString   The Receive From assign to the document
ScriptObject BCE.AutoCount.Scripting.ScriptObject O Returns the script object associated
SourceKey Long   The Source Key for the document
SourceType BCE.Data.DBString(2)   The Source Type for the document
Tax BCE.Data.DBDecimal(18,4) O Returns the tax amount
TaxableAmt BCE.Data.DBDecimal(18,4) O Returns the taxable amount
TaxBRNo BCE.Data.DBString(25)   The Tax BR Number assign to the document
Total BCE.Data.DBDecimal(18,4) O Returns the total amount
TotalExTax BCE.Data.DBDecimal(18,4) O Returns the total exclusive amount
TotalPayment BCE.Data.DBDecimal(18,4) O Returns the total payment amount
ToTaxCurrencyRate Decimal(18,8)   The To Tax Currency Rate assign to the document
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
UserData Object   The object that contains user data. This is use for scripting purposes

 

 

Cash Book Detail Properties

Field Name Type(Length) Read-Only Description
AccNo BCE.Data.DBString(12)   The Account Number assign to the detail
Amount BCE.Data.DBDecimal(18,4)   The Amount assign to the detail
DeptNo BCE.Data.DBString(10)   The department number assign to the detail
Description BCE.Data.DBString(100)   The description assign to the detail
DtlKey Long O Returns the detail key of the record
FurtherDescription BCE.Data.DBString   The further description assign to the detail
LocalAmount BCE.Data.DBDecimal(18,4) O Returns the amount in local currency
ProjNo BCE.Data.DBString(10)   The project number assign to the detail
RCHQAmount BCE.Data.DBDecimal(18,4)   The return cheque amount assign to the detail
Row DataRow O Returns the detail row
SalesAgent BCE.Data.DBString(12)   The sales agent assign to the detail
Seq Int O Returns the sequence of this detail
Tax BCE.Data.DBDecimal(18,4)   The Tax amount assign to the detail
TaxableAmount BCE.Data.DBDecimal(18,4)   The Taxable Amount assign to the detail
TaxAdjustment BCE.Data.DBDecimal(18,4)   The Tax Adjustment assign to the detail
TaxExportCountry BCE.Data.DBString(50)   The Tax Export Country assign to the detail
TaxPermitNo BCE.Data.DBString(20)   The Tax Permit Number assign to the detail
TaxType BCE.Data.DBString(14)   The Tax Type assign to the detail
ToAccountRate BCE.Data.DBDecimal(18,8)   The To Account Rate assign to the detail
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor

 

 

Cash Book Payment Detail Properties

Field Name Type(Length) Read-Only Description
BankCharge BCE.Data.DBDecimal(18,4)   The Bank Charge assign to the detail
BankChargeDeptNo BCE.Data.DBString(10)   The Bank Charge Department Number assign to the detail
BankChargeProjNo BCE.Data.DBString(10)   The Bank Charge Project Number assign to the detail
ChequeNo BCE.Data.DBString(20)   The Cheque Number assign to the detail
FloatDay Short   The Float Day assign to the detail
IsReturnedCheque Boolean   The status flag if the cheque is returned
PaymentAmount BCE.Data.DBDecimal(18,4)   The Payment Amount assign to the detail
PaymentBy BCE.Data.DBString(20)   The Payment By assign to the detail
PaymentMethod BCE.Data.DBString(20)   The Payment Method assign to the detail
ReturnedChequeDate BCE.Data.DBDateTime   The Returned Cheque Date assign to the detail
Row DataRow O Returns the detail row
Seq Int O Returns the sequence of this detail
ToBankRate BCE.Data.DBDecimal(18,8)   The To Bank Rate assign to the detail
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor

 

 

Journal Entry
Begin by creating a JournalEntryCommand object. This object is similar to the CashBookCommand object created previously for Cash Book Entry manipulation

Code Snippet
BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(myDBSetting);

 

 

Adding A New Journal Entry

Add Code Snippet

public void AddJournalVoucher()

{

    BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(myDBSetting);

 

    BCE.AutoCount.GL.JournalEntry.JournalEntry doc = cmd.AddNew();

 

    doc.Description = “DEPRECIATION FOR THE MONTH OF SEP 06″;

    BCE.AutoCount.GL.JournalEntry.JournalEntryDetail detail = doc.AddDetail();

    detail.AccNo = “903-0000″;

    detail.DR = 200;

    detail = doc.AddDetail();

    detail.AccNo = “300-B001″;

    detail.CR = 200;

 

    doc.DocDate = newDateTime(2007, 1, 1);

    doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Editing A Journal Entry

Edit Code Snippet

public void EditJournalVoucher()

{

    BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(myDBSetting);

 

    BCE.AutoCount.GL.JournalEntry.JournalEntry doc = cmd.Edit(“00001″);

 

    if (doc == null)

        return;

 

    doc.Description = “DEPRECIATION FOR THE MONTH OF SEP 06″;

    doc.ClearDetails();

    BCE.AutoCount.GL.JournalEntry.JournalEntryDetail detail = doc.AddDetail();

    detail.AccNo = “903-0000″;

    detail.DR = 500;

    detail = doc.AddDetail();

    detail.AccNo = “300-B001″;

    detail.CR = 500;

 

    doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

}

 

 

Deleting A Journal Entry

Delete Code Snippet

public void DeleteJournalVoucher()

{

    BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(myDBSetting);

    cmd.Delete(“JV-00001″);

}

 

 

JournalEntry Class Properties
JournalEntry Properties

Field Name Type(Length) Read-Only Description
Action BCE.AutoCount.GL.JournalEntry.JournalEntryAction O Returns the JournalEntryAction object
Cancelled Boolean O Returns true if the document is cancelled
Command BCE.AutoCount.GL.JournalEntry.JournalEntryCommand O Returns the JournalEntryCommand object
CreatedTimeStamp BCE.Data.DBDateTime O Returns the creation time of the document
CreatedUserID BCE.Data.DBString(10) O Returns the user id that created the record
CurrencyCode BCE.Data.DBString(5)   The currency code assign to this document
CurrencyRate Decimal(18,8)   The currency rate assign to this document
DataTableDetail DataTable O Returns the detail table
DataTableMaster DataTable O Returns the master table
Description BCE.Data.DBString(80)   The description assign to this document
DetailCount Int O Returns the detail count
DocDate BCE.Data.DBDateTime   The document date assign to this document
DocKey Long O Returns the document key of the document
DocNo BCE.Data.DBString(20)   The document number assign to this document
DocNo2 BCE.Data.DBString(25)   The secondary document number assign to this document
DocNoFormatName String   The document number format name assign to this document
ExTaxCR BCE.Data.DBDecimal(18,4) O Returns the exclusive tax amount for credit
ExTaxDR BCE.Data.DBDecimal(18,4) O Returns the exclusive tax amount for debit
ExternalLink BCE.AutoCount.Common.ExternalLink O Return the ExternalLink accessor
ExternalLinkText BCE.Data.DBString   The ExternalLink text assign to this document
GLTrxID BCE.Data.DBInt64   The GL Transaction ID assign to this document
InclusiveTax Boolean O Returns the status of if the document is using inclusive tax
JournalEntryDataSet DataSet O Returns the Journal Entry dataset
JournalType BCE.Data.DBString(10)   The journal type assign to the document
LastModified BCE.Data.DBDateTime O Returns the last modified time
LastModifiedUserID BCE.Data.DBString(10) O Returns the user id that last modified the record
LocalExTaxCR BCE.Data.DBDecimal(18,4) O Returns the exclusive tax amount for credit in local currency
LocalExTaxDR BCE.Data.DBDecimal(18,4) O Returns the exclusive tax amount for debit in local currency
LocalNetTotalCR BCE.Data.DBDecimal(18,4) O Returns the net total amount for credit in local currency
LocalNetTotalDR BCE.Data.DBDecimal(18,4) O Returns the net total amount for debit in local currency
LocalTaxableCR BCE.Data.DBDecimal(18,4) O Returns the taxable amount for credit in local currency
LocalTaxableDR BCE.Data.DBDecimal(18,4) O Returns the taxable amount for debit in local currency
LocalTaxCR BCE.Data.DBDecimal(18,4) O Returns the tax amount for credit in local currency
LocalTaxDR BCE.Data.DBDecimal(18,4) O Returns the tax amount for debit in local currency
LocalTotalCR BCE.Data.DBDecimal(18,4) O Returns the total amount for credit in local currency
LocalTotalCRExTax BCE.Data.DBDecimal(18,4) O Returns the total exclusive tax amount for credit in local currency
LocalTotalDR BCE.Data.DBDecimal(18,4) O Returns the total amount for debit in local currency
LocalTotalDRExTax BCE.Data.DBDecimal(18,4) O Returns the total exclusive tax amount for debit in local currency
MasterRow DataRow O Returns the master row
NetTotalCR BCE.Data.DBDecimal(18,4) O Returns the net total amount for credit
NetTotalDR BCE.Data.DBDecimal(18,4) O Returns the net total amount for debit
Note BCE.Data.DBString   The note assign to the document
PostGLAndTaxTrans Boolean   The status of the post to GL and Tax Transaction
PrintCount Short O Returns the print count
ScriptObject BCE.AutoCount.Scripting.ScriptObject O Returns the script object associated
SourceKey Long   The source key of the document
SourceType BCE.Data.DBString(2)   The source type of the document
TaxableCR BCE.Data.DBDecimal(18,4) O Returns the taxable credit amount
TaxableDR BCE.Data.DBDecimal(18,4) O Returns the taxable debit amount
TaxCR BCE.Data.DBDecimal(18,4) O Returns the credit tax amount
TaxDR BCE.Data.DBDecimal(18,4) O Returns the debit tax amount
TotalCR BCE.Data.DBDecimal(18,4) O Returns the credit total amount
TotalCRExTax BCE.Data.DBDecimal(18,4) O Returns the total credit exclusive tax amount
TotalDR BCE.Data.DBDecimal(18,4) O Returns the debit total amount
TotalDRExTax BCE.Data.DBDecimal(18,4) O Returns the total debit exclusive tax amount
ToTaxCurrencyRate Decimal(18,8)   The To Tax Currency Rate assign to the document
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor
UserData Object   The object that contains user data. This is use for scripting purposes

 

 

JournalEntryDetail Properties

Field Name Type(Length) Read-Only Description
AccNo BCE.Data.DBString(12)   The account number assign to the detail record
CR BCE.Data.DBDecimal(18,4)   The credit amount assign to the detail record
DeptNo BCE.Data.DBString(10)   The department number assign to the detail record
Description BCE.Data.DBString(100)   The description assign to the detail record
DR BCE.Data.DBDecimal(18,4)   The debit amount assign to the detail record
FurtherDescription BCE.Data.DBString   The further description assign to the detail record
ProjNo BCE.Data.DBString(10)   The project number assign to the detail record
RefNo2 BCE.Data.DBString(20)   The secondary reference number assign to the detail record
Row DataRow O Returns the detail row
SalesAgent BCE.Data.DBString(12)   The Sales Agent assign to the detail record
Seq Int O Returns the sequence of this detail
SupplyPurchase BCE.AutoCount.Tax.TaxSupplyPurchase   The Supply or Purchase tax to assign to the detail record
TaxableCR BCE.Data.DBDecimal(18,4)   The Taxable Credit amount assign to the detail record
TaxableDR BCE.Data.DBDecimal(18,4)   The Taxable Debit amount assign to the detail record
TaxAdjustment BCE.Data.DBDecimal(18,4)   The Tax Adjustment assign to the detail record
TaxBName BCE.Data.DBString(80)   The Tax B Name assign to the detail record
TaxBRNo BCE.Data.DBString(25)   The Tax BR Number assign to the detail record
TaxCR BCE.Data.DBDecimal(18,4)   The Credit Tax amount assign to the detail record
TaxDR BCE.Data.DBDecimal(18,4)   The Debit Tax amount assign to the detail record
TaxExportCountry BCE.Data.DBString(50)   The Tax Export Country assign to the detail record
TaxPermitNo BCE.Data.DBString(20)   The Tax Permit Number assign to the detail record
TaxType BCE.Data.DBString(14)   The Tax Type assign to the detail record
ToAccountRate BCE.Data.DBDecimal(18,8)   The To Account Rate assign to the detail record
TotalCR BCE.Data.DBDecimal(18,4) O Returns the Total Credit amount
TotalDR BCE.Data.DBDecimal(18,4) O Returns the Total Debit amount
UDF BCE.AutoCount.Data.UDFRecord O Returns the UDF accessor

 

 

Full Example

Code Snippet

using System;

using System.Data;

using BCE.Data;

 

namespace AccessingAccounting

{

    ///<summary>

    /// Summary description for AccessGL.

    ///</summary>

    public class AccessGL

    {

        private DBSetting myDBSetting;

 

        public AccessGL(DBSetting dbSetting)

        {

            //

            // TODO: Add constructor logic here

            //

            myDBSetting = dbSetting;

        }

 

        #region Accessing CashBookEntry

        public void AddCashBook()

        {

            BCE.AutoCount.GL.CashBook.CashBookCommand cmd = BCE.AutoCount.GL.CashBook.CashBookCommand.Create(myDBSetting);

 

            BCE.AutoCount.GL.CashBook.CashBook doc = cmd.AddNew(BCE.AutoCount.GL.CashBook.CashBookType.CashPayment);

 

            doc.DealWith = “WATER & ELECTRICITY FOR SEP 06″;

            BCE.AutoCount.GL.CashBook.CashBookPaymentDetail paymentDetail = doc.AddPaymentDetail();

            paymentDetail.PaymentMethod = “CASH”;

            paymentDetail.PaymentAmount = 200;

            paymentDetail.ChequeNo = “MBB 124323″;

 

            BCE.AutoCount.GL.CashBook.CashBookDetail detail = doc.AddDetail();

            detail.AccNo = “900-1000″;

            detail.Amount = 200;

 

            doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void EditCashBook()

        {

            BCE.AutoCount.GL.CashBook.CashBookCommand cmd = BCE.AutoCount.GL.CashBook.CashBookCommand.Create(myDBSetting);

 

            BCE.AutoCount.GL.CashBook.CashBook doc = cmd.Edit(“OR-000001″);

 

            if (doc == null)

                return;

 

            doc.ClearPaymentDetails();

            doc.ClearDetails();

 

            BCE.AutoCount.GL.CashBook.CashBookPaymentDetail paymentDetail = doc.AddPaymentDetail();

            paymentDetail.PaymentMethod = “CASH”;

            paymentDetail.PaymentAmount = 500;

 

            BCE.AutoCount.GL.CashBook.CashBookDetail detail = doc.AddDetail();

            detail.AccNo = “900-1000″;

            detail.Amount = 500;

 

            doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void DeleteCashBook()

        {

            BCE.AutoCount.GL.CashBook.CashBookCommand cmd = BCE.AutoCount.GL.CashBook.CashBookCommand.Create(myDBSetting);

            cmd.Delete(“OR-00001″);

        }

        #endregion

 

        #region Accessing JournalEntry

        public void AddJournalVoucher()

        {

            BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(myDBSetting);

 

            BCE.AutoCount.GL.JournalEntry.JournalEntry doc = cmd.AddNew();

 

            doc.Description = “DEPRECIATION FOR THE MONTH OF SEP 06″;

            BCE.AutoCount.GL.JournalEntry.JournalEntryDetail detail = doc.AddDetail();

            detail.AccNo = “903-0000″;

            detail.DR = 200;

            detail = doc.AddDetail();

            detail.AccNo = “300-B001″;

            detail.CR = 200;

 

            doc.DocDate = newDateTime(2007, 1, 1);

            doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void EditJournalVoucher()

        {

            BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(myDBSetting);

 

            BCE.AutoCount.GL.JournalEntry.JournalEntry doc = cmd.Edit(“00001″);

 

            if (doc == null)

                return;

 

            doc.Description = “DEPRECIATION FOR THE MONTH OF SEP 06″;

            doc.ClearDetails();

            BCE.AutoCount.GL.JournalEntry.JournalEntryDetail detail = doc.AddDetail();

            detail.AccNo = “903-0000″;

            detail.DR = 500;

            detail = doc.AddDetail();

            detail.AccNo = “300-B001″;

            detail.CR = 500;

 

            doc.Save(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(myDBSetting).LoginUserID);

        }

 

        public void DeleteJournalVoucher()

        {

            BCE.AutoCount.GL.JournalEntry.JournalEntryCommand cmd = BCE.AutoCount.GL.JournalEntry.JournalEntryCommand.Create(myDBSetting);

            cmd.Delete(“JV-00001″);

        }

        #endregion

    }

}