Journal reporting

Cette documentation est dépassée

La documentation la plus complète et actualisée est celle de Banana Comptabilité Plus : Essayez-le maintenant

In this article

In the following we will explain what need to be considered when creating a new BananaApps for a journal reporting.

  • Retrieving the transactions data.
  • Creating specific reports using the functionalities offered by the Banana API.

Documentation

Example files

Transactions table

The following table is an example of transactions:

We see above different types of transactions. The transactions can be on a single line or over multiple lines, with or without VAT.

The idea here is to print a journal’s table that contains all the accounts and the transactions. The final result it’s the following one:

 

Javascript API equivalent

To retrieve a Table object with all the amount registered on the accounts, we use the Journal’s API:

var journal = Banana.document.journal(Banana.document.originType, Banana.document.accountType);

where

originType specifies the row to be filtered for. Can be one of:

  • ORIGINTYPE_NONE no filter is applyied and all rows are returned (current and budget)
  • ORIGINTYPE_CURRENT only the normal transactions are returned
  • ORIGINTYPE_BUDGET only the budget transactions are returned

accountType specifies the row to be filtered for. Can be one of:

  • ACCOUNTTYPE_NONE no filter is applied and all rows are returned.
  • ACCOUNTTYPE_NORMAL only rows for normal accounts are returned
  • ACCOUNTTYPE_CC1 only rows for Cost Center 1 are returned
  • ACCOUNTTYPE_CC2 only rows for Cost Center 2 are returned
  • ACCOUNTTYPE_CC3 only rows for Cost Center 1 are returned
  • ACCOUNTTYPE_CC Cost Center rows are returned same as using (ACCOUNTTYPE_CC1 | ACCOUNTTYPE_CC2 | ACCOUNTTYPE_CC3)

The returned table has all the columns of the transaction's table plus many other (please, visit the Journal's API for more information).

Code example

A common use to create and use a journal table to retrieve transactions data would be:

// Create the journal table
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL);

// Read the table row by row and save some values
for (var i = 0; i < journal.rowCount; i++) {
       var tRow = journal.row(i);

       // From the journal table we take only the transactions rows
       if (tRow.value('JOperationType') == Banana.document.OPERATIONTYPE_TRANSACTION) {

              // Save some column values
              var jContraAccountGroup = tRow.value('JContraAccountGroup');
              var jRowOrigin = tRow.value('JRowOrigin');
              var jDate = tRow.value('JDate');
              var jAccount = tRow.value('JAccount');
              var jContraAccount = tRow.value('JContraAccount');
              var jDescription = tRow.value('JDescription');
              var jAccountDescription = tRow.value('JAccountDescription');
              var jAmount = tRow.value('JAmount');
              //...
       }
}

 

Results of the Journal’s table for each transaction

The journal’s table above is useful to better understand exactly how the journal works.

In general:

  • For each account used in the transaction table (AccountDebit, AccountCredit, CC1, CC2, CC3) the program generates a journal row with the JAccount column set with the specific account.
  • For a double entry account transaction that use AccountDebit, AccountCredit, AccountVat, CC1, CC2, CC3 the Journal will contain six rows. If the transaction has only AccountDebit and AccountCredit, then two rows will be generated.

All transactions in specific:

  • Doc 001 – Single line transaction without VAT

    Journal:


    One line for the 2020 JAccount
    One line for the 1010 JAccount

 

  • Doc 005 – Single line transaction with VAT

    Journal:


    One line for the 3260 JAccount
    One line for the 1000 JAccount
    One line for the 2020 JAccount

 

  • Doc 006 – Single line transaction with negative VAT

    Journal:


    One line for the 1000 JAccount
    One line for the 4100 JAccount
    One line for the 2020 JAccount. The VAT amount is in negative for the fact that the VAT amount is registered in credit, and therefore the amount must be pay to the tax authority

 

  • Doc 011 – Multiple lines transaction with VAT

    Journal:


    One line for the 1010 JAccount
    One line for the 3270 JAccount
    One line for the 2020 JAccount
    One line for the 3200 JAccount

 

 

Partager cet article: Twitter | Facebook | LinkedIn | Email