Developers Information
Extensions for Banana Accounting+
Introduction
By creating an Extension you can add new functionalities to the Banana Accounting Plus software:
- Create your own calculations or reports
- Interest calculation
- Statistics on transactions data
- Report based on special query
- Import data from proprietary file format
- Import data from a bank file format and automatically assign accounts.
- Import data from an invoice software.
- Consolidate accounting data entered with other software.
- Export data in a custom format
- Create an Export file for the Tax authorities.
- Export the balances of some accounts in a format ready to be published on internet or inserted in other documents.
- Check the accounting data
- Test transactions for a particular condition; You can show the rows that didn't meet the condition in a table, or display a message with detailed information to the user.
- Modify the accounting data
- Use the DocumentChange API to allows extensions to change the content or any open Banana Accounting file.
- Add, modify, replace, delete and move rows and columns of any table.
- Modify single row's fields, like for example the row's description or the transaction's exchange rate.
- Import external data and insert new accounts as well as new transactions in one single run.
Install extensions
In the Banana Accounting Marketplace you find many useful extensions.
- View and Install in Menu Extensions > Manage Extensions
Developing extensions
Extensions for Banana Accounting are written in Javascript and here we get the first resources that give you an idea.
- Reference documentation
- Extension Javascript file
This will show you how an extension file is structured. - Extension package
The package allows to pack many extensions together and also include different source and other resource files. - The different Extension's types
You can create extensions for import, preparing reports, etc.- General Extensions
For creating reports or changing data. - Import Extensions
For automatically converting a bank CSV and create accounting transactions.
- General Extensions
- Installation and running
- Introduction do major topics
- Extension Javascript file
- Start writing an extension.
- API Documentation
Fully commented class documentation and examples - Developing, Testing and Debugging
Examples file
- On github.com/BananaAccounting you will find the GitHub repository for Extensions.
How to Create Your First Banana Accounting Extensions
Here you can find very examples of extensions:
First Embedded Extension
This walkthrough provides step-by-step guidance for creating a simple Embedded Extension that uses JavaScript API to interact with Banana Accounting software.
How to create an embedded extension
The “Hello World!” program is a classic tradition in computer programming. It is a short and complete first program for beginners, and it is perfect as first embedded extension example.
There are three basic steps in order to create and run an embedded extension:
- Add the Documents table.
- Add the the JavaScript code to the Documents table.
- Run the embedded extension.
Add the Documents table
The embedded extension must be saved in the Documents table of the accounting file.
If it's not already present you need to add the Documents table in the accounting file with the menu command Tools > Add new features > Add document table.
Add the JavaScript code to Documents table
In the Documents table you can now add your embedded extension.
- In the ID column enter the file name (e.g. "helloworld").
- In the Description column enter a comment (optional).
- In the Attachments column you have to add the javascript code. Double click on the cell or select the edit symbol in the top right corner, then select Javascript code and confirm with OK.
- An editor where you can write your javascript code opens.
- Copy the following javascript code and paste it in the editor.
// @api = 1.0
// @id = ch.banana.uni.app.tutorialhelloworld
// @description = Tutorial: Hello world
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text
report.addParagraph('Hello World!!!');
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
- Change the attributes of the extension (for more information, see Extension's attributes):
- @id = <your_script_id>
This is the identification of the script.
In order to avoid duplicates, it is important to assign a unique id for each embedded extension. - @description = <your_script_description>
This is the name of the extension. The text will be displayed in the Extensions menu.
- @id = <your_script_id>
- When you are finished, confirm with OK. You can edit the code at any time by reopening the editor.
- Save the accounting file.
When you save the accounting file, the extension is also saved. You can run or edit it whenever you want.
Run the embedded extension
There are two ways to run an embedded extension:
- Click the run symbol in the Attachments cell where your code is located.
- From the Extensions menu, select the extension you want to run.
Useful resources
We have prepared Tutorial files for embedded Extensions that include samples code for most API. You can see how the API works and experiment with it.
Build your first File Based Javascript Extension
Introduction
This walkthrough provides step-by-step guidance for creating a simple extension that uses JavaScript API to interact with Banana Accounting software.
The more powerful extensions in packaged format are used for the development of extensions. But it is also possible to create an extension that is composed of just a single Javascript file. We will use this simple approach to explain how extensions work.
The “Hello World!” program is a classic tradition in computer programming. It is a short and complete first program for beginners, and it is perfect as first extension example.
There are three basic steps in order to experiment with extensions:
- Create the JavaScript file
- Install the extension
- Run the extension
Create the JavaScript file
- Use a text editor. Download a text editor from your choice (Notepad++, Sublime Text, etc.) that will let you code in a simple way.
It is important to be sure you can save with the UTF-8 encoding. Copy the following JavaScript code and paste it on your text editor.
// @id = ch.banana.app.helloworldexample // @api = 1.0 // @pubdate = 2018-10-24 // @publisher = Banana.ch SA // @description = Extension example: Hello world // @task = app.command // @doctype = *.* // @docproperties = // @outputformat = none // @inputdataform = none // @timeout = -1 function exec() { //Create the report var report = Banana.Report.newReport("Report title"); //Add a paragraph with the "hello world" text report.addParagraph("Hello World!"); //Print the report var stylesheet = Banana.Report.newStyleSheet(); Banana.Report.preview(report, stylesheet); }
- Change the attributes of the extension (for more information, see Extension's attributes):
- @id = <your_script_id>
This is the identification of the script.
In order to avoid duplicates, it is important to assign a unique id at avery script. - @description = <your_script_description>
This is the name of the extension. The text will be displayed in the dialogs.
- @id = <your_script_id>
- Save the file as helloworld.js.
You have now created your first extension!
Install the Extension
The next step is to install your Extension into the Banana Accounting software.
Before to use the Extension , and see the "Hello World!" text displayed as report in Banana, the App needs to be installed.
So, let's see how to install the "Hello World!" Extension.
- Open an accounting file in Banana Accounting
- In Banana select from the menu Extensions the command Manage Extensions...
- Click on Add from file...
- Select the helloworld.js file.
- Click on Open to install the extension.
- The Extension is displayed in the dialog.
By Selecting Installed from the left, all the installed Extensions (both local and online apps) will be displayed.
- Click on Close to close the Manage Banana Extensions dialog
You have now installed the Extension!
Important:
- Once installed, the JavaScript file needs to always remain in the same directory.
- If the JavaScript file is modified, the program will always use the last version.
Run the Extension
Finally, now it is possible to run the "Hello World!" extension and see the results.
To run the extension:
- In Banana select from the menu Extensions the Example Hello World Extension.
- The extension is executed and returns the following reports
Congratulations, you have now created, installed and executed your own extension!
Uninstall the Extension
In case you don't need an installed extension anymore, it is also possible to remove it from Banana Accounting software using the uninstall command.
- In Banana select from the menu Extensions the command Manage Extensions...
- Select the Installed section on the left in order to display all the currently installed Extensions.
- Select the Extensions you want to remove and click Uninstall.
- Confirm with Ok to remove the extension from Banana Accounting software.
The Extension is now removed from Banana Accounting software, but the JavaScript file (i.e. helloworld.js) is not removed from you computer.
More about Extensions
Create a First package Extension
This document explains the steps and activities to carry out with Visual Studio Code to create the .sbaa package used to create and distribute the Banana Plus extension.
The requirements for creating a package
To create a package with Visual Studio Code you must have met the following requirements:
- Install Visual Studio Code;
- Install CMake application;
- Install specific CMake Extensions to Visual Studio Code;
- Install Compiler toolset;
- Create a minimum structure of files in your project;
- Configuring the files that compiles CMake;
- Compiling the project with CMake in Visual Studio Code;
- Build and create the file .sbaa.
Install Visual Studio Code
Download and install Visual Studio Code from https://code.visualstudio.com.
Install CMake application
Download and install CMake from https://cmake.org. Use the default installation configurations.
Verify that the installed version is in your PATH, if not open CMake go to Menu Tools -> "How to install CMake for command line use" and follow the instructions.
Install specific CMake Extensions to Visual Studio Code
Click on the Extensions button and install the following extensions:
- twxs.cmake
CMake language support for Visual Studio Code (twsx). This is used for syntax highligh - ms-vscode.cmake-tools
CMake Tools (microsoft). This is used for enabling the cmake pane, where you can build the targets
Install Compiler toolset
Install the Microsoft Visual C++ compiler toolset as indicated to website: https://code.visualstudio.com/docs/cpp/config-msvc.
The steps are:
- Go to website: https://visualstudio.microsoft.com/it/downloads/
At the bottom of the website, you need to download and install the Tools per Visual Studio: "Build Tools per Visual Studio 2022" as indicated in the image below
- On the installation screen you must select and install what is indicated in the image, "Desktop development with C++" and the Optional as selected by default.
Create a minimum structure of files in your project
The minimum project structure to create the sbaa package file must have the following files:
- <extension_id>.js;
- <extension_id>.manifest.json;
- <extension_id>.qrc;
- /.vscode/settings.json;
- /test
- /testcases
- /testexpected
- /testresult
- <extension_id>.js;
- CMakeLists.txt;
- Readme.md;
- LICENCE.
An example of this structure you find in this repository: Simple project template.
Configuring the files that compiles CMake
extension_id.js
This file contain the main programm of extension. The name of this extension must be unique and follow the next rules:
country.developer.language.nameextension.js
Example:
ch.banana.en.extensionexample.js
To learn more about the contents of the file you can follow this link.
extension_id.manifest.json
The name of this file is the same of file extension_id.
Example name of file extension_id.js: ch.banana.en.extensionexample.js.
Example name of extension_id.manifest.json: ch.banana.en.extensionexample.manifest.json.
If you create a .sbaa file, also include a manifest file. The manifest.json file is a JSON-formatted file, which you can include in the .sbaa file through the .qrc file.
Using manifest.json, you specify basic metadata about your package such as the title, description and version.
The file name must end with the extension 'manifest.json'
The parameter about this file could be:
{
"category": "productivity",
"country":"universal",
"countryCode":"un",
"description": "Simple extension project",
"description.en": "Simple extension project",
"description.it": "Progetto semplice di estensione",
"description.fr": "Projet d'extension simple",
"description.de": "Einfaches Erweiterungsprojekt",
"id": "ch.banana.sample.simpleproject",
"language":"en",
"publisher": "Banana.ch",
"title": "Simple extension project",
"title.en": "Simple extension project",
"title.it": "Progetto semplice di estensione",
"title.fr": "Projet d'extension simple",
"title.de": "Einfaches Erweiterungsprojekt",
"version": "1.0"
}
If you have only one language of your extesion, you can write one description and one title (e.g. description.en, title.en).
- Available categories: export, import, invoice, invoice reminder, invoice statement, productivity.
If you don't specify the category ("category": ""), the program will take the category from the first app included in the package. If you don't specify country or language, the app will be shown for any country or language; - All tags are optional.
extension_id.qrc
This file is used to locate the resources used to create the sbaa package. The list of this file contains icons, images used by the extension, manifest.js and others. All files that needed to create the extension of Banana is listed in this code. For more explanation of files Resource Collection Files (QRC) you see this link.
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>manifest.json</file>
<file>ch.banana.sample.simpleproject.js</file>
<file>image.png</file>
<file>./src/exec.js</file>
</qresource>
</RCC>
/.vscode/settings.json
In Visual Studio Code, create under the extension's main folder a file named .vscode/settings.json and set the following CMake options:
- BAN_QT_RCC: path to the Qt rcc tool. The rcc Tool is used to compile the extension to a sbaa package.
- BAN_EXE_ PATH: path to the BananaPlus executable. The BananaPlus executable is used to run the tests defined in the project.
You can copy the content from the following example and modify the paths depending on your system and Qt's version you have installed on your system.
Example for Windows:
Replace "user_name" with the appropriate user name.
Example for macOS:
CMakeLists.txt
CMakeLists is a file that contain a series of directives and istruction that describe the source files, libraries about the project. This file is used to configure the process of compilation and generation of files necessary by Visual Studio Code. One important thing is that the file name is exactly CMakeLists.txt otherwise you will not see the "CMake: Select a Kit" command in the toolset of Visual Studio Code which allows the selection of which compiler to use for your CMake project.
The code of file:
cmake_minimum_required(VERSION 3.16)
project(simpleproject)
set(EXTENSION_ID "ch.banana.sample.simpleproject")
# CMake options
# Create a file .vscode/settings.json with the following content to set the options,
# adapt the path to your environment
# {
# "cmake.configureSettings": {
# "BAN_QT_RCC": "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/rcc.exe",
# "BAN_EXE_PATH": "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/BananaPlusDev.exe",
# }
# }
set(BAN_QT_RCC $ENV{BAN_QT_RCC} CACHE FILEPATH "Path to Qt rcc executable")
set(BAN_EXE_PATH $ENV{BAN_EXE_PATH} CACHE FILEPATH "Path to BananaPlus executable, used to run tests")
# This target is used to build the extension to a sbaa package
add_custom_target(${PROJECT_NAME}
COMMAND ${BAN_QT_RCC} -o ${EXTENSION_ID}.sbaa --binary ${EXTENSION_ID}.qrc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
SOURCES ${EXTENSION_ID}.qrc
)
# This target is used to run the tests of the extension
add_custom_target(test
COMMAND ${BAN_EXE_PATH} -cmd=runtestsapps -cmd_exit=1 -cmd_p1=${CMAKE_SOURCE_DIR}/${EXTENSION_ID}.sbaa -cmd_op=A
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
The parts of configurations in this code:
project(simpleproject) → Rename simpleproject of name of your project.
set(EXTENSION_ID "ch.banana.sample.simpleproject") → Rename "ch.banana.sample.simpleproject" of name of your id project.
set(BAN_QT_RCC $ENV{BAN_QT_RCC} CACHE FILEPATH "Path to Qt rcc executable") → Path example: "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/rcc.exe", which usern_name is yours.
set(BAN_EXE_PATH $ENV{BAN_EXE_PATH} CACHE FILEPATH "Path to BananaPlus executable, used to run tests") → Path example: "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/BananaPlusDev.exe", which usern_name is yours.
Readme.md
This file contain the explanation of the functionalities and the other detail about about your extension. Is the main file that contain the documentation of your extension.
LICENCE
A project's LICENSE file in CMake is a document that specifies the legal terms for using, modifying, and distributing the project's source code and binaries. The LICENSE file should contain the name of the license you choose, a brief description of its terms, and a full copy of the license text.
Compiling the project with CMake in Visual Studio Code
This section explain how do you compile your project in Visual Studio Code.
1. Open your folder of the project in Visual Studio Code;
2. Press press Ctrl+Shift+P, enter "CMake: Select a Kit" and press return, select the kit you want to use. Do not select the "[Scan for kits]" or "[Unspecified]".
3. If your configuration is correct, you see the messagge "Configuring done" and "Generating done". You see the path of your file building in the output of terminal of Visual Studio Code;
4. If the previous compilation was correct, appears in the Activity bar (on the left) the new icon that need to create building, press this icon and you see the main project.
5. Right click on the main project and select Run utility
Extension Reference Design
Banana Accounting offers JavaScript extensions as a way to extend the functionality of the software.
These extensions are essentially a JavaScript file that has a specific structure.
Use of extensions
They allow users to add custom features or automate specific tasks in the accounting software, catering to unique business needs or personal preferences.
The JavaScript extensions in Banana Accounting can vary widely in their functions. Some common examples might include:
- Custom Reporting: Tailoring financial reports to meet specific requirements that are not covered by the standard features of the software.
- Data Import/Export: Automating the process of importing or exporting data to and from different formats or systems.
- Automated Calculations: Performing complex calculations automatically, such as currency conversions, tax computations, or custom financial analyses.
- Integration with Other Tools: Connecting Banana Accounting with other tools or platforms, such as CRMs, eCommerce platforms, or external databases.
Extensions format and distribution
Banana Accounting Extensions have different format and availability.
- Single file (javascript file)
- It is the base format for all the extensions.
- It is composed by a single .js file
- Easier to edit (external text editors), move and update.
- Can be included in the menu Extensions.
- Can be used by different accounting file.
- Embedded extensions
- Extension file saved in the Document table.
- Not available in the menu Extensions.
- Only relative to the file where it is included.
- Editing only with the limited internal editor.
- On the Embedded Extensions JavaScript Tutorial you will find the documentation and different basic examples embedded in a document that you can run and edit.
- Packaged Extensions
- Is a compressed file that can include different resource.
The suffix of the file is .sbaa - Can include one or many single file extension.
- Can include any digital resource .
- Can be included in the menu Extensions.
- Can be used by different accounting file.
- The current format used to create extensions.
- Protected from user modification.
- Is a compressed file that can include different resource.
Extensions Store and Installation
In Menu Extension > Manage Extensions you can see the list of all available extensions.
- Clicking on install the extension is downloaded and is available to be used in the Extension menu.
- Extensions are also installed automatically if you open an accounting file that in the File Properties specify a needed extensions.
From Manage extensions you can also install:
- Local extensions.
- Extensions with a url.
Extensions Menu
The Extension Menu list all extensions that can be executed for this application.
Within the Attribute section of the extension, the developer can specify that an extension apply only to certain file. In this case the command will be listed only if the file has the specified characteristics.
The extension will apply only to:
- A specific type of file (for example double entry accounting).
- A file that include a specific term in the File properties.
- A file that require the specific extension.
Test framework for extensions
When we develop extension we require that a series of test are created to assure that when they are changed there are not regressions.
We offer a test framework to automate the testing, see:
Extension file Javascript
A Banana Extension is Javascript compliant script files (ECMA-262), containing the Attributes and Javascript code.
The single Javascript extension file, can be distributed as:
- An embedded extension within the accounting file.
Are automatically available within the accounting files. - Installable extensions
Once Extensions are installed you can use with any accounting file.
Extension linked to an accounting file are installed automatically at startup.- As Single file extension that reside on a local computer.
- An extension package that can contains other multiple extensions and other resources.
Javascript and Banana API
You can use any of the supported javascript functions, objects and properties see: Qt ECMAScript Reference.
Banana Accounting also make available the Banana API that you can use to retrieve data or create report objects or else.
Extensions interact with Banana Accounting through some global objects made available by Banana Accounting, like for example 'Banana.document'. Those objects are described under the Banana Script API.
Extension file structure
Extension files have two parts:
- Extension Attributes
Apps Attributes are special formatted JavaScript comment lines, at the beginning of the file. The apps attributes have a left part (name of the attribute) and right part, with the value. Attributes give information about the script, like its purpose, description and so on.- Required attributes are:
- / @api = 1.0
- // @id = ch.banana.apps.example.docfilepath
- // @description = Hello world
- // @task = app.command
- // @doctype = nodocument
- // @publisher = Banana.ch SA
- // @pubdate = 2015-05-12
- Include attribute
The script can include other files with the attribute- // @includejs = other.js
- Required attributes are:
- JavaScript code
The code must be included within functions. Functions are divided in startup functions, settings functions and normal functions.- Startup functions
Are called by Banana software when the script is executed.
The name of the function called depend on the type of the App.- exec() for following types:
- app.command
- export.file
- export.rows
- export.transactions
- import.transactions
- import.rows
- import.accounts
- import.categories
- import.exchangerates
- import.vatcodes
- report.general
- printDocument() for the following types:
- report.customer.invoice
- report.customer.statement
- report.customer.reminder
- exec() for following types:
- settingsDialog() function
It is called by the Banana Software when the user click on the Setting button, relative to the specific app.
The setting data is saved within the Accounting file.
See: Extension's Settings. - Other JavaScript functions
You can write any functions that is necessary.
- Startup functions
Extension id file
The name of this extension must be unique and follow the next rules:
- The @id attribute is used to identify the script;
It is also used by the help system, that open the help page in the browser. - In order to avoid duplicates banana.ch use the following scheme: developer.country.type.name
Value | Description | Example |
---|---|---|
developer | The developer of the app. | ch.banana |
country | The country for which the app is designed. If the app is not designed for a specific country. Use uni as universal. | ch, it, de, ... uni |
type | The type of the app. | app, import, invoice, reminder, statement |
name(*) | The name of the app. | vatreport, voucher,... |
For Invoices as 'name' we use the following scheme: country + number (numbers between 1 and 499):
- Example for Switzerland: ch01, ch02, ch03,...
- Example for all countries: uni01, uni02, uni03,...
For Reminders as 'name' we use the following scheme: country + number (numbers between 500 and 599):
- Example for Switzerland: ch500, ch501, ch502,...
- Example for all countries: uni500, uni501, uni502,...
For Statements as 'name' we use the following scheme: country + number (numbers starting from 600):
- Example for Switzerland: ch600, ch601, ch602,...
- Example for all countries: uni600, uni601, uni602,...
Examples:
- @id = ch.banana.ch.invoice.ch01
- @id = ch.banana.uni.reminder.uni500
- @id = ch.banana.uni.invoice.companyxx
- @id = ch.banana.ch.app.vatreport2018
Example:
ch.banana.ch.extensionexample.js
Extensions types, startup functions and how to run them
The Extension type is defined within the attribute @task.
For each type there is a specific startup function.
See: Exension's types.
The app.command is used for General extensions.
// @task = app.command
Include directive in JavaScript files
JavaScript extension files can use the directive @includejs to include other JavaScript files or use the command .
This included file need to be included in the package. Make sure that all included .js file are also specified in the qrc package description.
// Include a script via @includejs attribute // @includejs = somescript.js" // Include a script via Banana.include() method Banana.include(somescript.js);
Startup function exec([inData, options])
The functio exec() is required by most extensions and in particularly for the General Extensions.
The exec() funciton can have the following arguments:
- inData: the requested input data as a string or a Banana.Document object;
- This parameters is only used for import scripts, for all other tasks this parameter is just null;
- options:
options as an object that can contains those parameters; - useLastSettings: if true the script executes with the last used settings and doesn't show a setting's dialog;
Return value
The exec() function will return a null value or a string.
For import script the format is defined by the attribute @outputformat.
For Productivity extensions it is a JSon document or an Error.
- tablewithheaders
A tab separated text (csv) containing different columns.
The first row is the table header. - transactions.simple
A tab separated text (csv) containing the movement of a account in the form of income and expenses. - Empty type
JSon document that contains documentchange data, that allow to add, modify and delete data within the tables.
See: - @Error:
It an error occurs the function can return a string that begins with "@Error:", for example "@Error:Invalid file format".
The error text is then displayed to the user.
Extension's help and visibility
For marketplace application the Id of the extension is also used to provide context help to the documentation.
Visibility in menu extension
General Extensions are usually visible in the Menu Extension, but the developer can limit the visibility by adding specific properties.
- The attribute @doctype of the file open should match the File that is open.
- // @doctype = 100.110
- The command would be visible only if the accounting file is of type "Double entry with VAT".
- The File Properties > Other > Properties contains a property text that is defined in the property.
By setting the @docproperties in the attribute, an extension can restrict the visibility to only a file that suitable. - The @visibility attribute further allow to limit the visibility.
General Extensions that are part of a package will be visible and started within a Sub-Menu relative to the package.
This way all extensions relative to the package will be grouped together.
Security model
Extensions are secure for the fact that are confined within Banana.
Extensions are NOT ALLOWED to directly write or read file, web resource, change computer setting or execute programs.
Extensions , contrary to Excel Macro, can be run with the confidence, they will not change any data and modify any file or computer settings.
To access or write to file you need to use the Banana Api that display a dialog box to the user.
- To write file you need to use the export functionality, that display a dialog where the user indicate the file name where to save.
- To import file you need to use the import functionality that display a dialog where the user specify the file name.
Extension "Hello World" example
Here an example that open a print preview windows, and show a document with the text "Hello world!!!". Other examples are found in the Extensions tutorial.
// @id = ch.banana.report.helloworld
// @version = 1.0
// @doctype = nodocument
// @publisher = Banana.ch SA
// @description = Hello world
// @task = app.command
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text
report.addParagraph('Hello World!!!');
//Preview the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Extension with a setting's dialog example
Here an example that use a dialog to input a text. Other examples are found in the Extensions tutorial.
// @id = ch.banana.report.settingsdialog
// @version = 1.0
// @doctype = *
// @publisher = Banana.ch SA
// @description = Example for settings dialog
// @task = app.command
// @timeout = -1
function exec(inData, options) {
// Show dialog if options.useLastSettings is not set or is false
if (!options || !options.useLastSettings) {
if (!settingsDialog())
return; // return if user pressed cancel
}
// Get the settings
var text = Banana.document.getScriptSettings();
//Create the report
var report = Banana.Report.newReport('Report title');
report.addParagraph('You entered: "' + text + '"');
report.addParagraph(new Date().toString());
//Stylesheet
var stylesheet = Banana.Report.newStyleSheet();
//Preview the report
Banana.Report.preview(report, stylesheet);
}
function settingsDialog() {
// Ask the user to enter a text that will be printed in the report
var text = Banana.document.getScriptSettings();
text = Banana.Ui.getText("Enter a text", "The text will be printed in the report", text);
if (typeof(text) === 'string') {
Banana.document.setScriptSettings(text);
return true;
}
return false; // cancel pressed
}
Extension's Attributes
At the beginning at the script there should be a part that define the Extension's Attribute (See Extension File Structure).
// @api = 1.0
// @id = ch.banana.apps.example.docfilepath
// @description = Hello world
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2015-05-12
// @inputdatasource = none
// @timeout = -1
The attribute is a commented text line
- Start with //
- Followed by the attribute that start with @
- Followed by the " = " and the value
Tags defines the purpose (import, export, extract, ...), the name displayed in the dialogs, the kind of data it expect to receive, the kind of data it returns, and other information of the script. Tags are inserted at the beginning of the script in comment's lines though the following syntax: "// @tag-name = tag-value".
Attribute list
Attribute name | Required | Value 1) | Description |
@api | Required | The required API version. Available API versions: | Define the required API to be executed in the form of MAIN_VERSION.SUB_VERSION The implemented API in the application have to be equal or newer. See the page API Versions for a list of implemented versions, and the Changelog page for the list of changes in the API. |
@contributors | List of contributors separated by ';' | This attribute contains the list of people that contribute to the developing of the Banana Extensions. | |
@description[.lang] | Required | The name or description of the script | This text will be displayed in the dialogs. This tag is localizable. |
@docproperties | any text | Define a property the script is written for.
It works in combination of the @docproperties and @visibility | |
@doctype | Required | nodocument * XXX.* XXX.YYY !XXX.YYY ... | Define the type of document the script is written for. nodocument = doesn't require an open document, the add-on is always visible
300.* = All productivities App The sign "!" before the file type of the file will exclude the indicate type. The above codes can be combined together like the following examples: 100.130 = for double entries with VAT and with foreign currencies |
@exportfilename | A string defining the name of the file where to export the data. | If the string contains the text <Date>, it will be replaced by the current date in the format of yyyyMMdd-hhmm. | |
@exportfiletype | A string defining the type of data exported txt | This parameter is used for export scripts, it defines the type of exported data and it is used for the extension in the save file dialog. | |
@id | Required | An identification of the script | It is used when setting and reading the preferences. In order to avoid duplicate banana.ch use the following scheme. country.developper.app.domain.name for example: ch.banana.app.patriziato.consuntivopersubtotali |
@includejs | Relative path to a javascript .js file to load before the execution of the script. | Include the javascript file. Every function and object defined in the file are then available to the current script. The application searches for include files in this order:
Each distinct included script is evaluated once, even if it is included more than one time from different scripts. | |
@inputdatasource | One of the following values: none openfiledialog opendirdialog fixedfilepath 2) | With this attribute you can specify if you don't need to input data, if you want the user to select a file to import (openfiledialog), a directory to import (opendirdialog), or if you want to get a file which path is defined in @inputfilepath. If you set fixedfilepath the program will ask the user the permission to open this file, the user's answer will be saved for the next execution. | |
@inputencoding | The encoding of the input data. One of the following values: | The encoding used to read the input file (for import apps). If the attribute is empty or not defined, the application try to decode the input data with utf-8, if it fails, the application decode the input data with latin1. For a complete list see QTextCodec | |
@inputfilefilter[.lang] | The file filter for the open file dialog Ex.: Text files (*.txt *.csv);;All files (*.*) | This value describes the file filters you want to show in the input file dialog. If you need multiple filters, separate them with ';;' for instance. This tag is localizable. | |
@inputfilepath | The file to read for the input data | If the script has the value fixedfilepath as @inputdatasource, you can define here the path of the file to load. | |
@inputformat | One of the following values: text ac2 | If "text" the filter receive the selected file in inData as a text. If "ac2" the filter receive the selected file in inData as a Banana.Document object. | |
@outputencoding | The encoding of the input data. One of the following values: | The encoding used to write the output file (for export apps). For a complete list see QTextCodec | |
@outputformat | One of the follwing values: tablewithheaders transactions.simple | If the script has an import tasks this value define the format of the returned value. The format transaction.simple contains the transaction as income / expenses. For details of the formats see Import data from a txt file. | |
@pubdate | Required | The publication date in the format YYYY-MM-DD | This publication date is also used for scripts published by Banana.ch to check if newer version exist. |
@publisher | The publisher of the script | ||
@task | Required | One of following values: accounting.payment app.command create.init export.file export.rows export.transactions import.file import.rows import.transactions import.accounts import.categories import.exchangerates import.vatcodes report.general report.customer.invoice report.customer.statement report.customer.reminder | This value define the purpuse of the script, and determine in which dialog or menu the script is visible.
|
@testapp | Path and name of the test(s) app. The path can be relative or absolute, contains wildcards or be a list of files separated by ';'. Default is './test/*.test.js | This can be used if there is a test app and the path to the test app is different to the default path. If the path is not in the script's folder, a confirmation dialog is showed to the user before running the tests. Since Banana 9.0.4 | |
@testappversionmin @testappversionmax | Only for test cases. Minimum and mximum application's version to whitch the test is applicable. | ||
@timeout | The timeout for the script in milliseconds, default is 2000 (2 seconds). If you set -1 the timeout is disabled and the application allow you to abort it though a progress bar. | If the script takes longer than this value to finish, it will be aborted and a message showed. If you have a script with a very long run time, you can increase the timeout or set it to -1. | |
@visibility | always never extensionlinked | Define if the extension will be added to the menu Extensions.
from version 10.0.7 |
1) Default values are listed in bold.
2) Function not yet available
Example:
// @api = 1.0
// @id = ch.banana.apps.example.docfilepath
// @description = Hello world
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2015-05-12
// @inputdatasource = none
// @timeout = -1
/**
* Hello world example for Banana Accounting.
*/
function exec(inData) {
Banana.Ui.showInformation("", "Hello World");
if (Banana.document) {
var fileName = Banana.document.info("Base","FileName");
Banana.Ui.showInformation("Current document", fileName);
}
}
Include files, styles and images in your extension
You can create extensions that use external files. In this page we explain how to use an external css file in order to print the report. With this you can avoid to use javascript to set the style attributes.
As with Javascript, CSS is also limited to the attributes listed on the page Banana.Report.ReportStyle.
What do you need:
- The extension script (file .js).
- The CSS stylesheet (file .css).
- Create a package (file .sbaa)
Extension script (file .js)
In your extension javascript file:
- Take the external CSS stylesheet file with getLocalFile(path).
- Read and take the content with read().
- Parse the content in order to load the styles with parse(text).
var textCSS = "";
var file = Banana.IO.getLocalFile("file:script/yourFile.css");
var fileContent = file.read();
if (!file.errorString) {
Banana.IO.openPath(fileContent);
textCSS = fileContent;
} else {
Banana.console.log(file.errorString);
}
// New stylesheet
var stylesheet = Banana.Report.newStyleSheet();
// Parse the CSS text
stylesheet.parse(textCSS);
CSS stylesheet (file .css)
In your css stylesheet file:
- Insert the text following the CSS specification.
@page {
margin-top: 10mm;
margin-bottom: 10mm;
margin-left: 20mm;
margin-right: 10mm;
}
body {
font-family: Helvetica;
font-size: 10pt;
}
table {
font-size: 8px;
width: 100%;
}
table.table td {
border-top-style: solid;
border-top-color: black;
border-top-width: thin;
border-bottom-style: solid;
border-bottom-color: black;
border-bottom-width: thin;
border-left-style: solid;
border-left-color: black;
border-left-width: thin;
border-right-style: solid;
border-right-color: black;
border-right-width: thin;
}
.column1 {
width: 73%;
}
.column2 {
width: 13%;
}
.column3 {
width: 13%;
}
.table-header {
color: #ffffff;
background-color: #337ab7;
font-weight: bold;
text-align: right;
}
.amount-totals {
background-color: #F0F8FF;
text-align: right;
font-weight: bold;
}
Extension package (file .sbaa)
Now generate the Extension Package file (.sbaa) containing:
- The javascript file.
- The CSS file.
To do that:
Create the manifest file (.json) in the same directory of the javascript and css files.
{ "category": "productivity", "country":"switzerland", "countryCode":"ch", "description": "Extension with css", "description.en": "Extension with css", "language":"en", "publisher": "Banana.ch", "title": "Extension with css", "title.en": "Extension with css", "version": "1.0" }
Create the Qrc resource file (.qrc) in the same directory of the javascript and css files.
<!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>yourJavascriptFile.js</file> <file>yourCssFile.css</file> <file>manifest.json</file> </qresource> </RCC>
- Open Banana Accounting
- Drag the .qrc file in Banana Accounting.
- It will ask you if you want to compile the file and will generate a .sbaa file.
Define CSS file in Documents table
You can write the CSS code directly in the documents table and access the data via javascript as shown in the example
/**
* CSS file defined in Documents table.
*/
if (userParam.embedded_css_filename) {
var cssFiles = [];
var documentsTable = Banana.document.table("Documents");
if (documentsTable) {
for (var i = 0; i < documentsTable.rowCount; i++) {
var tRow = documentsTable.row(i);
var id = tRow.value("RowId");
if (id === userParam.embedded_css_filename) {
// The CSS file name entered by user exists on Documents table so it can be used as CSS
textCSS += documentsTable.findRowByValue("RowId",userParam.embedded_css_filename).value("Attachments");
}
}
// Parse the CSS text
repStyleObj.parse(textCSS);
}
}
In this example:
- userParam
An object containing different parameters user can define with the Dialog PropertyEditor. - embedded_css_filename
A the parameter where user enter the file name of the embedded css file saved in the Documents table. The file name is the content of the column Id (e.g. "myStyle.css").
Extension's Settings
Extensions settings allow to customize the Extension, for example:
- Setting for the printing.
- Header of a report that are set once only.
Function settingsDialog()
If you provide customization you should add a function settingDialog().
This function will called:
- When the user click on the Set Parameters on the Manage Extensions dialog.
- For Import extension in the Dialog Import > Button Settings.
- For Report extensions in the Printing Dialog > Button Settings.
Take care that:
- The extension is responsible to manage to load and save the settings.
- Return value.
- null if the user ha clicked on cancel button.
- any other value if the user has changed the settings.
A simple and powerful way to let the user customize the setting is by using the:
Saving the settings
The function settingDialog() should:
- Read the existing setting with the Banana.document.getScriptSettings();
- Request user to enter the information
- Set the modified values with the function Banana.document.setScriptSettings(paramToString);
The JSon text will be saved within the accounting file.
function settingsDialog() {
var param = initParam();
var savedParam = Banana.document.getScriptSettings();
if (savedParam.length > 0) {
param = JSON.parse(savedParam);
}
param = verifyParam(param);
param.isr_bank_name = Banana.Ui.getText('Settings', texts.param_isr_bank_name, param.isr_bank_name);
if (param.isr_bank_name === undefined)
return;
var paramToString = JSON.stringify(param);
Banana.document.setScriptSettings(paramToString);
}
Reading the settings
the function Exec() or any other function should then read the settings using the Banana.document.getScriptSettings().
Before using the setting you should check that they are valid and possibly provide a function that verify and eventually update the settings.
function printDocument(jsonInvoice, repDocObj, repStyleObj) {
var param = initParam();
var savedParam = Banana.document.getScriptSettings();
if (savedParam.length > 0) {
param = JSON.parse(savedParam);
param = verifyParam(param);
}
printInvoice(jsonInvoice, repDocObj, repStyleObj, param);
}
Sharing the setting with other extensions
The function Banana.document.setScriptSettings(paramToString); will save the setting in the accounting file under the Id of the extension.
If you need to share the settings with other extensions, like in case of a series of packaged extensions you should use the Banana.document.setScriptSettings((id, value).
And to read the setting use Banana.document.getScriptSettings((id).
For more information siee Banana.document.
Example:
// Save script settings
var paramString = JSON.stringify(param);
var value = Banana.document.setScriptSettings('ch.banana.vat', paramString);
Translations and multi language extension's
With BananaPlus you can provide translations to your extensions in a very simple and straightforward way. After you make the extension ready to be translated, adding a new language is as simple as adding a file to the package, without the need to change the source code.
Make an extension translatable
To make an extension translatable you need to:
- Install CMake, Visual Studio code and setup your development environment
- Mark strings for translation with the functions qsTr() or QT_TRANSLATE_NOOP() in *.js and *.qml files;
- Add a CMakeLists.txt file to your project and modify it;
- Translate strings with QtLinguist;
- Add the translations files *.qm in the resource file *.qrc;
- Build and deploy the extension's package;
You find a working complete example with the code described in this page on our GitHub Repository at: Sample extension for string translations
Limitations:
- JS and QML files can not contains a dot '.' in the file name: for example my.extention.js is no valid, but my_extension.js is valid;
- JS and QML files can not be renamed via the property Alias in resource files (*.qrc), for example from my.extention.js to my_extention.js or main.js;
- Translations files (*.qm) have to be found under the subfolder /translations;
Setup development environment
Follow the steps on the page setup your development environment.
Mark strings for translation
Strings to be translated have to be marked in .js or .qml files using the function qsTr() or QT_TRANSLATE_NOOP().
Strings marked for translations are extracted from .js and .qml files and inserted in translation's files *.ts. Translations files are created and compiled with Qt Creator and the translations done with Qt Linguist.
Function qsTR()
With the function qsTr() you mark strings to be translated in the application's language. Those are usually texts showed in the user interface (dialogs, messages, ...).
Example:
var translatedText = qsTr("Account card");
// The variabile translatedText contains the translated string "Account card"
// in the application's language
Function QT_TRANSLATE_NOOP()
With the function QT_TRANSLATE_NOOP() you mark strings to be translated in the document language. Those are usually texts printed in reports or invoices.
Those translation are retrieved through the API Banana.Translations.
Example:
// Exemple for function QT_TRANSLATE_NOOP
var myReportTexts = {};
myReportTexts.account_card = QT_TRANSLATE_NOOP("MyReport", "Account card"); // Mark text for translation
// NB: The variable myReportTexts.account_card contains the source code string "Account card"
// You need a Banana.Translator object to translate it in the desired language
// Get translator for the document's language
var documentLanguage = "en"; //default
if (Banana.document) {
documentLanguage = Banana.document.locale.substring(0,2);
}
var docTranslator = Banana.Translations.getTranslator(documentLanguage, "MyReport");
// Translate to the document's language
var myReportTranslatedText = docTranslator.tr(myReportTexts.account_card);
Add a CMake project file
A CMakeLists.txt project file is needed to extract all strings marked for translation from .js and .qml files and build the .sbaa extension's package.
Below is a template of a project file for translating an extension, you can copy it and modify it:
- copy the example and save it as CMakeLists.txt in your project folder;
- rename the project name translations_project to your desired name;
- renane the extension id ch.banana.translations to your desired id;
- add the desired languages under the variable translations_files;
- add source files as needed to the main target;
cmake_minimum_required(VERSION 3.16)
project(translations_project) # <!-- CHANGE THE PROJECT'S NAME
set(EXTENSION_ID "ch.banana.translations") # <!-- CHANGE THE EXTENSION'S ID
# CMake options
# Create a file .vscode/settings.json with the following content to set the options,
# adapt the path to your environment
# {
# "cmake.configureSettings": {
# "BAN_QT_RCC": "C:\users\user_name\AppData\Local\Programs\BananaPlusDev\rcc.exe",
# "BAN_EXE_PATH": "C:\users\user_name\AppData\Local\Programs\BananaPlusDev\BananaPlusDev.exe",
# "BAN_QT_LUPDATE": "C:\Qt\6.5.2\macos\bin\lupdate",
# "BAN_QT_LRELEASE": "C:\Qt\6.5.2\macos\bin\lrelease"
# }
# }
set(BAN_QT_RCC $ENV{BAN_QT_RCC} CACHE FILEPATH "Path to Qt rcc executable")
set(BAN_EXE_PATH $ENV{BAN_EXE_PATH} CACHE FILEPATH "Path to BananaPlus executable, used to run tests")
set(BAN_QT_LUPDATE $ENV{BAN_QT_LUPDATE} CACHE FILEPATH "Path to Qt lupdate executable")
set(BAN_QT_LRELEASE $ENV{BAN_QT_LRELEASE} CACHE FILEPATH "Path to Qt lrelease executable")
# This target is used to build the extension to a sbaa package
add_custom_target(translations_project ALL # <!-- CHANGE THE PROJECT'S NAME
COMMAND ${BAN_QT_RCC} -o ${EXTENSION_ID}.sbaa --binary ${EXTENSION_ID}.qrc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
SOURCES ${EXTENSION_ID}.qrc
)
add_dependencies(${PROJECT_NAME} lrelease) #build .qm files when building the sbaa package
# The variable translations_files contains the list of translations files
set(translations_files
translations/translations_de.ts
translations/translations_it.ts
translations/translations_fr.ts
#translations/translations_xx.ts # <!-- ADD LANGUAGES AS NEEDED
)
# The target lupdate is used to update *.ts translations files
set(lupdate_commands)
foreach(tr_file ${translations_files})
list(APPEND lupdate_commands
COMMAND ${BAN_QT_LUPDATE} ${EXTENSION_ID}.qrc -ts ${tr_file})
endforeach()
add_custom_target(lupdate
${lupdate_commands}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
# The target lrelease is used to compile *.ts files to *.qm files
set(lrelease_commands)
set(lrelease_files)
string(REPLACE ".ts" "" lrelease_files "${translations_files}") #remove file extension
foreach(tr_file ${lrelease_files})
list(APPEND lrelease_commands
COMMAND ${BAN_QT_LRELEASE} ${tr_file}.ts -qm ${tr_file}.qm)
endforeach()
add_custom_target(lrelease
${lrelease_commands}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
Set Cmake options
Create the file .vscode/settings.json and set the following options:
- BAN_QT_RCC: path to the Qt rcc tool. The rcc Tool is used to compile the extension to a sbaa package.
- BAN_EXE_ PATH: path to the BananaPlus executable. The BananaPlus executable is used to run the tests defined in the project.
- BAN_QT_LUPDATE: path to the Qt lupdate tool. The lupdate tool is used to update the translations, it will search for text to translate in the code and update the content of *.ts files. If you don't have translations, this options is not necessary.
- BAN_QT_RELEASE: path to the Qt lrealease tool. The lrelease tool is used to compile the translations, the compiled translation are integrated in the package.If you don't have translations, this options is not necessary.
{
"cmake.configureSettings": {
"BAN_QT_RCC": "C:\Programms\BananaPlusDev\rcc.exe",
"BAN_EXE_PATH": "C:\Programms\BananaPlusDev\BananaPlusDev.exe",
"BAN_QT_LUPDATE": "C:\Qt\6.5.2\macos\bin\lupdate",
"BAN_QT_LRELEASE": "C:\Qt\6.5.2\macos\bin\lrelease"
}
}
Translate strings
- Create a folder /translations in your repository;
- Open the CMakeLists.txt project file with QtCreator;
- Build in QtCreator the target lupdate (figure 1);
- Open the generated translations/*.ts files with QtLinguist and enter the translations (figure 2)
Keep the generated translations/*.ts files in the repository, as they are needed for updating the translations after one or more strings are changed or modified in the code.
Add translations to resource file
Add the *.qm files to the resource *.qrc file.
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>manifest.json</file>
<file>translations/translations_de.qm</file>
<file>translations/translations_fr.qm</file>
<file>translations/translations_it.qm</file>
</qresource>
</RCC>
Build and deploy
- Build the extension;
- The translations files *.qm are automatically released and included in the package;
- Copy the generated *.sbaa file to the destination folder;
- Add the extension in Banana AccountingPlus (see installing an'extension);
- Test it;
Implementation details
Loading of translation's files
Translations are automatically loaded by the application.
Translations are provided as *.qm binary files located in the extension's subfolder /translations.
sample_extention.js // extension translations/ translations_de.qm. // translation's files translations_it_CH.qm translations_it.qm ...
Translations files have the following naming convention:
translations_lang[_country].qm
Before the execution of the extension the application loads the translation corresponding to the application's language and country. For example if the application has the locale fr_FR the application looks for the following files, the first file found is taken.
translations_fr_FR.qm translations_fr.qm
Embedded Extensions in Table Documents
How to create an embedded extension
The following steps show how to create and use an embedded extension:
- Add the Documents table.
If it's not already present you need to add the Documents table in the Banana accounting file with the menu command Tools > Add new features > Add document table. - Add the Javascript file.
In the Documents table you can now add your embedded extension.- In the ID column enter the file name.
- In the Description column enter a comment (optional).
- In the Attachments column, double click on the cell or select the edit symbol in the top right corner, then select Javascript code and confirm with OK.
- Write the Javascript code of your extension.
An editor will open in which you can write the code. When you are finished, confirm with OK. You can edit the code at any time by reopening the editor.
- Save the accounting file.
When you save the accounting file, the extension is also saved. You can run or edit it whenever you want.
Run a general embedded extension
There are two ways to run an embedded extension:
- Click the run symbol in the Attachments cell where your code is located.
- From the Extensions menu, select the extension you want to run.

Execute Import, Layout or Customer Report Extensions
Once you have added the embedded extension you can choose the extension in:
- Accounting Import
- Print Invoice
- Print Customer Reminder
- Print Customer Statement
Useful resources
We have prepared Tutorial files for embedded Extensions that include samples code for most API. You can see how the API works and experiment with it.
Single File Extension
Single file extensions are Extension files that are composed of a single file that resides locally.
Developing a single file extension
You can easily develop a single file extension:
- Create a new Javacript file on you computer using a text editor.
- Structure the code as explained in the Extension file.
- Once Extensions are installed you can use with any accounting file.
Extension linked to an accounting file are installed automatically at startup.- A single file extension that reside on a local computer.
- An extension package that can contains other multiple extensions and other resources.
Install a single file extension
Before using a single file extension you are required to Install it.
Running a single file extension
Once the local extension is installed, it will be listed in the Extension Menu or in the appropriate setup listing (invoice printing, export).
The program, prior to running an extension, will read the content of the file. So if you change the content and save to a file, the program will always run the latest version.
Extensions as packaged file and project
This page gives a brief introduction of what CMake is and its implications with the Banana Plus software, beyond that it is explained how the project must be structured and how the files must be configured.
The chapters are:
- Extension Package Definition file (qrc file).
- Extension distribution package .sbaa.
- The reference of: How to generate the package file.
- The reference of: Installing and running the extension.
- Extension Project structure.
- Multiple extensions in the same package.
- The reference of: Unpack the package file.
Extension Package Definition file (qrc file)
The Definition file is a qrc file with a syntax of the Resource Collection Files (QRC) from the Qt Resource system.
The qrc file is an xml that list the content of the packaged file.
The rcc compiler will then read the qrc and compress and package the content in a sbaa file.
Example: ch.banana.script.report.jaml.qrc
<!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>manifest.json</file> <file>ch.banana.script.report.jaml.js</file> <file>lib/jaml-all.js</file> </qresource> </RCC>
Minimum content of the qrc file
The Banana Extension Package should contains:
- A manifest file (see below).
The manifest contains metadata relative to the package, like name, publisher. - A valid javascript extension file.
Other content of qrc file
- Other javascript files (.js) used by the extension.
- Other javascript extension file.
A single package can contains several extensions, also of different type.
The package could contains one or more report extensions, import extensions and a general extensions. - stylesheets files (.css).
- image files (.png, or .jpg).
- qml files
- any other files you need for your extensions.
Alias keyword
If you want to name the manifest file in another way you can use the alias keyword, so that the program will find a manifest.json file.
The alias is necessary when you create multiple packages and the files are in the same folder, so you need to have different manifest.json.
<!DOCTYPE RCC><RCC version="1.0"> <qresource> <file alias="manifest.json">ch.banana.script.report.vat-ch.manifest.json</file> <file>ch.banana.script.report.vat-ch.js</file> </qresource> </RCC>
Extension distribution package .sbaa
In order to distribute the extension you need to compile the qrc extension file to a .sbaa file.
- To compile the qrc file the rcc utility is used.
- The rcc compiler is a utility provided within by the QT framework.
Banana Accounting include a copy of the rcc compiler. - The .sbaa file will contains all the files specified in the qrc, in a compressed form.
Installing the extension package:
- The .sbaa Extension needs to be installed through the Manage Extensions command.
- Once the Extension is installed, it appears in the menu Extensions.
- The Extension can be run from the menu Extensions.
How to generate the package file
When you generate a package .sbaa you can :
Installing and running the extension
Prior to run the extension you need to install it.
See: Installation & Execute Extensions
Manifest file
If you create a .sbaa file, also include a manifest file. The manifest.json file is a JSON-formatted file, which you can include in the .sbaa file through the .qrc file.
Using manifest.json, you specify basic metadata about your package such as the title, description and version.
The file name must end with the extension 'manifest.json'
Example: ch.banana.script.report.vat-ch.manifest.json
{ "category": "import", "country":"switzerland", "countryCode":"ch", "description": "Postfinance Schweiz (Bewegungen importieren): ISO20022 und CSV Format", "description.en": "Swiss Postfinance (Import transactions): ISO20022 and CSV File Format", "language":"de", "publisher": "Banana.ch", "title": "Postfinance Schweiz (Bewegungen importieren)", "title.en": "Swiss Postfinance (Import transactions)", "version": "1.0" }
Options for the files.
- All tags are optional.
- Categories
- Valid categories are:
export, import, invoice, invoice reminder, invoice statement, productivity. - The category is used to displayed information on the Manage extension Dialog.
You need to choose a categorization type even if the package contains multiple extensions of different type.
In case of doubt use productivity. - If you don't specify the category ("category": ""), the program will take the category from the first app included in the package.
- Valid categories are:
- description
- title
Is used in the Menu Extensions to run the extensions.- If you have multiple extensions it becomes the title of the submenu that will contains all other extensions.
- The extensions will be listed in alphabetic order.
If you want a specific order precede the description of the extension with a number.
- Country
- If you don't specify country or language, the app will be shown for any country or language;
- Language
You can specify more than one language. - Translations
You can add translation by using the "description" followed by a dot and the language code.
Extension Project structure
We advise to create a separate folder for each extension that you create. The folder will contains all the file needed by the project:
- The qrc file.
- The manifest file.
- The file necessary to build a package.
- CMakeLists.txt if you build the package with the CMake.
- Other files needed for the development
- File needed for Tests
- The level of repository test is the same of the level of extesion_id.js
- Other file needed for the documentation purpose.
Folder structure
Create this folder structure, and add source files, images or folder as needed.
We recommend to use as a file name the same as the extension's id. The extension's id is the unique identification of the script and is specified within the extension's attributes, and it is important that you avoid having duplicates.
Therefore replace <extension_id> with the desired extension's id.
You can start by using a Simple project template.
Or you can create the folder structure manually.
CMakeList.txt CMake project file
<extension_id>.js Extension's code
<extension_id>.manifest.json Metadata such title, description and version
<extension_id>.qrc List of files included in the package
<extension_id>.sbaa Builded package (created after the building project)
changelog.md Change history
/test Test code
/testcases Test data (ac2 files, csv files, ...)
/testexpected Expected test results
/testresults Results of last runned test
<extension_id>.test.js Test code
LICENCE Extension licence
README.md Repository main documentation page
Multiple extensions of the same project
When you have multiple extension and you want create a single package that content all your extension, you can structure as example below.
CMakeLists.txt CMake project file
/Extension1 Repository Extension 1
extension_id_1.js Extension's code
extension_id_1.manifest.json Metadata such title, description
/Extension2 Repository Extension 2
extension_id_2.js Extension's code
extension_id_2.manifest.json Metadata such title, description
extension_id.qrc List of files included in the package
extension_id.sbaa Builded package (created after the building project)
changelog.md Change history
/test Test code
/testcases Test data (ac2 files, csv files,...)
/testexpected Expected test results
/testresults Results of last runned test
extension_id_1.test.js Test code of Extension 1
extension_id_2.test.js Test code of Extension 2
LICENCE Extension licence
README.md Repository main documentation page
Be careful that the repository test level is the same as the Extensions repositories, because if you don't define it in the same level you have problems running tests on the single extension. In the repository test you can create your test code of the specific extension.
The file .qrc must contain all the path file of extension's, for example:
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>./Extension1/<extension_id_1>.js</file>
<file>./Extension1/<extension_id_1>.manifest.json</file>
<file>./Extension2/<extension_id_2>.js</file>
<file>./Extension2/<extension_id_2>.manifest.json</file>
</qresource>
</RCC>
You need to rename the <extension_id>.js parameter to the name of the extension id.
You can use alias in this context for the purpose of including files without writing the relative path of the file.
An example:
QRC File:
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file alias="extension1">./Extension1/<extension_id_1>.js</file>
<file alias="extension2">./Extension2/<extension_id_2>.js</file>
</qresource>
</RCC>
Now for including the function and properties of the extension1, you write in the file of the project (extension_id_2.js):
//@includejs = extension1;
Before this configuration in the QRC file you use the relative path:
//includejs = ./Extension2/<extension_id_2>.js
LICENSE
A project's LICENSE file in CMake is a document that specifies the legal terms for using, modifying, and distributing the project's source code and binaries. The LICENSE file should contain the name of the license you choose, a brief description of its terms, and a full copy of the license text.
Readme.md
This file contain the explanation of the functionalities and the other detail about about your extension. Is the main file that contain the documentation of your extension.
Multiple extensions in the same package
The package file can contains multiple extensions. An extension is a Javascript file that has the extension attribute with the extension Id.
Depending on the extension @type and @visibility option the extension will be than available on the Extension's menu or in the specific dialog (for example import, invoice printing, etc.).
Unpack the package file
A project's that will unpack the package.
Create extension Package with Banana Accounting
Packaged extensions are QT resource files that are generated with the QT rcc command.
- The rcc utility is distribute with Banana Accounting.
- When you drag a .qrc file in Banana Accounting Windows the program will automatically call the rcc utility and compile the package and generate a .sbaa file.
Create a package extension file
For more information see Packaged extensions.
- Create a javascript extension file.
- Create a manifest.json file with the information regarding the extensions.
- Create a .qrc file with the list of the files to be included in the packages.
- Open Banana Accounting
- Drag the .qrc file in Banana Accounting to create a package:
- It will ask you if you want to compile the file.
- Banana Accounting is distributed with a rcc command, and the rcc wil be used to generate the a .sbaa file.
Once you have created the .sbaa file you can install the package.
Qrc file file can also be compiled directly with the QT command. We currently use cmake to automate the process of creating a packaged extensi
- You can use the free QT Creator application to develop and package Banana Accounting extensions.
- You can use the free Visual Studio Code application to develop and package Banana Accounting extensions.
Banana Extension Package with CMake
The CMake is a utility that allows to build the Extension package.
- It automatically call the rcc compiler and compile the .qrc description file and create an .sbaa file.
Introduction of CMake
CMake is a cross-platform build system that allows you to generate, configure and manage the compilation process of software written in various languages, such as C, C++ and others. CMake uses text files called CMakeLists.txt that contain the commands and instructions to define the project, its dependencies, its options and its build rules. CMake can produce native build files for different platforms, such as Visual Studio, Xcode and others. CMake is used by many open source and commercial projects.
CMake is a powerful and flexible build system that offers many advantages, such as:
- Portability: CMake can work on different operating systems, such as Windows, Linux, MacOS, and others;
- Modularity: CMake allows you to organize the project into subprojects, libraries, modules and packages;
- Configurability: CMake allows you to customize the project with variables, options, cache and scripts;
- Automatic generation: CMake can automatically generate the build files, the configuration files, the test files and the installation files, using the configure file, enable testing, add test and install commands.
CMake project file
A CMakeLists.txt project file is needed to extract all strings marked for translation from .js and .qml files and build the .sbaa extension's package.
The rcc compiler, needed to compile the qrc, is distributed with the Banana Accounting file. So you already have all the tools needed to build the qrc.
See also Build the package with Banana Accounting.
Below is a template of a project file for translating an extension, you can copy it and modify it:
- copy the example and save it as CMakeLists.txt in your project folder;
- add source files as needed to the main target by modifying the qrc file.
cmake_minimum_required(VERSION 3.16)
project(simpleproject)
set(EXTENSION_ID "ch.banana.sample.simpleproject")
# CMake options
# Create a file .vscode/settings.json with the following content to set the options,
# adapt the path to your environment
# {
# "cmake.configureSettings": {
# "BAN_QT_RCC": "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/rcc.exe",
# "BAN_EXE_PATH": "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/BananaPlusDev.exe",
# }
# }
set(BAN_QT_RCC $ENV{BAN_QT_RCC} CACHE FILEPATH "Path to Qt rcc executable")
set(BAN_EXE_PATH $ENV{BAN_EXE_PATH} CACHE FILEPATH "Path to BananaPlus executable, used to run tests")
# This target is used to build the extension to a sbaa package
add_custom_target(${PROJECT_NAME}
COMMAND ${BAN_QT_RCC} -o ${EXTENSION_ID}.sbaa --binary ${EXTENSION_ID}.qrc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
SOURCES ${EXTENSION_ID}.qrc
)
# This target is used to run the tests of the extension
add_custom_target(test
COMMAND ${BAN_EXE_PATH} -cmd=runtestsapps -cmd_exit=1 -cmd_p1=${CMAKE_SOURCE_DIR}/${EXTENSION_ID}.sbaa -cmd_op=A
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
Parts to configure
- project(simpleproject)
Rename simpleproject of name of your project. - set(EXTENSION_ID "ch.banana.sample.simpleproject")
Rename "ch.banana.sample.simpleproject" of name of your extension id. The name of extension id is the same name of .qrc file.
Environment Variables
In order to build cmake need the following variables.
- BAN_QT_RCC
path to the Qt rcc tool. The rcc Tool is used to compile the extension to a sbaa package.
The rcc tool is distributed also with Banana Accounting. - BAN_EXE_PATH
path to the BananaPlus executable. The BananaPlus executable is used to run the tests defined in the project.
But you can also enter the path directly in the cmake file
- set(BAN_QT_RCC $ENV{BAN_QT_RCC} CACHE FILEPATH "Path to Qt rcc executable")
C:/users/user_name/AppData/Local/Programs/BananaPlusDev/rcc.exe", rename usern_name with yours. set(BAN_EXE_PATH $ENV{BAN_EXE_PATH} CACHE FILEPATH "Path to BananaPlus executable, used to run tests")
Path example: "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/BananaPlusDev.exe", rename usern_name with yours.
For VS Code you can set the environment variables in the file .vscode/settings.json :
{
"cmake.configureSettings": {
"BAN_QT_RCC": "C:\Programms\BananaPlusDev\rcc.exe",
"BAN_EXE_PATH": "C:\Programms\BananaPlusDev\BananaPlusDev.exe",
}
}
Cmake Project File With Translations
A CMakeLists.txt project file is needed to extract all strings marked for translation from .js and .qml files and build the .sbaa extension's package.
You also need the QT utilities Lupdate and Lrelease that not included in Banana Accounting. You need to download and install the free QT Creator from https://www.qt.io.
Below is a template of a project file for translating an extension, you can copy it and modify it:
- copy the example and save it as CMakeLists.txt in your project folder;
- rename the project name translations_project to your desired name;
- rename the extension id ch.banana.translations to your desired id;
- add the desired languages under the variable translations_files;
- add source files as needed to the main target;
cmake_minimum_required(VERSION 3.16)
project(translations_project) # <!-- CHANGE THE PROJECT'S NAME
set(EXTENSION_ID "ch.banana.translations") # <!-- CHANGE THE EXTENSION'S ID
# CMake options
# For VS Code create a file .vscode/settings.json with the following content to set the options,
# adapt the path to your environment
# {
# "cmake.configureSettings": {
# "BAN_QT_RCC": "C:\users\user_name\AppData\Local\Programs\BananaPlusDev\rcc.exe",
# "BAN_EXE_PATH": "C:\users\user_name\AppData\Local\Programs\BananaPlusDev\BananaPlusDev.exe",
# "BAN_QT_LUPDATE": "C:\Qt\6.5.2\macos\bin\lupdate",
# "BAN_QT_LRELEASE": "C:\Qt\6.5.2\macos\bin\lrelease"
# }
# }
set(BAN_QT_RCC $ENV{BAN_QT_RCC} CACHE FILEPATH "Path to Qt rcc executable")
set(BAN_EXE_PATH $ENV{BAN_EXE_PATH} CACHE FILEPATH "Path to BananaPlus executable, used to run tests")
set(BAN_QT_LUPDATE $ENV{BAN_QT_LUPDATE} CACHE FILEPATH "Path to Qt lupdate executable")
set(BAN_QT_LRELEASE $ENV{BAN_QT_LRELEASE} CACHE FILEPATH "Path to Qt lrelease executable")
# This target is used to build the extension to a sbaa package
add_custom_target(translations_project ALL # <!-- CHANGE THE PROJECT'S NAME
COMMAND ${BAN_QT_RCC} -o ${EXTENSION_ID}.sbaa --binary ${EXTENSION_ID}.qrc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
SOURCES ${EXTENSION_ID}.qrc
)
add_dependencies(${PROJECT_NAME} lrelease) #build .qm files when building the sbaa package
# The variable translations_files contains the list of translations files
set(translations_files
translations/translations_de.ts
translations/translations_it.ts
translations/translations_fr.ts
#translations/translations_xx.ts # <!-- ADD LANGUAGES AS NEEDED
)
# The target lupdate is used to update *.ts translations files
set(lupdate_commands)
foreach(tr_file ${translations_files})
list(APPEND lupdate_commands
COMMAND ${BAN_QT_LUPDATE} ${EXTENSION_ID}.qrc -ts ${tr_file})
endforeach()
add_custom_target(lupdate
${lupdate_commands}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
# The target lrelease is used to compile *.ts files to *.qm files
set(lrelease_commands)
set(lrelease_files)
string(REPLACE ".ts" "" lrelease_files "${translations_files}") #remove file extension
foreach(tr_file ${lrelease_files})
list(APPEND lrelease_commands
COMMAND ${BAN_QT_LRELEASE} ${tr_file}.ts -qm ${tr_file}.qm)
endforeach()
add_custom_target(lrelease
${lrelease_commands}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
Supplementary Environment Variables for Translation
In order to build cmake need the following variables.
- BAN_QT_LUPDATE
path to the Qt lupdate tool. The lupdate tool is used to update the translations, it will search for text to translate in the code and update the content of *.ts files. If you don't have translations, this options is not necessary. - BAN_QT_RELEASE
path to the Qt lrealease tool. The lrelease tool is used to compile the translations, the compiled translation are integrated in the package.If you don't have translations, this options is not necessary.
{
"cmake.configureSettings": {
"BAN_QT_RCC": "C:\Programms\BananaPlusDev\rcc.exe",
"BAN_EXE_PATH": "C:\Programms\BananaPlusDev\BananaPlusDev.exe",
"BAN_QT_LUPDATE": "C:\Qt\6.5.2\macos\bin\lupdate",
"BAN_QT_LRELEASE": "C:\Qt\6.5.2\macos\bin\lrelease"
}
}
Add translations to resource file
Add the *.qm files to the resource *.qrc file.
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>manifest.json</file>
<file>translations/translations_de.qm</file>
<file>translations/translations_fr.qm</file>
<file>translations/translations_it.qm</file>
</qresource>
</RCC>
Using translation's files in the extension
Translations are automatically loaded by the application.
Translations are provided as *.qm binary files located in the extension's subfolder /translations.
sample_extention.js // extension translations/ translations_de.qm. // translation's files translations_it_CH.qm translations_it.qm ...
Translations files have the following naming convention:
translations_lang[_country].qm
Before the execution of the extension the application loads the translation corresponding to the application's language and country. For example if the application has the locale fr_FR the application looks for the following files, the first file found is taken.
translations_fr_FR.qm translations_fr.qm
Cmake Project File With Translations
Translate strings
- Create a folder /translations in your repository;
- Open the CMakeLists.txt project file with QtCreator;
- Build in QtCreator the target lupdate (figure 1);
- Open the generated translations/*.ts files with QtLinguist and enter the translations (figure 2)
Keep the generated translations/*.ts files in the repository, as they are needed for updating the translations after one or more strings are changed or modified in the code.
Add translations to resource file
Add the *.qm files to the resource *.qrc file.
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>manifest.json</file>
<file>translations/translations_de.qm</file>
<file>translations/translations_fr.qm</file>
<file>translations/translations_it.qm</file>
</qresource>
</RCC>
Build and deploy
- Build the extension;
- The translations files *.qm are automatically released and included in the package;
- Copy the generated *.sbaa file to the destination folder;
- Add the extension in Banana AccountingPlus (see installing an'extension);
- Test it;
Implementation details
Loading of translation's files
Translations are automatically loaded by the application.
Translations are provided as *.qm binary files located in the extension's subfolder /translations.
sample_extention.js // extension translations/ translations_de.qm. // translation's files translations_it_CH.qm translations_it.qm ...
Translations files have the following naming convention:
translations_lang[_country].qm
Before the execution of the extension the application loads the translation corresponding to the application's language and country. For example if the application has the locale fr_FR the application looks for the following files, the first file found is taken.
translations_fr_FR.qm translations_fr.qm
Build extensions with VS Code and CMake without translation
This document describe how to set up the development environment and build a BananaPlus Extension in packaged format with Visual Studio Code and CMake. Visual Studio Code and CMake are the recommended tools to develop extensions for Banana Plus.
After reading this document you will be able to:
- Setup your development environment
- Create a CMake project
- Build and create the packaged extension
- Run tests
- Deploy the extension
You find a working example with the code on this page on our GitHub Repository at: Simple project template.
Set up development environment
To build the extension and run tests we need the following applications:
- Visual Studio Code;
- CMake;
- CMake Extensions for Visual Studio Code;
- Compiler toolset.
Install Visual Studio Code
Download and install Visual Studio Code from https://code.visualstudio.com.
Install CMake
Download and install CMake from https://cmake.org. Verify that the installed version is in your PATH, if not open CMake go to Menu Tools -> "How to install CMake for command line use" and follow the instructions.
Install VS Code extensions for CMake
Click on the Extensions button and install the following extensions:
- twxs.cmake
CMake language support for Visual Studio Code (twsx). This is used for syntax highligh. - ms-vscode.cmake-tools
CMake Tools (microsoft). This is used for enabling the cmake pane, where you can build the targets.
Install compiler toolset
If you have already a compiler on your machine you can skip this step.
For Windows
You can see how to configure in this link: Configure VS Code for Microsoft C++.
The steps are:
- Go to website: https://visualstudio.microsoft.com/it/downloads/
At the bottom of the website, you need to download and install the Tools per Visual Studio: "Build Tools per Visual Studio 2022" as indicated in the image below.
- On the installation screen you must select and install what is indicated in the image, "Desktop development with C++" and the Optional as selected by default.
For macOS
Install XCode from Apple Store.
For linux
Install a gcc or clang compiler.
Set paths to Qt tools and Banana Plus
In Visual Studio Code, create under the extension's main folder a file named .vscode/settings.json and set the following CMake options:
- BAN_QT_RCC: path to the Qt rcc tool. The rcc Tool is used to compile the extension to a sbaa package.
- BAN_EXE_ PATH: path to the BananaPlus executable. The BananaPlus executable is used to run the tests defined in the project.
You can copy the content from the following example and modify the paths depending on your system and Qt's version you have installed on your system.
Example for Windows:
{
"cmake.configureSettings": {
"BAN_QT_RCC": "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/rcc.exe",
"BAN_EXE_PATH": "C:/users/user_name/AppData/Local/Programs/BananaPlusDev/BananaPlusDev.exe",
}
}
Replace "user_name" with the appropriate user name.
Example for macOS:
{
"cmake.configureSettings": {
"BAN_QT_RCC": "/Applications/BananaPlusDev.app/Contents/MacOS/rcc",
"BAN_EXE_PATH": "/Applications/BananaPlusDev.app/Contents/MacOS/BananaPlusDev"
}
}
Folder structure of CMake project file and configuring the files that compiles CMake
For creation the folder structure and the configuration of individual project files there is the following page that explains the topics Extension Package page.
Build the extension
1. Open your folder of the project in Visual Studio Code;
2. Press press Ctrl+Shift+P, enter "CMake: Select a Kit" and press return, select the kit you want to use. Do not select the "[Scan for kits]" or "[Unspecified]";
3. If your configuration is correct, you see the messagge "Configuring done" and "Generating done". You see the path of your file building in the output of terminal of Visual Studio Code;
4. If the previous compilation was correct, appears in the Activity bar (on the left) the new icon that need to create building, press this icon and you see the main project;
5. Right click on the main project and select Run utility.
Possible solutions for "CMake: Select a Kit" command not available in Visual Studio Code
For Windows operating system:
- Check in the manifest file and QRC file that have listed all files necessary to create the extension's;
- Check that the CMake file name matches "CMakeLists.txt" in your project (the file name must be exactly as mentioned). If it's not the same, even with all the toolsets and extensions installed, Visual Studio Code won't recognize the command;
Correct icon:
Wrong icon (because the file name is wrong):
- If the issue persists and is hard to identify, you can try using the "CMake (CMake-gui)" program. Build binaries by selecting the source code folder, choosing the build location, clicking "Generate," specifying the Visual Studio version for the project, using default conditions, and clicking "Finish". If the operation fails, error messages will provide clues. If successful, the program will display the message "Generating done."
- Configure the paths of source code and build location and click generate:
2. Specifying the Visual Studio version for the project (use default conditions):
3. Verify the results of operations:
Successful operation:
Operation with errors:
Run the tests
- Select CMake from the Activity bar (on the left)
- Right click on the test project and select Run utility
- Check the test results
NB.: to run tests you need BananaPlus Insider version
Deploy the extension
- Build the extension;
- The translations files *.qm are automatically released and included in the package;
- Copy the generated *.sbaa file to the destination folder;
- Add the extension in Banana AccountingPlus (see installing an'extension);
- Test it.
Build extensions with VS Code and CMake with translation
This document describe how to integrate translations in the CMake project.
First follow the instructions on the page Build with VS Code and CMake to set up your development environment and the CMake project.
Read also the page Extension's translation where we describe how to translate extensions.
You find a working complete example with the code on this page on our GitHub Repository at: Full project template.
Set up development environment
To build the translations we need the lpdate and lrelease utiltiy and therefore you need to install Qt and a third CMake extension.
Install Qt
Download and install Qt from https://www.qt.io. You need to install at least one Qt Version: Qt 6.4.3, 6.5.2, 6.60, ... it doesn't matter which one, if you are unsure install the latest one.
NB.: to download and install Qt you need to have or create a free qt.io account.
Set paths to lpudate and lrelease
Add the options BAN_QT_LUPDATE and BAN_QT_LRELEASE to the file .vscode/settings.json.
- BAN_QT_LUPDATE: path to the Qt lupdate tool. The lupdate tool is used to update the translations, it will search for text to translate in the code and update the content of *.ts files. If you don't have translations, this options is not necessary.
- BAN_QT_RELEASE: path to the Qt lrealease tool. The lrelease tool is used to compile the translations, the compiled translation are integrated in the package.If you don't have translations, this options is not necessary.
{
"cmake.configureSettings": {
"BAN_QT_RCC": C:/Programms/BananaPlusDev/rcc.exe",
"BAN_EXE_PATH": "C:/Programms/BananaPlusDev/BananaPlusDev.exe",
"BAN_QT_LUPDATE": "C:/Qt/6.5.2/macos/bin/lupdate",
"BAN_QT_LRELEASE": "C:/Qt/6.5.2/macos/bin/lrelease"
}
}
Set editor for *.ts files
Install the following CMake extension:
- fabiospampinato.vscode-open-in-application: Open in application extension
The installation of this extension is reccomended but not necessary. This extension let you open a file from VS Code in your preferred application, we use it to open *.ts in Qt Linguist.
Open vscode user setting file and add the editor for *.ts files
"openInApplication.applications": {
"*.ts": "QtLinguist"
}
In the operating system assign the *.ts to QtLinquist application.
To open a *.ts file with QtLinguist right click on the file in the file explorer panel and select Open in Application.
Update folder structure and CMake project file
Folder structure
Add a folder /translations where the translations files .ts and *qm reside.
You don't need to create the files .ts and .qm, they are generated automatically.
/
CMakeList.txt CMake project file
<extension_id>.js Extension's code
<extension_id>.lib.js
<extension_id>.manifest.json Metadata such title, description and version
<extension_id>.qrc List of files included in the package
<extension_id>.sbaa Buided package
changelog.md Change history
/translations
translation_de.ts
translation_qm.ts
...
CMake file
Add the targets lrelease and lupdate to update and compile translations.
cmake_minimum_required(VERSION 3.16)
project(fullproject)
set(EXTENSION_ID "ch.banana.sample.fullproject")
# CMake options
# Create a file .vscode/settings.json with the following content to set the options,
# adapt the path to your environment
# {
# "cmake.configureSettings": {
# "BAN_QT_RCC": "C:\users\user_name\AppData\Local\Programs\BananaPlusDev\rcc.exe",
# "BAN_EXE_PATH": "C:\users\user_name\AppData\Local\Programs\BananaPlusDev\BananaPlusDev.exe",
# "BAN_QT_LUPDATE": "C:\Qt\6.5.2\macos\bin\lupdate",
# "BAN_QT_LRELEASE": "C:\Qt\6.5.2\macos\bin\lrelease"
# }
# }
set(BAN_QT_RCC $ENV{BAN_QT_RCC} CACHE FILEPATH "Path to Qt rcc executable")
set(BAN_EXE_PATH $ENV{BAN_EXE_PATH} CACHE FILEPATH "Path to BananaPlus executable, used to run tests")
set(BAN_QT_LUPDATE $ENV{BAN_QT_LUPDATE} CACHE FILEPATH "Path to Qt lupdate executable")
set(BAN_QT_LRELEASE $ENV{BAN_QT_LRELEASE} CACHE FILEPATH "Path to Qt lrelease executable")
# This target is used to build the extension to a sbaa package
add_custom_target(${PROJECT_NAME}
COMMAND ${BAN_QT_RCC} -o ${EXTENSION_ID}.sbaa --binary ${EXTENSION_ID}.qrc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
SOURCES ${EXTENSION_ID}.qrc
)
# This target is used to run the tests of the extension
add_custom_target(test
COMMAND ${BAN_EXE_PATH} -cmd=runtestsapps -cmd_exit=1 -cmd_p1=${CMAKE_SOURCE_DIR}/${EXTENSION_ID}.sbaa -cmd_op=A
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
# The variable translations_files contains the list of translations files
set(translations_files
translations/translations_de.ts
translations/translations_it.ts
translations/translations_fr.ts
)
# The target lupdate is used to update *.ts translations files
set(lupdate_commands)
foreach(tr_file ${translations_files})
list(APPEND lupdate_commands
COMMAND ${BAN_QT_LUPDATE} ${EXTENSION_ID}.qrc -ts ${tr_file})
endforeach()
add_custom_target(lupdate
${lupdate_commands}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
# The target lrelease is used to compile *.ts files to *.qm files
set(lrelease_commands)
set(lrelease_files)
string(REPLACE ".ts" "" lrelease_files "${translations_files}") #remove file extension
foreach(tr_file ${lrelease_files})
list(APPEND lrelease_commands
COMMAND ${BAN_QT_LRELEASE} ${tr_file}.ts -qm ${tr_file}.qm)
endforeach()
add_custom_target(lrelease
${lrelease_commands}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_dependencies(${PROJECT_NAME} lrelease) #build .qm files when building the sbaa package
QRC file
In the qrc file insert the translations files:
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>ch.banana.sample.fullproject.js</file>
<file>ch.banana.sample.fullproject.lib.js</file>
<file>manifest.json</file>
<file>translations/translations_de.qm</file>
<file>translations/translations_fr.qm</file>
<file>translations/translations_it.qm</file>
</qresource>
</RCC>
Update translations
- Select CMake from the Activity bar (on the left)
- Right click on the lupdate project and select Run utility
This will update the translastions/translation_xx.ts files with the latest code changes - Open the files translastions/translation_xx.ts with Qt Linguist
Update the translations and save the file - Build the extension
The new translations are automatically compiled and inserted in the .sbaa package
Package with Qt Creator
Unpack the package
Installing and Running Extensions in Banana Accounting
Extensions for Banana Accounting need to be first installed.
The Banana Accounting Extensions Marketplace
The Banana Accounting Marketplace includes a great assortment of extensions that make Banana Accounting more flexible and powerful.
You can have a list and search the available extensions in menu Extensions > Manage Extensions.
Installation of an extension
In order to use an extension you need to install it from the menu Extensions > Manage Extensions.
The installation process varies depending on where the extension resides.
Marketplace extensions
Once you install a marketplace extension:
- The Title of the extension registered in the Marketplace is used as a title of the extension.
The title in the package is only used if the extension is not available in the marketplace. - The extension's file is downloaded from the marketplace and saved in the local user data storage.
- The extension is registered in the config file as locally available.
- If a new version is available it will be automatically updated.
- The program checks for extension updates only once a day, during the first run.
- Use the Update Extensions button to manually check and update all the installed extensions.
- In order to execute or fully use an extension a specific Subscription Plan may be required.
Local extensions
Local extensions are extensions that reside on your computer. You use local installed extension when developing an extension.
You can install single file extension or packaged extensions.
In order install local Extension you need to have a subscription to the Advanced plan.
To install local extensions:
- From the menu Extensions > Manage Extensions
- Click on Add from file...
Manage Extensions dialog
- Choose your extension file (javascript or package)
- Click on Open to install the extension
- Click on Close to close the Manage Extensions dialog
At this point, the extension is installed and ready to be used.
Once you install the extension:
- The file .js needs to always remain in the same directory.
- If the extension file is modified, the program will always use the last version.
- The extension is simply registered in the config file as locally available.
- The title of the package or the description attribute of the extension is used as a name of the extension.
- When you execute the extension the program will read the extension, so it will use the last modified file.
- If you install a packaged extension Banana Accounting will automatically see all extensions included.
- For developing purpose you can also install a single local javascript extension file.
Make sure the extension id attribute is unique (each extension must have a different id).
URL extensions
From the menu Extensions > Manage Extensions, click on Add from url... button.
Install from URL allow to use an extension available online.
- You can install single file extension or packaged extensions.
- The extension's file is downloaded from the specified Url and saved in the local user data storage.
- The title of the package or the description attribute of the extension is used as a name of the extension.
- The extension is registered in the config file as locally available.
- If the extension on the origin change you have to install again.
In order install local Extension you need to have a subscription to the Advanced plan.
Release Stable, Beta and Internal
The Marketplace allows to make available different version of the extension. This is very helpful when developing new functionalities or fixing bugs. Selected users can try the new version without affecting other users.
In Menu Extensions > Manage Extensions next to each extension you can see if an Extension makes available different release. You can then choose the preferred release that you want to use between:
- Release Stable.
When developing a new extension we usually develop Beta release also in the Release Stable. - Release Beta.
Release that are not considered stable and are made available for test purpose. - Release Insider.
Available only internally to Banana.ch for special development purpose.
Uninstalling extensions
You can uninstall extensions in Menu Extensions > Manage Extensions. Select the an extension from the Installed section and click on Uninstall.
- The extension will be un-registered from the config file.
- If the extension has been installed from the Marketplace or from an Url, the extension file will be deleted.
- If the extension is local, the file will remains and you can install it later again.
Install an Extension from a local file
- In Banana select from the menu Extensions the command Manage Extensions...
- Click on Add from file...
Manage Extensions dialog
- Choose your JavaScript (.js) file
- Click on Open to install the extension
- Click on Close to close the Manage Banana Extensions dialog
At this point, the extension is installed and ready to be used.
Important information:
- Once installed, the file .js needs to always remain in the same directory.
- If the extension file is modified, the program will always use the last version.
Extensions Menu
General extensions will be automatically listed in the menu extension:
- The description attribute of the extension is used as extension name displayed in the menu.
- For package the title specified in the manifest is used as a title of the submenu.
- The general extensions included in the package will be listed in the submenu in alphabetic order.
- If you want a specific order start the description of the extension with a number.
Auto installing extensions
In the Menu File > File Properties > Other you can specify that an extension available on the Banana.ch marketplace should be automatically installed when the file is opened. Extensions are marked as automatically installed.
This is very useful when you preparing template that are associated with a specific extension. When the user open a file the program will automatically download and install the extension.
If you do not use the extension any more you need to uninstall the extension manually.
Installing for development
When you are developing an extension it must reside on your computer and you need to install manually. See:
Each extension should have a unique Id, therefore if you are working on an extension that is available on the marketplace and that has been already installed you have a conflict of id and the program will choose the first one. To resolve the conflict you can use the property Enable of the extension.
- In Menu Extensions > Manage Extensions
- Disable the extension from the marketplace.
- Enable the local installed extension.
- Once the development is finished and the extension has been published.
- Re-enable the extension from the marketplace.
- Disable or uninstall the local installed extension.
Community extensions
Community extensions are extensions developed by third party and that are made available through the Banana.ch marketplace.
Installation folder
The market place Extensions are installed:
- Under Windows:
- in the AppData of the user folder.
"\Users\username\AppData\Roaming\Banana.ch\BananaPlus\10.0\Apps\" - The "bananaapps.cfg" contains the list of the installed extensions.
- in the AppData of the user folder.
- Under macOS:
- "/Users/username/Library/Application Support/Banana.ch/BananaPlus/10.0/Apps/"
- The "bananaapps.cfg" contains the list of the installed extensions.
Enterprise extensions
If you need to install a specific extension for each user in your organization.
- Marketplace extensions.
- In the accounting File > File Properties > Other, specify the extension to be automatically installed.
- Instruct the user how to install the extension.
- Local extensions.
Extension developed for you organization.- Make available the extension to the uses, preferably on a shared folder that the administrator can easily update.
- Install for each user the extension manually.
The first time you install a software you can eventually automatically overwrite a config file with a standard one.
Tables and Columns References
In Banana Accounting Plus there are different types of accounting files, each with specific Tables and Columns.
See in detail how the tables and columns are structured for the different types of accounting files:
The name Xml
Each table and each column in Banana Accounting Plus have a unique internal name called "name Xml". These Xml names:
- Are always in english.
- Cannot contain spaces or special characters.
- Are used to identify specific tables and columns.
- Cannot be changed for default tables and columns; can only be changed for additional tables or columns.
- Are used in Banana Accounting Javascript extensions to access and read and retrieve the contents of tables and columns.
Tables
Depending on the type of accounting file the tables change. These are the main distinctions of accounting files with a list of the tables:
- Income & Expense accounting or Cash Manager tables (name Xml):
- Accounts, Categories, Transactions, Budget, VatCodes, Items, Documents, Extract, FileInfo
- Double-entry accounting tables (name Xml):
- Accounts, Transactions, Budget, Totals, VatCodes, Items, Documents, Extract, FileInfo
- Multi-currency accounting tables (name Xml):
- Accounts, Transactions, Budget, Totals, VatCodes, ExchangeRates, Items, Documents, Extract, FileInfo
In case of accounting without VAT, the VatCodes table and all the VAT columns in any table are not present, regardless of the type of accounting file.
Each table is used for a specific purpose and has dedicated columns.
Columns
Each table is composed by multiple rows with specific columns. The various columns that compose a row contain various information depending on the context and table you are in.
Each column is constructed in the following way:
- nameXml.
String value. It is the unique name that the program uses as a reference to access and read the contents of the column. - alignment.
String value. It is the alignment of the text inside the column (left, center, right). - dataType.
String value. It is the type of data the column contains (Text, Number, Amount, Date, Time, booleab, link). - decimal.
Integer number value. It is the decimal points for rounding in case of amount type column. - description.
String value. It is the column description. This description will be shown as a tooltip. - excludeFromPrinting.
Boolean value. When this option is activated, the field will be excluded from printing. - header.
String value. It is the header of the column shown in the table. - header2.
String value. It is the header2 of the column shown in the table. - style.
Properties to apply a style to a column.- objectName.
Not used. - backgroundColor.
The background color of the column. - color.
The color of the text in the column. - fontSize.
The font size of the text in the column. - bold.
Boolean value to set the bold style of the text in the column. - italic.
Boolean value to set the italic style of the text in the column.
- objectName.
- visible.
Boolean value. This option allows to make a column visible. - editable.
Boolean value. This option allows to make a column editable. - width.
Float number. This option allows to set the width of the column
The following is an example in JSON format of the Description column of the Accounts table.
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
}
Grouping
Banana Accounting's grouping system is used to totalise the amounts of accounts and groups automatically. The program gives the maximum flexibility to create as many levels of totalling as wanted.
The grouping system is used:
- In the Accounts and Categories tables to define the structure of the Balance sheet and Profit & Loss Statement.
- In the VatCodes table to group VAT codes .
- In the Items table to group items.
How Grouping works
Grouping is always based on two columns:
- Group column, contains the identifiers of each group, which can be textual or numeric.
- Gr column, indicates the grouping for each account or group row, specifying which totalization group it belongs to.
Each group row represents a total row, where:
- Group balances are the sum of all rows that list the group name in the Gr column.
- The program automatically calculates the totals for all columns with numeric values, including both predefined ones (such as "Opening" or "Balance") and any added manually.
This system allows for the creation of multiple levels of grouping.
Example: For the accounts "Cash," "Post," and "Bank," a "Liquidity" group is created. By entering "Liquidity" in the Gr column for each account, the program automatically sums the balances of Cash, Post, and Bank in the Liquidity total row.
Group | Account | Description | Gr | Balance |
Cash | The cash account | LIQUIDITY | 100 | |
Post | The post account | LIQUIDITY | 80 | |
Bank | The bank account | LIQUIDITY | 220 | |
LIQUIDITY | Total Liquidity | 400 |
Accounting tables
In Banana Accounting, accounting tables are specific tables for each type of accounting file.
Table of contents
Double-entry accounting tables and columns structure
In Banana Accounting javascript extensions, when referring to tables and columns, you must always use the correct nameXml.
Each table and each column has a proper nameXml. With the nameXml, tables and columns can be accessed to read the data they contain.
All tables and columns are shown below with their nameXml.
Double-entry accounting tables
These are the nameXml of all the tables for a double-entry accounting file:
- Accounts.
The nameXml for the Accounts table that is used to set up the chart of accounts of the accounting. - Transactions.
The nameXml for the Transactions table that is used to enter all the accounting movements. - Budget.
The nameXml for the Budget table that is used to enter the financial planning transactions in order to have a comprehensive vision of the future of the company. - Totals.
The nameXml for the Totals table that presents the totals by Group and is used to check the accounting balance. - VatCodes.
The nameXml for the VatCodes table that is used to define all the parameters that allow to manage the procedures for registering with VAT. - Items.
The nameXml for the Items table that is used to enter all the inventory items which need to be managed. - Documents.
The nameXml for the Documents table that is used to include attachments like images, logos, text documents, HTML texts, Markdown codes, CSS stylesheet codes and Javascript codes. - Extract.
The nameXml for the Extract table that is used to extract rows from a table and display them in a separate table. The rows of the main table are not changed. - FileInfo.
The nameXml for the FileInfo table that is used by the program to store all the information about the currently open file.
In case of accounting without VAT, the VatCodes table is not present.
Each table is used for a specific purpose and has dedicated columns. The structure for each table with the related columns are shown below.
Accounts table
The Accounts table is used to set up the chart of accounts of the accounting. There are several types of accounts:
- Normal accounts.
- Segments (accounts that begin with ":").
- Cost Centers (accounts that begin with "." or "," or ";").
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to add a link to an external document. Section
This column is used to subdivide the chart of accounts into sections (assets and liabilities for balance sheet, expenses and revenues for income statement).
This subdivision into sections allows to choose whether to print the entire balance sheet and income statement, or choose which sections to print (e.g. only the balance sheet, or just a group, excluding the other components from printing).
The coding used in Section column is the following:* Title1 the asterisk separates the sections and indicates the main headers ** Title 2 to be entered for the secondary headers 1 Assets to be entered in the row of the Assets title 2 Liabilities to be entered in the row of the Liabilities title 3 Expenses to be entered in the row of the Expenses title 4 Revenue to be entered in the row of the Revenue title 01 Customers register to be entered in the row of the Customers Register title 02 Suppliers register to be entered in the row of the Suppliers Register title 03 Cost Centers to be entered in the row of the Cost Centers title 04 Profit Centers to be entered in the row of the Profit Centers title # Notes to be entered in the row of the Notes title #X Hidden data to be entered in the row from whereon the data have to be hidden - Group
This column is used to define the group rows. The group code is then used in the Gr column to indicate the grouping for each account or group row, specifying which totalization group it belongs to. - Account
This column is used to define the accounts, cost centers and segments.
Can be numbers or texts.
So within the Account column there are different account type:- Debit and Credit Accounts
Are used in AccountDebit and AccountCredit columns of the Transactions table. - CC1 Cost centers begin with ".", example ".P1" .
Used in the Cc1 column of the Transactions table. - CC2 Cost centers begin with ",", example ",P1".
Used in the Cc2 column of the Transactions table. - CC3 Cost centers begin with ";", example ";P1".
Used in the column Cc3 of the Transactions table. - Segments begin with ":".
There can be 10 levels of segments.
Level 1 begin with ":" , example ":S1".
Level 2 begin with "::" , example "::S1".
Level 3 begin with ":::" , example ":::S1".
Level 4 begin with "::::" , example "::::S1".
Level 5 begin with ":::::" , example ":::::S1".
Level 6 begin with "::::::" , example "::::::S1".
Level 7 begin with ":::::::" , example ":::::::S1".
Level 8 begin with "::::::::" , example "::::::::S1".
Level 9 begin with ":::::::::" , example ":::::::::S1".
Level 10 begin with"::::::::::" , example "::::::::::S1".
- Debit and Credit Accounts
- Description
This column is used to indicate the name or a description of the account, group or section. - Notes
This column is used to add personal notes. - Disable
This column is used to disable the accounts.
By entering 1, the account does not appear in the auto-complete list, but can be used in the Transactions table.
By entering 2, the account is disabled and can not be used. - VatCode
This column is used to enter a VAT code that needs to be applied automatically, when this account is being entered in the debit A/c or credit A/c column of the Transactions.
This column is linked to the VatCodes table where all the VAT codes with VAT rates are defined. - GrVat
- VatNumber
This column is used to enter the VAT number in case this account is linked to a client or a supplier. - FiscalNumber
This column is used to enter the Fiscal number in case this account is linked to a client or a supplier. - BClass
This column is used to indicate the type of account: 1=assets; 2=liabilities; 3=expenses; 4=income.
Only accounts have a BClass. Groups and subgroups do not have BClass. - Gr
This column is used to indicate the grouping for each account or group row, specifying which totalization group it belongs to.
The content must be a value defined in the column Group. See below Grouping. - Gr1
This column is used to indicate additional grouping codes. - Gr2
This column is used to indicate additional grouping codes. - Opening
This column is used to indicate the account and group balance at the beginning of the year.
Credit amounts are entered with negative sign. - Debit
This column is used by the program to sum debit movements using the entries in the Transactions table.
The column is read only. - Credit
This column is used to indicate the credit movements included in the Transactions table.
The column is read only. - Balance
This column is used to indicate the balance of the account which includes the opening balance and the movements in debit and credit.
The balance in debit is positive, while a credit balance is negative.
The column is read only. - Budget
This column is used to enter the budget amount for the current period.
The budgeted amount for costs (debit) must be entered in positive, for revenue in negative (credit).
If the Budget table has been activated, the Budget column in the Accounts table is read only and is linked with the Budget table and the amounts are calculated on the basis of the budget postings. - BudgetDifference
This column is used to indicate the difference between Balance and Budget amount.
The column is read only. - Prior
This column is used to indicate the balance of the account at the end of the preceding year. - PriorDifference
This colum is used to indicate the difference between the Balance and the balance of preceding year.
The column is read only. - BudgetPrior
This column is used to indicate the previous year's budget. - PeriodBegin
This column is used to indicate the balance at the start of the period.
The column is read only. - PeriodDebit
This column is used to indicate the total debit in the period.
The column is read only. - PeriodCredit
This column is used to indicate the total debit in the period.
The column is read only. - PeriodTotal
This column is used to indicate the total movements in the period.
The column is read only. - PeriodEnd
This column is used to indicate the balance at end of the period.
The column is read only. - NamePrefix
This column is used to indicate the contact prefix. Used for customers and suppliers address information. - FirstName
This column is used to indicate the contact name. Used for customers and suppliers address information. - FamilyName
This column is used to indicate the contact last name. Used for customers and suppliers address information. - OrganisationName
This column is used to indicate the contact organisation name. Used for customers and suppliers address information. - Street
This column is used to indicate the contact street address. Used for customers and suppliers address information. - AddressExtra
This column is used to indicate the contact extra street address. Used for customers and suppliers address information. - POBox
This column is used to indicate the contact postal office box. Used for customers and suppliers address information. - PostalCode
This column is used to indicate the contact postal code. Used for customers and suppliers address information. - Locality
This column is used to indicate the contact locality. Used for customers and suppliers address information. - Region
This column is used to indicate the contact region. Used for customers and suppliers address information. - Country
This column is used to indicate the contact country. Used for customers and suppliers address information. - CountryCode
This column is used to indicate the contact country code. Used for customers and suppliers address information. - LanguageCode
This column is used to indicate the contact language code. Used for customers and suppliers address information. - PhoneMain
This column is used to indicate the contact phone number. Used for customers and suppliers address information. - PhoneMobile
This column is used to indicate the contact mobile phone number. Used for customers and suppliers address information. - Fax
This column is used to indicate the contact fax number. Used for customers and suppliers address information. - EmailWork
This column is used to indicate the contact email. Used for customers and suppliers address information. - Website
This column is used to indicate the contact website. Used for customers and suppliers address information. - DateOfBirth
This column is used to indicate the contact date of birth. Used for customers and suppliers information. - PaymentTermInDays
This column is used to indicate the contact payment term in days. Used for customers and suppliers information. - CreditLimit
This column is used to indicate the contact credit limit. Used for customers and suppliers information. - MemberFee
This column is used to indicate the contact member fee. Used for customers and suppliers information. - BankName
This column is used to indicate the contact bank name. - BankIban
This column is used to indicate the contact bank IBAN code. - BankAccount
This column is used to indicate the contact bank account code. - BankClearing
This column is used to indicate the contact bank clearing code. - Code1
- Description_En
Accounts columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Accounts",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "Account",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Account number",
"excludeFromPrinting": "",
"header": "Account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Notes",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Disable",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Disable account or group",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "GrVat",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT Group",
"excludeFromPrinting": "",
"header": "GrVAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "FiscalNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Fiscal number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "BClass",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Base class",
"excludeFromPrinting": "",
"header": "BClass",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "Gr1",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Gr2",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Opening",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Opening balance",
"excludeFromPrinting": "",
"header": "Opening",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 250
},
{
"nameXml": "Debit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total debit transactions",
"excludeFromPrinting": "",
"header": "Debit",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Credit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total credit transactions",
"excludeFromPrinting": "",
"header": "Credit",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "Budget",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Budget amount",
"excludeFromPrinting": "",
"header": "Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BudgetDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between budget and balance",
"excludeFromPrinting": "",
"header": "Diff.Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Prior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance from previous year",
"excludeFromPrinting": "",
"header": "Prev. Year",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PriorDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between previous year and balance",
"excludeFromPrinting": "",
"header": "Diff. Prev. Year",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BudgetPrior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Previous Year's Budget",
"excludeFromPrinting": "",
"header": "Prev.Year Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PeriodBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at start of period",
"excludeFromPrinting": "",
"header": "Period Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodDebit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total debit for period",
"excludeFromPrinting": "",
"header": "Debit Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodCredit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total credit for period",
"excludeFromPrinting": "",
"header": "Credit Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodTotal",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total movements in the period",
"excludeFromPrinting": "",
"header": "Total Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodEnd",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at end of period",
"excludeFromPrinting": "",
"header": "Period End",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "NamePrefix",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact prefix",
"excludeFromPrinting": "",
"header": "Prefix",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "FirstName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact first name",
"excludeFromPrinting": "",
"header": "First name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "FamilyName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact family name",
"excludeFromPrinting": "",
"header": "Family name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "OrganisationName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Organisation/Company",
"excludeFromPrinting": "",
"header": "Organisation",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Street",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address street",
"excludeFromPrinting": "",
"header": "Street",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "AddressExtra",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address Extra information",
"excludeFromPrinting": "",
"header": "Address extra",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "POBox",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address P.O.Box",
"excludeFromPrinting": "",
"header": "P.O.Box",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "PostalCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address Postal code",
"excludeFromPrinting": "",
"header": "Zip",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Locality",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address locality / city",
"excludeFromPrinting": "",
"header": "Locality",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Region",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address State/Province",
"excludeFromPrinting": "",
"header": "Region",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Country",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address country",
"excludeFromPrinting": "",
"header": "Country",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "CountryCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Address country code",
"excludeFromPrinting": "",
"header": "Country Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "LanguageCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Language code",
"excludeFromPrinting": "",
"header": "Language code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "PhoneMain",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Phone main",
"excludeFromPrinting": "",
"header": "Main phone",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "PhoneMobile",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Mobile phone",
"excludeFromPrinting": "",
"header": "Mobile",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Fax",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact fax",
"excludeFromPrinting": "",
"header": "Fax",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "EmailWork",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Email work",
"excludeFromPrinting": "",
"header": "Email work",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Website",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact Web site",
"excludeFromPrinting": "",
"header": "WWW",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "DateOfBirth",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Contact date of birth",
"excludeFromPrinting": "",
"header": "Birth",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "PaymentTermInDays",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Payment term in days",
"excludeFromPrinting": "",
"header": "Days",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "CreditLimit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Credit limit",
"excludeFromPrinting": "",
"header": "Limit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "MemberFee",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Member fee",
"excludeFromPrinting": "",
"header": "Fee",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "BankName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Bank name",
"excludeFromPrinting": "",
"header": "Bank name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankIban",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "IBAN Account",
"excludeFromPrinting": "",
"header": "IBAN",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankAccount",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Bank account",
"excludeFromPrinting": "",
"header": "Bank account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankClearing",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Bank clearing",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Code1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Code 1",
"excludeFromPrinting": "",
"header": "Code 1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Description_En",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description_en",
"excludeFromPrinting": "",
"header": "Description_en",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 1518
}
]
}
Transactions table
The Transactions table is used to enter all the accounting movements.
All nameXml of the table columns are listed below:
- SysCod
- Section
- Date
This column is used to indicate the date of the transaction. - DateDocument
This column is used to indicate the date of a document. - DateValue
This column is used to indicate the value date of the bank operation. - Doc
This column is used to indicate the number of the document voucher of the transaction. - DocProtocol
This column is used to indicate an extra alternative numbering for the transactions. - DocType
This column is used to indicate a code that the program uses to identify a type of transaction.- 01=opening transaction.
- 02=closing transaction.
- from 10 to 19: codes for customers' invoices (10=invoice to client; 11=payment by client; 12=credit note to client).
- from 20 to 29: codes for suppliers' invoices (20=invoice supplier; 21=payment to suppier; 22=credit note from supplier).
- from 30 to 1000: codes reserved for future purposes.
- DocOriginal
This column is used to indicate the reference number present on a document. - DocInvoice
This column is used to indicate the number of an issued or paid invoice. - InvoicePrinted
This column is used to indicate when an invoice has already been printed (1=invoice printed). - DocLink
This column is used to indicate a link to an external file. - ExternalReference
This column is used to indicate the reference number that was allocated by the program that has generated the transaction. This value can be used to check whether a given operation is imported twice. - ItemsId
This column is linked with the Items table. It is used to indicate the item identifier present in the Items table. - Description
This column is used to indicate the text of the transaction. - Notes
This column is used to indicate a personal note. - AccountDebit
This column is linked with the Account column of the Accounts table.
This column is used to indicate the account present in the Accounts table that will be charged.
Segments can be entered after the account using the ":" or "-" separator. - AccountDebitDes
This column is linked with the Description column of the Accounts table.
This column is used to indicate the description of the debit account present in the Accounts table. - AccountCredit
This column is linked with the Account column of the Accounts table.
This column is used to indicate the account present in the Accounts table that will be credited. - AccountCreditDes
This column is linked with the Description column of the Accounts table.
This column is used to indicate the description of the credit account present in the Accounts table. - Quantity
This column is used to indicate the quantity. For example when creating an invoice transaction. The Quantity multiplied by UnitPrice will produce the total amount. - ReferenceUnit
This column is linked with the ReferenceUnit column of Items table. It is used to indicate a description referring to the quantity. For example when creating an invoice transaction it is referred to the item (pieces, hours, etc.). - UnitPrice
This column is linked with the SellingPrice column of Items table. It is used to indicate the unit price. For example when creating an invoice transaction. The UnitPrice multiplied by the Quantity, will produce the total amount. - Amount
This column is used to indicate the amount of the transaction. - Balance
This column is used to indicate the sum of debit and credit. - VatCode
This column is linked with the VatCode column of the VatCodes table. It is used for transactions with VAT to indicate the VAT code to use (the VAT code must be present in the VatCodes table). - VatAmountType
This column is linked with the AmountType column of VatCodes table. It is used to indicate how the program consider the transaction amount:- 0 (or empty cell) = with VAT/sales tax; the transaction amount is VAT included.
- 1 = without VAT/Sales tax; the transaction amount is VAT excluded.
- 2 = VAT amount; the transaction amount is considered the VAT amount at 100%.
- VatExtraInfo
This column is linked with the VatCodes table. It is used to indicate a code related to extra info about the VAT, to be used only in very exceptional cases. It is possible to enter a symbol to identify specific VAT cases. - VatRate
This column is linked with the VatRate column of VatCodes table. It is used to indicate the VAT percentage associated with the VAT code. - VatRateEffective
This column is used to indicate the VAT percentage referred to the net amount (taxable amount). - VatTaxable
This column is used to indicate the taxable amount (without VAT). - VatAmount
This column is used to indicate the VAT amount. - VatAccount
This column is linked with the VatAccount column of VatCodes table. It is used to indicate the account where the VAT is registered. - VatAccountDes
This column is linked with the Description column of the Accounts table. It is used to indicate the VAT account description. - VatPercentNonDeductible
This column is linked with the VatPercentNonDeductible of VatCodes table. It is used to indicate the non deductible percentage. - VatNonDeductible
This column is used to indicate the VAT non deductible amount. - VatPosted
This column is used to indicate the VAT amount registered in the VAT account (the difference "VatAmount - VatNonDeductible"). - VatNumber
This column is linked with the VatNumber column of Accounts table. It is used to indicate the code or VAT number of a client/supplier. - Cc1
This column is linked with the Account column of Accounts table. It is used to indicate the cost center account that in Accounts table is preceded by "." In Cc1 column of Transactions table the cost center account is entered without "." - Cc1Des
This column is linked with the Description column of Accounts table. It used to indicate the description of the cost center account preceded by "." - Cc2
This column is linked with the Account column of Accounts table. It is used to indicate the cost center account that in Accounts table is preceded by "," In Cc2 column of Transactions table the cost center account is entered without "," - Cc2Des
This column is linked with the Description column of Accounts table. It used to indicate the description of the cost center account preceded by "," - Cc3
This column is linked with the Account column of Accounts table. It is used to indicate the cost center account that in Accounts table is preceded by ";" In Cc3 column of Transactions table the cost center account is entered without ";" - Cc3Des
This column is linked with the Description column of Accounts table. It used to indicate the description of the cost center account preceded by ";" - Segment
This column is not used. - DateExpiration
This column is used to indicate the date before which an invoice has to be paid. - DateExpected
- DatePayment
This column is used to indicate the payment date. - LockNumber
- LockAmount
- LockProgressive
- LockLine
Transactions columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Transactions",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Date",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "DateDocument",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Document date",
"excludeFromPrinting": "",
"header": "Doc Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateValue",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Doc",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document number",
"excludeFromPrinting": "",
"header": "Doc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "DocProtocol",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Protocol number",
"excludeFromPrinting": "",
"header": "Doc.Prot.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document type",
"excludeFromPrinting": "",
"header": "Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocOriginal",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Original document number",
"excludeFromPrinting": "",
"header": "Doc.Original",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocInvoice",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Invoice number",
"excludeFromPrinting": "",
"header": "Invoice",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "InvoicePrinted",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Invoice printed",
"excludeFromPrinting": "",
"header": "Printed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocLink",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Link to external file",
"excludeFromPrinting": "",
"header": "Link",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "ExternalReference",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "External reference",
"excludeFromPrinting": "",
"header": "ExtRef",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "right",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Annotations",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 500
},
{
"nameXml": "AccountDebit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Debit account",
"excludeFromPrinting": "",
"header": "Debit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 140
},
{
"nameXml": "AccountDebitDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Debit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "AccountCredit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Credit account",
"excludeFromPrinting": "",
"header": "Credit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 140
},
{
"nameXml": "AccountCreditDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Credit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Quantity",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Quantity",
"excludeFromPrinting": "",
"header": "Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "UnitPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Unit price",
"excludeFromPrinting": "",
"header": "Unit/Price",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Amount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Amount",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 220
},
{
"nameXml": "VatCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "VatAmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatExtraInfo",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Extra Info",
"excludeFromPrinting": "",
"header": "Extra info",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "VAT/Sales tax percentage",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 100
},
{
"nameXml": "VatRateEffective",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Effective VAT/Sales tax rate",
"excludeFromPrinting": "",
"header": "%Eff.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "VatTaxable",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Sales tax/VAT taxable amount",
"excludeFromPrinting": "",
"header": "Taxable",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax amount",
"excludeFromPrinting": "",
"header": "Amt.VAT",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAccount",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT A/C",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
},
{
"nameXml": "VatAccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account description",
"excludeFromPrinting": "",
"header": "VAT A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "VatNonDeductible",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount non deductible",
"excludeFromPrinting": "",
"header": "NonDed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatPosted",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax accountable",
"excludeFromPrinting": "",
"header": "VAT Acc",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT Number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Cc1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 1",
"excludeFromPrinting": "",
"header": "CC1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc1Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 1",
"excludeFromPrinting": "",
"header": "CC1 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc2",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 2",
"excludeFromPrinting": "",
"header": "CC2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc2Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 2",
"excludeFromPrinting": "",
"header": "CC2 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc3",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 3",
"excludeFromPrinting": "",
"header": "CC3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc3Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 3",
"excludeFromPrinting": "",
"header": "CC3 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Segment",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Segment",
"excludeFromPrinting": "",
"header": "Segment",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "DateExpiration",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Expiration date",
"excludeFromPrinting": "",
"header": "Date Exp.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateExpected",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Date expected",
"excludeFromPrinting": "",
"header": "Expected",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DatePayment",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Payment date",
"excludeFromPrinting": "",
"header": "Date Pay.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "LockNumber",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Lock number",
"excludeFromPrinting": "",
"header": "LockNum",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "LockAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Lock amount",
"excludeFromPrinting": "",
"header": "LockAmt",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "LockProgressive",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Lock progressive",
"excludeFromPrinting": "",
"header": "LockProgr",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 380
},
{
"nameXml": "LockLine",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "LockLine",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
}
]
}
Budget table
The Budget table is very similar to the Transactions table, but with some specific columns.
The Budget table is used to enter the financial planning transactions in order to have a comprehensive vision of the future of the company.
All nameXml of the table columns are listed below:
- SysCod
- Section
- Date
This column is used to indicate the future date when you expect the operation to take place. - DateEnd
- Repeat
This column is used to indicate a repetition code for recurring income or expenses. - Variant
This column is used to indicate a possible variant relating to the budget, in combination with the Extensions. - ForNewYear
This column is used to indicate how the transfer should take place when a new year is created (no value=date incremented by one year; 1=date remains the same; 2=transaction not transferred to new year). - DateDocument
- DateValue
- Doc
- DocProtocol
- DocType
- DocOriginal
- DocInvoice
- InvoicePrinted
- DocLink
- ExternalReference
- ItemsId
- Description
- Notes
- AccountDebit
- AccountDebitDes
- AccountCredit
- AccountCreditDes
- Quantity
- ReferenceUnit
- UnitPrice
- Formula
This column is used to enter calculation formulas in javascript, or programming functions of the Banana Accounting Extensions. - Amount
- AmountTotal
- VatCode
- VatAmountType
- VatExtraInfo
- VatRate
- VatRateEffective
- VatTaxable
- VatAmount
- VatAccount
- VatAccountDes
- VatPercentNonDeductible
- VatNonDeductible
- VatPosted
- VatNumber
- Cc1
- Cc1Des
- Cc2
- Cc2Des
- Cc3
- Cc3Des
- Segment
- DateExpiration
- DateExpected
- DatePayment
Budget columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Budget",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Date",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "DateEnd",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "End",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "Repeat",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Repeat",
"excludeFromPrinting": "",
"header": "Repeat",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "Variant",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Variant",
"excludeFromPrinting": "",
"header": "Variant",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ForNewYear",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "How to handle transaction for new year creation",
"excludeFromPrinting": "",
"header": "New Year",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DateDocument",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Document date",
"excludeFromPrinting": "",
"header": "Doc Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateValue",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Doc",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document number",
"excludeFromPrinting": "",
"header": "Doc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocProtocol",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Protocol number",
"excludeFromPrinting": "",
"header": "Doc.Prot.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document type",
"excludeFromPrinting": "",
"header": "Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocOriginal",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Original document number",
"excludeFromPrinting": "",
"header": "Doc.Original",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocInvoice",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Invoice number",
"excludeFromPrinting": "",
"header": "Invoice",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "InvoicePrinted",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Invoice printed",
"excludeFromPrinting": "",
"header": "Printed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocLink",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Link to external file",
"excludeFromPrinting": "",
"header": "Link",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "ExternalReference",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "External reference",
"excludeFromPrinting": "",
"header": "ExtRef",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "right",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Annotations",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 500
},
{
"nameXml": "AccountDebit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Debit account",
"excludeFromPrinting": "",
"header": "Debit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 140
},
{
"nameXml": "AccountDebitDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Debit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "AccountCredit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Credit account",
"excludeFromPrinting": "",
"header": "Credit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 140
},
{
"nameXml": "AccountCreditDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Credit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Quantity",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Quantity",
"excludeFromPrinting": "",
"header": "Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "UnitPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Unit price",
"excludeFromPrinting": "",
"header": "Unit/Price",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "Formula",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Formula amount basic currency",
"excludeFromPrinting": "",
"header": "Formula",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "Amount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Amount",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "AmountTotal",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total Amount",
"excludeFromPrinting": "",
"header": "Total",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "VatCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "VatAmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatExtraInfo",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Extra Info",
"excludeFromPrinting": "",
"header": "Extra info",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "VAT/Sales tax percentage",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 100
},
{
"nameXml": "VatRateEffective",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Effective VAT/Sales tax rate",
"excludeFromPrinting": "",
"header": "%Eff.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "VatTaxable",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Sales tax/VAT taxable amount",
"excludeFromPrinting": "",
"header": "Taxable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax amount",
"excludeFromPrinting": "",
"header": "Amt.VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAccount",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT A/C",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
},
{
"nameXml": "VatAccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account description",
"excludeFromPrinting": "",
"header": "VAT A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "VatNonDeductible",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount non deductible",
"excludeFromPrinting": "",
"header": "NonDed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatPosted",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax accountable",
"excludeFromPrinting": "",
"header": "VAT Acc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT Number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Cc1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 1",
"excludeFromPrinting": "",
"header": "CC1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc1Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 1",
"excludeFromPrinting": "",
"header": "CC1 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc2",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 2",
"excludeFromPrinting": "",
"header": "CC2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc2Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 2",
"excludeFromPrinting": "",
"header": "CC2 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc3",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 3",
"excludeFromPrinting": "",
"header": "CC3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc3Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 3",
"excludeFromPrinting": "",
"header": "CC3 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Segment",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Segment",
"excludeFromPrinting": "",
"header": "Segment",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "DateExpiration",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Expiration date",
"excludeFromPrinting": "",
"header": "Date Exp.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateExpected",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Date expected",
"excludeFromPrinting": "",
"header": "Expected",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DatePayment",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Payment date",
"excludeFromPrinting": "",
"header": "Date Pay.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
Totals table
The Totals table presents the totals by Group and is used to check the accounting balance. It is processed automatically by the program and it is read only, cannot be modified.
All nameXml of the table columns are listed below:
- SysCod
- Links
- Section
- Group
This column is used to indicate the main groups of Accounts table. - Description
This column is used to indicate the main groups description of Accounts table. - Gr
This column is used to indicate the grouping for each group, specifying which totalization group it belongs to. - Opening
This column is used to indicate the total opening amount of the group. - Balance
This column is used to indicate the total balance amount of the group. - ReportTotalsOnly
- ReportKeepRows
- ReportWithMovements
Totals columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Totals",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 800
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 100
},
{
"nameXml": "Opening",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Opening balance",
"excludeFromPrinting": "",
"header": "Opening",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "ReportTotalsOnly",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "Only print totals",
"excludeFromPrinting": "",
"header": "Tot",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "ReportKeepRows",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "Keep rows",
"excludeFromPrinting": "",
"header": "Keep",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "ReportWithMovements",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "with movements",
"excludeFromPrinting": "",
"header": "With mov.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
VatCodes table
The VatCodes table is used to define all the parameters that allow to manage the procedures for registering with VAT.
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to indicate a link to an external file. - Section
- Group
This column is used to indicate the group to which the codes belong. - VatCode
This column is used to indicate the VAT code. - Description
This column is used to indicate the description of the VAT code or group. - Disable
This column is used to disable VAT codes that are not used (1=VAT code is not visible in Transactions table but can be used; 2=VAT code is not visible in Transactions table and must not be used). - Gr
This column is used to indicate the abbreviation or number of the Group in which the row of a code must be totaled. - Gr1
This column is used to indicate specific groupings. - Gr2
This column is used to indicate additional groupings. - IsDue
This column is used to indicate when a VAT is a debit or a credit; Yes=VAT is debit (due to the State); empty=VAT is credit (recoverable). - AmountType
This column is used to indicate how the program consider the transaction amount:- 0 (or empty cell) = with VAT/sales tax; the transaction amount is VAT included.
- 1 = without VAT/Sales tax; the transaction amount is VAT excluded.
- 2 = VAT amount; the transaction amount is considered the VAT amount at 100%.
- VatRate
This column is used to indicate the VAT percentage associated with the VAT code. - VatRateOnGross
This column is used to indicate "Yes" if the VAT percentage has to be applied on the gross amount (VAT included) and not on the taxable amount. - VatPercentNonDeductible
This column is used to indicate the non deductible percentage, in case it is not possible to deduct the full 100%. - VatAccount
This column is used to indicate the account to which the broken down VAT automatically is posted. - RoundMin
This column is used to indicate the minimum rounding value. When empty the basic accounting rounding is used. - NoWarning
There are particular entries that the program might interpret as wrong, but which are in fact correct. To prevent the program from reporting error warnings, enter Yes to the code of interest.
VatCodes columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "VatCodes",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 700
},
{
"nameXml": "Disable",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Disable vat code",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Gr1",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Gr2",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "IsDue",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": " Due VAT/Sales tax",
"excludeFromPrinting": "",
"header": "Due VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "AmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "% VAT/Sales tax",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatRateOnGross",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": " VAT/Sales tax percentage on gross amount",
"excludeFromPrinting": "",
"header": "VAT% on Gross",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "VatAccount",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "RoundMin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Minimal amount rounding",
"excludeFromPrinting": "",
"header": "Round Min",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "NoWarning",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Don't warn",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
Items table
The Items table is a common table used for all accounting file types. This table is used to enter all the inventory items which need to be managed.
Documents table
The Documents table is a common table used for all accounting file types. This table is used to include attachments like images, logos, text documents, HTML codes, Markdown codes, CSS stylesheet codes and Javascript Extensions codes.
FileInfo table
The FileInfo table is a common table used for all accounting file types. In this table the program stores all the information about the currently open file.
Income & Expense accounting tables and columns structure
In Banana Accounting javascript extensions, when referring to tables and columns you must always use the correct nameXml.
Each table and each column has its own nameXml. With the nameXml, tables and columns can be accessed to read the data they contain.
All tables and columns are shown below with their nameXml.
Income & Expense accounting tables
These are the nameXml of all the tables for an Income & Expense accounting file:
- Accounts.
The nameXml for the Accounts table that is used to set up the balance sheet accounts of the accounting. Categories.
The nameXml for the Categories table that is used to set up the Income and Expenses categories of the accounting.- Transactions.
The nameXml for the Transactions table that is used to enter all the accounting movements. - Budget.
The nameXml for the Budget table that is used to enter the financial planning transactions in order to have a comprehensive vision of the future of the company. - VatCodes.
The nameXml for the VatCodes table that is used to define all the parameters that allow to manage the procedures for registering with VAT. - Items.
The nameXml for the Items table that is used to enter all the inventory items which need to be managed. - Documents.
The nameXml for the Documents table that is used to include attachments like images, logos, text documents, HTML texts, Markdown codes, CSS stylesheet codes and Javascript codes. - Extract.
The nameXml for the Extract table that is used to extract rows from a table and display them in a separate table. The rows of the main table are not changed. - FileInfo.
The nameXml for the FileInfo table that is used by the program to store all the information about the currently open file.
In case of accounting without VAT, the VatCodes table is not present.
Each table is used for a specific purpose and has dedicated columns. The structure for each table with the related columns are shown below.
Accounts table
The Accounts table is used to set up the balance sheet accounts of the accounting. There are several types of accounts:
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to add a link to an external document. - Section
This column is used to subdivide the chart of accounts into sections (assets and liabilities for balance sheet). - Group
This column is used to define the group rows. The group code is then used in the Gr column to indicate the grouping for each account or group row, specifying which totalization group it belongs to. - Account
This column is used to define the accounts of the for the balance sheet (assets and liabilities). - Description
This column is used to indicate the name or a description of the account, group or section. - Notes
This column is used to add personal notes. - Disable
This column is used to disable the accounts.
By entering 1, the account does not appear in the auto-complete list, but can be used in the Transactions table.
By entering 2, the account is disabled and can not be used. - VatCode
This column is used to enter a VAT code that needs to be applied automatically, when this account is being entered in the Income or Expenses column of the Transactions.
This column is linked to the VatCodes table where all the VAT codes with VAT rates are defined. - GrVat
- VatNumber
This column is used to enter the VAT number in case this account is linked to a client or a supplier. - FiscalNumber
This column is used to enter the Fiscal number in case this account is linked to a client or a supplier. - Gr
This column is used to indicate the grouping for each account or group row, specifying which totalization group it belongs to. - Gr1
This column is used to indicate additional grouping codes. - Opening
This column is used to indicate the account and group balance at the beginning of the year. The opening balance can be positive and negative. - Income
This column is used to indicate the balance of incoming transactions included in the Transactions table. - Expenses
This column is used to indicate the balance of expenses transactions included in the Transactions table. - Balance
This column is used to indicate the balance of the account which includes the opening balance and the movements in income and expenses. The balance can be positive and negative. - Budget
This column is used to enter the budget amount for the current period.
The budgeted amount for income must be entered in positive, for expenses in negative.
If the Budget table has been activated, the Budget column in the Accounts table is linked with the Budget table and the amounts are calculated on the basis of the budget postings. - BudgetDifference
This column is used to indicate the difference between Balance and Budget amount. - Prior
This column is used to indicate the balance of the account at the end of the preceding year. - PriorDifference
This colum is used to indicate the difference between the Balance and the balance of preceding year. - BudgetPrior
This column is used to indicate the previous year's budget. - PeriodBegin
This column is used to indicate the balance at the start of the period. - PeriodIncome
This column is used to indicate the total income in the period. - PeriodExpenses
This column is used to indicate the total expenses in the period. - PeriodTotal
This column is used to indicate the total movements in the period. - PeriodEnd
This column is used to indicate the balance at end of the period. - NamePrefix
This column is used to indicate the contact prefix. Used for customers and suppliers address information. - FirstName
This column is used to indicate the contact name. Used for customers and suppliers address information. - FamilyName
This column is used to indicate the contact last name. Used for customers and suppliers address information. - OrganisationName
This column is used to indicate the contact organisation name. Used for customers and suppliers address information. - Street
This column is used to indicate the contact street address. Used for customers and suppliers address information. - AddressExtra
This column is used to indicate the contact extra street address. Used for customers and suppliers address information. - POBox
This column is used to indicate the contact postal office box. Used for customers and suppliers address information. - PostalCode
This column is used to indicate the contact postal code. Used for customers and suppliers address information. - Locality
This column is used to indicate the contact locality. Used for customers and suppliers address information. - Region
This column is used to indicate the contact region. Used for customers and suppliers address information. - Country
This column is used to indicate the contact country. Used for customers and suppliers address information. - CountryCode
This column is used to indicate the contact country code. Used for customers and suppliers address information. - LanguageCode
This column is used to indicate the contact language code. Used for customers and suppliers address information. - PhoneMain
This column is used to indicate the contact phone number. Used for customers and suppliers address information. - PhoneMobile
This column is used to indicate the contact mobile phone number. Used for customers and suppliers address information. - Fax
This column is used to indicate the contact fax number. Used for customers and suppliers address information. - EmailWork
This column is used to indicate the contact email. Used for customers and suppliers address information. - Website
This column is used to indicate the contact website. Used for customers and suppliers address information. - DateOfBirth
This column is used to indicate the contact date of birth. Used for customers and suppliers information. - PaymentTermInDays
This column is used to indicate the contact payment term in days. Used for customers and suppliers information. - CreditLimit
This column is used to indicate the contact credit limit. Used for customers and suppliers information. - MemberFee
This column is used to indicate the contact member fee. Used for customers and suppliers information. - BankName
This column is used to indicate the contact bank name. - BankIban
This column is used to indicate the contact bank IBAN code. - BankAccount
This column is used to indicate the contact bank account code. - BankClearing
This column is used to indicate the contact bank clearing code. - Code1
- Description_En
Accounts columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Accounts",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 130
},
{
"nameXml": "Account",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Account number",
"excludeFromPrinting": "",
"header": "Account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 130
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Notes",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Disable",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Disable account or group",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "GrVat",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Group",
"excludeFromPrinting": "",
"header": "GrVAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "FiscalNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Fiscal number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 290
},
{
"nameXml": "Gr1",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Opening",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Opening balance",
"excludeFromPrinting": "",
"header": "Opening",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 250
},
{
"nameXml": "Income",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Income",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "Expenses",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Expenses",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "Budget",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Budget amount",
"excludeFromPrinting": "",
"header": "Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "BudgetDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between budget and balance",
"excludeFromPrinting": "",
"header": "Diff.Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "Prior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance from previous year",
"excludeFromPrinting": "",
"header": "Prev. Year",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PriorDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between previous year and balance",
"excludeFromPrinting": "",
"header": "Diff. Prev. Year",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BudgetPrior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Previous Year's Budget",
"excludeFromPrinting": "",
"header": "Prev.Year Budget",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PeriodBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at start of period",
"excludeFromPrinting": "",
"header": "Period Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodIncome",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Period Income",
"excludeFromPrinting": "",
"header": "Income Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodExpenses",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Period Expenses",
"excludeFromPrinting": "",
"header": "Expenses Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodTotal",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total movements in the period",
"excludeFromPrinting": "",
"header": "Total Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodEnd",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at end of period",
"excludeFromPrinting": "",
"header": "Period End",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "NamePrefix",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact prefix",
"excludeFromPrinting": "",
"header": "Prefix",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "FirstName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact first name",
"excludeFromPrinting": "",
"header": "First name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "FamilyName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact family name",
"excludeFromPrinting": "",
"header": "Family name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "OrganisationName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Organisation/Company",
"excludeFromPrinting": "",
"header": "Organisation",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Street",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address street",
"excludeFromPrinting": "",
"header": "Street",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "AddressExtra",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address Extra information",
"excludeFromPrinting": "",
"header": "Address extra",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "POBox",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address P.O.Box",
"excludeFromPrinting": "",
"header": "P.O.Box",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "PostalCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address Postal code",
"excludeFromPrinting": "",
"header": "Zip",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Locality",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address locality / city",
"excludeFromPrinting": "",
"header": "Locality",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Region",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address State/Province",
"excludeFromPrinting": "",
"header": "Region",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Country",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address country",
"excludeFromPrinting": "",
"header": "Country",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "CountryCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Address country code",
"excludeFromPrinting": "",
"header": "Country Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "LanguageCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Language code",
"excludeFromPrinting": "",
"header": "Language code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "PhoneMain",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Phone main",
"excludeFromPrinting": "",
"header": "Main phone",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "PhoneMobile",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Mobile phone",
"excludeFromPrinting": "",
"header": "Mobile",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Fax",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact fax",
"excludeFromPrinting": "",
"header": "Fax",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "EmailWork",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Email work",
"excludeFromPrinting": "",
"header": "Email work",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Website",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact Web site",
"excludeFromPrinting": "",
"header": "WWW",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "DateOfBirth",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Contact date of birth",
"excludeFromPrinting": "",
"header": "Birth",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "PaymentTermInDays",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Payment term in days",
"excludeFromPrinting": "",
"header": "Days",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "CreditLimit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Credit limit",
"excludeFromPrinting": "",
"header": "Limit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "MemberFee",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Member fee",
"excludeFromPrinting": "",
"header": "Fee",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "BankName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Bank name",
"excludeFromPrinting": "",
"header": "Bank name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankIban",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "IBAN Account",
"excludeFromPrinting": "",
"header": "IBAN",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankAccount",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Bank account",
"excludeFromPrinting": "",
"header": "Bank account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankClearing",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Bank clearing",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Code1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Code 1",
"excludeFromPrinting": "",
"header": "Code 1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Description_En",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description_en",
"excludeFromPrinting": "",
"header": "Description_en",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 1518
}
]
}
Categories table
The Categories table that is used to set up the Income and Expenses categories of the accounting. There are several types of categories:
- Normal categories.
- Segments (categories that begin with ":").
- Cost Centers (categories that begin with "." or "," or ";").
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to add a link to an external document. - Section
This column is used to subdivide the chart of accounts into sections (income and expenses for income statement). - Group
This column is used to define the group rows. The group code is then used in the Gr column to indicate the grouping for each account or group row, specifying which totalization group it belongs to. - Category
This column is used to define the categories, cost centers and segments.
Categories can be numbers or text.
Cost centers begin with "." or "," or ";". There are three levels of cost centers: "." is for cost centers 1, "," is for cost centers 2, ";" is for cost centers 3.
Segments begin with ":". There can be multiple levels of segments: a single ":" is level 1, double "::" is level 2, three ":::" is level 3, etc. The maximun level allowed is 10. - Description
This column is used to indicate the name or a description of the category, group or section. - Notes
This column is used to add personal notes. - Disable
This column is used to disable the categories.
By entering 1, the category does not appear in the auto-complete list, but can be used in the Transactions table.
By entering 2, the category is disabled and can not be used. - VatCode
This column is used to enter a VAT code that needs to be applied automatically, when this category is being entered in the Income or Expenses column of the Transactions.
This column is linked to the VatCodes table where all the VAT codes with VAT rates are defined. - GrVat
- VatNumber
This column is used to enter the VAT number in case this category is linked to a client or a supplier. - FiscalNumber
This column is used to enter the Fiscal number in case this category is linked to a client or a supplier. - Gr
This column is used to indicate the grouping for each category or group row, specifying which totalization group it belongs to. - Gr1
This column is used to indicate additional grouping codes. - Income
This column is used to indicate the balance of incoming transactions included in the Transactions table. - Expenses
This column is used to indicate the balance of expenses transactions included in the Transactions table. - Balance
This column is used to indicate the balance of the category which includes the opening balance and the movements in income and expenses. The balance can be positive and negative. - Budget
This column is used to enter the budget amount for the current period.
The budgeted amount for income must be entered in positive, for expenses in negative.
If the Budget table has been activated, the Budget column in the Categories table is linked with the Budget table and the amounts are calculated on the basis of the budget postings. - BudgetDifference
This column is used to indicate the difference between Balance and Budget amount. - Prior
This column is used to indicate the balance of the account at the end of the preceding year. - PriorDifference
This colum is used to indicate the difference between the Balance and the balance of preceding year. - BudgetPrior
This column is used to indicate the previous year's budget. - PeriodBegin
This column is used to indicate the balance at the start of the period. - PeriodIncome
This column is used to indicate the total income in the period. - PeriodExpenses
This column is used to indicate the total expenses in the period. - PeriodTotal
This column is used to indicate the total movements in the period. - PeriodEnd
This column is used to indicate the balance at end of the period. - Description_En
Categories columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Categories",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 130
},
{
"nameXml": "Category",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Category",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 130
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Notes",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Disable",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Disable account or group",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "GrVat",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Group",
"excludeFromPrinting": "",
"header": "GrVAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "FiscalNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Fiscal number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "Gr1",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Income",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Income",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "Expenses",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Expenses",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "Budget",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Budget amount",
"excludeFromPrinting": "",
"header": "Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "BudgetDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between budget and balance",
"excludeFromPrinting": "",
"header": "Diff.Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "Prior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance from previous year",
"excludeFromPrinting": "",
"header": "Prev. Year",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PriorDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between previous year and balance",
"excludeFromPrinting": "",
"header": "Diff. Prev. Year",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BudgetPrior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Previous Year's Budget",
"excludeFromPrinting": "",
"header": "Prev.Year Budget",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PeriodBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at start of period",
"excludeFromPrinting": "",
"header": "Period Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodIncome",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Period Income",
"excludeFromPrinting": "",
"header": "Income Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodExpenses",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Period Expenses",
"excludeFromPrinting": "",
"header": "Expenses Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodTotal",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total movements in the period",
"excludeFromPrinting": "",
"header": "Total Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodEnd",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at end of period",
"excludeFromPrinting": "",
"header": "Period End",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Description_En",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description_en",
"excludeFromPrinting": "",
"header": "Description_en",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 1518
}
]
}
Transactions table
The Transactions table is used to enter all the accounting movements.
All nameXml of the table columns are listed below:
- SysCod
- Section
- Date
This column is used to indicate the date of the transaction. - DateDocument
This column is used to indicate the date of a document. - DateValue
This column is used to indicate the value date of the bank operation. - Doc
This column is used to indicate the number of the document voucher of the transaction. - DocProtocol
This column is used to indicate an extra alternative numbering for the transactions. - DocType
This column is used to indicate a code that the program uses to identify a type of transaction.- 01=opening transaction.
- 02=closing transaction.
- from 10 to 19: codes for customers' invoices (10=invoice to client; 11=payment by client; 12=credit note to client).
- from 20 to 29: codes for suppliers' invoices (20=invoice supplier; 21=payment to suppier; 22=credit note from supplier).
- from 30 to 1000: codes reserved for future purposes.
- DocOriginal
This column is used to indicate the reference number present on a document. - DocInvoice
This column is used to indicate the number of an issued or paid invoice. - InvoicePrinted
This column is used to indicate when an invoice has already been printed (1=invoice printed). - DocLink
This column is used to indicate a link to an external file. - ExternalReference
This column is used to indicate the reference number that was allocated by the program that has generated the transaction. This value can be used to check whether a given operation is imported twice. - ItemsId
This column is linked with the Items table. It is used to indicate the item identifier present in the Items table. - Description
This column is used to indicate the text of the transaction. - Notes
This column is used to indicate a personal note. - Quantity
This column is used to indicate the quantity. For example when creating an invoice transaction. The Quantity multiplied by UnitPrice will produce the total amount. - ReferenceUnit
This column is linked with the ReferenceUnit column of Items table. It is used to indicate a description referring to the quantity. For example when creating an invoice transaction it is referred to the item (pieces, hours, etc.). - UnitPrice
This column is linked with the SellingPrice column of Items table. It is used to indicate the unit price. For example when creating an invoice transaction. The UnitPrice multiplied by the Quantity, will produce the total amount. - Income
This column is used to indicate the incoming amount. - Expenses
This column is used to indicate the outgoing amount. - Account
This column is linked with the Account column of Accounts table. It is used to indicate the account present in the Accounts table. - AccountDes
This column is linked with the Description column of Accounts table. It is used to indicate the account's description present in the Accounts table. - Category
This column is linked with the Category column of Categories table. It is used to indicate the category present in the Categories table. - CategoryDes
This column is linked with the Description column of Categories table. It is used to indicate the category's description present in the Categories table. - Balance
This column is used to indicate the sum of income and expenses. - VatCode
This column is linked with the VatCode column of the VatCodes table. It is used for transactions with VAT to indicate the VAT code to use (the VAT code must be present in the VatCodes table). - VatAmountType
This column is linked with the AmountType column of VatCodes table. It is used to indicate how the program consider the transaction amount:- 0 (or empty cell) = with VAT/sales tax; the transaction amount is VAT included.
- 1 = without VAT/Sales tax; the transaction amount is VAT excluded.
- 2 = VAT amount; the transaction amount is considered the VAT amount at 100%.
- VatExtraInfo
This column is linked with the VatCodes table. It is used to indicate a code related to extra info about the VAT, to be used only in very exceptional cases. It is possible to enter a symbol to identify specific VAT cases. - VatRate
This column is linked with the VatRate column of VatCodes table. It is used to indicate the VAT percentage associated with the VAT code. - VatRateEffective
This column is used to indicate the VAT percentage referred to the net amount (taxable amount). - VatTaxable
This column is used to indicate the taxable amount (without VAT). - VatAmount
This column is used to indicate the VAT amount. - VatAccount
This column is linked with the VatAccount column of VatCodes table. It is used to indicate the account where the VAT is registered. - VatAccountDes
This column is linked with the Description column of the Accounts table. It is used to indicate the VAT account description. - VatPercentNonDeductible
This column is linked with the VatPercentNonDeductible of VatCodes table. It is used to indicate the non deductible percentage. - VatNonDeductible
This column is used to indicate the VAT non deductible amount. - VatPosted
This column is used to indicate the VAT amount registered in the VAT account (the difference "VatAmount - VatNonDeductible"). - VatNumber
This column is linked with the VatNumber column of Accounts/Categories table. It is used to indicate the code or VAT number of a client/supplier. - Cc1
This column is linked with the Category column of Categories table. It is used to indicate the cost center that in Categories table is preceded by "." In Cc1 column of Transactions table the cost center is entered without "." - Cc1Des
This column is linked with the Description column of Categories table. It used to indicate the description of the cost center preceded by "." - Cc2
This column is linked with the Category column of Categories table. It is used to indicate the cost center that in Categories table is preceded by "," In Cc2 column of Transactions table the cost center is entered without "," - Cc2Des
This column is linked with the Description column of Categories table. It used to indicate the description of the cost center preceded by "," - Cc3
This column is linked with the Category column of Categories table. It is used to indicate the cost center that in Categories table is preceded by ";" In Cc3 column of Transactions table the cost center is entered without ";" - Cc3Des
This column is linked with the Description column of Categories table. It used to indicate the description of the cost center preceded by ";" - Segment
This column is not used. - DateExpiration
This column is used to indicate the date before which an invoice has to be paid. - DateExpected
- DatePayment
This column is used to indicate the payment date. - LockNumber
- LockAmount
- LockProgressive
- LockLine
Transactions columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Transactions",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Date",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "DateDocument",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Document date",
"excludeFromPrinting": "",
"header": "Doc Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateValue",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Doc",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document number",
"excludeFromPrinting": "",
"header": "Doc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "DocProtocol",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Protocol number",
"excludeFromPrinting": "",
"header": "Doc.Prot.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document type",
"excludeFromPrinting": "",
"header": "Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocOriginal",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Original document number",
"excludeFromPrinting": "",
"header": "Doc.Original",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocInvoice",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Invoice number",
"excludeFromPrinting": "",
"header": "Invoice",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "InvoicePrinted",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Invoice printed",
"excludeFromPrinting": "",
"header": "Printed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocLink",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Link to external file",
"excludeFromPrinting": "",
"header": "Link",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "ExternalReference",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "External reference",
"excludeFromPrinting": "",
"header": "ExtRef",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "right",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Annotations",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 500
},
{
"nameXml": "Quantity",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Quantity",
"excludeFromPrinting": "",
"header": "Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "UnitPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Unit price",
"excludeFromPrinting": "",
"header": "Unit/Price",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Income",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Income",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "Expenses",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Expenses",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "Account",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 170
},
{
"nameXml": "AccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Account Description",
"excludeFromPrinting": "",
"header": "Account Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Category",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Category",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 170
},
{
"nameXml": "CategoryDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Category Description",
"excludeFromPrinting": "",
"header": "Category Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "VatAmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatExtraInfo",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Extra Info",
"excludeFromPrinting": "",
"header": "Extra info",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "VAT/Sales tax percentage",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 100
},
{
"nameXml": "VatRateEffective",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Effective VAT/Sales tax rate",
"excludeFromPrinting": "",
"header": "%Eff.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "VatTaxable",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Sales tax/VAT taxable amount",
"excludeFromPrinting": "",
"header": "Taxable",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax amount",
"excludeFromPrinting": "",
"header": "Amt.VAT",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAccount",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT A/C",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
},
{
"nameXml": "VatAccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account description",
"excludeFromPrinting": "",
"header": "VAT A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "VatNonDeductible",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount non deductible",
"excludeFromPrinting": "",
"header": "NonDed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatPosted",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax accountable",
"excludeFromPrinting": "",
"header": "VAT Acc",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT Number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Cc1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 1",
"excludeFromPrinting": "",
"header": "CC1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc1Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 1",
"excludeFromPrinting": "",
"header": "CC1 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc2",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 2",
"excludeFromPrinting": "",
"header": "CC2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc2Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 2",
"excludeFromPrinting": "",
"header": "CC2 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc3",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 3",
"excludeFromPrinting": "",
"header": "CC3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc3Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 3",
"excludeFromPrinting": "",
"header": "CC3 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Segment",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Segment",
"excludeFromPrinting": "",
"header": "Segment",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "DateExpiration",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Expiration date",
"excludeFromPrinting": "",
"header": "Date Exp.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateExpected",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Date expected",
"excludeFromPrinting": "",
"header": "Expected",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DatePayment",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Payment date",
"excludeFromPrinting": "",
"header": "Date Pay.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "LockNumber",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Lock number",
"excludeFromPrinting": "",
"header": "LockNum",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "LockAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Lock amount",
"excludeFromPrinting": "",
"header": "LockAmt",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "LockProgressive",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Lock progressive",
"excludeFromPrinting": "",
"header": "LockProgr",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 380
},
{
"nameXml": "LockLine",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "LockLine",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
}
]
}
Budget table
The Budget table is very similar to the Transactions table, but with some specific columns.
The Budget table is used to enter the financial planning transactions in order to have a comprehensive vision of the future of the company.
All nameXml of the table columns are listed below:
- SysCod
- Section
- Date
This column is used to indicate the future date when you expect the operation to take place. - DateEnd
- Repeat
This column is used to indicate a repetition code for recurring income or expenses. - Variant
This column is used to indicate a possible variant relating to the budget, in combination with the Extensions. - ForNewYear
This column is used to indicate how the transfer should take place when a new year is created (no value=date incremented by one year; 1=date remains the same; 2=transaction not transferred to new year). - DateDocument
- DateValue
- Doc
- DocProtocol
- DocType
- DocOriginal
- DocInvoice
- InvoicePrinted
- DocLink
- ExternalReference
- ItemsId
- Description
- Notes
- Quantity
- ReferenceUnit
- UnitPrice
- FormulaBegin
This column is used to enter a text that will be inserted before the text used in the Formula and then used for calculation. - Formula
This column is used to enter calculation formulas in javascript, or programming functions of the Banana Accounting Extensions. - Income
- Expenses
- Account
- AccountDes
- Category
- CategoryDes
- AmountTotal
- VatCode
- VatAmountType
- VatExtraInfo
- VatRate
- VatRateEffective
- VatTaxable
- VatAmount
- VatAccount
- VatAccountDes
- VatPercentNonDeductible
- VatNonDeductible
- VatPosted
- VatNumber
- Cc1
- Cc1Des
- Cc2
- Cc2Des
- Cc3
- Cc3Des
- Segment
- DateExpiration
- DateExpected
- DatePayment
Budget columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Budget",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Date",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "DateEnd",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "End",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "Repeat",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Repeat",
"excludeFromPrinting": "",
"header": "Repeat",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "Variant",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Variant",
"excludeFromPrinting": "",
"header": "Variant",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ForNewYear",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "How to handle transaction for new year creation",
"excludeFromPrinting": "",
"header": "New Year",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DateDocument",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Document date",
"excludeFromPrinting": "",
"header": "Doc Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateValue",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Doc",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document number",
"excludeFromPrinting": "",
"header": "Doc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocProtocol",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Protocol number",
"excludeFromPrinting": "",
"header": "Doc.Prot.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document type",
"excludeFromPrinting": "",
"header": "Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocOriginal",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Original document number",
"excludeFromPrinting": "",
"header": "Doc.Original",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocInvoice",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Invoice number",
"excludeFromPrinting": "",
"header": "Invoice",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "InvoicePrinted",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Invoice printed",
"excludeFromPrinting": "",
"header": "Printed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocLink",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Link to external file",
"excludeFromPrinting": "",
"header": "Link",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "ExternalReference",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "External reference",
"excludeFromPrinting": "",
"header": "ExtRef",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "right",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Annotations",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 500
},
{
"nameXml": "Quantity",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Quantity",
"excludeFromPrinting": "",
"header": "Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "UnitPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Unit price",
"excludeFromPrinting": "",
"header": "Unit/Price",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "FormulaBegin",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Formula begin",
"excludeFromPrinting": "",
"header": "Formula Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Formula",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Formula amount basic currency",
"excludeFromPrinting": "",
"header": "Formula",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "Income",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Income",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "Expenses",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Expenses",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "Account",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 170
},
{
"nameXml": "AccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Account Description",
"excludeFromPrinting": "",
"header": "Account Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Category",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Category",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 170
},
{
"nameXml": "CategoryDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Category Description",
"excludeFromPrinting": "",
"header": "Category Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "AmountTotal",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total Amount",
"excludeFromPrinting": "",
"header": "Total",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "VatCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "VatAmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatExtraInfo",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Extra Info",
"excludeFromPrinting": "",
"header": "Extra info",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "VAT/Sales tax percentage",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 100
},
{
"nameXml": "VatRateEffective",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Effective VAT/Sales tax rate",
"excludeFromPrinting": "",
"header": "%Eff.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "VatTaxable",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Sales tax/VAT taxable amount",
"excludeFromPrinting": "",
"header": "Taxable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax amount",
"excludeFromPrinting": "",
"header": "Amt.VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAccount",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT A/C",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
},
{
"nameXml": "VatAccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account description",
"excludeFromPrinting": "",
"header": "VAT A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "VatNonDeductible",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount non deductible",
"excludeFromPrinting": "",
"header": "NonDed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatPosted",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax accountable",
"excludeFromPrinting": "",
"header": "VAT Acc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT Number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Cc1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 1",
"excludeFromPrinting": "",
"header": "CC1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc1Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 1",
"excludeFromPrinting": "",
"header": "CC1 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc2",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 2",
"excludeFromPrinting": "",
"header": "CC2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc2Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 2",
"excludeFromPrinting": "",
"header": "CC2 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc3",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 3",
"excludeFromPrinting": "",
"header": "CC3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc3Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 3",
"excludeFromPrinting": "",
"header": "CC3 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Segment",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Segment",
"excludeFromPrinting": "",
"header": "Segment",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "DateExpiration",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Expiration date",
"excludeFromPrinting": "",
"header": "Date Exp.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateExpected",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Date expected",
"excludeFromPrinting": "",
"header": "Expected",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DatePayment",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Payment date",
"excludeFromPrinting": "",
"header": "Date Pay.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
VatCodes table
The VatCodes table is used to define all the parameters that allow to manage the procedures for registering with VAT.
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to indicate a link to an external file. - Section
- Group
This column is used to indicate the group to which the codes belong. - VatCode
This column is used to indicate the VAT code. - Description
This column is used to indicate the description of the VAT code or group. - Disable
This column is used to disable VAT codes that are not used (1=VAT code is not visible in Transactions table but can be used; 2=VAT code is not visible in Transactions table and must not be used). - Gr
This column is used to indicate the abbreviation or number of the Group in which the row of a code must be totaled. - Gr1
This column is used to indicate specific groupings. - Gr2
This column is used to indicate additional groupings. - IsDue
This column is used to indicate when a VAT is a debit or a credit; Yes=VAT is debit (due to the State); empty=VAT is credit (recoverable). - AmountType
This column is used to indicate how the program consider the transaction amount:- 0 (or empty cell) = with VAT/sales tax; the transaction amount is VAT included.
- 1 = without VAT/Sales tax; the transaction amount is VAT excluded.
- 2 = VAT amount; the transaction amount is considered the VAT amount at 100%.
- VatRate
This column is used to indicate the VAT percentage associated with the VAT code. - VatRateOnGross
This column is used to indicate "Yes" if the VAT percentage has to be applied on the gross amount (VAT included) and not on the taxable amount. - VatPercentNonDeductible
This column is used to indicate the non deductible percentage, in case it is not possible to deduct the full 100%. - VatAccount
This column is used to indicate the account to which the broken down VAT automatically is posted. - RoundMin
This column is used to indicate the minimum rounding value. When empty the basic accounting rounding is used. - NoWarning
There are particular entries that the program might interpret as wrong, but which are in fact correct. To prevent the program from reporting error warnings, enter Yes to the code of interest.
VatCodes columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "VatCodes",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 700
},
{
"nameXml": "Disable",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Disable vat code",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Gr1",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Gr2",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "IsDue",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": " Due VAT/Sales tax",
"excludeFromPrinting": "",
"header": "Due VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "AmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "% VAT/Sales tax",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatRateOnGross",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": " VAT/Sales tax percentage on gross amount",
"excludeFromPrinting": "",
"header": "VAT% on Gross",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "VatAccount",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "RoundMin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Minimal amount rounding",
"excludeFromPrinting": "",
"header": "Round Min",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "NoWarning",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Don't warn",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
Items table
The Items table is used to enter all the inventory items which need to be managed.
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to indicate the link to an external file. - Section
- Group
This column is used to create a total row using the grouping system. - ItemsId
This column is used to indicate the item identifier. - Description
This column is used to indicate a text description of the item. - Notes
This column is used to indicate a personal note. - Gr
This column is used to indicate the grouping for each item, specifying which totalization group it belongs to. - Disable
- Account
This column is linked with the Account/Category column of Accounts/Categories table. It is used to indicate the account used in the Transactions table. - VatCode
This column is linked with the VatCode column of VatCodes table. It is used to indicate the VAT code to use. - ReferenceUnit
This column is used to indicate an abbreviation to define the type to which the quantity refers. - SellingPrice
This column is used to indicate the unit sale price. - Cost
This column is used to indicate the unit cost price. - QuantityBegin
This column is used to indicate the initial quantity amount of the item. - UnitPriceBegin
This column is used to indicate the initial unit price of the item. - ValueBegin
This column is used to indicate the initial quantity multiplied by Price Begin. - QuantityCurrent
This column is used to indicate the current quantity. - UnitPriceCurrent
This column is used to indicate the current price of the item. - ValueCurrent
This column is used to indicate the current quantity multiplied by current price.
Items columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Items",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": " Group name",
"excludeFromPrinting": "",
"header": " Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "right",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Notes",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Disable",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Disable account or group",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Account",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Account number",
"excludeFromPrinting": "",
"header": "Account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "SellingPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Selling price",
"excludeFromPrinting": "",
"header": "Selling",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Cost",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Product cost",
"excludeFromPrinting": "",
"header": "Cost",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "QuantityBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Begin quantity",
"excludeFromPrinting": "",
"header": "Begin Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "UnitPriceBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Begin unit price",
"excludeFromPrinting": "",
"header": "Price Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "ValueBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Value begin",
"excludeFromPrinting": "",
"header": "Value Begin",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "QuantityCurrent",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Current quantity",
"excludeFromPrinting": "",
"header": "Current Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 125
},
{
"nameXml": "UnitPriceCurrent",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Current unit price",
"excludeFromPrinting": "",
"header": "Price Current",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "ValueCurrent",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Value current",
"excludeFromPrinting": "",
"header": "Value Current",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
}
]
}
Documents table
The Documents table is used to include attachments like images, logos, text documents, HTML texts, Markdown codes, CSS stylesheet codes and Javascript codes.
All nameXml of the table columns are listed below:
- SysCod
- Links
- Section
- RowId
This column is used to indicate the identification of the row. - Description
This column is used to indicate a description for the row. - Attachments
This column is used to include an attachment. - ArchivedDate
- ArchivedNotes
Documents columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Documents",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "RowId",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Row Id",
"excludeFromPrinting": "",
"header": "Id",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 400
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Attachments",
"alignment": "left",
"dataType": "mime",
"decimal": "",
"description": "Attachments",
"excludeFromPrinting": "",
"header": "Attachments",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "ArchivedDate",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Archived date",
"excludeFromPrinting": "",
"header": "Arch.Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "ArchivedNotes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Archived notes",
"excludeFromPrinting": "",
"header": "Archived Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
}
]
}
FileInfo table
The FileInfo table is used by the program to store all the information about the currently open file.
All nameXml of the table columns are listed below:
- SysCod
- Links
- Section
This column is used to indicate the Group name of the values. - SectionText
- Id
This column is used to indicate the specific and explicit identification of the value. - Description
This column is used to indicate explanation of the value. - Value
This column is used to indicate the formatted value. - SectionXml
This column is used to indicate the name of the section in English. - IdXml
This column is used to indicate the identification in English. - ValueXml
This column is used to indicate the field contents in Xml format.
The SectionXml and the IdXml identify the value unambiguously.
With Javascript extensions you can retrieve the ValueXml using the "Banana.document.info(SectionXml,IdXml)" API function.
FileInfo columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "FileInfo",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "SectionText",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "Id",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Id",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 800
},
{
"nameXml": "Value",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 900
},
{
"nameXml": "SectionXml",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section Xml",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "IdXml",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "ID Xml",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "ValueXml",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Value Xml",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
}
]
}
Multi-currency accounting tables and columns structure
In Banana Accounting javascript extensions, when referring to tables and columns, you must always use the correct nameXml.
Each table and each column has a proper nameXml. With the nameXml, tables and columns can be accessed to read the data they contain.
All tables and columns are shown below with their nameXml.
Multi-currency accounting tables
These are the nameXml of all the tables for a Multi-currency accounting file:
- Accounts.
The nameXml for the Accounts table that is used to set up the chart of accounts of the accounting. - Transactions.
The nameXml for the Transactions table that is used to enter all the accounting movements. - Budget.
The nameXml for the Budget table that is used to enter the financial planning transactions in order to have a comprehensive vision of the future of the company. - Totals.
The nameXml for the Totals table that presents the totals by Group and is used to check the accounting balance. - VatCodes.
The nameXml for the VatCodes table that is used to define all the parameters that allow to manage the procedures for registering with VAT. - ExchangeRates.
The nameXml for the ExchangeRates table that is used to enter the exchange rates referred to the basic currency (accounting currency) for the foreign currencies. - Items.
The nameXml for the Items table that is used to enter all the inventory items which need to be managed. - Documents.
The nameXml for the Documents table that is used to include attachments like images, logos, text documents, HTML texts, Markdown codes, CSS stylesheet codes and Javascript codes. - Extract.
The nameXml for the Extract table that is used to extract rows from a table and display them in a separate table. The rows of the main table are not changed. - FileInfo.
The nameXml for the FileInfo table that is used by the program to store all the information about the currently open file.
In case of accounting without VAT, the VatCodes table is not present.
Each table is used for a specific purpose and has dedicated columns. The structure for each table with the related columns are shown below.
Accounts table
The Accounts table is used to set up the chart of accounts of the accounting. There are several types of accounts:
- Normal accounts.
- Segments (accounts that begin with ":").
- Cost Centers (accounts that begin with "." or "," or ";").
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to add a link to an external document. Section
This column is used to subdivide the chart of accounts into sections (assets and liabilities for balance sheet, expenses and revenues for income statement).
This subdivision into sections allows to choose whether to print the entire balance sheet and income statement, or choose which sections to print (e.g. only the balance sheet, or just a group, excluding the other components from printing).
The coding used in Section column is the following:* Title1 the asterisk separates the sections and indicates the main headers ** Title 2 to be entered for the secondary headers 1 Assets to be entered in the row of the Assets title 2 Liabilities to be entered in the row of the Liabilities title 3 Expenses to be entered in the row of the Expenses title 4 Revenue to be entered in the row of the Revenue title 01 Customers register to be entered in the row of the Customers Register title 02 Suppliers register to be entered in the row of the Suppliers Register title 03 Cost Centers to be entered in the row of the Cost Centers title 04 Profit Centers to be entered in the row of the Profit Centers title # Notes to be entered in the row of the Notes title #X Hidden data to be entered in the row from whereon the data have to be hidden - Group
This column is used to define the group rows. The group code is then used in the Gr column to indicate the grouping for each account or group row, specifying which totalization group it belongs to. - Account
This column is used to define the accounts, cost centers and segments.
Can be numbers or texts.
So within the Account column there are different account type:- Debit and Credit Accounts
Are used in AccountDebit and AccountCredit columns of the Transactions table. - CC1 Cost centers begin with ".", example ".P1" .
Used in the Cc1 column of the Transactions table. - CC2 Cost centers begin with ",", example ",P1".
Used in the Cc2 column of the Transactions table. - CC3 Cost centers begin with ";", example ";P1".
Used in the column Cc3 of the Transactions table. - Segments begin with ":".
There can be 10 levels of segments.
Level 1 begin with ":" , example ":S1".
Level 2 begin with "::" , example "::S1".
Level 3 begin with ":::" , example ":::S1".
Level 4 begin with "::::" , example "::::S1".
Level 5 begin with ":::::" , example ":::::S1".
Level 6 begin with "::::::" , example "::::::S1".
Level 7 begin with ":::::::" , example ":::::::S1".
Level 8 begin with "::::::::" , example "::::::::S1".
Level 9 begin with ":::::::::" , example ":::::::::S1".
Level 10 begin with"::::::::::" , example "::::::::::S1".
- Debit and Credit Accounts
- Description
This column is used to indicate the name or a description of the account, group or section. - Notes
This column is used to add personal notes. - Disable
This column is used to disable the accounts.
By entering 1, the account does not appear in the auto-complete list, but can be used in the Transactions table.
By entering 2, the account is disabled and can not be used. - AccountExchangeDifference
- VatCode
This column is used to enter a VAT code that needs to be applied automatically, when this account is being entered in the debit A/c or credit A/c column of the Transactions.
This column is linked to the VatCodes table where all the VAT codes with VAT rates are defined. - GrVat
- VatNumber
This column is used to enter the VAT number in case this account is linked to a client or a supplier. - FiscalNumber
This column is used to enter the Fiscal number in case this account is linked to a client or a supplier. - BClass
This column is used to indicate the type of account: 1=assets; 2=liabilities; 3=expenses; 4=income.
Only accounts have a BClass. Groups and subgroups do not have BClass. - Gr
This column is used to indicate the grouping for each account or group row, specifying which totalization group it belongs to. - Gr1
This column is used to indicate additional grouping codes. - Gr2
This column is used to indicate additional grouping codes. - Currency
- OpeningCurrency
- Opening
This column is used to indicate the account and group balance at the beginning of the year.
Credit amounts are entered with negative sign. - Debit
This column is used to indicate the debit movements included in the Transactions table.
The column is read only. - Credit
This column is used to indicate the credit movements included in the Transactions table.
The column is read only. - DebitCurrency
- CreditCurrency
- BalanceCurrency
- Balance
This column is used to indicate the balance of the account which includes the opening balance and the movements in debit and credit.
The balance in debit is positive, while a credit balance is negative.
The column is read only. - BalanceCalculated
- ExchangeDifference
- OpeningCurrency2
- DebitCurrency2
- CreditCurrency2
- BalanceCurrency2
- BalanceCalculatedCurrency2
- Budget
This column is used to enter the budget amount for the current period.
The budgeted amount for costs (debit) must be entered in positive, for revenue in negative (credit).
If the Budget table has been activated, the Budget column in the Accounts table is linked with the Budget table and the amounts are calculated on the basis of the budget postings. - BudgetDifference
This column is used to indicate the difference between Balance and Budget amount.
The column is read only. - Prior
This column is used to indicate the balance of the account at the end of the preceding year. - PriorDifference
This colum is used to indicate the difference between the Balance and the balance of preceding year.
The column is read only. - BudgetPrior
This column is used to indicate the previous year's budget. - PeriodBegin
This column is used to indicate the balance at the start of the period.
The column is read only. - PeriodDebit
This column is used to indicate the total debit in the period.
The column is read only. - PeriodCredit
This column is used to indicate the total debit in the period.
The column is read only. - PeriodTotal
This column is used to indicate the total movements in the period.
The column is read only. - PeriodEnd
This column is used to indicate the balance at end of the period.
The column is read only. - NamePrefix
This column is used to indicate the contact prefix. Used for customers and suppliers address information. - FirstName
This column is used to indicate the contact name. Used for customers and suppliers address information. - FamilyName
This column is used to indicate the contact last name. Used for customers and suppliers address information. - OrganisationName
This column is used to indicate the contact organisation name. Used for customers and suppliers address information. - Street
This column is used to indicate the contact street address. Used for customers and suppliers address information. - AddressExtra
This column is used to indicate the contact extra street address. Used for customers and suppliers address information. - POBox
This column is used to indicate the contact postal office box. Used for customers and suppliers address information. - PostalCode
This column is used to indicate the contact postal code. Used for customers and suppliers address information. - Locality
This column is used to indicate the contact locality. Used for customers and suppliers address information. - Region
This column is used to indicate the contact region. Used for customers and suppliers address information. - Country
This column is used to indicate the contact country. Used for customers and suppliers address information. - CountryCode
This column is used to indicate the contact country code. Used for customers and suppliers address information. - LanguageCode
This column is used to indicate the contact language code. Used for customers and suppliers address information. - PhoneMain
This column is used to indicate the contact phone number. Used for customers and suppliers address information. - PhoneMobile
This column is used to indicate the contact mobile phone number. Used for customers and suppliers address information. - Fax
This column is used to indicate the contact fax number. Used for customers and suppliers address information. - EmailWork
This column is used to indicate the contact email. Used for customers and suppliers address information. - Website
This column is used to indicate the contact website. Used for customers and suppliers address information. - DateOfBirth
This column is used to indicate the contact date of birth. Used for customers and suppliers information. - PaymentTermInDays
This column is used to indicate the contact payment term in days. Used for customers and suppliers information. - CreditLimit
This column is used to indicate the contact credit limit. Used for customers and suppliers information. - MemberFee
This column is used to indicate the contact member fee. Used for customers and suppliers information. - BankName
This column is used to indicate the contact bank name. - BankIban
This column is used to indicate the contact bank IBAN code. - BankAccount
This column is used to indicate the contact bank account code. - BankClearing
This column is used to indicate the contact bank clearing code. - Code1
- Description_En
Accounts columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Accounts",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 270
},
{
"nameXml": "Account",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Account number",
"excludeFromPrinting": "",
"header": "Account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 625
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 569
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Notes",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Disable",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Disable account or group",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "AccountExchangeDifference",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Exchange rate difference account",
"excludeFromPrinting": "",
"header": "Exch. rate Diff. Acct.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "GrVat",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT Group",
"excludeFromPrinting": "",
"header": "GrVAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "FiscalNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Fiscal number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "BClass",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Base class",
"excludeFromPrinting": "",
"header": "BClass",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 250
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 279
},
{
"nameXml": "Gr1",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Gr2",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Currency",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 268
},
{
"nameXml": "OpeningCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Opening currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 250
},
{
"nameXml": "Opening",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Opening balance",
"excludeFromPrinting": "",
"header": "Opening",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "Debit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total debit transactions",
"excludeFromPrinting": "",
"header": "Debit",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Credit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total credit transactions",
"excludeFromPrinting": "",
"header": "Credit",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "DebitCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Debit currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "CreditCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Credit currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BalanceCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Balance currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "BalanceCalculated",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Calculated balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "ExchangeDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Exchange rate difference",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "OpeningCurrency2",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Opening",
"header2": "Currency 2",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "DebitCurrency2",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Debit",
"header2": "Currency 2",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "CreditCurrency2",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Credit",
"header2": "Currency 2",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BalanceCurrency2",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "Currency 2",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BalanceCalculatedCurrency2",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Calclulated balance",
"header2": "Currency 2",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Budget",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Budget amount",
"excludeFromPrinting": "",
"header": "Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BudgetDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between budget and balance",
"excludeFromPrinting": "",
"header": "Diff.Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Prior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance from previous year",
"excludeFromPrinting": "",
"header": "Prev. Year",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PriorDifference",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Difference between previous year and balance",
"excludeFromPrinting": "",
"header": "Diff. Prev. Year",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "BudgetPrior",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Previous Year's Budget",
"excludeFromPrinting": "",
"header": "Prev.Year Budget",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PeriodBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at start of period",
"excludeFromPrinting": "",
"header": "Period Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodDebit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total debit for period",
"excludeFromPrinting": "",
"header": "Debit Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodCredit",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total credit for period",
"excludeFromPrinting": "",
"header": "Credit Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodTotal",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total movements in the period",
"excludeFromPrinting": "",
"header": "Total Per.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "PeriodEnd",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Balance at end of period",
"excludeFromPrinting": "",
"header": "Period End",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "NamePrefix",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact prefix",
"excludeFromPrinting": "",
"header": "Prefix",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "FirstName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact first name",
"excludeFromPrinting": "",
"header": "First name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "FamilyName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact family name",
"excludeFromPrinting": "",
"header": "Family or Company name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "OrganisationName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Organisation/Company",
"excludeFromPrinting": "",
"header": "Organisation",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Street",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address street",
"excludeFromPrinting": "",
"header": "Street",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "AddressExtra",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address Extra information",
"excludeFromPrinting": "",
"header": "Address extra",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "POBox",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address P.O.Box",
"excludeFromPrinting": "",
"header": "P.O.Box",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "PostalCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address Postal code",
"excludeFromPrinting": "",
"header": "Zip",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Locality",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address locality / city",
"excludeFromPrinting": "",
"header": "Locality",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Region",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address State/Province",
"excludeFromPrinting": "",
"header": "Region",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Country",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Address country",
"excludeFromPrinting": "",
"header": "Country",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "CountryCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Address country code",
"excludeFromPrinting": "",
"header": "Country Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Language",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Language",
"excludeFromPrinting": "",
"header": "Language",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "PhoneMain",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Phone main",
"excludeFromPrinting": "",
"header": "Main phone",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "PhoneMobile",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Mobile phone",
"excludeFromPrinting": "",
"header": "Mobile",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Fax",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact fax",
"excludeFromPrinting": "",
"header": "Fax",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "EmailWork",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Email work",
"excludeFromPrinting": "",
"header": "Email work",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Website",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Contact Web site",
"excludeFromPrinting": "",
"header": "WWW",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "DateOfBirth",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Contact date of birth",
"excludeFromPrinting": "",
"header": "Birth",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "PaymentTermInDays",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Payment term in days",
"excludeFromPrinting": "",
"header": "Days",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "CreditLimit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Credit limit",
"excludeFromPrinting": "",
"header": "Limit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "MemberFee",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Member fee",
"excludeFromPrinting": "",
"header": "Fee",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "BankName",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Bank name",
"excludeFromPrinting": "",
"header": "Bank name",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankIban",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "IBAN Account",
"excludeFromPrinting": "",
"header": "IBAN",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankAccount",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Bank account",
"excludeFromPrinting": "",
"header": "Bank account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "BankClearing",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Bank clearing",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 400
},
{
"nameXml": "Code1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Code 1",
"excludeFromPrinting": "",
"header": "Code 1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "Description_En",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description_en",
"excludeFromPrinting": "",
"header": "Description_en",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 1518
}
]
}
Transactions table
The Transactions table is used to enter all the accounting movements.
All nameXml of the table columns are listed below:
- SysCod
- Section
- Date
- DateDocument
- DateValue
- Doc
- DocProtocol
- DocType
- DocOriginal
- DocInvoice
- InvoicePrinted
- DocLink
- ExternalReference
- ItemsId
- Description
- Notes
- AccountDebit
- AccountDebitDes
- AccountCredit
- AccountCreditDes
- Quantity
- ReferenceUnit
- UnitPrice
- AmountCurrency
- ExchangeCurrency
- ExchangeRate
- ExchangeMultiplier
- Amount
- Balance
- VatCode
- VatAmountType
- VatExtraInfo
- VatRate
- VatRateEffective
- VatTaxable
- VatAmount
- VatAccount
- VatAccountDes
- VatPercentNonDeductible
- VatNonDeductible
- VatPosted
- VatNumber
- Cc1
- Cc1Des
- Cc2
- Cc2Des
- Cc3
- Cc3Des
- Segment
- DateExpiration
- DateExpected
- DatePayment
- LockNumber
- LockAmount
- LockProgressive
- LockLine
Transactions columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Transactions",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Date",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "DateDocument",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Document date",
"excludeFromPrinting": "",
"header": "Doc Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateValue",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Doc",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document number",
"excludeFromPrinting": "",
"header": "Doc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "DocProtocol",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Protocol number",
"excludeFromPrinting": "",
"header": "Doc.Prot.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document type",
"excludeFromPrinting": "",
"header": "Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocOriginal",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Original document number",
"excludeFromPrinting": "",
"header": "Doc.Original",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocInvoice",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Invoice number",
"excludeFromPrinting": "",
"header": "Invoice",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "InvoicePrinted",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Invoice printed",
"excludeFromPrinting": "",
"header": "Printed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocLink",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Link to external file",
"excludeFromPrinting": "",
"header": "Link",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ExternalReference",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "External reference",
"excludeFromPrinting": "",
"header": "ExtRef",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 308
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 880
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Annotations",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 500
},
{
"nameXml": "AccountDebit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Debit account",
"excludeFromPrinting": "",
"header": "Debit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 441
},
{
"nameXml": "AccountDebitDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Debit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "AccountCredit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Credit account",
"excludeFromPrinting": "",
"header": "Credit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 526
},
{
"nameXml": "AccountCreditDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Credit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Quantity",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Quantity",
"excludeFromPrinting": "",
"header": "Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 178
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "UnitPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Unit price",
"excludeFromPrinting": "",
"header": "Unit/Price",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 174
},
{
"nameXml": "AmountCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount in currency",
"excludeFromPrinting": "",
"header": "Currency Amount",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 311
},
{
"nameXml": "ExchangeCurrency",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 276
},
{
"nameXml": "ExchangeRate",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "",
"excludeFromPrinting": "",
"header": "Exchange Rate",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "ExchangeMultiplier",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "Multiplier",
"excludeFromPrinting": "",
"header": "Mult.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "Amount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Amount",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 220
},
{
"nameXml": "VatCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 152
},
{
"nameXml": "VatAmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 242
},
{
"nameXml": "VatExtraInfo",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Extra Info",
"excludeFromPrinting": "",
"header": "Extra info",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "VAT/Sales tax percentage",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 194
},
{
"nameXml": "VatRateEffective",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Effective VAT/Sales tax rate",
"excludeFromPrinting": "",
"header": "%Eff.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "VatTaxable",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Sales tax/VAT taxable amount",
"excludeFromPrinting": "",
"header": "Taxable",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax amount",
"excludeFromPrinting": "",
"header": "Amt.VAT",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAccount",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT A/C",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
},
{
"nameXml": "VatAccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account description",
"excludeFromPrinting": "",
"header": "VAT A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "VatNonDeductible",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount non deductible",
"excludeFromPrinting": "",
"header": "NonDed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatPosted",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax accountable",
"excludeFromPrinting": "",
"header": "VAT Acc",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT Number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Cc1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 1",
"excludeFromPrinting": "",
"header": "CC1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc1Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 1",
"excludeFromPrinting": "",
"header": "CC1 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc2",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 2",
"excludeFromPrinting": "",
"header": "CC2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc2Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 2",
"excludeFromPrinting": "",
"header": "CC2 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc3",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 3",
"excludeFromPrinting": "",
"header": "CC3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc3Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 3",
"excludeFromPrinting": "",
"header": "CC3 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Segment",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Segment",
"excludeFromPrinting": "",
"header": "Segment",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "DateExpiration",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Expiration date",
"excludeFromPrinting": "",
"header": "Date Exp.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateExpected",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Date expected",
"excludeFromPrinting": "",
"header": "Expected",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DatePayment",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Payment date",
"excludeFromPrinting": "",
"header": "Date Pay.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "LockNumber",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Lock number",
"excludeFromPrinting": "",
"header": "LockNum",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "LockAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Lock amount",
"excludeFromPrinting": "",
"header": "LockAmt",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "LockProgressive",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Lock progressive",
"excludeFromPrinting": "",
"header": "LockProgr",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 380
},
{
"nameXml": "LockLine",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "LockLine",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
}
]
}
Budget table
The Budget table is used to enter the financial planning transactions in order to have a comprehensive vision of the future of the company.
All nameXml of the table columns are listed below:
- SysCod
- Section
- Date
- DateEnd
- Repeat
- Variant
- ForNewYear
- DateDocument
- DateValue
- Doc
- DocProtocol
- DocType
- DocOriginal
- DocInvoice
- InvoicePrinted
- DocLink
- ExternalReference
- ItemsId
- Description
- Notes
- AccountDebit
- AccountDebitDes
- AccountCredit
- AccountCreditDes
- Quantity
- ReferenceUnit
- UnitPrice
- FormulaBegin
- FormulaCurrency
- AmountCurrency
- ExchangeCurrency
- ExchangeRate
- ExchangeMultiplier
- Formula
- Amount
- AmountTotalCurrency
- AmountTotal
- VatCode
- VatAmountType
- VatExtraInfo
- VatRate
- VatRateEffective
- VatTaxable
- VatAmount
- VatAccount
- VatAccountDes
- VatPercentNonDeductible
- VatNonDeductible
- VatPosted
- VatNumber
- Cc1
- Cc1Des
- Cc2
- Cc2Des
- Cc3
- Cc3Des
- Segment
- DateExpiration
- DateExpected
- DatePayment
Budget columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Budget",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Date",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "DateEnd",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "End",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "Repeat",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Repeat",
"excludeFromPrinting": "",
"header": "Repeat",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "Variant",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Variant",
"excludeFromPrinting": "",
"header": "Variant",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ForNewYear",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "How to handle transaction for new year creation",
"excludeFromPrinting": "",
"header": "New Year",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DateDocument",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Document date",
"excludeFromPrinting": "",
"header": "Doc Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateValue",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Doc",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document number",
"excludeFromPrinting": "",
"header": "Doc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocProtocol",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Protocol number",
"excludeFromPrinting": "",
"header": "Doc.Prot.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Document type",
"excludeFromPrinting": "",
"header": "Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocOriginal",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Original document number",
"excludeFromPrinting": "",
"header": "Doc.Original",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocInvoice",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Invoice number",
"excludeFromPrinting": "",
"header": "Invoice",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "InvoicePrinted",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Invoice printed",
"excludeFromPrinting": "",
"header": "Printed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "DocLink",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Link to external file",
"excludeFromPrinting": "",
"header": "Link",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "ExternalReference",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "External reference",
"excludeFromPrinting": "",
"header": "ExtRef",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "right",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Annotations",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 500
},
{
"nameXml": "AccountDebit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Debit account",
"excludeFromPrinting": "",
"header": "Debit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 140
},
{
"nameXml": "AccountDebitDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Debit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "AccountCredit",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Credit account",
"excludeFromPrinting": "",
"header": "Credit A/C ",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 140
},
{
"nameXml": "AccountCreditDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Credit A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Quantity",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Quantity",
"excludeFromPrinting": "",
"header": "Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "UnitPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Unit price",
"excludeFromPrinting": "",
"header": "Unit/Price",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "FormulaBegin",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Formula begin",
"excludeFromPrinting": "",
"header": "Formula Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "FormulaCurrency",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Formula amount transaction's currency",
"excludeFromPrinting": "",
"header": "Formula Currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "AmountCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount in Currency",
"excludeFromPrinting": "",
"header": "Currency Amount",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "ExchangeCurrency",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "ExchangeRate",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "",
"excludeFromPrinting": "",
"header": "Exchange Rate",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "ExchangeMultiplier",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "Multiplier",
"excludeFromPrinting": "",
"header": "Mult.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "Formula",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Formula amount basic currency",
"excludeFromPrinting": "",
"header": "Formula",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 300
},
{
"nameXml": "Amount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Amount",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 220
},
{
"nameXml": "AmountTotalCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total Currency Amount",
"excludeFromPrinting": "",
"header": "Currency Total",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "AmountTotal",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Total Amount",
"excludeFromPrinting": "",
"header": "Total",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "VatCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "VatAmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatExtraInfo",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT Extra Info",
"excludeFromPrinting": "",
"header": "Extra info",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "VAT/Sales tax percentage",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 100
},
{
"nameXml": "VatRateEffective",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Effective VAT/Sales tax rate",
"excludeFromPrinting": "",
"header": "%Eff.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "VatTaxable",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Sales tax/VAT taxable amount",
"excludeFromPrinting": "",
"header": "Taxable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAmount",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax amount",
"excludeFromPrinting": "",
"header": "Amt.VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatAccount",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT A/C",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 150
},
{
"nameXml": "VatAccountDes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account description",
"excludeFromPrinting": "",
"header": "VAT A/C Des.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "VatNonDeductible",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Amount non deductible",
"excludeFromPrinting": "",
"header": "NonDed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 200
},
{
"nameXml": "VatPosted",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "VAT/Sales tax accountable",
"excludeFromPrinting": "",
"header": "VAT Acc",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "VatNumber",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax number",
"excludeFromPrinting": "",
"header": "VAT Number",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Cc1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 1",
"excludeFromPrinting": "",
"header": "CC1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc1Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 1",
"excludeFromPrinting": "",
"header": "CC1 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc2",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 2",
"excludeFromPrinting": "",
"header": "CC2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc2Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 2",
"excludeFromPrinting": "",
"header": "CC2 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Cc3",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Cost center 3",
"excludeFromPrinting": "",
"header": "CC3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Cc3Des",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Description of cost center 3",
"excludeFromPrinting": "",
"header": "CC3 Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 300
},
{
"nameXml": "Segment",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Segment",
"excludeFromPrinting": "",
"header": "Segment",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "DateExpiration",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Expiration date",
"excludeFromPrinting": "",
"header": "Date Exp.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DateExpected",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Date expected",
"excludeFromPrinting": "",
"header": "Expected",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DatePayment",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "Payment date",
"excludeFromPrinting": "",
"header": "Date Pay.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
Totals table
The Totals table presents the totals by Group and is used to check the accounting balance. It is processed automatically by the program and it is read only, cannot be modified.
All nameXml of the table columns are listed below:
- SysCod
- Links
- Section
- Group
This column is used to indicate the main groups of Accounts table. - Description
This column is used to indicate the main groups description of Accounts table. - Gr
This column is used to indicate the grouping for each group, specifying which totalization group it belongs to. - Opening
This column is used to indicate the total opening amount of the group. - Balance
This column is used to indicate the total balance amount of the group. - ReportTotalsOnly
- ReportKeepRows
- ReportWithMovements
Totals columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Totals",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 800
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 100
},
{
"nameXml": "Opening",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Opening balance",
"excludeFromPrinting": "",
"header": "Opening",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "Balance",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "",
"excludeFromPrinting": "",
"header": "Balance",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "ReportTotalsOnly",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "Only print totals",
"excludeFromPrinting": "",
"header": "Tot",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "ReportKeepRows",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "Keep rows",
"excludeFromPrinting": "",
"header": "Keep",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "ReportWithMovements",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "with movements",
"excludeFromPrinting": "",
"header": "With mov.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
VatCodes table
The VatCodes table is used to define all the parameters that allow to manage the procedures for registering with VAT.
All nameXml of the table columns are listed below:
- SysCod
- Section
- Group
- VatCode
- Description
- Disable
- Gr
- Gr1
- Gr2
- IsDue
- AmountType
- VatRate
- VatRateOnGross
- VatPercentNonDeductible
- VatAccount
- RoundMin
- NoWarning
VatCodes columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "VatCodes",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Group name",
"excludeFromPrinting": "",
"header": "Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT Code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 700
},
{
"nameXml": "Disable",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "Disable vat code",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Gr1",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Gr2",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Gr2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "IsDue",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": " Due VAT/Sales tax",
"excludeFromPrinting": "",
"header": "Due VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "AmountType",
"alignment": "center",
"dataType": "number",
"decimal": "",
"description": "Vat Amount Type",
"excludeFromPrinting": "",
"header": "Amount type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatRate",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "% VAT/Sales tax",
"excludeFromPrinting": "",
"header": "%VAT",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatRateOnGross",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": " VAT/Sales tax percentage on gross amount",
"excludeFromPrinting": "",
"header": "VAT% on Gross",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "VatPercentNonDeductible",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percent non deductible",
"excludeFromPrinting": "",
"header": "%NonDed.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "VatAccount",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax account",
"excludeFromPrinting": "",
"header": "VAT account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "RoundMin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Minimal amount rounding",
"excludeFromPrinting": "",
"header": "Round Min",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "NoWarning",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Don't warn",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
ExchangeRates table
The ExchangeRates table is used to enter the exchange rates referred to the basic currency (accounting currency) for the foreign currencies.
All nameXml of the table columns are listed below:
- SysCod
- Links
- Section
- Date
- CurrencyReference
- Currency
- Description
- IsFixed
- Rounding
- Multiplier
- Rate
- RateOpening
- RateMin
- RateMax
- DecimalPoints
- Country
ExchangeRates column structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "ExchangeRates",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Date",
"alignment": "left",
"dataType": "date",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "CurrencyReference",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference Currency",
"excludeFromPrinting": "",
"header": "Ref.Currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "Currency",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Text",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 500
},
{
"nameXml": "IsFixed",
"alignment": "center",
"dataType": "bool",
"decimal": "",
"description": "Is fixed",
"excludeFromPrinting": "",
"header": "Fixed",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Rounding",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "",
"excludeFromPrinting": "",
"header": "Rounding",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Multiplier",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "Multiplier",
"excludeFromPrinting": "",
"header": "Mult.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "Rate",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "",
"excludeFromPrinting": "",
"header": "Exchange rate",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "RateOpening",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "Opening exchange rate",
"excludeFromPrinting": "",
"header": "Rate Opening",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 200
},
{
"nameXml": "RateMin",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "",
"excludeFromPrinting": "",
"header": "Min",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "RateMax",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "",
"excludeFromPrinting": "",
"header": "Max",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "DecimalPoints",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Decimal points",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "Country",
"alignment": "right",
"dataType": "number",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Country",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
}
]
}
Items table
The Items table is a common table used for all accounting file types. This table is used to enter all the inventory items which need to be managed.
Documents table
The Documents table is a common table used for all accounting file types. This table is used to include attachments like images, logos, text documents, HTML codes, Markdown codes, CSS stylesheet codes and Javascript Extensions codes.
FileInfo table
The FileInfo table is a common table used for all accounting file types. In this table the program stores all the information about the currently open file.
Common tables for all accounting
In Banana Accounting, common tables are those tables that are included in every accounting file, regardless of type.
Table of contents
Documents table columns structure
In Banana Accounting javascript extensions, when referring to tables and columns, you must always use the correct nameXml.
Each table and each column has a proper nameXml. With the nameXml, tables and columns can be accessed to read the data they contain.
All columns of Documents table are shown below with their nameXml.
Documents table
The Documents table is used to include attachments like images, logos, text documents, HTML codes, Markdown codes, CSS stylesheet codes and Javascript Extensions codes.
All nameXml of the table columns are listed below:
- SysCod
- Links
- Section
- RowId
This column is used to indicate the identification of the row. - Description
This column is used to indicate a description for the row. - Attachments
This column is used to include an attachment. - ArchivedDate
- ArchivedNotes
Documents columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Documents",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "RowId",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Row Id",
"excludeFromPrinting": "",
"header": "Id",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 400
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Attachments",
"alignment": "left",
"dataType": "mime",
"decimal": "",
"description": "Attachments",
"excludeFromPrinting": "",
"header": "Attachments",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "ArchivedDate",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Archived date",
"excludeFromPrinting": "",
"header": "Arch.Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 200
},
{
"nameXml": "ArchivedNotes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Archived notes",
"excludeFromPrinting": "",
"header": "Archived Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
}
]
}
FileInfo table columns structure
In Banana Accounting javascript extensions, when referring to tables and columns, you must always use the correct nameXml.
Each table and each column has a proper nameXml. With the nameXml, tables and columns can be accessed to read the data they contain.
All columns of FileInfo table are shown below with their nameXml.
FileInfo table
The FileInfo table is used by the program to store all the information about the currently open file.
All nameXml of the table columns are listed below:
- SysCod
- Links
- Section
This column is used to indicate the Group name of the values. - SectionText
- Id
This column is used to indicate the specific and explicit identification of the value. - Description
This column is used to indicate explanation of the value. - Value
This column is used to indicate the formatted value. - SectionXml
This column is used to indicate the name of the section in English. - IdXml
This column is used to indicate the identification in English. - ValueXml
This column is used to indicate the field contents in Xml format.
The SectionXml and the IdXml identify the value unambiguously.
With Javascript extensions you can retrieve the ValueXml using the "Banana.document.info(SectionXml,IdXml)" API function.
FileInfo columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "FileInfo",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "SectionText",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "Id",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Id",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 800
},
{
"nameXml": "Value",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Value",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 900
},
{
"nameXml": "SectionXml",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section Xml",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "IdXml",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "ID Xml",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
},
{
"nameXml": "ValueXml",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Value Xml",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 400
}
]
}
FileInfo table for a double-entry accounting
The following is an example of the FileInfo table for a double-entry accounting data with some values in it.
- In the first row there are the names Xml of the columns.
- In the next rows there are all the data saved in the table.
SectionXml | IdXml | Description | ValueXml | Value |
Base | Date | Date | 2024-11-15 | 15.11.2024 |
Base | Time | Time | 15:17:51.537 | 15:17:51 |
Base | ProgramVersion | Program version | 10.1.24.24275 | 10.1.24.24275 |
Base | HashAlgorithm | Hash algorithm | Sha2-256 | Sha2-256 |
Base | HashTotal | Total Hash | a77a16e6eae92a9db0d4109d2040a6f6 | a77a16e6eae92a9db0d4109d2040a6f6 |
Base | FileName | File Name | /Users/username/Desktop/Double-entry with VAT-Sales tax.ac2 | /Users/username/Desktop/Double-entry with VAT-Sales tax.ac2 |
Base | WorkingCopyFileName | Working copy file name | /Users/username/Library/Application Support/Banana.ch/BananaPlus/10.0/WorkingCopies/Double-entry with VAT-Sales tax.ac2 | /Users/username/Library/Application Support/Banana.ch/BananaPlus/10.0/WorkingCopies/Double-entry with VAT-Sales tax.ac2 |
Base | DateLastSaved | Date last saved | 2024-11-08 | 08.11.2024 |
Base | TimeLastSaved | Time last saved | 16:10:31.000 | 16:10:31 |
Base | FileSize | File size | 782728 | 782728 |
Base | FilePwdProtected | File password protected | No | No |
Base | HeaderLeft | Header Left | Company XX | Company XX |
Base | HeaderRight | Header Right | Accounting 2024 | Accounting 2024 |
Base | DecimalsAmounts | Decimal points for amounts | 2 | 2 |
Base | RoundingType | Rounding Type | 3:Commercial/Arithmetic (Half up) | 3:Commercial/Arithmetic (Half up) |
Base | Language | Language in use | enu | English |
Base | LanguageCreation | Language used to create | enu | English |
Base | Extension1 | Extension 1 | https://www.banana.ch/portal/repodata/ghba/Universal/report/accounting/portfolioAccounting/ch.banana.portfolio.accounting.sbaa | https://www.banana.ch/portal/repodata/ghba/Universal/report/accounting/portfolioAccounting/ch.banana.portfolio.accounting.sbaa |
Base | Extension2 | Extension 2 | ||
Base | Extension3 | Extension 3 | ||
Base | CreateProgramVersion | Version Creation | 10.1.24.24275 | 10.1.24.24275 |
Base | LastSavedProgramVersion | Version Last saved | 10.1.24.24275 | 10.1.24.24275 |
Base | MaxSavedProgramVersion | Version Max saved | 10.1.24.24275 | 10.1.24.24275 |
Base | SavedProgramVersionCompatibility | Version compatibility | 9.0.1 | 9.0.1 |
Base | FileType | Type | Double-entry with VAT/Sales tax | Double-entry with VAT/Sales tax |
Base | FileTypeGroup | Group type | 100 | 100 |
Base | FileTypeNumber | Number type | 110 | 110 |
Base | FileTypeVersion | Version type | 100 | 100 |
AccountingDataBase | Company | Company | Company XX | Company XX |
AccountingDataBase | Courtesy | Courtesy | ||
AccountingDataBase | Name | Name | Pinco | Pinco |
AccountingDataBase | FamilyName | Family Name | Pallino | Pallino |
AccountingDataBase | Address1 | Address 1 | Via del Sole 54 | Via del Sole 54 |
AccountingDataBase | Address2 | Address 2 | ||
AccountingDataBase | Zip | Zip | 6900 | 6900 |
AccountingDataBase | City | City | Lugano | Lugano |
AccountingDataBase | State | State | ||
AccountingDataBase | Country | Country | Switzerland | Switzerland |
AccountingDataBase | CountryCode | CountryCode | CH | CH |
AccountingDataBase | Web | Web | www.companyxx.com | www.companyxx.com |
AccountingDataBase | companyxx@info.com | companyxx@info.com | ||
AccountingDataBase | Phone | Phone | 1234567890 | 1234567890 |
AccountingDataBase | Mobile | Mobile | 0987654321 | 0987654321 |
AccountingDataBase | IBAN | IBAN | CHXX 0900 0XXX XXXX XXXX X | CHXX 0900 0XXX XXXX XXXX X |
AccountingDataBase | FiscalNumber | Fiscal number | ||
AccountingDataBase | VatNumber | VAT Number | CHE-123.456.789 VAT | CHE-123.456.789 VAT |
AccountingDataBase | Recalculate | Entire recalculation | No | No |
AccountingDataBase | BasicCurrency | Basic Currency | CHF | CHF |
AccountingDataBase | BasicCurrencyHeader | Basic Currency Header | ||
AccountingDataBase | DecimalsAmountsCurrency | Decimal points for amounts in foreign currency | 2 | 2 |
AccountingDataBase | OpeningDate | Opening date | 2024-01-01 | 01.01.2024 |
AccountingDataBase | ClosureDate | Closure date | 2024-12-31 | 31.12.2024 |
AccountingDataBase | ObligatoryDate | Obligatory transaction date | Yes | Yes |
AccountingDataBase | MinusSignSegmentSeparator | Minus sign as segments separator | No | No |
AccountingDataBase | CostCenterSign | Cost center sign relative to amount | No | No |
AccountingDataBase | FileNamePreviousYear | File from previous year | ||
AccountingDataBase | SmartFillFromPreviousYear | Smart fill from previous year | No | No |
AccountingDataBase | VatAccount | VAT Account | ||
AccountingDataBase | VatAccountRecoverable | Recoverable VAT Account | ||
AccountingDataBase | VatRounding | VAT rounding | ||
AccountingDataBase | Cc1VatAmount | CC1 VAT amount | 0 | 0 |
AccountingDataBase | Cc2VatAmount | CC2 VAT amount | 0 | 0 |
AccountingDataBase | Cc3VatAmount | CC3 VAT amount | 0 | 0 |
AccountingDataBase | CustomersGroup | Customers group | DEB1 | DEB1 |
AccountingDataBase | SuppliersGroup | Suppliers group | CRE1 | CRE1 |
AccountingDataBase | AccountingDifference | There are accounting imbalances | Yes | Yes |
AccountingDataBase | InitialBalanceDifference | Difference on initial balance | ||
AccountingDataBase | DebitCreditDifference | Debit/credit difference | 147.50 | 147.50 |
Accounts | TableNameXml | Xml Table name | Accounts | Accounts |
Accounts | TableHeader | Table header | Accounts | Accounts |
Accounts | CountRows | Number of rows | 46 | 46 |
Accounts | CountRowsError | Rows with errors | 0 | 0 |
Accounts | CountRowsWarning | Rows with messages | 0 | 0 |
Accounts | CountRowsProtected | Protected rows | 0 | 0 |
Accounts | CountRowsLocked | Locked rows | 0 | 0 |
Accounts | CountGroups | Number of groups | 9 | 9 |
Accounts | CountAccounts | Number of accounts | 23 | 23 |
Accounts | CountAccountsBalance | Number of accounts with a balance | 10 | 10 |
Accounts | CountTransactions | Number of accounts with transactions | 10 | 10 |
Accounts | HashAccountsBalance | Hash of the balance | bcySJq3b9DHGdeyzP/CZzkgmcCfeBpLm | bcySJq3b9DHGdeyzP/CZzkgmcCfeBpLm |
Accounts | CountAccountsOpening | Number of accounts with opening balance | ||
Accounts | HashAccountsOpening | Hash of the opening balance | ||
Transactions | TableNameXml | Xml Table name | Transactions | Transactions |
Transactions | TableHeader | Table header | Transactions | Transactions |
Transactions | CountRows | Number of rows | 46 | 46 |
Transactions | HashComplete | Hash complete | x1iqL10LDNjc9DqkXvu9xsj8olbM2CGr | x1iqL10LDNjc9DqkXvu9xsj8olbM2CGr |
Transactions | CountRowsError | Rows with errors | 0 | 0 |
Transactions | CountRowsWarning | Rows with messages | 0 | 0 |
Transactions | CountRowsProtected | Protected rows | 0 | 0 |
Transactions | CountRowsLocked | Locked rows | 0 | 0 |
Transactions | DateEarliestTransaction | Earliest transaction date | ||
Transactions | DateLatestTransaction | Latest transaction date | 2024-10-31 | 31.10.2024 |
Transactions | TransactionLockUsed | Transaction lock is used | No | No |
VatCodes | TableNameXml | Xml Table name | VatCodes | VatCodes |
VatCodes | TableHeader | Table header | VAT codes | VAT codes |
VatCodes | CountRows | Number of rows | 90 | 90 |
VatCodes | HashComplete | Hash complete | pwLdoomYeFIdnw1T2dfpxO2B6ks8a3tK | pwLdoomYeFIdnw1T2dfpxO2B6ks8a3tK |
VatCodes | CountRowsError | Rows with errors | 0 | 0 |
VatCodes | CountRowsWarning | Rows with messages | 0 | 0 |
VatCodes | CountRowsProtected | Protected rows | 0 | 0 |
VatCodes | CountRowsLocked | Locked rows | 0 | 0 |
Budget | TableNameXml | Xml Table name | Budget | Budget |
Budget | TableHeader | Table header | Budget | Budget |
Budget | CountRows | Number of rows | 1 | 1 |
Budget | CountRowsError | Rows with errors | 0 | 0 |
Budget | CountRowsWarning | Rows with messages | 0 | 0 |
Budget | CountRowsProtected | Protected rows | 0 | 0 |
Budget | CountRowsLocked | Locked rows | 0 | 0 |
Documents | TableNameXml | Xml Table name | Documents | Documents |
Documents | TableHeader | Table header | Documents | Documents |
Documents | CountRows | Number of rows | 1 | 1 |
Documents | CountRowsError | Rows with errors | 0 | 0 |
Documents | CountRowsWarning | Rows with messages | 0 | 0 |
Documents | CountRowsProtected | Protected rows | 0 | 0 |
Documents | CountRowsLocked | Locked rows | 0 | 0 |
LockTransactions | TransactionLockUsed | Transaction lock is used | No | No |
The same table exists for all the accounting file types. What changes from one type of accounting to another is the data the table contains.
The SectionXml and the IdXml columns identify the value unambiguously.
With Javascript extensions you can retrieve the value of ValueXml column using the JavaScript API function "Banana.document.info(SectionXml,IdXml)". The function returns the info value of the document referenced by SectionXml and IdXml.
Some examples:
// Get some value of the accounting file
var FileName = Banana.document.info("Base","FileName");
var DecimalsAmounts = Banana.document.info("Base","DecimalsAmounts");
var HeaderLeft = Banana.document.info("Base","HeaderLeft");
var HeaderRight = Banana.document.info("Base","HeaderRight");
var BasicCurrency = Banana.document.info("AccountingDataBase","BasicCurrency");
// For openingDate and closureDate use instead startDate and endDate
var openingDate = Banana.document.info("AccountingDataBase","OpeningDate");
var closureDate = Banana.document.info("AccountingDataBase","ClosureDate");
// For file accounting type
var FileType = Banana.document.info("Base","FileType");
var FileGroup = Banana.document.info("Base","FileTypeGroup");
var FileNumber = Banana.document.info("Base","FileTypeNumber");
// For customer settings
var customersGroup = Banana.document.info("AccountingDataBase","CustomersGroup");
var suppliersGroup = Banana.document.info("AccountingDataBase","SuppliersGroup");
Items table columns structure
In Banana Accounting javascript extensions, when referring to tables and columns, you must always use the correct nameXml.
Each table and each column has a proper nameXml. With the nameXml, tables and columns can be accessed to read the data they contain.
All columns of Items table are shown below with their nameXml.
Items table
The Items table is used to enter all the inventory items which need to be managed.
All nameXml of the table columns are listed below:
- SysCod
- Links
This column is used to indicate the link to an external file. - Section
- Group
This column is used to create a total row using the grouping system. - ItemsId
This column is used to indicate the item identifier. - Description
This column is used to indicate a text description of the item. - Notes
This column is used to indicate a personal note. - Gr
This column is used to indicate the grouping for each item, specifying which totalization group it belongs to. - Disable
- Account
This column is linked with the Account column of Accounts table. It is used to indicate the account used in the Transactions table. - VatCode
This column is linked with the VatCode column of VatCodes table. It is used to indicate the VAT code to use. - ReferenceUnit
This column is used to indicate an abbreviation to define the type to which the quantity refers. - SellingPrice
This column is used to indicate the unit sale price. - Cost
This column is used to indicate the unit cost price. - QuantityBegin
This column is used to indicate the initial quantity amount of the item. - UnitPriceBegin
This column is used to indicate the initial unit price of the item. - ValueBegin
This column is used to indicate the initial quantity multiplied by Price Begin. - QuantityCurrent
This column is used to indicate the current quantity. - UnitPriceCurrent
This column is used to indicate the current price of the item. - ValueCurrent
This column is used to indicate the current quantity multiplied by current price.
For the multy-currency accounting file type, there are additional columns for the Items table. The nameXml of the additional columns are listed below:
- Currency
- ValueBeginCurrency
- ExchangeBegin
- CurrencyCurrentValue
- ExchangeCurrent
Items columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Items",
"columns": [
{
"nameXml": "SysCod",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "SysCod",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 100
},
{
"nameXml": "Links",
"alignment": "left",
"dataType": "links",
"decimal": "",
"description": "Links to external documents",
"excludeFromPrinting": "",
"header": "Links",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "Group",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": " Group name",
"excludeFromPrinting": "",
"header": " Group",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "ItemsId",
"alignment": "right",
"dataType": "text",
"decimal": "",
"description": "Items Id",
"excludeFromPrinting": "",
"header": "Item",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 150
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 600
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Notes",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Gr",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Sum in the indicated Group",
"excludeFromPrinting": "",
"header": "Sum In",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Disable",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Disable account or group",
"excludeFromPrinting": "",
"header": "Disable",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Account",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Account number",
"excludeFromPrinting": "",
"header": "Account",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "VatCode",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "VAT/Sales tax code",
"excludeFromPrinting": "",
"header": "VAT code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "ReferenceUnit",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Reference unit",
"excludeFromPrinting": "",
"header": "Unit",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "SellingPrice",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Selling price",
"excludeFromPrinting": "",
"header": "Selling",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "Cost",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Product cost",
"excludeFromPrinting": "",
"header": "Cost",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 125
},
{
"nameXml": "QuantityBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Begin quantity",
"excludeFromPrinting": "",
"header": "Begin Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "UnitPriceBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Begin unit price",
"excludeFromPrinting": "",
"header": "Price Begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "ValueBegin",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Value begin",
"excludeFromPrinting": "",
"header": "Value Begin",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "QuantityCurrent",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Current quantity",
"excludeFromPrinting": "",
"header": "Current Qt.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 125
},
{
"nameXml": "UnitPriceCurrent",
"alignment": "right",
"dataType": "amount",
"decimal": 4,
"description": "Current unit price",
"excludeFromPrinting": "",
"header": "Price Current",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 125
},
{
"nameXml": "ValueCurrent",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Value current",
"excludeFromPrinting": "",
"header": "Value Current",
"header2": "CHF",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
}
]
}
For the multy-currency accounting file type, there are additional columns.
The list of the additional columns is shown below in JSON format, with also the information for each column.
{
"nameXml": "Currency",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Currency",
"excludeFromPrinting": "",
"header": "Currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 268
},
{
"nameXml": "ValueBeginCurrency",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Value begin currecy",
"excludeFromPrinting": "",
"header": "V. begin currency",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "ExchangeBegin",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "Exchange begin",
"excludeFromPrinting": "",
"header": "Exch. begin",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
},
{
"nameXml": "CurrencyCurrentValue",
"alignment": "right",
"dataType": "amount",
"decimal": 2,
"description": "Currency current value",
"excludeFromPrinting": "",
"header": "Currency V.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 250
},
{
"nameXml": "ExchangeCurrent",
"alignment": "right",
"dataType": "number",
"decimal": 12,
"description": "Exchange current",
"excludeFromPrinting": "",
"header": "Exchange",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 250
}
Productivity tables
Other tables of productivity applications of Banana Accounting.
Table of contents
Time Sheet tables and columns structure
In Banana Accounting javascript extensions, when referring to tables and columns, you must always use the correct nameXml.
Each table and each column has a proper nameXml. With the nameXml, tables and columns can be accessed to read the data they contain.
All tables and columns are shown below with their nameXml.
Time Sheet tables
These are the nameXml of all the tables for a Time Sheet file:
- Journal.
The nameXml for the Journal table that is used to set up and enter the daily data of the Time Sheet. - Documents.
The nameXml for the Documents table that is used to include attachments like images, logos, text documents, HTML texts, Markdown codes, CSS stylesheet codes and Javascript codes. - FileInfo.
The nameXml for the FileInfo table that is used by the program to store all the information about the currently open file.
Each table is used for a specific purpose and has dedicated columns. The structure for each table with the related columns are shown below.
Journal table
The Journal table is used to set up the Time Sheet.
All nameXml of the table columns are listed below:
- Section
This column is protected. It is used by the program to make a distinction between rows used for data entry and system-specific rows. - Date
This column is protected. It is used for entering the date of the day. - TimeDayType
This column is used to indicate the type of the day- Blank - business day.
- 0 - to set the current day as a holiday.
- 1 - to set the current day as non-working.
- 2 - to set the current day as a working day.
- [0] - festive day set automatically, as per the File Properties.
- [1] - non-working day set automatically, as per the File Properties.
- W0 - to set the current day as festive. On the same day, in the following weeks it will be automatically set with the (0) value.
- W1 - to set the current day as non-working day. On the same day, in the following weeks it will be automatically set with the (1) value .
- W2 - to set the current day as a working day. On the same day, in the following weeks it will be automatically set with the (2) value.
- WR - to reset the current day with the value indicated in the File Properties.
- WA - to reset the current day with the value indicated in the File Properties. On the same day, in the following weeks it will be set automatically with the value indicated in the file properties.
- TimeDayDescription
Column used by the program for automatic insertion of the name of the day, based on the date. - RowType
- Description
This column is used to indicate an additional description. - Code1
This column is used to indicate any customer, project or other number. - Notes
This column is used to indicate additional notes. - TimeWork1
This column is used to indicate working hours (e.g. nights, holidays). - TimeWork2
This column is used to indicate working hours (e.g. nights, holidays). - TimeStart1
This column is used to indicate the starting work time. - TimeStop1
This column is used to indicate the ending work time. - TimeStart2
This column is used to indicate the starting work time. - TimeStop2
This column is used to indicate the ending work time. - TimeStart3
This column is used to indicate the starting work time. - TimeStop3
This column is used to indicate the ending work time. - TimeStart4
This column is used to indicate the starting work time. - TimeStop4
This column is used to indicate the ending work time. - TimeStart5
This column is used to indicate the starting work time. - TimeStop5
This column is used to indicate the ending work time. - TimeWorkTotal
This column is protected. It is used by the program to calculate the total hors worked.
It is the sum of "(TimeStart1, TimeStop1) + (TimeStart2, TimeStop2) + (TimeStart3, TimeStop3) + (TimeStart4, TimeStop4) + (TimeStart5, TimeStop5)" - TimeDetailTotal
- TimeSurchargeManual
- TimeSurchargePercentage
- TimeSurchargeCalculated
- TimeSurchargeTotal
- TimeAbsenceSick
This column is used to indicate the hours of absence due to illness. - TimeAbsenceHoliday
This column is used to indicate the holiday hours. - TimeAbsenceService
This column is used to indicate mandatory absences, such as military service, community service or other. - TimeAbsenceOther
This column is used to indicate other types of abscences that are not indicated in TimeAbsenceSick, TimeAbsenceHoliday, TimeAbsenceService. - TimeAbsenceTotal
This column is protected. It is used by the program to automatically calculate the sum of absences. - TimeAdjustment
This column is used to indicate an adjustment value. - TimeDayTotal
- TimeDueCode
This column is used to change the value of the Due (hours of work due).- DS (Set Today) - Set the due hours of the current day, without changing the other days.
- WS (Set Week Day) - Sets the hours due for the day and for the same day of the following weeks.
- PS (Set Predefined) - Sets the due hours for the day and for all subsequent days without a different setting
- WR (Reset Week Day) - Reset the default value for the day of the week.
- WA (Reset All Week Days) - Resets all the default values for the days of the week.
- PR (Reset Predefined) - Reset general default. Removes the default value set previously.
- PA (Reset Predefined and Week Days) - Reset the general default and those of the week. It is like starting everything anew.
- RP (Restart progressive) - Restarts the value of the Progressive column from zero. You insert this code in the beginning of month row, when all hourly salaries, when all the hours of the previous month have been paid.
- TimeDueDay
This column is protected. The program automatically calculates the difference between the hours worked and those due. At the end of the month and year, the totals of the Due are also reported. - TimeDifference
This column is protected. The program automatically calculates the difference between the hours worked (Total) and those due (Due). At the end of the month and at the end of the year, the totals of the difference are also reported. - TimeProgressive
This column is protected. The program automatically calculates the difference between the hours worked (Total) and those due (Due). At the end of the month and at the end of the year, the totals of the difference are also reported. - TimeSplit1
This column is used to track hours invested in projects. - TimeSplit2
This column is used to track hours invested in projects.
Journal columns structure
The list of columns is shown below in JSON format, with also additional information for each column.
{
"nameXml": "Journal",
"columns": [
{
"nameXml": "Section",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Section",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 250
},
{
"nameXml": "Date",
"alignment": "right",
"dataType": "date",
"decimal": "",
"description": "Date",
"excludeFromPrinting": "",
"header": "Date",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 200
},
{
"nameXml": "TimeDayType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Festive",
"excludeFromPrinting": "",
"header": "Festive",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "TimeDayDescription",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Day description",
"excludeFromPrinting": "",
"header": "Day description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 400
},
{
"nameXml": "RowType",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Row type",
"excludeFromPrinting": "",
"header": "Type",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "Description",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "",
"excludeFromPrinting": "",
"header": "Description",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 600
},
{
"nameXml": "Code1",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Code 1",
"excludeFromPrinting": "",
"header": "Code 1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 150
},
{
"nameXml": "Notes",
"alignment": "left",
"dataType": "text",
"decimal": "",
"description": "Notes",
"excludeFromPrinting": "",
"header": "Notes",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 300
},
{
"nameXml": "TimeWork1",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Time work 1",
"excludeFromPrinting": "",
"header": "Work1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeWork2",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Time work 2",
"excludeFromPrinting": "",
"header": "Work2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeStart1",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time start 1",
"excludeFromPrinting": "",
"header": "Start1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "TimeStop1",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time stop 1",
"excludeFromPrinting": "",
"header": "Stop1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "TimeStart2",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time start 2",
"excludeFromPrinting": "",
"header": "Start2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "TimeStop2",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time stop 2",
"excludeFromPrinting": "",
"header": "Stop2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "TimeStart3",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time start 3",
"excludeFromPrinting": "",
"header": "Start3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeStop3",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time stop 3",
"excludeFromPrinting": "",
"header": "Stop3",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeStart4",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time start 4",
"excludeFromPrinting": "",
"header": "Start4",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeStop4",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time stop 4",
"excludeFromPrinting": "",
"header": "Stop4",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeStart5",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time start 5",
"excludeFromPrinting": "",
"header": "Start5",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeStop5",
"alignment": "right",
"dataType": "time",
"decimal": "",
"description": "Time stop 5",
"excludeFromPrinting": "",
"header": "Stop5",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeWorkTotal",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Time worked total",
"excludeFromPrinting": "",
"header": "Worked",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 120
},
{
"nameXml": "TimeDetailTotal",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Time row detail total",
"excludeFromPrinting": "",
"header": "Detail",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 120
},
{
"nameXml": "TimeSurchargeManual",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Surcharge manual",
"excludeFromPrinting": "",
"header": "Surcharge",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeSurchargePercentage",
"alignment": "right",
"dataType": "number",
"decimal": 2,
"description": "Percentage surcharge",
"excludeFromPrinting": "",
"header": "% Surcharge",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 100
},
{
"nameXml": "TimeSurchargeCalculated",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Surcharge calculated",
"excludeFromPrinting": "",
"header": "Surcharge Calc.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 120
},
{
"nameXml": "TimeSurchargeTotal",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Total surcharge",
"excludeFromPrinting": "",
"header": "Surcharge total",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 120
},
{
"nameXml": "TimeAbsenceSick",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Absence for sick leave",
"excludeFromPrinting": "",
"header": "Sick",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "TimeAbsenceHoliday",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Absence for holiday",
"excludeFromPrinting": "",
"header": "Holiday",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "TimeAbsenceService",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Public service",
"excludeFromPrinting": "",
"header": "Service",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeAbsenceOther",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Absence other",
"excludeFromPrinting": "",
"header": "Other",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeAbsenceTotal",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Absence total",
"excludeFromPrinting": "",
"header": "Absence",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": "",
"width": 180
},
{
"nameXml": "TimeAdjustment",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Adjustment",
"excludeFromPrinting": "",
"header": "Adjust.",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 120
},
{
"nameXml": "TimeDayTotal",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Time day total",
"excludeFromPrinting": "",
"header": "Total",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 120
},
{
"nameXml": "TimeDueCode",
"alignment": "center",
"dataType": "text",
"decimal": "",
"description": "Due code",
"excludeFromPrinting": "",
"header": "Due code",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 100
},
{
"nameXml": "TimeDueDay",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Due for the day",
"excludeFromPrinting": "",
"header": "Due",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": true,
"width": 180
},
{
"nameXml": "TimeDifference",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Time day difference",
"excludeFromPrinting": "",
"header": "Difference",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 180
},
{
"nameXml": "TimeProgressive",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Progressive balance",
"excludeFromPrinting": "",
"header": "Progressive",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": true,
"editable": "",
"width": 180
},
{
"nameXml": "TimeSplit1",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Split 1",
"excludeFromPrinting": "",
"header": "Split 1",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
},
{
"nameXml": "TimeSplit2",
"alignment": "right",
"dataType": "timecounter",
"decimal": 3,
"description": "Split 2",
"excludeFromPrinting": "",
"header": "Split 2",
"header2": "",
"style": {
"objectName": "",
"backgroundColor": "",
"color": "",
"fontSize": 10,
"bold": false,
"italic": false
},
"visible": "",
"editable": true,
"width": 120
}
]
}
Documents table
The Documents table is a common table used for all accounting file types. This table is used to include attachments like images, logos, text documents, HTML codes, Markdown codes, CSS stylesheet codes and Javascript Extensions codes.
FileInfo table
The FileInfo table is a common table used for all accounting file types. In this table the program stores all the information about the currently open file.
Extension's Types
The Extension type is defined within the attribute @task.
There are many types, and some of them are started in different ways.
Every extension need a specific type and a startup function.
- Types: app.command, export.file, export.rows, export.transactions, report.general
- Startup function: exec()
- How to run it:
- File based Apps are started from the menu App.
- Embedded Apps are run with the button within the Document table
General extension
The General extension type is used for anything that is not specific. It can input data, prepare report or modify the accounting.
- // @task = app.command
The extension is shown in the Menu extension.
You can run the extensions in two way:
- Menu > Extensions settings > Execute
- Menu Extension > the specific extension command
Export extension
Export extensions create and return a content that is than saved to a file.
- @task: import.transactions
Import extensions
The purpose is to translate the content of a file to a Banana Compatible format.
Import extensions are displayed in the Menu Action > Import in to Accounting.
There are different type:
- import.transactions
- @task: import.transactions
- Startup function: excec(fileContent) with the content of the file as parameter. The function should return a comma separated file.
- How to run it:
- Select from the menu Actions the command Import to accounting...
- As Import type select Transactions
- Select an import app from the list
- Click Browse to select the file with the data to import in Banana
- import.rows
- import.accounts
- import.categories
- import.exchangerates
- import.vatcodes
Report extensions
Report extensions purpose it to create a report.
- The report startup function is called by the specific function in Banana, for example the print invoice function.
- The function should return a Banana.Report document.
- The result is displayed on the preview windows.
Customer Report Extensions
Customer Report Extensions are of different type :
- report.customer.invoice
- Type: report.customer.invoice
- Startup function printDocument(jsonInvoice, repDocObj, repStyleObj)
- How to run it:
- Accounting: menu Reports > Customers the command Print invoices...
- Inoice & Estimate : menu Reports > Print invoices...
- report.customer.statement
- Type: report.customer.statement
- Startup function printDocument(jsonInvoice, repDocObj, repStyleObj)
- How to run it:
- Select from the menu Reports > Customers the command Print statements...
- report.customer.reminder
- Type: report.customer.reminder
- Startup function printDocument(jsonInvoice, repDocObj, repStyleObj)
- How to run it:
- Select from the menu Reports > Customers the command Print reminders...
Payment extensions
Payment extensions are used in the accounting to enter payment data and create payments orders.
Invoice Dialog extensions
Invoice Dialog extensions is a special type that is called by the Invoice & Expense application to edit or update the content of an invoice or estimate.
File Creator Extensions
File Creator Extensions are used to create a Banana Accounting file by importing and transforming the data.
General Extensions
General extensions are extensions that are not specific. You can use for anything.
- Entering data.
- Creating a report.
- Making changes to a file.
Attributes
In the attribute the Productivity extension should define:
- @tast = app.command
// @task = app.command
Starting function
The entry point of an Productivity extension is the function exec().
function exec(inData) {
}
Return value
The return value is an error or a JSON containing a documentChange to modify the accounting data.
General Reports Extensions
Extensions are used to create reports.
Report Extensions are General Extensions that use the Report functionality. They have the following structured:
- Have the attribute "app.command".
- Contain the function exec() tha
- create ReportObject
and populate with data. - create a Banana.Report.ReportStylesheet
use the function Banana.Report.newStyleSheet() - call a function Banana.Report.preview(reportObject, stylesheet)
The program will then open the preview window and visualize the content.
- create ReportObject
Specific Report Extensions
Specific report extensions are for:
Example Extension for Creating a Report with a Table
Introduction
All the following code samples are used in the embedded_javascript_tutorial1.ac2 file as embedded BananaApps. This file contains a list of complete and working examples that can be run.
Another complete and working example of BananaApp that use a table can be found here.
Table object
Tables are used in BananaApps to present tabular data as reports.
A Table object is defined using the addTable([classes]) function, and contains a number of table cells which are organized into table rows.
The process for creating a table is the following:
- Create the report object that willl contain the table
- Add a table object to the report
- Add a row object to the table using the addRow([classes]) method.
- Add cells objects to the row using the addCell([span]) or addCell(text [,classes, span]) methods.
- Repeat steps 3 and 4
Table Code Sample: Simple Table
// @api = 1.0
// @id = ch.banana.uni.app.tablereport
// @description = Tutorial: Table example report
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var report = Banana.Report.newReport("Report title"); // create the report
var myTable = report.addTable("myTable"); // create and add a table to the report
var tableRow = myTable.addRow(); // add a row to the table
tableRow.addCell("Cash"); // add a first cell to the row
tableRow.addCell("500.00"); // add a second cell to the row
var tableRow = myTable.addRow(); // add a row to the table
tableRow.addCell("Bank"); // add a first cell to the row
tableRow.addCell("1200.50"); // add a second cell to the row
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Output:
Column headers
Table cells may should act as column headers, in such cases it should be used the getHeader() function.
If the table goes over several pages, this would allow you to repeat at the beginning of each page the headers of the columns.
var report = Banana.Report.newReport("Report title");
var table = report.addTable("myTable");
// add the table header
var tableHeader = table.getHeader();
var tableRow = tableHeader.addRow();
tableRow.addCell("Description");
tableRow.addCell("Amount");
// add the first row of the table
tableRow = table.addRow();
tableRow.addCell('Cash');
tableRow.addCell('1200');
Output:
Caption
A caption, which is a descriptive text associated with the element, can be added to a table using the getCaption() function.
var table = report.addTable("MyTable");
var caption = table.getCaption();
caption.addText("Table caption text", "captionStyle");
Output:
Merge cells
Table cells can be merged using the span attribute of the addCell([span]) or addCell(text [,classes, span]) functions.
tableRow.addCell(); // span empty cell over 1 column (default value)
tableRow.addCell("", 3); // span empty cell over 3 columns
tableRow.addCell("Cash", 2); // span the cell over 2 columns
tableRow.addCell("Cash", "classStyle", 2); // span the cell over 2 columns
Columns and Cells attributes
Styles attributes can be defined to set, for example, the columns width and cells borders using the addColumn([classes]) and setStyleAttributes(attributes) functions.
- The width attribute (applied to a table) specifies the width of a table. If the width attribute is not set, a table takes up the space of the report page.
- The width attribute (applied to a column) specifies the width of a column. If the width attribute is not set, a column takes up the space it needs to display the data.
- The border attribute (applied to a cell) specifies the border of a cell. If the border attribute is not set, a cell will be displayed without borders.
var report = Banana.Report.newReport("Report Title");
var table = report.addTable("MyTable");
table.setStyleAttributes("width:100%;"); // specifies the width of the table
var column1 = table.addColumn("col1");
column1.setStyleAttributes("width:10%"); // specifies the width of the column1
var column2 = table.addColumn("col2");
column2.setStyleAttributes("width:55%"); // specifies the width of the column2
var column3 = table.addColumn("col3");
column3.setStyleAttributes("width:30%"); // specifies the width of the column3
var column4 = table.addColumn("col4");
column4.setStyleAttributes("width:5%"); // specifies the width of the column4
var tableRow = table.addRow();
tableRow.addCell("A", "", 1).setStyleAttributes("border:thin solid black"); // specifies the cell border
tableRow.addCell("B", "", 1).setStyleAttributes("border:thin solid black"); // specifies the cell border
tableRow.addCell("C", "", 1).setStyleAttributes("border:thin solid black"); // specifies the cell border
tableRow.addCell("D", "", 1).setStyleAttributes("border:thin solid black"); // specifies the cell border
Output:
Cell with multiple paragraphs
Table cells can contain multiple paragraphs of text or data. Use the addParagraph([text, classes]) function to add many paragraphs to a cell.
var report = Banana.Report.newReport("Report Title");
var table = report.addTable("MyTable");
table.setStyleAttributes("width:100%;");
tableRow = table.addRow();
// Add first cell with paragraphs
var cell1 = tableRow.addCell("", "", 1);
cell1.setStyleAttributes("border:thin solid black");
cell1.addParagraph("First paragraph...", "");
cell1.addParagraph("Second paragraph...", "");
cell1.addParagraph(" "); //empty paragraph
cell1.addParagraph("Fourth paragraph...", "");
// Add second cell without paragraphs
var cell2 = tableRow.addCell("Cell2...", "", 1).setStyleAttributes("border:thin solid black");
Output:
Table Code Sample: Complex Table
var report = Banana.Report.newReport("Report Title");
var table = report.addTable("MyTable");
table.setStyleAttributes("width:100%;");
var column1 = table.addColumn("col1");
column1.setStyleAttributes("width:25%");
var column2 = table.addColumn("col2");
column2.setStyleAttributes("width:25%");
var column3 = table.addColumn("col3");
column3.setStyleAttributes("width:25%");
var column4 = table.addColumn("col4");
column4.setStyleAttributes("width:25%");
// 1st row
tableRow = table.addRow();
tableRow.addCell("Row 1, Cell 1: span cell over 4 columns", "", 4).setStyleAttributes("border:thin solid black");
// 2nd row
tableRow = table.addRow();
tableRow.addCell("Row 2, Cell 1: span cell over 2 columns", "", 2).setStyleAttributes("border:thin solid black");
tableRow.addCell("Row 2, Cell 3: span cell over 2 columns", "", 2).setStyleAttributes("border:thin solid black");
// 3rd row
tableRow = table.addRow();
tableRow.addCell("Row 3, Cell 1", "", 1).setStyleAttributes("border:thin solid black");
tableRow.addCell("Row 3, Cell 2: span cell over 2 columns", "", 2).setStyleAttributes("border:thin solid black");
tableRow.addCell("Row 3, Cell 4", "", 1).setStyleAttributes("border:thin solid black");
// 4th row
tableRow = table.addRow();
tableRow.addCell("Row 4, Cell 1", "", 1).setStyleAttributes("border:thin solid black");
tableRow.addCell("Row 4, Cell 2", "", 1).setStyleAttributes("border:thin solid black");
tableRow.addCell("Row 4, Cell 3", "", 1).setStyleAttributes("border:thin solid black");
tableRow.addCell("Row 4, Cell 4", "", 1).setStyleAttributes("border:thin solid black");
// 5th row
tableRow = table.addRow();
tableRow.addCell("Row 5, Cell 1: span cell over 3 columns", "", 3).setStyleAttributes("border:thin solid black");
tableRow.addCell("Row 5, Cell 4", "", 1).setStyleAttributes("border:thin solid black");
Output:
Table within a Table
Tables can also be added within other tables, in particular to cells of "externals" tables. This might be useful when you need to create tables with more complex structures.
In these cases it is only necessary to add a tables to the cell object of the external tables instead of the report. These tables are treated as a separate table, with their own rows, cells and attributes.
var report = Banana.Report.newReport("Report Title");
/* EXTERNAL TABLE */
var table = report.addTable("outTable");
// ... add style attributes, rows, cells, etc. for the first external table
/* INTERNAL TABLE */
row_out = table.addRow(); // add a new row and a cell
cell_out = row_out.addCell("", "", 1);
var insideTable = cell_out.addTable("inTable"); // add a second table within a cell of the first table
var row_in = insideTable.addRow();
var cell_in = row_in.addCell("1", "", 1);
cell_in = row_in.addCell("2", "", 1);
row_in = insideTable.addRow();
cell_in = row_in.addCell("3", "", 1);
cell_in = row_in.addCell("4", "", 1);
// add a second cell to the first table
cell_out = row_out.addCell("row 2, cell 2", "", 1);
Output example:
Example Extension for Journal reporting
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
- The examples files are available on github/General/CaseStudies/JournalReport.
- Solutions making use of the journal api:
- China, Voucher report
- Netherlands, Auditfile
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:
// Copyright [2024] [Banana.ch SA - Lugano Switzerland]
// @id = ch.banana.addon.journalreport.js
// @api = 1.0
// @pubdate = 2016-06-01
// @publisher = Banana.ch SA
// @description = Journal Report Example
// @task = app.command
// @doctype = 100.*;110.*;130.*
// @docproperties =
// @outputformat = none
// @inputdataform = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a journal table
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL);
//Print the table header
var table = report.addTable("table");
tableRow = table.addRow();
tableRow.addCell("JContraAccountGroup", "bold", 1);
tableRow.addCell("JRowOrigin", "bold", 1);
tableRow.addCell("JDate", "bold", 1);
tableRow.addCell("JAccount", "bold", 1);
tableRow.addCell("JContraAccount", "bold", 1);
tableRow.addCell("JDescription", "bold", 1);
tableRow.addCell("JAccountDescription", "bold", 1);
tableRow.addCell("JAmount", "bold", 1);
//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 want only the transactions rows
if (tRow.value('JOperationType') == Banana.document.OPERATIONTYPE_TRANSACTION) {
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');
tableRow = table.addRow();
tableRow.addCell(jContraAccountGroup, "", 1);
tableRow.addCell(jRowOrigin, "", 1);
tableRow.addCell(jDate, "", 1);
tableRow.addCell(jAccount, "", 1);
tableRow.addCell(jContraAccount, "", 1);
tableRow.addCell(jDescription, "", 1);
tableRow.addCell(jAccountDescription, "", 1);
tableRow.addCell(jAmount, "right", 1);
}
}
//We apply some style and print the report
var stylesheet = Banana.Report.newStyleSheet();
var pageStyle = stylesheet.addStyle("@page");
pageStyle.setAttribute("margin", "15mm 5mm 10mm 5mm");
stylesheet.addStyle("body", "font-size: 7pt; font-family: Helvetica");
stylesheet.addStyle(".bold", "font-weight:bold");
stylesheet.addStyle(".right", "text-align:right");
stylesheet.addStyle(".backgroundColor", "background-color:#464e7e");
style = stylesheet.addStyle(".table");
style.setAttribute("width", "100%");
stylesheet.addStyle("table.table td", "border: thin solid black");
Banana.Report.preview(report, stylesheet);
}
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
Example Extension for Cash Flow Report
Introduction
This walkthrough provides step-by-step guidance for creating an Extension for printing a cash flow report.
As example we use the Cash Flow Report that is part of the Rapports comptables (OHADA - RDC) Extension, developed following the specifications for the OHADA-RDC in Africa (for more information, visit the GitHub documentation).
There are three basic steps in order to experiment with this Extension:
- Prepare for programming
- Create a JavaScript programming
- Install the Extension
- Run the Extension
Preparation work
Before you start programming, you need to define how the output should look like and how its calculations will be done.
With the following information the software developer will be able to program the software:
- Prepare an accounting file with:
- The accounting plan you will use as the base for the report.
The Cash flow report is related to a specific accounting plan, its accounting groups and its numbers. - The data that is necessary to test if the report is correct.
- Opening balances for all the accounts and groups that partecipate in the calculation.
Possibly use simple to understand amounts (10, 20, 100, 1000). - Transactions for all relevant accounts.
- Opening balances for all the accounts and groups that partecipate in the calculation.
- The accounting plan you will use as the base for the report.
- Decide how the report should look like.
If you aren't already in process of an example printout, use Excel and prepare an example of the desired printout.
On the left side ad a column with the name for each row.
See OHADA example. - Explain for each row how the calculation for the related row of the report should be done.
See OHADA example.- Specify the accounts or groups that will be summed
- Specify amounts that should be entered manually.
In case the information cannot be retrieved from the accounting data (lack of account), the programmer can easily create a dialog in order to enter the information manually.
How to specify calculations for programmers
In order to understand how to specify calculations for programmers, you need to know which amounts you can retrieve from the Accounts table of Banana Accounting.
You can retrieve amounts for both, accounts and groups, and specify the type of amount:
- opening: the amount at the beginning of the period (the Opening column of the Accounts table). Can be positive or negative.
- debit: the amount of debit transactions for the period (the Debit column of the Accounts table). Only positive values.
- credit: the amount of credit transactions for the period (the Credit column of the Accounts table). Only positive values.
- total: the difference between debit-credit for the period. Can be positive or negative.
- balance: the balance for the period (opening + total). Can be positive or negative.
The combination of account/group and amounts type can be used to specify the calculations for programmers:
- In case of accounts, indicate "account_number , amount_type" (i.e. "1000 , opening").
- In case of groups, indicate "Gr=group_number , amount_type" (i.e. "Gr=10 , total").
See the table below for more examples:
Row name | Formula | Description |
---|---|---|
ZA | getAmount(Gr=BT, opening) | Takes the opening amount of the group BT |
FA | + (-1) getAmount(Gr=134, total) + getAmount(6541, total) + getAmount(6542, total) - (-1)getAmount(7541, total) - (-1)getAmount(7542, total) + (-1)getAmount(Gr=136, total) + (-1)getAmount(Gr=TO, total) - getAmount(Gr=RP, total) - getAmount(Gr=RQ, total) - getAmount(Gr=RS, total) | add (inverted) total amount of group 134 add total amount of account 6541 add total amount of account 6542 subtract (inverted) total amount of account 7541 subtract (inverted) total amount of account 7542 add (inverted) total amount of group 136 add (inverted) total amount of group TO subtract total amount of group RP subtract total amount of group RQ subtract total amount of group RS |
FB | getAmount(488, total) | Takes the movement of the period (total) for the account 488 |
FJ | + getAmount(826, credit) + getAmount(Gr=AS-1, credit) - getAmount(4856, debit) | add credit amount of account 826 add credit amount of group AS-1 subtract debit amount of account 4856 |
Example of the "FA" row in the report with the sum of all the amounts:
Here is the Javascript code for the calculation of each line. For a better control there has been created a function for each row, that retrieves and sums the values for a specific period and then returns the amount to be printed.
function calculate_ZA(banDoc, startDate, endDate) {
/*
Gr=BT,opening - (- Gr=DT,opening)
*/
var grBT = getAmount(banDoc,'Gr=BT','opening',startDate,endDate);
var grDT = getAmount(banDoc,'Gr=DT','opening',startDate,endDate);
return Banana.SDecimal.subtract(grBT, Banana.SDecimal.invert(grDT));
}
function calculate_FA(banDoc, startDate, endDate) {
/*
+ (-Gr=134, total)
+ account 6541, total
+ account 6542, total
- (-account 7541, total)
- (-account 7542, total)
+ (-Gr=136, total)
+ (-Gr=TO, total)
- Gr=RP, total
- Gr=RQ, total
- Gr=RS, total
*/
var gr134 = getAmount(banDoc,'Gr=134','total',startDate,endDate);
var acc6541 = getAmount(banDoc,'6541','total',startDate,endDate);
var acc6542 = getAmount(banDoc,'6542','total',startDate,endDate);
var acc7541 = getAmount(banDoc,'7541','total',startDate,endDate);
var acc7542 = getAmount(banDoc,'7542','total',startDate,endDate);
var gr136 = getAmount(banDoc,'Gr=136','total',startDate,endDate);
var grTO = getAmount(banDoc,'Gr=TO','total',startDate,endDate);
var grRP = getAmount(banDoc,'Gr=RP','total',startDate,endDate);
var grRQ = getAmount(banDoc,'Gr=RQ','total',startDate,endDate);
var grRS = getAmount(banDoc,'Gr=RS','total',startDate,endDate);
var res = 0;
res = Banana.SDecimal.add(res, Banana.SDecimal.invert(gr134));
res = Banana.SDecimal.add(res,acc6541);
res = Banana.SDecimal.add(res,acc6542);
res = Banana.SDecimal.subtract(res, Banana.SDecimal.invert(acc7541));
res = Banana.SDecimal.subtract(res, Banana.SDecimal.invert(acc7542));
res = Banana.SDecimal.add(res, Banana.SDecimal.invert(gr136));
res = Banana.SDecimal.add(res, Banana.SDecimal.invert(grTO));
res = Banana.SDecimal.subtract(res,grRP);
res = Banana.SDecimal.subtract(res,grRQ);
res = Banana.SDecimal.subtract(res,grRS);
return res;
}
function calculate_FB(banDoc, startDate, endDate) {
/*
account 488, total
*/
return getAmount(banDoc,'488','total',startDate,endDate);
}
function calculate_FJ(banDoc, startDate, endDate) {
/*
+ account 826, credit
+ Gr=AS-1, credit
- 4856, debit
*/
var acc826 = getAmount(banDoc,'826','credit',startDate,endDate);
var grAS1 = getAmount(banDoc,'Gr=AS-1','credit',startDate,endDate);
var acc4856 = getAmount(banDoc,'4856','debit',startDate,endDate);
var res = 0;
res = Banana.SDecimal.add(res,acc826);
res = Banana.SDecimal.add(res,grAS1);
res = Banana.SDecimal.subtract(res,acc4856);
return res;
}
Create the JavaScript programming
The script retrieves all the required data from Banana Accounting files, makes some addition and subtraction operations, and presents the data in a table.
By looking a the source code for Cash Flow Report (OHADA - RDC) you will understand how the report is setup.
If you want to experiment with the script, copy and paste it on your text editor and save the file as .js (i.e. cashflow.js). Otherwise you can just install and run the app following the GitHub documentation.
Retrieve data from Banana
In order to build a cash flow it is required to get different data from the accounting. These data are values related to specific accounts or groups and to some columns of the table accounts.
But how to do that? How to retrieve a specific account value for a specific column of the accounts table and period?
Function currentBalance()
To retrieve the various amounts of the report, we use the currentBalance(account, startDate, endDate) function.
The function sums the amounts of opening, debit, credit, total and balance calculated based on the opening and all transactions for the given accounts/group and period.
To build the cash flow report we use this function for accounts and groups:
// example for account 1000
var currentBal = Banana.document.currentBalance('1000','2019-01-01','2019-12-31');
// example for group 10
var currentBal = Banana.document.currentBalance('Gr=10','2019-01-01','2019-12-31');
The parameters of the function are:
- account or group number (the group number is preceded by "Gr=")
- start date of the period we are intrested
- end date of the period we are intrested
The returned value of the currentBalance() function is an object, which has name:values pairs called properties. These properties are the values we need.
The object structure is like the following one:
{
"amount":"17570.00",
"amountCurrency":"",
"bClass":"1",
"balance":"17570.00",
"balanceCurrency":"",
"credit":"30.00",
"creditCurrency":"",
"debit":"16600.00",
"debitCurrency":"",
"opening":"1000.00",
"openingCurrency":"1000.00",
"rowCount":"6",
"total":"16570.00",
"totalCurrency":""
}
As you can see this object has many properties, but the cash flow report we want to build uses only four of them:
- opening the amount at the beginning of the period (the Opening column of the Accounts table). Can be positive or negative.
- debit the amount of debit transactions for the period (the Debit column of the Accounts table). Only positive values.
- credit the amount of credit transactions for the period (the Credit column of the Accounts table). Only positive values.
- total the difference between debit-credit for the period. Can be positive or negative.
- balance the balance for the period. (opening + total). Can be positive or negative.
For more information, see the documentation here.
Accessing Object Properties
Ok, now we have the object with all the properties. But how to get a single property value?
There are three methods for accessing the property of an object:
// method 1: objectName.property
var value = currentBal.debit; // returns 16600.00
// method 2: objectName["property"]
var value = currentBal["credit"]; // returns 30.00
// method 3: objectName[expression]
var x = "total";
var value = currentBal[x]; // returns 16570.00
It doesn't matter which method is used, the result does not change.
Calculate totals
The cash flow report requires to do addition and subtraction operations using some specific values retrieved from the accounting file.
To build all the various totals we encounter in the report we use the add(value1, value2) and the subtract(value1, value2) functions.
// example sum the amounts of accounts 6541 and 6542
var acc6541 = Banana.document.currentBalance('6541','2019-01-01','2019-12-31').total;
var acc6542 = Banana.document.currentBalance('6542','2019-01-01','2019-12-31').total;
var sum = Banana.SDecimal.add(acc6541, acc6542);
Previous year Banana document
To generate the report, the Extension retrieves data from the current year accounting file and from the previous year accounting file.
The current year accounting file is the one that is opened in Banana, the one that starts the execution of the Extension.
The previous year accounting file is not opened in Banana, it is just selected from the menu File -> File and accounting properties... -> Options tab -> File from previous year.
In order to retrieve data from the previous year we use the previousYear([nrYears]) function.
The function returns the previous year as a Banana.Document object. If the previous year is not defined or it is not found it returns null.
/* CURRENT year file: the opened document in Banana */
var current = Banana.document;
/* PREVIOUS year file: open a dialog window to select the previous year .ac2 file */
var previous = Banana.document.previousYear();
The object Banana.document represent the current document opened in the application.
The previous variable represent the defined previous year document.
Function getAmount()
We have added to the script a parameterized function that calls the currentBalance() and retrieves the value for the given parameters.
With this function it is possible to define which value to extract and from which Banana document file.
function getAmount(banDoc,account,property,startDate,endDate) {
var currentBal = banDoc.currentBalance(account,startDate,endDate);
var value = currentBal[property];
return value;
}
The parameters are:
- banDoc: the Banana document from which retrieve the data (see Open Banana document);
- account: the account or group;
- property: the property of the returned currentBalance() object (i.e. opening, debit, credit, total);
- startDate: the opening date of the accounting period;
- endDate: the closing date of the accounting period;
// retrieve from the current year Banana document the 6541 account's total value
var current6541 = getAmount(current,'6541','total','2019-01-01','2019-12-31');
// retrieve from the previous year Banana document the 6541 account's total value
var previous6541 = getAmount(previous,'6541','total','2018-01-01','2018-12-31');
The use of the function is the same, but the returned values are different: one returns the value of the current year and the other the value of the previous year.
The Dates
Dates that we use in the script are taken from the accounting file using the info(section, id) function.
These dates are retrieved from the Opening and Closing dates of the accounting file (File properties > Accounting Tab).
// Accounting period for the current year file
var currentStartDate = current.info("AccountingDataBase","OpeningDate");
var currentEndDate = current.info("AccountingDataBase","ClosureDate");
// Accounting period for the previous year file
var previousStartDate = previous.info("AccountingDataBase","OpeningDate");
var previousEndDate = previous.info("AccountingDataBase","ClosureDate");
Function toLocaleNumberFormat()
The function toLocaleNumberFormat is used to convert all the amount numbers to the local format.
Banana.Converter.toLocaleNumberFormat('16570.00'); // returns 16'570.00
Install and run the Extension
Visit the Install your Extension documentation to install and run the app.
Report example:
Example Extenstion for a Country Specific VAT Report
Following, we will explain what needs to be considered when creating a Banana Accounting Extension for VAT reporting suitable for a specific country.
- Creating the Vat code for the specific country.
- Creating the country specific reports or export files, using the functionalities offered by the Banana API .
Documentation
Banana Accounting manage all kinds of VAT, thanks to the use of customizable VAT Code. For more information on how it managed and recorded VAT see:
Vat Table
Countries require to fill a form with the VAT grouped by different percentages and criterias. In order to achieve this goals it is necessary to create a specific VAT code for each type of VAT that need to be reported.
There are two main groups:
- Vat due to the tax authority.
- Vat recoverable
Creating the VatCode for a specific country
When you use Banana Accounting in a new country, you need to adapt the VatCode table to your country needs. Basically you should procede as described here:
- The starting point is the Vat reporting form of the country.
- You need to create a VAT Code in the VAT Code Table.
- The user, for each transaction that is related to the VAT, will specify the VAT code so that similar transactions can be grouped and summed together, based on the form requirements.
- For each case there should be a specific VAT Codes. The parameters will vary base on:
- VAT recoverable and payable
- Percentage of VAT.
- Tax reporting requirements.
There should be a different VAT Code for export of goods and goods that are exempt.
Tax authorities requires the amounts to be reported sepately even if the percentage applicable is always zero.
Example, for a country that has a VAT percentage of 0% and 5%.
- For the 0% you need to report both the sales exempt and the export:
- Create a Vat code S0 for Vat Exempt (Vat due Yes even if percentage is 0)
- Create a Vat code SE for Vat Export. (Vat due Yes even if percentage is 0)
- For the 5%
- Create a Vat code S5 for sales at 5% (Vat due Yes)
- Create a Vat code P5 for purchase. (Vat due void, means recoverable)
- If you need to show separatly on the tax form the discounts, create a Vat code SD5 for discount on sales at 5%.
If it is not necessary to show separatly the discounts, when entering the transactions for discounts we precede the VAT code with the "-S5" so the amount will be reversed.
There are countries where the are many VAT percentages and a complex tax reporting form. In this case, you will end up having a VAT table with many codes.
Use the Gr1 to groups VAT Code together
If the VAT amounts for different VAT code need to be grouped together, you can use the Gr1 to enter to witch field the VAT code belong.
- When creating a Banana Extension to groups the amounts together, you can use this groups to report the amounts.
- In case the user need to add a new VatCode that fit in a form, he can do it and get it correctly summed in the tax form.
Specify in the Gr1 the field number of the VAT form, separating the number with ";" if the same goes in more than one group. For example:
- The field 100 of the tax form require to declare all sales amounts.
- The different sales need also to be indicated in the specific tax field, so we specify also the other tax field.
- Discount need to be indicate separately so we specify for a discount the specific field. The same for purchases.
Give the full VAT code table
It is possible that you will end up with a very complex VAT table.
Some user will probably use only few VAT code, the one that are necessary for their actitivity.
It is better not to give to the user a stripped down Vat table, for the fact that it may need one specific Vat code.
In this case enter the 1 in the Disable columns. The user will be able to use the code but this will not appear in the list of available VatCode when entering it in the Transactions table.
Assigning vat code to the accounts table
For each account you can assign a default Vat Code (column Vat code).
When you enter or import transactions the Vat code will be retrieved, but you can change it.
Vat Transactions
When entering transactions you also specify the VAT code, so that:
- The VAT code parameters are retrieved.
- The VAT Amounts are calculated.
- The VAT is recorded on the appropriate accounts.
- You will have all the information necessary to prepare a summary report.
We see above different examples of VAT transactions.
- Doc 10-11.
We record cash sale using different Amount type.
We see that the transaction amount is different but the Taxable amount and VAT amount are always the same.
VAT amount is in negative for the fact that the VAT amount is registered in credit, and therefore the amount must be payed to the tax authority. - Doc 20.
Return of goods from customer.
We use the same VAT code, but preceeded by the minus sing. The taxable amount and VAT amout sign is inverted.
Vat Amount is positive (debit), meaning we recover the VAT from the tax authoriy. - Doc 100-102.
Purchase the VAT amount is positive (debit) meaning we recover the VAT from the tax authortity. - Doc 130.
Return of good to suppliers the VAT code is inverted, and we owe the taxt to the authority.
VAT documentation
For each country there should be a documentation that explain the VAT theme with:
- Page for the VAT codes.
Explaining the single VAT code and grouping. - Page for the transactions with examples and explanations
In one or more pages all possible transactions case should be explained. The page is a reference that allows user to understand how a specific case should be recorded.- Create a file with transactions examples.
- Create header and sub header for the different cases, user should be able to find the case by going through the page or an index. Typical:
- VAT Due
- Normal
- Credit notes
- Reverse charge
- VAT Recoverable
- Normal
- Credit note
- VAT not fully deductible.
- VAT Exempt
- VAT 0 %
- Adjustments
- Corrections
- End of period transactions.
- VAT Due
- Create images of the Transaction's table.
- Use the column Doc to number each transaction group.
- When you write explanations you will precede the explanation with the doc number of the tranasaction.
- Use bullet paragraph when explaining single transactions.
- End of period
Explain what procedure do to at the and of period.- Check accounting.
- Account1 -> VAT report
- Country specific report
- Transaction to move the automatic VAT amount to the VAT due or recoverable.
- Transaction to pay the VAT
Banana Extension for VAT country summary report
Before creating a country specific VAT report you should have created a file containing:
- Account plan for the country.
- VAT code table with all the necessary VAT codes for the country, with the GR1 set with the group.
- Test Transactions for all the cases and VAT codes. Including also che reversal transactions (like discounts or credit notes).
This transactions will allow the programmer to immediately test the results.
Examples files
- The examples files are available on github/General/CaseStudies.
- Solutions making use of the VAT API.
Javascipt API to use for VAT Calculation
The API to retrieve the values above would be:
//get the description of the vat code Banana.document.vatDescription("S10"); // use the vatCurrent Balance to retrieve the different values Banana.document.vatCurrentBalance("S10").vatTaxable; Banana.document.vatCurrentBalance("S10").vatAmount; Banana.document.vatCurrentBalance("S102").vatNotDeductible; Banana.document.vatCurrentBalance("S10").vatPosted; Banana.document.vatCurrentBalance("S10").rowCount;
- vatTaxable is the net amount, the one that usually must figure on the vat report as the amount of revenue to declare.
- vatAmount is the VAT amount.
- vatTaxable + vatAmount is the gross amount or inclusive Vat..
- vatNotDeductible is the amount of vat that cannot be fiscally deducted. In case you have an expense where the VAT cannot be totally deducted.
- vatPosted (vatAmount - vatNotDeductible) is the amount that has been posted on tha VAT account.
- count is the number of row that have been found to use the vatCode.
Grouping VAT Codes
The VAT call can only be made for one or more VAT Codes.
If more VAT code need to be grouped together, you should have a Javascript function that take as parameter the GR1.
The function should iterate the VAT table and return the VAT code that have the the corresponding GR1.
The sign of the vatAmount
The sign of the vatAmount follows the accounting convention.
- If the sign of the vatAmount is negative (debit), it means that the vat is due.
- If the sign of the vatAmount is positive, it means that the vat is recoverable.
The sign of the vatTaxable follow the sign of the vatAmount. In case the vatAmount is zero the vatTaxable sign is negative if the isDue of the vatCode is true.
If you use the vatAmount to create a tax form you should take care to invert the amount.
vatAmount sign and isDue flag:
- Vat code that have the isDue to true (1) normally have the vatAmount in negative, but the vatAmount could also be positive in case the user has used the vatCode with the minus sign "-S10".
The minus sign before the vatCode is used in case of reversal transaction (correction of an incorrect transactions). In this case, the vatAmount would be recorded in the positive. - Vat code that have the isDue to false (void) normally have the vatAmount in positive, but the vatAmount could also be negative in case the user has used the vatCode with the minus sign "-P10".
In this case the vatAmount would be recorded in negative.
Amount used in the vat report for the tax authorities
Vat due
The amounts are usually in negative,so they must be inverted.
Banana.document.vatCurrentBalance("S10").vatTaxable * (-1); Banana.document.vatCurrentBalance("S10").vatAmount * (-1);
They could be positive in the case that there have been a good returned from clients that exceeds the amount of sales.
Vat recoverable
The amounts are usually in negative,so they must be inverted.
Banana.document.vatCurrentBalance("P10").vatTaxable; Banana.document.vatCurrentBalance("P10").vatAmount;
They could be negative in the case that there have been a good returned to suppliers that exceed the amount of sales.
Combination of sign and typology (VAT Class)
Combining sign and typology we have the different case that come up in the VAT reporting:
- "1" Recoverable VAT Taxable (VAT netto)
- "2" Due VAT Taxable (VAT netto)
- "3" Recoverable VAT posted (VAT Amount)
- "4" Due VAT posted (VAT Amount)
- "5" Recoverable VAT gross amount (VAT taxable + VAT amount)
- "6" Due VAT gross amount (VAT taxable + VAT amount)
The VAT class is used in a function to automate the calculation and reporting with the correct sign.
Period
VAT report are usually done for a period (month, quarter or semester).
You should use the vatCurrentBalance with tha startDate and endDate
//vat report for January 2018 var startDate = "2018-01-01"; var endDate = "2018-01-31 Banana.document.vatCurrentBalance("S10", startDate, endDate).vatTaxable; Banana.document.vatCurrentBalance("P10", startDate, endDate).vatTaxable;
Summing many VAT codes
You can have the total of different code by separating the VAT code with the sign "|"
//vat report for January 2018 var startDate = "2018-01-01"; var endDate = "2018-01-31 // The taxable amount Banana.document.vatCurrentBalance("S0|S5|S10|SD5|SD10", startDate, endDate).vatTaxable * (-1); // The vat due Banana.document.vatCurrentBalance("S0|S5|S10|SD5|SD10", startDate, endDate).vatAmount * (-1); // The vat taxable vat recoverable Banana.document.vatCurrentBalance("P0|P5|P10|PD5|PD10", startDate, endDate).vatTaxable; // The vat vat recoverable Banana.document.vatCurrentBalance("P0|P5|P10|PD5|PD10", startDate, endDate).vatAmount;
VAT Extra Info
There are some case where for appropriate reporting the VAT code alone is not sufficient. The VAT Extra info allows to define an extra code and enter in the Transactions to further specify the case. The VAT Extra code allows to limit the number of VAT codes needed, but also to track exceptions.
Printing the VAT transactions list
To print the transactions with VAT or doing VAT calculations, use the function Banana.document.journal().
// use the data from the transactions and only normal accounts (exclude cost centers) var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL); for (i = 0; i < journal.rowCount; i++) { var tRow = journal.row(i); // we get the vat values var vatTaxable = tRow.value('JVatTaxable'); var vatAmount = tRow.value('VatAmount'); var vatPosted = tRow.value('VatPosted'); }
Within the samples apps repository you find two examples of transactions list:
- List of transactions with vatTaxable, vatAmount and vatPosted.
- List of transctions with vatTaxable, vatAmount and vatPosted also converted in the transaction's currency.
Export Extensions
Export apps are used to export data in a custom format.
-
Define attribute @task as export.file
// @task = export.file -
Define the extension of the file to be exported.
// @exportfiletype = xml -
The text to be written to the export file is the return value of the exec function and must be a return.
return "exported text". -
When the script terminate and if the return text is not null and does not start with "@Cancel ", the user will be promped with a dialog to choose a file name where to export.
Example
Export all the accounting with description and balance in a xml file.
// @id = ch.banana.apps.export // @api = 1.0 // @pubdate = 2016-04-08 // @doctype = *.* // @description = Export into a text file (.txt) // @task = export.file // @exportfiletype = txt // @timeout = -1 function exec() { var exportResult = '<accounts>'; var tableAccounts = Banana.document.table('Accounts'); if ( !tableAccounts) { return; } for (i=0;i<tableAccounts.rowCount;i++) { if (tableAccounts.row(i).value('Account')) { exportResult += '<account>'; exportResult += '<accountnr>' + tableAccounts.row(i).value('Account') + '</accountnr>'; exportResult += '<description>' + tableAccounts.row(i).value('Description') + '</description>'; exportResult += '<balance>' + tableAccounts.row(i).value('Balance') + '</balance>'; exportResult += '</account>'; } } exportResult += '</accounts>'; //return the string return exportResult; }
Develop an Import Extensions
Most software or online banking can only export data in a proprietary format that Banana Accounting cannot understand.
For this cases it is possible to create an Import Extension that that converts data from a proprietary format to a format that is accepted by Banana.
Import Extensions read a custom format and convert in an import format suitable for using with the command "Import to accounting".
- Import extension for Bank Statements
- Extension for importing transactions
- For examples see the Github.com template page.
Create an Import Extensions for converting from other formats
The Import Extensions can be used within the Command Action->Import into Accounting.
Extension Attributes
An Import extension has the Extension attribute @task of type "import.":
- import.accounts
See the format specified in: Import Accounts. - import.categories
- import.vatcodes
- import.transaction
When importing transaction you can set the @outputformat- tablewithheaders
will take the columns exactly as in the Transactions table, that varies depending on the account type.
For double entry transaction see: Import Double-entry transactions in CSV format. - transactions.simple
Will take the format that is typical for a bank account statement.
See: Import Income & Expenses transactions in CSV format.
- tablewithheaders
exec() function
Banana load an extension and call the Exec(inText) function of an Import Extention:
- The exec( inText) the argument receive the row data that is read from the file or clipboard.
- The exec() function should return a value that contains the converted data that is to be imported. It can be of type:
- TSV (Tab separated Value)
- The first line should contains the column names.
Columns names varies dependent on the table or functionality.
See Import data from a txt file. - The other lines should contain the data to be imported.
- The first line should contains the column names.
- JSon in the the DocumentChange API Format.
- TSV (Tab separated Value)
Convert to a tab separated text
Imports Extensions are JavaScript program that import data to a specific table.
The import with tab separated text only allow to add rows to a table:
Import Extensions have:
- the attribute @task defined as one of the import for example //@task = import.transactions (for more information, see Apps attributes documentation)
- the attribute @outputformat defines the format of the imported data:
- For a Double-entry accounting use the value //@outputformat = tablewithheaders.
- For an Income/Expenses accounting use the value //@outputformat = transactions.simple.
- The parameter in the function exec contains the import data (the content of the file specified in the input box)
- You can specify that the data is read from the file specified on the input box or that the user can select the file with "// @inputdatasource = openfiledialog"
- The import text is returned as a String in the function exec with the return statement
Import with DocumentChange
You can directly import the data into accounting using the DocumentChange API. Parse the information, define the changes to be made to the document and return the JSON Object.
With the DocumentChange API you can add, modify or remove line from any tables. You can also add or modify columns.
Import Extensions "transactions.simple" Income & Expenses for Digital Bank Statements
An import extension that is used to import a bank account statements, takes as input a bank statements in digital format and convert into a "transactions.simple" format that is accepted as input from Banana Accounting.
See also:
transactions.simple converted to the accounting file
Using the "transactions.simple" has the advantage that the program automatically convert the data to the specific accounting you are using. So the format is adequate to be used for double entry, multi-currency or Income & expenses.
The program automatically convert the data to the specific accounting file format.
- Cash Manager and Income & Expenses
- Income Amounts goes in the column Income
- Expense Amounts or negative Income Amounts goes in the column Expenses.
- Double entry accounting
- Income Amounts goes in the column Amount.
Bank Account goes in the Account Debit Column - Expense Amounts or negative Income Amounts goes in the column Amount as positive values.
Bank Account goes in the Account Credit Column
- Income Amounts goes in the column Amount.
Digital Bank Statement
A digital bank statement is a file containing the transactions of a bank account within a specific period.
Bank statements have usually this elements:
- Information regarding the accounts.
- Account id
- Account holder
- Period information.
- Start Date
- End Date
- Begin Balance
- End Balance
- Transactions with all for each movement a least the following information.
- Date
- Description of the transactions
- Income amount, positive for the customer
- Outcome amount , negative for the customer
- Amount an amount that contain income as positive number and negative numbers as expenses.
Digital Bank Customer Statements Formats
Banks can make their bank statements available in different formats.
- ISO 20022 Bank Statements Format camt.052, camt.053, camt.054.
It is an XML file that can contain multiple bank statements.
Each country can have a specific implementation of this format.
Banana Accounting provides extensions to read such file. - ISO MT940.
Is a text based format. - CSV (Comma separated file format) containing bank statements transactions.
Banks, within online application, usually allows customer to export the transaction in a CSV or Excel file.
Bank CSV Bank Statements
Banks usually let you export the bank statement in a CSV format, but the columns header, columns sequence and format of the data usually differs.
When converting the data from a Bank Statement to a "transactions.simple" file format it is important to analyze with attention the bank statement:
The structure of a Bank Statement CSV is usually this:
- Optional Information regarding the account and holder.
- Unstructured data at the begin of the file.
- The columns headers.
- A line with the name of the columns.
For examples "Date,Description,Income,Expense" - Columns name are separated by a character, usually a comma "," or a semicolon ";".
- The columns name use similar naming, but are also usually in a language specific to the customer. For example:
- German "Datum,Buchungstext,Einnahmen, Ausgaben“
- A line with the name of the columns.
- The transactions movements.
- Multiple lines each one containing a single movement.
- Date may be expressed in a specific format.
- Number may be expressed in a specific localized format.
- For example
- "31.12.2024,"Payment to Albert",,"1'344,22",
- "31.12.2024,"Income from Albert","344,22",
- Other optional information.
- Unstructured data at the end of the file.
Banks use different naming for columns containing the income and expenses amount.
- Double entry column's naming convention:
Debit and Credit is usually referred to the bank point of view. "We have debited you", "We have credited you".- Debit for the costumer is an Expense (credit amount).
- Credit for the costumer is an Income (debit amount).
In the example the values are written in an excel document.
Import Extension for transactions.simple
The import Extension takes a
Extensions attributes
The Extensions attributes should contains the following lines:
//@task = import.transaction
//@outputformat = transactions.simple
JavaScript code
The function takes the input data (e.g. csv file) and converts it to a "transactions.simple" tabulator separated values (tsv file).
- An exec(data)
- It take as parameter the CSV bank statement.
- It process the input data and convert to transactions.simple data structure.
- It returns the data.
- Mapping the CSV columns to the transactions.simple naming
When mapping column, the Date column must always be on first position.
For example:- "Datum" to "Date"
- "Buchungstext" to "Description"
- "Einnahmen" to "Income"
- "Ausgaben" to "Expenses"
- Converting the date value to transactions.simple format yyyy-mm-dd.
- To convert a date, use the "Banana.Converter.toInternalDateFormat(date, input_format)"
- Date "31.12.2024," to "2024-12-31"
- Example: Banana.Converter.toInternalDateFormat("31.12.2024", "dd-mm-yyyy") returns "2024-12-31"
- To convert a date, use the "Banana.Converter.toInternalDateFormat(date, input_format)"
- Converting the numeric value to transactions.simple format
- To convert a numeric value, use the "Banana.Converter.toInternalNumberFormat(numeric_value, input_decimal_separator)"
- Numeric "344,22" to "344.22"
- Example: "Banana.Converter.toInternalNumberFormat("123,45", ",")" returns "123.45"
- For all numeric operations, use the Banana.SDecimal class.
- To convert the sign of a numeric value, use the "Banana.SDecimal.invert(numeric_value)"
Example: Banana.SDecimal.invert("123.45") returns "-123.45" - To verify the when a numeric value is positive or negative, use the "Banana.SDecimal.sign(numeric_value)"
Example: Banana.SDecimal.sign("-123.45") returns "-1".
- To convert the sign of a numeric value, use the "Banana.SDecimal.invert(numeric_value)"
- To convert a numeric value, use the "Banana.Converter.toInternalNumberFormat(numeric_value, input_decimal_separator)"
- Creating the output in the transactions.simple format, containing:
- The columns header
- The transactions data
"transactions.simple" format (Income & Expenses)
The import extension takes in input the bank statement and convert to a "transactions.simple" format with the following characteristics:
- Tabulator Separated Values (tsv).
- Column headers and data must use the tab character as separator "\t"
- Each line (after a "\n") is a new record
- The first line of the file contains the Columns headers.
After the header come the lines with the transactions data. - Columns header
They specify the name of the column.- Column names are case sensitive.
- Required Columns
- Date
The date of the transaction.
Date should be in format "yyyy-mm-dd" (e.g. "2024-12-31"). - Description
A a brief text of the transaction. - Income
The income amount.
For double-entry accounting, the the amount in debit, if negative is considered in credit.
The amount should be in simple numeric format, with the point "." as a decimal separator.
- Date
- Optional predefined columns:
When present the import function will use the content.- Expenses
The outcome amount.
For double entry the amount is in credit.
The Expense can also be specified as a negative number in the column "Income". - DocInvoice
The invoice number. - ContraAccount
The account number (debit/credit) or category.
Enter square brackets [] to keep the field empty. - Account
The account of the transaction when the file contains the movements of multiple accounts.
Enter square brackets [] to keep the field empty. - VatCode
The VAT code that should be used.
The VatCode should be defined in the VatCodes Table.
Precede with the minus "-" sign if the Transaction is a correction of an existing transactions. - IsDetail
For composed transactions a "S" identifies a counterpart transaction and a "D" a detail transactions
- Expenses
- Transactions data in column format
- Tabulator separated values following the headers.
- Date columns should be in the format "yyyy-mm-dd".
- Amount should be in a standard JavaScript decimal number format:
- Decimal separator is the point "."
- No thousands separators
- Only numeric characters "12345678.90"
- Negative number with a minus sign "-" preceding the numbers (e.g. "-100.00").
Example Extension
This extension example return a predefined data content, does not convert the data.
// @api = 1.0
// @id = ch.banana.scripts.import.example
// @description = Import Example bank (*.csv)
// @task = import.transactions
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2024-06-21
// @outputformat = transactions.simple
// @inputdatasource = openfiledialog
// @inputfilefilter = Text files (*.txt *.csv);;All files (*.*)
// @inputfilefilter.de = Text (*.txt *.csv);;Alle Dateien (*.*)
/**
* Parse the data and return the data to be imported as a tab separated file.
*/
function exec(inText) {
// parse the inText and set to outText
// in the return text the data is tab separated
var outText = "";
outText += "Date\tDescription\tIncome\tExpenses\n";
outText += "2015-01-01\tIncome text\t100.25\t\n";
outText += "2015-01-02\tExpense text\t\t73.50\n";
return outText;
}
Banks Statement in Excel Format
If your bank makes available the statements in Excel format, proceed in the following way:
- Open the statement file in excel.
- Select and Copy to the clipboard content of the statement.
- When Importing in Accounting, tell Banana to use the Clipboard as input.
You can create an Import Extension for CSV that use the content of the file you copy to a clipboard.
Installing and Running a Bank CSV Import Extension
Introduction
This page provides you with step-by-step guidance for creating a file based Javascript extension to import a typical bank statement in CSV format.
You find simple examples in the Repository China/ImportExtensions. All the examples have also their own test.
The steps in order to experiment with import Banana Extension are the following:
- Create a CSV file example
- Create the import file based javascript extension
- Install the extension
- Run the extension
Create the CSV file
For test purpose we create a file in CSV format using the format specified import income & expenses transactions in CSV format.
Copy the following CSV example, paste it on your text editor and save it as csv_example.csv:
"Date","Description","Income","Expenses"
"2019-01-01","Income transaction text","100.00",""
"2019-02-02","Expense transaction text","","200.00"
- First line is the fields header. Fields names are case sensitive and must correspond to the NameXml (English) of the columns in Banana Accounting.
- Fields names and data values are between double quotes.
- Fields and values are separated with a comma
- Each line is a new record
- The format for the Date fields is yyyy-mm-dd
Create the file based javascript import extension
Copy the following JavaScript code, paste it on your text editor and save it as import_transaction_example.js:
// @id = ch.banana.app.importtransactionexample
// @api = 1.0
// @pubdate = 2018-10-30
// @publisher = Banana.ch SA
// @description = Example Import Transactions (*.csv)
// @doctype = *
// @docproperties =
// @task = import.transactions
// @outputformat = transactions.simple
// @inputdatasource = openfiledialog
// @inputencoding = latin1
// @inputfilefilter = Text files (*.txt *.csv);;All files (*.*)
/* CSV file example:
"Date","Description","Income","Expenses"
"2019-01-01","Income transaction text","100.00",""
"2019-02-02","Expense transaction text","","200.00"
*/
// Parse the data and return the data to be imported as a tab separated file.
function exec(inText) {
// Convert a csv file to an array of array.
// Parameters are: text to convert, values separator, delimiter for text values
var csvFile = Banana.Converter.csvToArray(inText, ',', '"');
// Converts a table (array of array) to a tsv file (tabulator separated values)
var tsvFile = Banana.Converter.arrayToTsv(csvFile);
// Return the converted tsv file
return tsvFile;
}
When it is used transaction.simple as @outputformat attribute in the script, it's important that CSV file includes "Income" and "Expenses" fields.
Install the Extension
For the installation of the file based extension, see First File Based Extension > Install the Extension.
Run the import Extension
To run an import Extension follow the steps below:
- Open an accounting file in Banana Accounting.
- In Banana select from the menu Actions the command Import to accounting...
- From the import type selection select Transactions.
- From the list select the Example Import Transactions (*.csv) extension.
- Click on Browse and look for the csv_example.csv file, then click to Open.
- Click Ok to begin the import process.
- On the dialog window select a Destination account and click on Ok to import the data.
The data from the CSV file are imported into the Transactions table of your accounting file like the following examples.
- For a Double-Entry accounting:
You can now replace all the [CA] values with the appropriate contra-account, so that the Credit transactions will be balanced with the Debit transactions.
- For an Income & Expenses accounting:
For each transaction you can now enter an income or expense category, as defined in the Categories table.
More about Import Extensions
Parameterizable import CSV extension
This guide explains how to create your own import CSV extension, starting from the Banana Accounting parametrizable import template.
For more information see the import as "transactions.simple" .
Requirements
To create your import extension, you need:
- A CSV file: Ensure you can open the file to review its contents.
- The template code: Use import.csvstatement.parametrizable.template.js as your base.
- Adaptable parameters: Update the parameter values in the JavaScript code based on your CSV file structure.
Extension parameters
At the beginning of the JavaScript code, locate the getConversionParamUser() function. This is where you change parameter values based on your CSV file.
//This function defines the parameters specific for the CSV Transactions file to be imported
function getConversionParamUser(convertionParam) {
// The following variables need to be set according to the specific
// CSV file that will be imported
// Column separator character
// Use '\t' for tab separated columns.
// Use the '\t' when processing CSV copied from Excel to the clipboard
convertionParam.column_separator = ';';
// Text delimiter character for string
convertionParam.text_delimiter = '"';
// Decimal separator charachter used for amounts
convertionParam.amounts_decimal_separator = '.';
// Line number where the column header starts (with the columns name)
// First line is 0
convertionParam.header_line_start = 0;
// Line number where data starts
// Usually header_line_start + 1
convertionParam.data_line_start = 1;
// Column name header for the date transaction
convertionParam.column_date_name = '';
// Date format for column containing dates
// For example 'dd.mm.yyyy', 'mm/dd/yyyy', 'dd.mm.yy', 'yyyy-mm-dd'
convertionParam.date_format = '';
// Column name for the column description
convertionParam.column_description_name = '';
// Column name for the income amount
convertionParam.column_income_name = '';
// Column name for the expenses/outcome amounts
convertionParam.column_expenses_name = '';
// Column name for the external reference identification number of the transaction
convertionParam.column_external_reference_name = '';
}
Parameter Descriptions
The parameters are in an object called convertionParam and are as follows:
- convertionParam.column_separator
Parameter used to specify the separator character used in the CSV file to separate the columns (e.g., ;). - convertionParam.text_delimiter
Parameter used to specify the text delimiter character used in the CSV file to delimit the text (e.g., "). - convertionParam.amounts_decimal_separator
Parameter used to specify the amounts decimal separator used in the CSV file to indicate the decimals of the amounts (e.g, .). - convertionParam.header_line_start
Parameter used to specify at which row of the CSV file is the header with the column titles.
Zero-based index (start counting from 0) of the row containing column titles (e.g., 0 for the first row). - convertionParam.data_line_start
Parameter used to specify at which row of the CSV file start the transactions rows.
Zero-based index (start counting from 0) of the first row containing transaction data (e.g., 1 if it follows the header). - convertionParam.column_date_name
Parameter used to specify the name for the column with the date of the transaction used in the CSV file. - convertionParam.date_format
Parameter used to specify the format of the date used in the CSV file (e.g., dd.mm.yyyy for 31.12.2024). - convertionParam.column_description_name
Parameter used to specify the name for the column with the description of the transaction used in the CSV file. - convertionParam.column_income_name
Parameter used to specify the name for the column with the income amount of the transaction used in the CSV file. - convertionParam.column_expenses_name
Parameter used to specify the name for the column with the expenses amount of the transaction used in the CSV file (only if using two-column format). - convertionParam.column_external_reference_name
Parameter used to specify the name for the column with the identification number of the transaction used in the CSV file.
CSV amount columns format
The CSV file can have two format for amount columns:
- one-column amounts: income is positive, expenses are negative.
In this case use only the convertionParam.column_income_name to define the column name used for the amounts. - two-column amounts: income and expense amounts have separate columns.
In this case use both convertionParam.column_income_name for income amounts and convertionParam.column_expenses_name for expenses amounts.
Example
Sample CSV file contents:
xxxx;;;;;
;;;;;
;;;;;
Datum;Buchungstext;Betrag;Saldo;Valuta;Id
03.01.2024;"aaa";127.2;42282.99;03.01.2024;1
04.01.2024;"bbb";-165.75;42117.24;04.01.2024;2
05.01.2024;"ccc";90.05;42207.29;05.01.2024;3
CSV file structure:
- ; is used as column separator.
- " is used as text delimiter (e.g., "aaa").
- . is used as amounts decimal separator (e.g., 127.2).
- 3 is the row where the header line starts (start counting from 0).
- 4 is the row where the data start (start counting from 0).
- Datum is used as column name for the date.
- dd.mm.yyyy is used as date format (e.g., 03.01.2024).
- Buchungstext is used as column name for the description.
- Betrag is used as column name for the amounts (one-column format: income amounts are positive, expenses amounts are negative).
- Id is used as column name for the external reference identification numbers (e.g., 1,2,3).
Updated parameters:
// example with setting for the CSV file above
function getConversionParamUser(convertionParam) {
convertionParam.column_separator = ';';
convertionParam.text_delimiter = '"';
convertionParam.amounts_decimal_separator = '.';
convertionParam.header_line_start = 3;
convertionParam.data_line_start = 4;
convertionParam.column_date_name = 'Datum';
convertionParam.date_format = 'dd.mm.yyyy';
convertionParam.column_description_name = 'Buchungstext';
convertionParam.column_income_name = 'Betrag';
convertionParam.column_expenses_name = '';
convertionParam.column_external_reference_name = 'Id';
}
How to Create and Run the Parameterizable CSV Import Extension
There are two methods to create an import extension:
- As an Embedded Extension.
- As a File Based Extension.
Embedded Extension
For detailed instructions on creating and running embedded extensions, refer to the First Embedded Extension documentation.
Follow these steps to create and run the extension:
- Creating the Extension
- Add the extension to the Documents table.
- Copy and paste the template code from import.csvstatement.parametrizable.template.js.
- Customizing the Extension
- Adjust the parameters within the getConversionParamUser() function.
- Open the CSV file to inspect its content and edit the parameter values based on the CSV structure.
- Running the Extension
- Save the accounting file.
- Run the extension from the Documents table by clicking the run icon in the Attachments cell containing your code.
- Select the CSV file to import.
- In the Import Transactions dialog, choose the destination account and confirm with OK.
- The transactions will be imported and displayed in the Transactions table.
File-Based Extension
For detailed instructions on creating and running file based extensions, refer to the First File Based Extension documentation.
Follow these steps to create and run the extension:
- Creating the Extension
- Copy and paste the template code from import.csvstatement.parametrizable.template.js.
- Save the file as .js.
- Customizing the Extension
- Adjust the parameters within the getConversionParamUser() function.
- Open the CSV file to inspect its content and edit the parameter values based on the CSV structure.
- Installing the Extension
- Install the extension from the menu: Extensions > Manage Extensions > Add from file.
- Running the Extension
- Run the extension from the menu: Actions > Import to accounting > Import: Transactions.
- In the Import to accounting dialog, select the "Parameterizable Import CSV" extension and the CSV file to import.
- In the Import Transactions dialog, choose the destination account and confirm with OK.
- The transactions will be imported and displayed in the Transactions table.
Invoice Layout Extension
The Invoice Layout Extension is a report extension for printing invoices.
It is used on the
- Accounting file
- Menu Reports > Customers > Print invoices...
- In the Estimate & Invoice
- Menu Invoices > Print invoice...
- Menu Invoices > Print estimate...
Structure of the extensions
The Invoice Layout Extension need to contains the following elements:
- The extension attribute with
@task = report.customer.invoice. - printDocument(jsonContent, repDocObj, repStyleObj [, prefSelected])
the main function that is called by the program
Is use the content of the invoice json object to add element to the reportDocObj. - settingsDialog() (optional)
called from user to set up parameters like colour or additional text. - getPrintPreferences() (optional)
returns a JSON object with the available print options.
Invoice Json Properties.
Extension attributes
// @id = scriptfilename.js // @api = 1.0 // @pubdate = yyyy-mm-dd // @publisher = yourName // @description = script description // @task = report.customer.statement
Function printDocument
The main function is printDocument(jsonStatement, repDocObj, repStyleObj [, format]). The parameter jsonStatement object contains the data, repDocObj is the document object and repStyleObj is the stylesheet object where you can add styles.
function printDocument(jsonStatement, repDocObj, repStyleObj) { var param = initParam(); var savedParam = Banana.document.getScriptSettings(); if (savedParam.length > 0) { param = JSON.parse(savedParam); param = verifyParam(param); } printInvoice(jsonInvoice, repDocObj, repStyleObj, param); }
Function settingsDialog
The function settingsDialog() is called from Banana when you select the button Params... from dialog Manage apps. You can write any code you need for your script.
/*Update script's parameters*/ function settingsDialog() { var param = initParam(); var savedParam = Banana.document.getScriptSettings(); if (savedParam.length > 0) { param = JSON.parse(savedParam); } param = verifyParam(param); ... var paramToString = JSON.stringify(param); var value = Banana.document.scriptSaveSettings(paramToString); }
Invoice Json Object
Data structure used by the Invoice Layout Extension to print an invoice.
{
"billing_info": {
"discount": {
"amount_vat_exclusive": "2.20"
},
"due_date": "2020-06-17",
"total_advance_payment": "",
"total_amount_vat_exclusive": "122.15",
"total_amount_vat_exclusive_before_discount": "124.35",
"total_amount_vat_inclusive": "131.56",
"total_amount_vat_inclusive_before_discount": "133.93",
"total_categories": [],
"total_discount_percent": "1.8",
"total_discount_vat_exclusive": "2.20",
"total_discount_vat_inclusive": "2.37",
"total_rounding_difference": "",
"total_to_pay": "131.56",
"total_vat_amount": "9.41",
"total_vat_amount_before_discount": "9.58",
"total_vat_codes": [
{
"total_amount_vat_exclusive": "122.15",
"total_amount_vat_inclusive": "131.56",
"total_vat_amount": "9.41",
"vat_code": "V77"
}
],
"total_vat_rates": [
{
"total_amount_vat_exclusive": "122.15",
"total_amount_vat_inclusive": "131.56",
"total_vat_amount": "9.41",
"vat_rate": "7.70"
}
]
},
"creator_info": {
"name": "ch.banana.application.invoice.default",
"pubdate": "2021-09-24",
"publisher": "Banana.ch SA",
"version": ""
},
"customer_info": {
"address1": "Via ai Salici 12",
"address2": "",
"address3": "",
"business_name": "La stanza del Te SA",
"city": "Lugano",
"country": "",
"country_code": "CH",
"courtesy": "",
"email": "",
"first_name": "pinco",
"iban": "",
"last_name": "",
"mobile": "",
"number": "1",
"phone": "",
"postal_code": "6900",
"web": ""
},
"document_info": {
"currency": "CHF",
"customer_reference": "asdf",
"date": "2020-06-17",
"decimals_amounts": 2,
"description": "Fornitura merce (esempio iva esclusa)",
"doc_type": "10",
"locale": "it",
"number": "3",
"rounding_totals": "0.05",
"text_begin": "",
"title": "Fornitura merce (esempio iva esclusa)",
"vat_mode": "vat_excl"
"custom_info": [
{
"id": "custom_field_1",
"title": "Weight",
"value": "45 kg"
},
{
"id": "custom_field_2",
"title": "Packages",
"value": "3"
}
]
},
"items": [
{
"description": "Te\n1\n2\n3",
"item_type": "item",
"mesure_unit": "pz",
"number": "1000",
"price": "",
"quantity": "4.00",
"total": "",
"total_amount_vat_exclusive": "19.68",
"total_amount_vat_inclusive": "21.20",
"total_vat_amount": "1.52",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "5.30",
"calculated_amount_vat_exclusive": "4.92",
"calculated_amount_vat_inclusive": "5.30",
"calculated_vat_amount": "0.38",
"vat_code": "V77",
"vat_rate": "7.70"
},
"vat_code": "",
"vat_rate": ""
},
{
"description": "Te",
"discount": {
"percent": "30."
},
"item_type": "item",
"mesure_unit": "pz",
"number": "1000",
"quantity": "4.00",
"total": "",
"total_amount_vat_exclusive": "13.78",
"total_amount_vat_inclusive": "14.84",
"total_vat_amount": "1.06",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "5.30",
"calculated_amount_vat_exclusive": "4.92",
"calculated_amount_vat_inclusive": "5.30",
"calculated_vat_amount": "0.38",
"discounted_amount_vat_exclusive": "3.44",
"discounted_amount_vat_inclusive": "3.71",
"discounted_vat_amount": "0.27",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Te",
"discount": {
"amount": "1.60"
},
"item_type": "item",
"mesure_unit": "pz",
"number": "1000",
"quantity": "4.00",
"total": "",
"total_amount_vat_exclusive": "13.74",
"total_amount_vat_inclusive": "14.80",
"total_vat_amount": "1.06",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "5.30",
"calculated_amount_vat_exclusive": "4.92",
"calculated_amount_vat_inclusive": "5.30",
"calculated_vat_amount": "0.38",
"discounted_amount_vat_exclusive": "3.44",
"discounted_amount_vat_inclusive": "3.70",
"discounted_vat_amount": "0.26",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Te",
"item_type": "item",
"mesure_unit": "pz",
"number": "",
"quantity": "10000",
"total_amount_vat_exclusive": "17.18",
"total_amount_vat_inclusive": "18.50",
"total_vat_amount": "1.32",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "0.00185",
"calculated_amount_vat_exclusive": "0.00172",
"calculated_amount_vat_inclusive": "0.00185",
"calculated_vat_amount": "0.00013",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Te",
"discount": {
"amount": "0.00035"
},
"item_type": "item",
"mesure_unit": "pz",
"number": "1000",
"quantity": "10000",
"total": "",
"total_amount_vat_exclusive": "13.93",
"total_amount_vat_inclusive": "15.00",
"total_vat_amount": "1.07",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "0.00185",
"calculated_amount_vat_exclusive": "0.00172",
"calculated_amount_vat_inclusive": "0.00185",
"calculated_vat_amount": "0.00013",
"discounted_amount_vat_exclusive": "0.00139",
"discounted_amount_vat_inclusive": "0.00150",
"discounted_vat_amount": "0.00011",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Te",
"discount": {
"percent": "3."
},
"item_type": "item",
"mesure_unit": "pz",
"number": "1000",
"quantity": "10000",
"total": "",
"total_amount_vat_exclusive": "16.67",
"total_amount_vat_inclusive": "17.95",
"total_vat_amount": "1.28",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "0.00185",
"calculated_amount_vat_exclusive": "0.00172",
"calculated_amount_vat_inclusive": "0.00185",
"calculated_vat_amount": "0.00013",
"discounted_amount_vat_exclusive": "0.00167",
"discounted_amount_vat_inclusive": "0.00179",
"discounted_vat_amount": "0.00013",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Te",
"item_type": "item",
"mesure_unit": "pz",
"number": "",
"quantity": "0.00025",
"total_amount_vat_exclusive": "9.33",
"total_amount_vat_inclusive": "10.05",
"total_vat_amount": "0.72",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "40200.00",
"calculated_amount_vat_exclusive": "37325.91",
"calculated_amount_vat_inclusive": "40200.00",
"calculated_vat_amount": "2874.09",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Te",
"discount": {
"amount": "8000"
},
"item_type": "item",
"mesure_unit": "pz",
"number": "1000",
"quantity": "0.00025",
"total": "",
"total_amount_vat_exclusive": "7.47",
"total_amount_vat_inclusive": "8.05",
"total_vat_amount": "0.58",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "40200.00",
"calculated_amount_vat_exclusive": "37325.91",
"calculated_amount_vat_inclusive": "40200.00",
"calculated_vat_amount": "2874.09",
"discounted_amount_vat_exclusive": "29897.86",
"discounted_amount_vat_inclusive": "32200.00",
"discounted_vat_amount": "2302.14",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Te",
"discount": {
"percent": "25."
},
"item_type": "item",
"mesure_unit": "pz",
"number": "1000",
"quantity": "0.00025",
"total": "",
"total_amount_vat_exclusive": "7.00",
"total_amount_vat_inclusive": "7.54",
"total_vat_amount": "0.54",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "40200.00",
"calculated_amount_vat_exclusive": "37325.91",
"calculated_amount_vat_inclusive": "40200.00",
"calculated_vat_amount": "2874.09",
"discounted_amount_vat_exclusive": "27994.43",
"discounted_amount_vat_inclusive": "30150.00",
"discounted_vat_amount": "2155.57",
"vat_code": "V77",
"vat_rate": "7.70"
}
},
{
"description": "Spese di spedizione",
"item_type": "item",
"mesure_unit": "",
"number": "4000",
"price": "",
"quantity": "1.00",
"total": "",
"total_amount_vat_exclusive": "5.57",
"total_amount_vat_inclusive": "6.00",
"total_vat_amount": "0.43",
"unit_price": {
"amount_vat_exclusive": null,
"amount_vat_inclusive": "6.00",
"calculated_amount_vat_exclusive": "5.57",
"calculated_amount_vat_inclusive": "6.00",
"calculated_vat_amount": "0.43",
"vat_code": "V77",
"vat_rate": "7.70"
},
"vat_code": "",
"vat_rate": ""
}
],
"note": [
{
"date": null,
"description": "aFASD\nF AS\nDF\n AS\nDF ASDF"
}
],
"payment_info": {
"due_date": "2020-07-17"
},
"supplier_info": {
"address1": "VIa alle colline 12",
"address2": "",
"address3": "",
"business_name": "My Company",
"city": "Lugano",
"country": "Svizzera",
"country_code": "CH",
"courtesy": "",
"email": "info@mycompany.zz",
"first_name": "",
"fiscal_number": "",
"iban_number": "CH93 0076 2011 6238 5295 7",
"last_name": "",
"mobile": "",
"phone": "+41 56 777 999",
"postal_code": "600",
"vat_number": "CHE-111.333.999 IVA",
"web": "https://www.mycompany.zz"
},
"type": "invoice",
"version": "1.0"
}
Invoice Json Properties Explanation
The Json has the following main elements:
- type
"invoice" - version
"1.0" - document_info
- Information relative to the invoice or estimate (currency, doctype,...)
- Initial texts, before Items
- payment_info
Invoice due date. - supplier_info
Address of the company that issue/send the invoice.customer_info - Address of one receiving the invoice.
- shipping_info
Shipping Address - items
The list of items - billing_info
Total of the invoices.note - note
Array that contains the notes, to be printed at the end. - parameters
Not used - template_parameters
- Texts that are defined in the Invoice Dialogs
- transactions
Payment information (not used in transactions)
Source of data
This list explains where the actual information on your invoice json object is coming from
Invoice Object Property | Source |
---|---|
customer_info.address1 | Table: Accounts, View: Address, Column: Street |
customer_info.address2 | Table: Accounts, View: Address, Column: AddressExtra |
customer_info.address3 | Table: Accounts, View: Address, Column: POBox |
customer_info.balance | Table: Accounts, View: Address, Column: Balance |
customer_info.balance_base_currency | Table: Accounts, View: Address, Column: BalanceCurrency |
customer_info.bank_account | Table: Accounts, View: Address, Column: BankAccount |
customer_info.bank_clearing | Table: Accounts, View: Address, Column: BankClearing |
customer_info.bank_name | Table: Accounts, View: Address, Column: BankName |
customer_info.business_name | Table: Accounts, View: Address, Column: OrganisationName |
customer_info.city | Table: Accounts, View: Address, Column: Locality |
customer_info.country | Table: Accounts, View: Address, Column: Country |
customer_info.country_code | Table: Accounts, View: Address, Column: CountryCode |
customer_info.courtesy | Table: Accounts, View: Address, Column: NamePrefix |
customer_info.credit_limit | Table: Accounts, View: Address, Column: CreditLimit |
customer_info.currency | Table: Accounts, View: Address, Column: Currency |
customer_info.date_birth | Table: Accounts, View: Address, Column: DateOfBirth |
customer_info.email | Table: Accounts, View: Address, Column: EmailWork |
customer_info.fax | Table: Accounts, View: Address, Column: Fax |
customer_info.first_name | Table: Accounts, View: Address, Column: FirstName |
customer_info.fiscal_number | Table: Accounts, View: Address, Column: FiscalNumber |
customer_info.iban_number | Table: Accounts, View: Address, Column: BankIban |
customer_info.lang | Table: Accounts, View: Address, Column: Language |
customer_info.last_name | Table: Accounts, View: Address, Column: FamilyName |
customer_info.member_fee | Table: Accounts, View: Address, Column: MemberFee |
customer_info.mobile | Table: Accounts, View: Address, Column: PhoneMobile |
customer_info.number | Table: Accounts, View: Address, Column: Account |
customer_info.payment_term_days | Table: Accounts, View: Address, Column: PaymentTermInDays |
customer_info.phone | Table: Accounts, View: Address, Column: PhoneMain |
customer_info.postal_code | Table: Accounts, View: Address, Column: PostalCode |
customer_info.state | Table: Accounts, View: Address, Column: Region |
customer_info.vat_number | Table: Accounts, View: Address, Column: VatNumber |
customer_info.web | Table: Accounts, View: Address, Column: Website |
document_info.currency | Invoice currency which usually corresponds to the customer account currency |
document_info.date | Table: Transactions, Column: DateDocument or Date |
document_info.decimals_amounts | Decimals are the same as the decimals used in the accounting file |
document_info.description | Not used |
document_info.doc_type | Table: Transactions, Column: DocType |
document_info.greetings | Table: Transactions, Column: DocType Transactions with DocType=10:gre If there are many rows with 10:gre the texts are joined with ','. More info... |
document_info.locale | Menu: File-File and accounting properties, Other, current Language |
document_info.number | Table: Transactions, Column: DocInvoice |
document_info.order_date | Table: Transactions, Column: DocType Transactions with DocType=10:ordd More info... |
document_info.order_number | Table: Transactions, Column: DocType Transactions with DocType=10:ordn More info... |
document_info.origin_row | Row index of source transaction |
document_info.origin_table | Table name of source transaction |
document_info.rounding_total | Default value for CHF: 0.05 You can overwrite this value with the menu command: Account2 - Customers - Settings - Advanced - Invoice rounding For multicurrency accounting: you can setup the rounding value for each currency in the table ExchangeRates, column DecimalPoints |
document_info.text_begin | Table: Transactions, Column: DocType Transactions with DocType=10:beg More info... |
document_info.type | invoice |
items | Table: Transactions All rows with the same invoice number and transaction date are invoice's items (lines) |
note | Table: Transactions, Column: DocType Transactions with DocType=10:not. More info... |
parameters | Table: Transactions, Column: DocType Transactions with DocType=10:par:key Key: any key text you wish Value: is taken from column Description More info... |
payment_info | Calculated from journal |
shipping_info | Delivery address if different from the invoice address (customer_info) Table: Transactions, Column: DocType Transactions with DocType=10:sadr More info... |
supplier_info.address1 | Menu: File-File and accounting properties, Address, Address 1 |
supplier_info.address2 | Menu: File-File and accounting properties, Address, Address 2 |
supplier_info.business_name | Menu: File-File and accounting properties, Address, Company |
supplier_info.city | Menu: File-File and accounting properties, Address, City |
supplier_info.country | Menu: File-File and accounting properties, Address, Country |
supplier_info.courtesy | Menu: File-File and accounting properties, Address, Courtesy |
supplier_info.email | Menu: File-File and accounting properties, Address, Email |
supplier_info.fax | Menu: File-File and accounting properties, Address, Fax |
supplier_info.first_name | Menu: File-File and accounting properties, Address, Name |
supplier_info.fiscal_number | Menu: File-File and accounting properties, Address, Fiscal Number |
supplier_info.last_name | Menu: FilevFile and accounting properties, Address, Family Name |
supplier_info.mobile | Menu: File-File and accounting properties, Address, Mobile |
supplier_info.phone | Menu: File-File and accounting properties, Address, Phone |
supplier_info.postal_code | Menu: File-File and accounting properties, Address, Zip |
supplier_info.state | Menu: File-File and accounting properties, Address, Region |
supplier_info.vat_number | Menu: File-File and accounting properties, Address, Vat Number |
supplier_info.web | Menu: File-File and accounting properties, Address, Web |
transactions | Table: Transactions All rows with the same invoice number and different transaction date, which are not considered invoice items, like payments transactions |
Layout Preferences Json Object
The function getPrintPreferences() returns a list of user-selectable preferences for printing an invoice in Json format.
Banana takes care of checking whether the getPrintPreferences() function exists in the script and whether it returns the available choices. If found, the layout preferences are displayed within the dialogue for printing invoices, if not, no choices are displayed.
Layout preferences depend on the selected layout type, currently, the returning layouts of the preferences are:
This feature is available only with the Advanced plan, those who own another plan still see the layout preference box but the choices are disabled.
The layout preferences the user can choose from are:
- Print as: The user can decide the type of document to print:
- Automatic (default, depends on invoice status).
- Invoice.
- Delivery note.
- Delivery note without amounts.
- Reminder (number 1,2 or 3).
Complete Json structure
This is the layout preferences structure with multiple elements, that serve as a reference for future implementation:
- version: JSON structure version
- id: Id of the structure.
- text: Name of the structure.
- base_options: Array of objects, each object represents a basic customization option, like the 'print as' options.
- advanced_options_function: Object that contains advanced customization options.
The script defines the language in which to return the Json object, the structure remains the same, only the texts in the 'text' fields change.
The Json code include comments that should not be present in the code.
{
"version" : "1.0",
"id": "invoice_available_layout_preferences",
"text":"Layout Preferences",
"base_options" : [
{
// first combo box
"id": "invoice_available_print_as",
"text": "Print as",
"print_as": [
{
"id":"automatic",
"text":"Automatic"
},
{
"id":"invoice",
"text": "Invoice"
},
{
"id":"delivery_note" ,
"text": "Delivery Note"
},
{
"id":"reminder_1",
"text": "Reminder 1"
},
{
"id":"reminder_2",
"text":"Reminder 2"
},
{
"id":"reminder_3",
"text": "Reminder 3"
}
],
"default": "automatic"
},
],
// button.
// When clicked the "function_name" is called
// Not yet implemented
"advanced_options_function" :{
"text": "Print options",
"function_name": "dialog_print_options"
}
}
Base preferences JSON structure example
The basic layout preferences concern more basic customisations, such as the document type (invoice status). The Json for the basic options is structured as follows:
- id: Id of the structure.
- text: Name of the structure.
- print_as: Array of objects, each object represents an available document type (or invoice status). Each element has an id and a text that is displayed in the combo box.
{
"version" : "1.0",
"id": "invoice_available_layout_preferences",
"text":"Layout Preferences",
"base_options" : [
{
"id": "invoice_available_print_as",
"text": "Print as",
"print_as": [
{
"id":"automatic",
"text":"Automatic"
},
{
"id":"invoice",
"text": "Invoice"
},
{
"id":"delivery_note" ,
"text": "Delivery Note"
},
{
"id":"reminder_1",
"text": "Reminder 1"
},
{
"id":"reminder_2",
"text":"Reminder 2"
},
{
"id":"reminder_3",
"text": "Reminder 3"
}
],
"default": "automatic"
}],
}
Advanced preferences JSON structure example
The advanced print options concern more detailed customisations. (to define)
{
"version" : "1.0",
"id": "invoice_available_print_preferences",
"text":"Layout Preferences",
"base_options" : [{/*Base options*/}],
"advanced_options_function" :{
"text": "Print options",
"function_name": "dialog_print_options"
}
Returned JSON structure example
Banana returns a Json with user-selected layout preferences to the invoice layout script.
This structure is passed to the script through printDocument function.
- version: JSON structure version
- id: Id of the structure.
- print_choices: Object that contains the print choices selected by the user. We send to the script the id of the preference choosed by the user.
In the following example, the user chose to print the third reminder, the value returned to the script, in this case 'reminder_3'.
{
"version" : "1.0",
"id": "invoice_available_layout_preferences",
"print_choices" : {
"print_as":"reminder_3",
//other preferences
},
}
Adapt Existing Invoice Layouts
In Banana Accounting Plus (Advanced plan only) you can take an existing invoice layout, modify it and use it as a new custom layout.
A layout is an Extension that is specific for printing an invoice.
The following steps describe how to adapt to your needs the existing [CH10] Layout with Swiss QR Code and [UNI11] Layout 11 Programmable Invoice layouts.
- Choose the layout to start from
- Save the layout files
- Modify the layout
- Add your layout to the Banana Extensions
- View an invoice with the custom template
Choose the layout to start from
On GitHub you can find the following layouts:
These layouts extensions are packed into .sbaa files that include all the required files needed to run the extensions.
- CH10 Swiss layout, ch.banana.ch.invoice.ch10.sbaa:
- ch.banana.ch.invoice.ch10.js
The javascript code of the layout. - ch.banana.ch.invoice.ch10.texts.js
The javascript code of the layout texts. - ch.banana.ch.invoice.ch10.parameters.js
The javascript code of the layout parameters. - ch.banana.ch.invoice.ch10.printpreferences.js
The javascript code of the layout preferences. - invoice.css
The css stylesheet code. - swissqrcode.js
The javascript code of the QR Code part. - checkfunctions.js
The javascript code of some check functions.
- ch.banana.ch.invoice.ch10.js
- UNI11 Universal layout, ch.banana.uni.invoice.uni11.sbaa:
- ch.banana.uni.invoice.uni11.js
The javascript code of the layout. - ch.banana.uni.invoice.uni11.texts.js
The javascript code of the layout texts. - ch.banana.uni.invoice.uni11.parameters.js
The javascript code of the layout parameters. - ch.banana.uni.invoice.uni11.printpreferences.js
The javascript code of the layout preferences. - invoice.css
The css stylesheet code.
- ch.banana.uni.invoice.uni11.js
Save the layout files
Choose the layout you want to start from and download all the files included in the .sbaa package on your computer.
- Open the links above.
- Right click on the page.
- Select Save page.
All the files must be saved in the same directory.
Modify the layout
- Open the local file ch.banana.ch.invoice.ch10.js or ch.banana.uni.invoice.uni11.js with a text editor program.
- Right click on the file.
- Open with and select the text editor program.
- Change the @id with a new one.
Each new invoice layout must have a different @id text. - Change the @description with a new one.
The description will appear in the print dialog window when selecting the invoice layout. - Modify then the script as you want.
Find more information about the content of the Json Object of the invoice. - Save the file.
Add your layout to the Banana Extensions
At this point you can choose the way you want to add the layout to the Banana Extensions.
You have two options:
- Install the layout without recreating a new package.
- This can be useful if you don't need to share the layout with someone else, and also if you want to test your changes faster.
- From Banana, menu Extensions → Manage Extensions.
- Click on the button Add from file... and choose the file you just downloaded and modified (ch.banana.ch.invoice.ch10.js or ch.banana.uni.invoice.uni11.js).
- Create a new Extension Package (.sbaa file).
- This can be useful if you need to share the layout with someone else.
- Use the following manifest and QRC files and adapt them as you need:
- ch.banana.ch.invoice.ch10.manifest.json
- Open the link, right click on the page, select Save page.
- Open the file using a text editor program and change description and title.
- ch.banana.ch.invoice.ch10.qrc.
- ch.banana.ch.invoice.ch10.manifest.json
- From Banana, menu Extensions → Manage Extensions.
- Click on the button Add from file... and choose the file .sbaa you just created.
Important: Do not delete the extension file from your pc or move it to another directory after the installation, otherwise the extension will no longer work. If you want to move the extension to another directory, you must reinstall it from the new location.
View an invoice with the custom layout
- From Banana, menu Reports → Customers → Print Invoices select the layout you just added.
- Confirm with Ok to see the preview.
Customize Invoice Layout
With the Advanced plan of Banana Accounting Plus, you can create your own Invoice Layout.
A Layout is an Extension that is specific for printing an Invoice.
The following steps describe how to create an invoice template starting from an existing one and adapting it to your needs.
Choose your print style
- From the Banana program, select menu Extensions > Manage Extensions...
- Select Online > Invoice.
- Choose one of the existing templates (i.e. [UNI01] Layout 1)
- Click on Show details.
- Click on URL.
Save the layout's script
A page with the JavaScript code opens. Save the script file to your documents folder (menu File > Save Page As) or right click somewhere on the page > Save As.
Modify the template
- Open the local file with a text editor program
- Right click on the file.
- Open with .... and select the text editor program.
- Change the @description and the @id.
- Save the file.
Add your layout to the Banana extensions
- From the Banana program, menu Extensions > Manage Extensions....
- Click on the button Add from file... and choose the file you just downloaded and modified.
View an invoice with the custom template.
- In menu Reports > Customers > Print Invoices select the layout Smith & Co. Invoice.
- Click Ok.
Preview:
Additional changes
The images below illustrates how to carry out the following changes to your layout.
- How to change the header position to the right:
- Modify the lines as described here (see from row 683 to 686). Save changes.
- How to change the text "Customer No" to "Customer"
See your changes
Simply click on the refresh button
Exporting Invoices to XML
This page explains how to create a Banana Accounting Javascript Extension, that creates the invoice in a specific format. The explanation takes as example the extension Fattura Elettronica , which exports electronic invoices according to Italian B2B standards in XML format.
The Extension has the following steps:
- Use the Banana API, to retrieve the list invoicesCustomers in Json format.
- InvoiceCustomers includes the Invoice objects.
- For the Italian export it is necessary to have also information regarding the Tax code. This supplementary information is calculated by the VAT Extension. That is why the Extensions includes different files.
- The user is given the ability to enter data. So a dialog is displayed with the information required.
See Extension documentation in Italian. - The Extension can also have parameters that can be set with the settings dialog.
- Once you have all the information, you need to convert the data in the format that you need. In the Italian case, the invoice is in the XML format that follows the specific requirements.
- At the end, the Extension calls a function that prompts the user to specify the file where he wants to save the XML data.
- The Extension for Italy also includes a possibility to have a preview of the invoice and export it in PDF.
References:
- Information on creating invoices in Banana is available in our Invoicing documentation.
- All the code reported can be found in the following folder: Italia/Fatture elettroniche/B2B/
- Build you first Extension.
Attributes list
Each extension must declare some attributes in order to run in Banana environment. For more info see Extension's Attributes page
- @id: this is the script ID. It will be used by getScriptSettings() and setScriptSettings() to save params values for this script
- @includejs: ch.banana.it.invoice.it05.js this is the invoice template used to print out the invoice in preview and PDF format.
- @includejs: ch.banana.script.italy_vat_2017.journal.js this file contains the class Journal, used to retrieve transactions and customer info such as adresses. Other includes are dependencies of ch.banana.script.italy_vat_2017.journal.js
// @id = ch.banana.it.efattura.b2b // @api = 1.0 // @pubdate = 2019-04-25 // @publisher = Banana.ch SA // @description = [BETA] Fattura elettronica (XML, PDF)... // @description.it = [BETA] Fattura elettronica (XML, PDF)... // @doctype = * // @task = app.command // @inputdatasource = none // @timeout = -1 // @includejs = ch.banana.it.invoice.it05.js // @includejs = ch.banana.script.italy_vat_2017.errors.js // @includejs = ch.banana.script.italy_vat_2017.journal.js // @includejs = ch.banana.script.italy_vat.daticontribuente.js // @includejs = ch.banana.script.italy_vat_2017.xml.js
Function exec()
The exec() function is the main function, which is called when the extension is executed. This function does the following:
- loads user parameters
- creates an EFattura-class object
- the EFattura object loads data according to user parameters
- the EFattura object issues invoices in xml format or in print preview
function exec(inData, options) {
...
// creates the EFattura object that contains the logic to load the invoices
// and transform them into the required formats
var eFattura = new EFattura(Banana.document);
if (!eFattura.verifyBananaVersion())
return "@Cancel";
// user params can be retrieved using the method Banana.document.getScriptSettings()
// they are saved in the system table syskey using the method Banana.document.setScriptSettings()
var param = {};
...
param = JSON.parse(Banana.document.getScriptSettings());
...
eFattura.setParam(param);
//loadData() retrieves data from table invoicesCustomers() and returns an array of json invoices grouped by customer
var jsonCustomerList = eFattura.loadData();
...
//output the data according to user param (xml or pdf)
if (eFattura.param.output == 0) {
var docs = [];
var styles = [];
for (var i in jsonCustomerList) {
var jsonInvoices = jsonCustomerList[i];
for (var j = 0; j < jsonInvoices.length; j++) {
var jsonInvoice = jsonInvoices[j];
if (jsonInvoice.customer_info) {
var repDocObj = Banana.Report.newReport('');
var repStyleObj = Banana.Report.newStyleSheet();
eFattura.createReport(jsonInvoice, repDocObj, repStyleObj);
docs.push(repDocObj);
styles.push(repStyleObj);
}
}
}
if (docs.length) {
Banana.Report.preview("", docs, styles);
}
}
else {
//output xml
for (var i in jsonCustomerList) {
var jsonInvoices = jsonCustomerList[i];
var xmlDocument = Banana.Xml.newDocument("root");
var output = eFattura.createXml(jsonInvoices, xmlDocument, true);
if (output != "@Cancel") {
var xslt = "";
var outputStyled = output.slice(0, 39) + xslt + output.slice(39);
eFattura.saveFile(outputStyled);
}
}
}
}
Class EFattura()
This class contains all the logic of the application in order to print out the invoices. The costructor initializes some variables.
function EFattura(banDocument) {
this.banDocument = banDocument;
...
this.name = "Banana Accounting EFattura";
this.version = "V1.0";
this.helpId = "ch.banana.it.efattura.b2b.js";
this.errorList = [];
/* errors id*/
this.ID_ERR_ACCOUNTING_TYPE_NOTVALID = "ID_ERR_ACCOUNTING_TYPE_NOTVALID";
...
this.initParam();
this.initNamespaces();
this.initSchemarefs();
}
EFattura.initParam()
This method initializes the class parameters, which will resume user-set values using the setParam() method and the settingsDialog() function.
EFattura.prototype.initParam = function () {
this.param = {};
/*output format 0=pdf, 1=xml*/
this.param.output = 0;
/*selection 0=single invoice, 1=single customer 2=all*/
this.param.selection = 0;
/*invoice number*/
this.param.selection_invoice = '';
/*customer number*/
this.param.selection_customer = '';
/* periodSelected 0=none, 1=1.Q, 2=2.Q, 3=3Q, 4=4Q, 10=1.S, 12=2.S, 30=Year */
this.param.periodAll = true;
this.param.periodSelected = 1;
this.param.periodStartDate = '';
this.param.periodEndDate = '';
/*params for xml format*/
this.param.xml = {};
this.param.xml.progressive = '1';
this.param.xml.open_file = false;
this.param.xml.destination_folder = '';
/*params for pdf format*/
this.param.report = {};
this.param.report.print_header = true;
this.param.report.print_logo = true;
this.param.report.print_quantity = false;
this.param.report.font_family = '';
this.param.report.color_1 = '#337ab7';
this.param.report.color_2 = '#ffffff';
this.param.report.header_row_1 = '';
this.param.report.header_row_2 = '';
this.param.report.header_row_3 = '';
this.param.report.header_row_4 = '';
this.param.report.header_row_5 = '';
this.param.report.footer = '';
}
EFattura.loadData()
The loadData() declares the following objects:
- this.journal: this is an object available from the script Iva Italia. The journal contains all the accounting transactions and the list of customers, including their addresses.
In order to use this object you need to include the file ch.banana.script.italy_vat_2017.journal.js using the statement @includejs = ch.banana.script.italy_vat_2017.journal.js in the attribute list of the script.
- this.journalInvoices: this can be loaded directly from Banana.document.invoicesCustomers and contains all invoices.
EFattura.prototype.loadData = function () {
//loads transactions, the journal is declared in script /iva/2017/ch.banana.script.italy_vat_2017.journal.js
//the journal is used for retrieving the following data: "IT_TipoDoc" (type of document), "IT_Natura" (nature of the transaction)
//see @includes at the beginning of this script
if (!this.journal) {
this.journal = new Journal(this.banDocument);
this.journal.excludeVatTransactions = true;
this.journal.load();
}
//loads list of invoices using the Banana.document object
if (!this.journalInvoices) {
this.journalInvoices = this.banDocument.invoicesCustomers();
}
var jsonInvoiceList = [];
//if invoice filter is defined and invoice number is empty, no invoice is returned
if (this.param.selection == 0 && this.param.selection_invoice.length <= 0)
return jsonInvoiceList;
//if customer filter is defined and customer number is empty, no invoice is returned
if (this.param.selection == 1 && this.param.selection_customer.length <= 0)
return jsonInvoiceList;
//if tax payer data is not defined, no invoiced is returned
if (!this.initDatiContribuente())
return jsonInvoiceList;
//set period of the transactions to be loaded
var periodAll = this.param.periodAll;
var startDate = this.param.periodStartDate;
var endDate = this.param.periodEndDate;
for (var i = 0; i < this.journalInvoices.rowCount; i++) {
var tRow = this.journalInvoices.row(i);
//the column 'ObjectJSonData', in the table journalInvoices, contains the invoice object
if (tRow.value('ObjectJSonData') && tRow.value('ObjectType') === 'InvoiceDocument') {
var jsonData = {};
jsonData = JSON.parse(tRow.value('ObjectJSonData'));
var addInvoice = true;
if (parseInt(this.param.selection) === 0 && jsonData.InvoiceDocument.document_info.number !== this.param.selection_invoice) {
addInvoice = false;
}
if (parseInt(this.param.selection) === 1 && jsonData.InvoiceDocument.customer_info.number !== this.param.selection_customer) {
addInvoice = false;
}
if (addInvoice && !periodAll) {
if (jsonData.InvoiceDocument.document_info.date < startDate || jsonData.InvoiceDocument.document_info.date > endDate) {
addInvoice = false;
}
}
if (addInvoice) {
jsonInvoiceList.push(jsonData.InvoiceDocument);
}
}
}
if (jsonInvoiceList.length<=0) {
var msg = this.getErrorMessage(this.ID_ERR_NOINVOICE);
this.addMessage(msg, this.ID_ERR_NOINVOICE);
}
//data is grouped by customer because the xml file can contain only one customer per file
//if many customers are printed, these will be splitted into many files
var jsonCustomerList = {};
for (var i = 0; i < jsonInvoiceList.length; i++) {
var jsonInvoice = jsonInvoiceList[i];
if (jsonInvoice.customer_info) {
var accountId = jsonInvoice.customer_info.number;
if (!jsonCustomerList[accountId])
jsonCustomerList[accountId] = [];
jsonCustomerList[accountId].push(jsonInvoice);
}
}
return jsonCustomerList;
}
EFattura.createReport(jsonInvoice, report, stylesheet)
The createReport() generates the preview of the invoice. If you wish to change the layout of the invoice you can modify or replace the script ch.banana.it.invoice.it05.js
@jsonInvoice: this is the json invoice object which contains all data to print out
@report: this is the Banana.Report.ReportElement object which permits you to preview and print out the data
@stylesheet: this is the Banana.Report.ReportStyleSheet object which contains all css information for printing out the report.
//print the single invoice to the object report,
//the methods printInvoice and setInvoiceStyle are declared in the file ch.banana.it.invoice.it05.js
if (jsonInvoice && jsonInvoice.customer_info) {
printInvoice(jsonInvoice, report, stylesheet, this.param.report);
...
setInvoiceStyle(report, stylesheet, this.param.report);
stylesheet.addStyle("@page").setAttribute("margin", "0");
}
EFattura.createXml(jsonInvoiceList, xmlDocument, indent)
The createXml() generates the xml code of the invoice. The XML file will contains one or more invoices of a single customer.
@jsonInvoiceList: this is an array with the list of invoices which belong to a single customer
@xmlDocument: this is a Banana.Xml.XmlElement which contains all XML data
@indent: if true the string xml will be indented and formatted with spaces
if (!xmlDocument || jsonInvoiceList.length<=0)
return "@Cancel";
var nodeRoot = this.createXmlHeader(jsonInvoiceList[0], xmlDocument);
if (!nodeRoot || this.isEmpty(nodeRoot))
return "@Cancel";
for (var i = 0; i < jsonInvoiceList.length; i++) {
this.createXmlBody(jsonInvoiceList[i], nodeRoot);
}
return Banana.Xml.save(xmlDocument, indent);
Customer Report Extensions
Report extensions are java-script programs that are used to customize printouts like invoice documents.
The program:
- Will call the main function printDocument() with the json object (for example the invoice) and the other parameters.
- It create a print document and shows the result in a print preview window.
Copies of some report apps that you can use as starting point are available at the following address: github.com/BananaAccounting
Important notes
- Banana Accounting uses Qt script engine to execute report extension.
- Mandatory and optional functions:
- printDocument(jsonContent, repDocObj, repStyleObj [, prefSelected])
the main function that is called by the program - settingsDialog() (optional)
called from user to set up parameters like colour or additional text. - getPrintPreferences() (optional)
returns a JSON object with the available print options.
- Available jsonContent formats:
- The extension of custom report apps should be ".js" and the script must contains the main attributes, see Apps Attributes.
- The attribute @id of the script should correspond to the file name.
- System report apps are downloaded to the folder /User/.../AppData/Local/Banana.ch/.../Apps
(Mac Users: /Users/.../Library/Application Support/Banana.ch/.../Apps) - Do not overwrite system report apps because updates will overwrite your changes.
- You can save your report app anywhere, Banana Accounting saves the path to your app in the configuration file /AppData/Local/Banana.ch/.../Apps/apps.cfg
Customer Statement Layout Extension
Create personalized statement report extension
We have published our templates on github.com/BananaAccounting. In this section you will find different basic examples.
You can save a copy of one template in your computer and make the changes you wish. In order to use your custom template in Banana you have to:
- select the command Reports - Customers - Print statements...
- In the Print statements dialog select Manage apps...
- In the Manage apps dialog select Add from file... and choose your statement report file you just created
Extension attributes
// @id = scriptfilename.js
// @api = 1.0
// @pubdate = yyyy-mm-dd
// @publisher = yourName
// @description = script description
// @task = report.customer.statement
Report code
The main function is printDocument(jsonStatement, repDocObj, repStyleObj [, format]). The parameter jsonStatement object contains the data, repDocObj is the document object and repStyleObj is the stylesheet object where you can add styles.
function printDocument(jsonStatement, repDocObj, repStyleObj) {
var param = initParam();
var savedParam = Banana.document.getScriptSettings();
if (savedParam.length > 0) {
param = JSON.parse(savedParam);
param = verifyParam(param);
}
printInvoice(jsonInvoice, repDocObj, repStyleObj, param);
}
The function settingsDialog() is called from Banana when you select the button Params... from dialog Manage apps. You can write any code you need for your script.
/*Update script's parameters*/
function settingsDialog() {
var param = initParam();
var savedParam = Banana.document.getScriptSettings();
if (savedParam.length > 0) {
param = JSON.parse(savedParam);
}
param = verifyParam(param);
...
var paramToString = JSON.stringify(param);
var value = Banana.document.scriptSaveSettings(paramToString);
}
Customer Statement Json Object
Statement Json Object
Data structure you can access through the report:
{
"customer_info": {
"address1": "Viale Stazione 11",
"business_name": "Rossi SA",
"city": "Bellinzona",
"first_name": "Andrea",
"last_name": "Rossi",
"number": "1100",
"origin_row": "26",
"origin_table": "Accounts",
"postal_code": "6500"
},
"document_info": {
"date": "20160927",
"decimals_amounts": 2,
"description": "",
"locale": "it",
"number": "",
"type": "statement"
},
"items": [
{
"balance": "540.00",
"credit": "",
"currency": "CHF",
"date": "20160101",
"debit": "540.00",
"due_date": "20160131",
"due_days": "240",
"item_type": "invoice",
"last_reminder": "",
"last_reminder_date": "",
"number": "10",
"payment_date": "",
"status": "",
"total_amount_vat_exclusive": "",
"total_amount_vat_inclusive": "",
"total_vat_amount": "",
"unit_price": {
}
},
{
"balance": "540.00",
"credit": "",
"currency": "",
"date": "",
"debit": "540.00",
"item_type": "total",
"number": "",
"status": "",
"total_amount_vat_exclusive": "",
"total_amount_vat_inclusive": "",
"total_vat_amount": "",
"unit_price": {
}
}
],
"supplier_info": {
"address1": "Indirizzo 1",
"address2": "Indirizzo 2",
"business_name": "Società",
"city": "Loc",
"email": "info@myweb",
"first_name": "Nome",
"fiscal_number": "numerofiscale",
"last_name": "Cognome",
"postal_code": "CAP",
"web": "http://www.myweb"
}
}
Reminder Extensions Layout
Create personalized reminder report extensions
We have published our templates on github.com/BananaAccounting. In this section you will find different basic examples.
You can save a copy of one template in your computer and make the changes you wish. In order to use your custom template in Banana you have to:
- select the command Reports - Customers - Print reminders...
- In the Print payment reminders dialog select Manage apps...
- In the Manage apps dialog select Add from file... and choose your reminder report file you just created
Extensions attributes
// @id = scriptfilename.js
// @api = 1.0
// @pubdate = yyyy-mm-dd
// @publisher = yourName
// @description = script description
// @task = report.customer.reminder
Report code
The main function is printDocument(jsonReminder, repDocObj, repStyleObj).
- The parameter jsonReminder object contains the data,
- repDocObj is the document object.
- repStyleObj is the stylesheet object where you can add styles.
function printDocument(jsonReminder, repDocObj, repStyleObj) {
var param = initParam();
var savedParam = Banana.document.getScriptSettings();
if (savedParam.length > 0) {
param = JSON.parse(savedParam);
param = verifyParam(param);
}
printReminder(jsonReminder, repDocObj, repStyleObj, param);
}
The function settingsDialog() is called from Banana when you select the button Params... from dialog Manage apps. You can write any code you need for your script.
/*Update script's parameters*/
function settingsDialog() {
var param = initParam();
var savedParam = Banana.document.getScriptSettings();
if (savedParam.length > 0) {
param = JSON.parse(savedParam);
}
param = verifyParam(param);
...
var paramString = JSON.stringify(param);
var value = Banana.document.setScriptSettings(paramString);
}
Reminder Json Object
Reminder Json Object
Data structure you can access through the report:
{
"customer_info": {
"address1": "Viale Stazione 11",
"business_name": "Rossi SA",
"city": "Bellinzona",
"first_name": "Andrea",
"last_name": "Rossi",
"number": "1100",
"origin_row": "26",
"origin_table": "Accounts",
"postal_code": "6500"
},
"document_info": {
"date": "20160927",
"decimals_amounts": 2,
"description": "",
"locale": "it",
"number": "",
"type": "reminder"
},
"items": [
{
"balance": "540.00",
"balance_base_currency": "540.00",
"base_currency": "CHF",
"credit": "",
"credit_base_currency": "",
"currency": "CHF",
"date": "20160101",
"debit": "540.00",
"debit_base_currency": "540.00",
"item_type": "invoice",
"number": "10",
"status": "1. reminder",
"total_amount_vat_exclusive": "",
"total_amount_vat_inclusive": "",
"total_vat_amount": "",
"unit_price": {
}
},
{
"balance": "540.00",
"balance_base_currency": "540.00",
"base_currency": "",
"credit": "",
"credit_base_currency": "",
"currency": "",
"date": "",
"debit": "540.00",
"debit_base_currency": "540.00",
"item_type": "total",
"number": "",
"status": "",
"total_amount_vat_exclusive": "",
"total_amount_vat_inclusive": "",
"total_vat_amount": "",
"unit_price": {
}
}
],
"supplier_info": {
"address1": "Indirizzo 1",
"address2": "Indirizzo 2",
"business_name": "Società",
"city": "Loc",
"email": "info@myweb",
"first_name": "Nome",
"fiscal_number": "numerofiscale",
"last_name": "Cognome",
"postal_code": "CAP",
"web": "http://www.myweb"
}
}
Estimate and Invoice Dialog Extensions
The Invoice Dialog Extension is used by the the Application Estimate and Invoice. It open a dialog and let the user Enter the invoice data.
The extension uses as input and output a JSON invoice structure.
The Invoice Dialog Extension allows to completely customize the dialog for specific purposes in case you have a high volume of invoices or you have specific needs. Please contact our support for more information.
For more information see the github documentation:
Payment Extension
The payment interface allows you to generate payment messages (xml files) that can be transmitted to a financial institution to make payments.
The payment interface is based on the JsAction class. This class allows you to define through a javascript file all operations on table's fields of Mime Data Type, which contains json objects, such as an invoice or a payment. The various operations allow you to update the transaction row that contains the object and to update the object itself.
See the Payment Extension for Switzerland on Github
Documentation Payment Extension
JsAction::JsAction(banDocument)
/*
* Class Constructor
*/
JsAction::create(tabPos, uuid)
/*
* Creates the payment data object
* Returns a json patch document to be applied or null if the user discard the changes.
* @tabPos: Table name and position row
* @uuid: unique id to identify the payment/data object generated by c++
*/
JsAction::createTransferFile(paymentFile)
/*
* Create a payment file (pain.001 A-level)
* @param paymentData contains a json object of type payment/file
*/
JsAction::edit(tabPos, isModified)
/*
* It is like the updateRow() method, except for displaying the dialog with the properties of the object
* @tabPos: Table name and position row
* @isModified:
*/
JsAction::exportTransferFile(xml, fileName)
/*
* Save the xml pain file to the selected destination folder
* @fileName: suggested fileName
*/
JsAction::getInfo()
/*
* Returns the info to show in the info panel as object (see class InfoMessage)
*/
JsAction::listPainFormats()
/*
* Return the list of the supported transfer file formats
*/
JsAction::scanCode(tabPos, code)
/*
* Scans an invoice QRCode and creates the related transaction
* Returns a json patch document to be applied, null if no changes, or an Error object.
* @tabPos: Table name and position row
* @code: QR-Code text
*/
JsAction::updateRow(tabPos, uuid)
/*
* This method updates the transaction row according to the payment object.
* It returns a json patch document, null if no changes, or an Error object.
* Uuid is used only for new rows (copied or duplicated rows)
*/
JsAction::validateTransferFile(xml, painFormat)
/*
* Validate xml pain file against schema available in package
*/
Example of Payment/Data object
The Payment/Data object is a JSON object which contains the information for making a payment.
{
"methodId":"QRCODE",
"creditorAccountId":";8004",
"creditorName":"Ernesto Verdi",
"creditorStreet1":"Piazza Luvini","creditorStreet2":"",
"creditorCity":"Chiasso",
"creditorPostalCode":"6800",
"creditorCountry":"",
"creditorBankName":"",
"creditorBankAddress1":"",
"creditorBankAddress2":"",
"creditorBankAccount":"",
"creditorIban":"CH58 0900 0000 6525 0122 4",
"creditorBic":"",
"ultimateDebtorName":"",
"ultimateDebtorStreet1":"",
"ultimateDebtorStreet2":"",
"ultimateDebtorCity":"",
"ultimateDebtorPostalCode":"",
"ultimateDebtorCountry":"",
"amount":"140.00",
"currency":"CHF",
"referenceType":"NON",
"reference":"",
"unstructuredMessage":"",
"billingInfo":"",
"categoryPurpose":"",
"invoiceNo":"1002",
"transactionDate":"2022-05-05",
"dueDate":"2022-07-31",
"description":"Fattura Verdi",
"syncTransaction":true,
"@appId":"ch.banana.switzerland.pain001",
"@type":"payment/data",
"@version":"1.0",
"@uuid":"c4ab8cf6-b9e7-4904-80e8-39bfa433ec6a"
}
Example of Payment/File object
The Payment/File object is a JSON object, which contains one or more Payment/Data objects and the pain XML file transmitted to the financial institution.
{
"@appId": "ch.banana.switzerland.pain001",
"@format": "pain.001.001.03.ch.02",
"@title": "Payment June",
"@type": "payment/file",
"@uuid": "c05f6a7b8c9a4c27a55255fcd19c444a",
"@version": "1.0",
"confirmationDetailed": true,
"confirmationExecution": true,
"debtorAccountId": "1020",
"debtorBic": "POFICHBEXXX",
"debtorIban": "CH5809000000652501224",
"debtorName": "Tarchini SA",
"requestExecutionDate": "2022-06-08",
"requestExecutionDateApplyAll": false,
"transactions": [
{
"@appId": "ch.banana.switzerland.pain001",
"@type": "payment/data",
"@uuid": "c4ab8cf6-b9e7-4904-80e8-39bfa433ec6a",
"@version": "1.0",
"amount": "140.00",
"billingInfo": "",
"categoryPurpose": "",
"creditorAccountId": ";8004",
"creditorBankAccount": "",
"creditorBankAddress1": "",
"creditorBankAddress2": "",
"creditorBankName": "",
"creditorBic": "",
"creditorCity": "Chiasso",
"creditorCountry": "",
"creditorIban": "CH58 0900 0000 6525 0122 4",
"creditorName": "Ernesto Verdi",
"creditorPostalCode": "6800",
"creditorStreet1": "Piazza Luvini",
"creditorStreet2": "",
"currency": "CHF",
"description": "Fattura Verdi",
"dueDate": "2022-07-31",
"invoiceNo": "1002",
"methodId": "QRCODE",
"reference": "",
"referenceType": "NON",
"syncTransaction": true,
"transactionDate": "2022-05-05",
"ultimateDebtorCity": "",
"ultimateDebtorCountry": "",
"ultimateDebtorName": "",
"ultimateDebtorPostalCode": "",
"ultimateDebtorStreet1": "",
"ultimateDebtorStreet2": "",
"unstructuredMessage": ""
}
],
"transferFile": "\n\n \n \n c05f6a7b8c9a4c27a55255fcd19c444a \n 2022-06-08T15:35:37 \n 1 \n 140.00 \n \n message sender name missing \n \n Banana Accounting+/Banana.ch SA \n 10.0.12.22152 \n \n \n \n \n PAYMT-2022068133537178-000 \n TRF \n true \n 1 \n 140.00 \n 2022-07-31 \n \n Tarchini SA \n \n \n \n CH5809000000652501224 \n \n \n CWD \n \n \n \n \n POFICHBEXXX \n \n \n CRED \n \n \n INSTRID-1 \n c4ab8cf6b9e7490480e839bfa433ec6a \n \n \n \n 140.00 \n \n \n Ernesto Verdi \n \n Piazza Luvini \n 6800 Chiasso \n \n \n \n \n CH5809000000652501224 \n \n \n \n \n \n \n"
}
File Creator Extensions
The File Create extensions transforms allow to create Banana file, by importing a data formats (like audit files, bank statements or invoices files) .
For example of File Creator Extensions, see the Menu Tools > Create file from external data.
Extension Package
The Create extension must be published as sbaa package and contains at least the following two files:
- manifest.json
The description of the package
- createlocate.json
This file specify to which file the conversion apply, and the resource used for converting and creating a file.
- createinit.js
A javascript file that analyse the data and return a Json text, that specify what script is used to convert the data and what document Banana Accounting will create.
createlocate.json
The text file createlocate.json associates a specific file format to an extension. When opening a text file, whose format is defined in createlocate.json, Banana Accounting will create a new accounting file and import the content of the text file.
In the following example, opening an XML file with namespace 'http:://ivaservizi.agenziaentrate.gov....', Banana Accounting will look for the extension to be executed defined in the createlocate.json file.
{
"country":"italy",
"countryCode":"it",
"description": "Importazione e-fatture ordinarie v1.2 (xml)",
"docUri": "",
"fileExtension": "xml",
"mimeType": "text/xml",
"script": {
"function": "exec",
"uri": "ch.banana.it.import.efattura.sbaa/createinit.js"
},
"xml": {
"namespace": "http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2",
"rootItem": "FatturaElettronica"
},
"type": "text/json",
"version": "1.0"
}
Example of XML Data
This example will be imported according to the instructions contained in the createlocate.js file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type='text/xsl' href='fatturaPA_v1.2.1.xsl'?>
<p:FatturaElettronica versione="FPR12" xmlns:p="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FatturaElettronicaHeader>
<DatiTrasmissione>
<IdTrasmittente><IdPaese>IT</IdPaese><IdCodice>09009900999</IdCodice></IdTrasmittente>
...
</DatiTrasmissione>
</FatturaElettronicaHeader>
</p:FatturaElettronica>
createinit.js
This is a script file with the attribute @task create.init.
The script returns a json object which defines the type of accounting file to create and the extension to execute for importing data.
The argument of the exec function (inData) is the data to be imported.
// @id = createinit
// @api = 1.0
// @pubdate = 2021-07-28
// @publisher = Banana.ch SA
// @description = Create Init for importing Italy's XML Invoices
// @task = create.init
// @doctype = *
function exec(inData) {
var jsonData = {
"fileType": {
"accountingType" : {
"docGroup" : "100",
"docApp" : "110",
"decimals" : "2"
},
"template" : "https://github.com/BananaAccounting/Italia/raw/master/templates/contabilita_doppia/cd_commerciale.ac2",
},
"scriptImport": {
"function": "exec",
"uri": "ch.banana.it.import.efattura.sbaa/ch.banana.it.import.efattura"
},
"scriptSetup": {
"function": "setup",
"uri": "ch.banana.it.import.efattura.sbaa/ch.banana.it.import.efattura"
},
};
return jsonData;
}
- fileType: the ac2 file which will contain the imported data
- accountingType: if template is empty, a new empty accounting file will be created. You can decide which type to create:
docGroup 100 double entry accounting
docGroup 110 simple accounting (income - expenses accounting)
docGroup 130 cash book accounting
docApp 100 without VAT
docApp 110 with V AT
docApp 120 multicurrency without VAT
docApp 130 multicurrency with VAT
- template: url of an ac2 file. You can download ac2 files from our website (resources). If template is empty a new empty file will be created.
- scriptImport:
function is the method which will be called when importing data. uri is the name of the file which contains the javascript with this method.
- scriptSetup:
function is the method which will be called when setting up the script. uri is the name of the file which contains the javascript with this method.
API Introduction
Retrieve Data
The Accounting files content can be accessed and be modified using specific API functions.
Retrieving data
The accounting file contains file properties and tables.
- Banana.Application
Information regarding the program, API version, messages. - Banana.Document (Base)
Is the main class that give access to the content of the accounting file.
Some properties and functions:- Banana.document.tableNames
Return a list of the tableNames in the file. - Banana.document.table(xmlTableName)
Return a table object of the specified table.
- Banana.Document (Accounting)
Additional properties and functions specific to accounting files.
For examples:- budgetBalance()
Calculate the balance of an account using the budget data. - currentBalance()
Calculate the balance of an account using the current data.
- Banana.Document (Invoice & Estimate)
Additional properties and functions for Invoice & Estimates files.- calculateInvoice()
Calculate the invoice and return the filled Json. - printInvoice()
Call the dialog for printing and previewing Invoices.
- Banana.document
Is the object of the current open accounting file. - Banana.Document.Table
It the class that provide access to the table content.
Some properties and functions:- columnNames
A property with the list of columns. - column(columnName)
Return the Column with the given name in the given view as Column Object. - rows
Return the rows of the table as an array of Row objects.
- Banana.Document.Column
Provide information about the column.
Some properties are:- alignment
- header
- dataType
- Banana.Document.Row
Access to the content of the single row.- value(columnName)
Return the cell content of the specified column.
Extension setting
Data specific to the extension can be saved within the accounting file and later retrieved with the specific Banana.Document functions:
- Banana.document.getScriptSettings()
- Banana.document.setScriptSettings()
Math, Data conversion and XML
For manipulating data you can use the Javascript native functions.
Banana API makes available some function that make it easy to convert from and to Banana format:
- Banana.Converter
A collection of methods useful to convert various formats to and from data tables (array of arrays). - Banana.SDecimal
Provides functions to do precise decimal math calculation with up to 34 decimal.
It overcomes the rounding problem typical of Javasctipt float type. - Banana.Xml
A convenient class to access and create XML content.
Modify Data
The Accounting files content can be be modified using specific API functions.
Banana Accounting Extension can modify the data, but the user has full control of it:
- Changes to the file are first displayed to the user.
- The user must approve the changes.
- The user can undo the changes.
This approach put the user on full control. Once the changes are displayed, the user can decide whether to apply them or not. In addition, the user can also undo changes.
It's a different approach from Excel where scripts makes direct changes to the sheets and user cannot preview and undo them.
Extension for changing data
The process to change data is the following:
- The extension creates a DocumentChange JSON object that contains the information regarding the change:
- Add new rows with the possibility of also defining the style (colors, font size, ...).
- Modify existing rows with the possibility of also defining the style (colors, font size, ...).
- Delete rows.
- Modify File properties data.
- The exec() function of the extension returns the DocumentChange Object (see the Example of an Extension using a DocumentChange).
- When you run the extension, the program displays a dialog box where the user can see a preview of the data that will be changed.

Preview example where a new row is added to the Transactions table
- The user need to confirm the changes.
- The changes will be added to the undo/redo mechanism.
The user can therefore undo and redo the change, similar to all other commands. - The changes are applied to the accounting file.

The row with the style is added to the Transactions table
Extensions: Display and Get Data from Users
Extension have different way to display and get data from users.
Displaying information
- addMessage functions
- This will display the information in the same pop-up dialog used in Banana Accounting.
- The message is also available in the Message window.
- The function is available from this objects types.
Application, Document, Table, Row.
- Banana.Console
- Let the developer output information to the Debug windows.
- See Debugging.
- The Banana.Ui method to display data, like:
- showText()
Show the given text in a dialog with the given title.
- Banana.Report class
Let you create reports, preview, print and export to pdf or other formats.
Getting information from users
The Banana.Ui class offers methods to display get data from users.
- Questions
- showQuestion()
how the user a question dialog with Yes and No buttons.
- Getting simple data (for example):
- getText()
Show the user a dialog asking to insert a text. - getDouble()
Show the user a dialog asking to insert a double. - getItem()
Show the user a combo box dialog asking to select an item from a list.
- Structured date entry dialog:
- The openPropertyEditor()
function create a structured dialog for entering data.
See: Dialog PropertyEditor Page.
- Custom Dialogs
Creating Widgets
With QT Creator you can design any kind of widget and use it in the extension to visualize o get data from the user.
For simple interactions with the user you can use the predefined dialogs of the class Banana.Ui. With those dialogs you can ask the user to insert a value, answer a question, or
Extensions: File access, Import and Export of Data
The extension mechanism to access local files, import and export data is focused on security, those giving the user full control of the process.
File Access
- Banana.IO
The Banana.IO class is used to read and write to files.- Banana.IO.LocalFile
The LocalFile class represents a file on the local file system.
- Banana.Application
- openDocument()
Opens the ac2 file located in filePath and returns an Object of type Banana.Document or undefined if the file is not found.
The path can be relative, in this case the base directory is the path of the current document.
Import Data
You can create an extension specific for importing data.
- See: Import Extensions
Export Data
You can create an extension specific for exporting data.
- See: Export Extensions
Debugging
Output messages to the debug panel
For debugging you can use the methods in Banana.Console object to output useful information to the debug panel during the execution of the script.
If you have to notify the user use instead the methods
- Banana.application.addMessage
- Banana.document.addMessage
- Banana.Document.Table.addMessage
- Banana.Document.Row.addMessage
Example
Banana.console.log("An info message");
Banana.console.debug("A debug message");
Banana.console.warning("A warning message");
Banana.console.crtitcal("A critical message");
Debug panel
The debug panel when enabled is located on the bottom of the main window near the Info and Messages panels. To open the debug panel you have to enable the option:
- Menu > Window > Appearance > Show Developer Menu
- Menu > Developer > Show Debug Panel
In the debug panel you can choose the type of message to shows (only warnings, debug or info messages), click on the panel with the right mouse key and select the desired level.

Extension Test Framework
When developing extension we strongly encourage to use the test functionalities and add testcase to you project so that when making change you can see if there have been regressions.
How tests works
The test framework operates similar as a typical testunit.
For example if you need to test an accounting report.
- Preparing the test:
- You create a test case in the sub-directory your extension (see extension package and project).
- For the report case in the test directory you will put a the accounting file with the data that is necessary for the test.
- You create a expected results directory.
In our case it will contain the expected report.
The first time you run a test, you will copy the results to the expected directory. - You write a test function that load the accounting data and call the extension function that generate a report.
The first time you run a test, you will check manually that the report is correct.
- Running the test.
- You start the test.
- The framework will run the test case.
- The result will be compared to the expected result and if the result is different the test will fail.
Documentation and examples
- Banana.Test
Class used when creating unit tests. - How to for the Test Framework
Step-by-step guide for creating a simple test case example that uses Extensions Test Framework to run unit tests of Extensions.
Working with the TestFramework for extenstions
Introduction
This walkthrough provides step-by-step guidance for creating a simple test case example that uses Extensions Test Framework to run unit tests of Extensions.
The steps in order to experiment with Extensions Test Framework are the following:
- Download and use the Banana Experimental version
- Create a Extension to be tested
- Create a test case
- Run the test
- Verify the test results
Create an Extension to be tested
A test case is related to a working Extension.
For this example we use a modified version of "Hello World!" Extension example (see Build your first Extension).
Copy the code below, paste it on your text editor and save the file as helloworld2.js
// @id = ch.banana.app.helloworldexample
// @api = 1.0
// @pubdate = 2018-10-23
// @publisher = Banana.ch SA
// @description = Example Hello world 2
// @task = app.command
// @doctype = *.*
// @docproperties =
// @outputformat = none
// @inputdataform = none
// @timeout = -1
function exec() {
//Call the function to create the report
var report = createReport();
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
function createReport() {
//Create the report
var report = Banana.Report.newReport("Report title");
//Add a paragraph with the "hello world" text
report.addParagraph("Hello World!");
//Return the report
return report;
}
Create a test case
Follow the instructions below to create a working test case:
- Create a folder test in the same folder where the Extension helloworld2.js is located.
Copy the following JavaScript code and paste it into a text editor.
// @id = ch.banana.app.helloworld2example.test
// @api = 1.0
// @pubdate = 2018-10-30
// @publisher = Banana.ch SA
// @description = [Test] Example Hello world 2
// @task = app.command
// @doctype = *.*
// @docproperties =
// @outputformat = none
// @inputdataform = none
// @timeout = -1
// @includejs = ../helloworld2.js
// Register this test case to be executed
Test.registerTestCase(new TestFrameworkExample());
// Define the test class, the name of the class is not important
function TestFrameworkExample() {
}
// This method will be called at the beginning of the test case
TestFrameworkExample.prototype.initTestCase = function() {
this.progressBar = Banana.application.progressBar;
}
// This method will be called at the end of the test case
TestFrameworkExample.prototype.cleanupTestCase = function() {
}
// This method will be called before every test method is executed
TestFrameworkExample.prototype.init = function() {
}
// This method will be called after every test method is executed
TestFrameworkExample.prototype.cleanup = function() {
}
// Every method with the prefix 'test' are executed automatically as test method
// You can defiend as many test methods as you need
TestFrameworkExample.prototype.testVerifyMethods = function() {
Test.logger.addText("The object Test defines methods to verify conditions.");
// This method verify that the condition is true
Test.assert(true);
Test.assert(true, "message"); // You can specify a message to be logged in case of failure
// This method verify that the two parameters are equals
Test.assertIsEqual("Same text", "Same text");
}
TestFrameworkExample.prototype.testBananaApps = function() {
Test.logger.addText("This test will tests the BananaApp helloworld.js");
var document = Banana.application.openDocument("file:script/../test/testcases/accounting_file.ac2");
Test.assert(document, "File ac2 not found");
// Add the report content text to the result txt file
var report = createReport();
Test.logger.addReport("ReportName", report);
}
- Modify the script: find the row "var document = Banana.application.openDocument("file:script/../test/testcases/accounting_file.ac2")" and replace "accounting_file.ac2" with the name of your Banana accounting file.
- Save the file into test folder as helloworld2.test.js (the file name must always be <same_name_bananaapp>.test.js).
- Create a folder test/testcases and copy there your file .ac2.
- Now you should have something like this:

- helloworld2.js: the BananaApp
- test: the test folder
- helloworld2.test.js: the test script for the Extension
- testcases: the folder for test ac2 files
- xxx.ac2: your Banana accounting file
Run the test case
Finally, now it is possible to run the test case and see the results.
To run the test:
- In Banana select from the menu Extensions the command Manage Extensions...

- Select from the Installed element the “Example Hello World 2” Extension
- Click on the button Run tests

Test case results
The test compare the current results with the expected results and checks if there are differences.
If differences are found a dialog message warn you. All the details can be found inside the .test.diff.txt file.
The first time you run a test probably you will see the following "Test failed" dialog message:

In your test folder you can see two new auto generated folders:
- test/testresults:
contains the helloworld2.test folder with a helloworld2.test.txt file with the results of the test.
When the test is run, the folder and the file are automatically generated. - test/testexpected:
contains the helloworld2.test folder that should contain a helloworld2.test.txt file with the expected results.
When the test is run, the folder is automatically generated, but the file NOT. The first time you run the test the folder is empty. This is why the test fails.
You now should have something like that:

Inside the test/testresults/helloworld2.test folder there is the helloworld2.test.txt file with all the results of the test, like the following one:

The file helloworld2.test.diff.txt is a resume of the results, with all the differences the test has found.
The image below shows an example of test summary with differences:
- with the sign "+" are indicated the rows added to the .txt file of the test/testresults folder (compared with the testexpected folder)
- with the sign "-" are indicated the rows removed from the .txt file of the test/testresults folder (compared with the testexpected folder)

As mentioned above, the folder test/testexpected is empty. This is why we can see a lot of added rows to the .txt file of the test/testresults folder.
If you have differences and and you know these differences are correct (like in this case):
- copy the test results .txt file from the folder test/testresults to the folder test/testexpected.
You should have a structure like this:

Note that the helloworld2.test.txt file is now located in both folders, in the test/testresults/helloworld2.test folder and in the test/testexpected/helloworld2.test folder.
If you run again the test, this time the result is different. You now should see a positive message from the dialog:

This means that the results .txt file generated from the test, is perfectly identical of the expected .txt file. So, the test is successfully passed.
You can also check the helloworld2.test.diff.txt file of the test/testresults/helloworld2.test folder to see the differences results, and there should not be differences found.

From that point, every time you do changes to the Extension you can test it and see if the changes you made works as you expected.
Remember: if you have differences and you know these differences are correct, you have to replace the expected .txt file.
More about Extensions Test
- Extension Test Framework
- TestFramework GitHub documentation
- JavaScript code example (ch.banana.script.testframework.test.js)
Test case Import
Test case import
The type of test that will be analyzed will be suitable for importing the data contained in a CSV file.
To create a test case for an import extension, a series of requirements are required:
- Developed a function that imports CSV file data into the Banana accounting software.
- You have created a couple of CSV files with the data inside structured according to a syntax explained on this page, to be used as a test for the method that will be illustrated for carrying out the tests.
- The creation of functions to do the test.
Functions that imports CSV file data into Banana
function exec(inText){
// Convert a CSV file to an array of arrays.
// The parameters are: text to convert, value separator, delimiter for text values
var csvFile = Banana.Converter.csvToArray(inText, ',', '"');
//Convert a table (array of arrays) to a tsv (tab separated values) file
var tsvFile = Banana.Converter.arrayToTsv(csvFile);
return tsvFile;
}
Structure data syntax of CSV file
This syntax permit to import the registration and the amount of registration in Banana accounting.
There are specific name of the columns in file CSV:
- Date.
- Description.
- Income.
- Expenses.
This is an example of what do you want obtain from CSV file:
Date Description Income Expenses 2024-01-01 Registration Income example 900.00 2024-01-31 Registration Expense example 100.00
The file CSV have to structured as this example:
"Date","Description","Income","Expenses"
"2024-01-01","Income example","900.00",""
"2024-01-31","Registration Expense example","","100.00"
Creation of function testing import data from CSV
Create your file in your folder project "test" with the name of your file of extension: "nameExtensionImport.test.js".
Write the metadata for creation your test, an example:
// @id = nameExtensionId.test.test
// @api = 1.0
// @pubdate = 2024-04-05
// @publisher = Banana.ch SA
// @description = <TEST nameExtensionId.test.test>
// @task = app.command
// @doctype = *.*
// @docproperties =
// @outputformat = none
// @inputdataform = none
// @timeout = -1
// @includejs = extensionImport.js
Write the functions and instance of your test:
Test.registerTestCase(new TestExtensionImport());
function TestExtensionImport() { }
// This method will be called at the beginning of the test case
TestExtensionImport.prototype.initTestCase = function () {
}
// This method will be called at the end of the test case
TestExtensionImport.prototype.cleanupTestCase = function () {
}
// This method will be called before every test method is executed
TestExtensionImport.prototype.init = function () {
}
// This method will be called after every test method is executed
TestExtensionImport.prototype.cleanup = function () {
}
TestExtensionImport.prototype.testImport = function(){
//Path of your file csv to testing
var fileName = "file:script/../test/testcases/csv_test_transaction.csv";
//Returns an object of type Banana.IO.LocalFile that represents the requested file.
//You get a reference to the specified CSV file.
var file = Banana.IO.getLocalFile(fileName);
// Verify that the file exists.
Test.assert(file);
var fileContent = file.read();
// Verify that the contents of the file were read correctly.
Test.assert(fileContent);
// Run a function called 'exec' on the contents of the file.
var transactions = exec(fileContent, true);
//Add transactions to the CSV logger.
this.testLogger.addCsv('', transactions);
}
Subsequently, having implemented and followed all these steps and after having built and installed the extension on Banana:
If you want to try the extension you created it will be able to import recordings in Banana, when you start the extension, you will be asked for the path to where the csv file is located and then to define the income and expense accounts.
To view the import function you must have opened a file where you want to import the recordings (you can also try a file created by default with double entry) click on the "Actions" menu at the top, choose Import: "Transactions" and from here you can select the developed extension and path.
To test the extension, you will have to access the Banana "Manage Extensions" menu, then select the developed extension in the Installed menu and click Run test.
Test case report example
To create a complete report, it is necessary to start with some operations that are integrated into the extension code.
This is a repository to begin your report example:
The operations are:
- Create the structure and the logic of your report.
- Create a structure of report (balance, profit-loss).
- Validate the groups of the accounting.
- Load your report values from the Balance Sheet.
- Calculate the totals of the amounts.
- Format amount values of the report.
- Print the results of your report.
- Create a function that contains all the tests you want to run.
- Save the content of your file about test case.
- Configure user parameters.
After these operations on the code side you can run your test as explained on this page.
Create a function for testing a report
In the javascript test file, you have to create a function that generates the report and adds it to the test results. Use the addReport() function defined in Banana.Test.Logger class.
You can see an example of how to create a test for a report:
Save the content of your file about test case
var bananaDocument = Banana.application.openDocument("file:script/../test/testcases/nameFileTestCases.ac2");
In this variable you save the content of your test case ac2 file.
To learn more about the method openDocument and other methods:
Configure parameter of user
You can initialize the parameters to define some data like the period (start date and end date), the report title, and others.
The parameter column defines which column to use in order to create the report. By default is Gr1. In this column for each account is defined an ID used to regroup the accounts for the report sections.
Create structure of your report - Balance
For creation a base report, you can create an array that contain all information that you need as in example:
The information are:
- the group IDs.
- Description of account.
- Sum of the group of accounts.
- Type of account (asset, liabilitie , cost, revenue).
Parameter explanation
- id
Is the unique parameter of column in Banana, the column name of id corresponds to Gr1, you can decide what to put as the id, as long as the id is the same as what you configure in the Gr1 column of Banana. - type
Define what type of data is. The are three options: title, group and total.Title: Normally used when a title or a description text without amount must be displayed.
The "id" group starts with a "d" (description).
Example:
{"id":"dABI", "type":"title", "indent":"1", "description":"I - Intangible assets"}
Group: Used when a group with text and amount must be displayed.
Examples:
{"id":"ABI1", "type":"group", "indent":"2", "bclass":"1", "description":"1) Installation and expansion costs"}
{"id":"ABI2", "type":"group", "indent":"2", "bclass":"1", "description":"2) Development costs"}
Total: Used for the total of a group with and amount. The amount is the sum groups amounts. Use the property "sum" to indicate the list of all "id" groups that must be summed together, separated by a semicolon ";". To subtract amounts use the minus sign "-" before the group "id".
Examples:
{"id":"TC", "type":"total", "indent":"1", "description":"Total Costs", "sum":"C1;C2"} → sum = C1 + C2
{"id":"AS", "type":"total", "indent":"1", "description":"Total Assets", "sum":"AS1;-C3"} → sum = AS1 - C3
- bclass
Corresponding of what is this account. In Banana bclass 1 is Assets, 2 is Liabilities, 3 Costs, 4 Revenues. - description
Used to define the description text used for the print. - note
This is used to provide more details in the report. - sum
This is used to define how to calculate the total.
In this example, you create a simply configuration for creation a report of Balance Sheet, where contains the assets and the liabilities of short term:
function createReportStructure(){
//create an array where do you pass your parameter for creation your structure of Balance
var reportStructureBalance = [];
//AN EXAMPLE OF STRUCTURE
//Assets
reportStructureBalance.push({ "id": "CashId", "type": "group", "note": "", "bclass": "1", "description": "Cash" });
reportStructureBalance.push({ "id": "BankId", "type": "group", "note": "", "bclass": "1", "description": "Bank" });
reportStructureBalance.push({ "id": "TotalLiquidityId", "type": "total", "note": "", "bclass": "1", "description": "Total liquidity", "sum":"CashId;BankId" });
//Liabilities
reportStructureBalance.push({ "id": "SuppliersId", "type": "group", "note": "", "bclass": "2", "description": "Suppliers" });
reportStructureBalance.push({ "id": "DueBanksShortTermId", "type": "group", "note": "", "bclass": "2", "description": "Due to banks short/term" });
reportStructureBalance.push({ "id": "ShortTermOnorousDebtsId", "type": "total", "note": "", "bclass": "1", "description": "Short-term onorous debts", "sum":"SuppliersId;DueBanksShortTermId" });
}
Loads your values of report from the Balance Sheet
Before load your values of report, you have to create the next functions in the exentension and invoke this functions in the test file:
- validateGroupsBalance.
- loadBalances.
- calculateTotals.
- formatValues.
- excludeEntries.
- printBalanceSheet.
Repository that content the functions of operations 1 to 5:
Repository that content the function of operation 6:
Functions
validateGroupsBalance(grColumn)
The input of this function grColumn: is a prameter of id group of column (Example: Gr1).
This function have to check if the groups defined by user is valid or not.
loadBalances()
This function load and calculate the current and previous balances of the report structure.
calculateTotals(fields)
Calculates all totals of the reportStructure for the given list of fields.
formatValues(fields)
Converts all the amounts to local format for the given list of field.
excludeEntries()
Entries preceded by Arabic numbers or lower case letters with zero amounts for two consecutive exercises, can be excluded from the print.
Banana Accounting API Extensions Reference
Extensions API, Namespace, Formats, Versions
Banana namespace
The whole API (Application Program Interface) made available for Banana is under the namespace "Banana".
There are different objects and methods that belong to the namespace Banana, that can be accessed by the javascript at run time:
String Data Type
String Data Type are String that contains text for different purposes.
Banana Accounting Extensions make a lot of use of String Data Types.
For example Data.row.value("columnNameXML) return a String that may contains a different value based on the column type.
It is up to the developer to know what kind of Data Type the String contains and use the content appropriately.
Date
Date values are in ISO 8601 format "YYYY-MM-DD".
Decimal
Decimal values have a '.' (dot) as decimal separator and don't have a group separator. For example: "12345.67".
Decimal values are rounded according to the accounting settings.
Text
Text values can contain any character supported by UTF-8.
Time
Time values are in ISO 8601 format "HH:MM:SS". The formats "HH:MM" and "HH:MM:SS.ZZZ" are also accepted.
API Version
List of API Version made available by Banana Accounting.
In the script you can set the attribute @api to notify the required minimum version.
Banana Accounting Version API Version 7.0.6 1.0 8.0.7 or more recent 1.0 9.0.0 or more recent 1.0 Plus 1.2.4 Plus Insider 1.2.5
Banana (Objects)
Banana is the namespace (object) through which all Banana script's methods, class and objects are accessible.
Banana Properties
Banana.application
The object Banana.application represents the running application.
Banana.console
The object Banana.console is used to send messages to the debug script.
Banana.Converter
The class Banana.Converter contains methods useful to convert data from and to various formats.
Banana.document
The object Banana.document represents the document currently open in the application. It contains base properties and methods, see Banana.Document (Base), and if the document represents an accounting document that contains additional accounting's properties and methods, see Banana.Document (Accounting). If any document is opened this object is of type Undefined.
Banana.IO
The class Banana.IO is used to read and write files.
Banana.Report
The class Banana.Report enables you to create reports, preview and print them in Banana Accounting.
Banana.script
The object Banana.script is used to get information about the running script.
Banana.SDecimal
The class Banana.SDecimal contains methods useful for decimal math calculation.
Banana.Test
The class Banana.Test contains methods to run test units.
Banana.Ui
The class Banana.Ui contains predefined dialogs to interact with the user, and methods to load dialogs from .ui or .qml files.
Banana.Xml
The class Banana.Xml contains methods to parse and access Xml data.
Banana Methods
Banana.compareVersion(v1, v2)
Compares two version strings. Version strings are in the form of "x.y.w.z". Returns 0 if v1 and v2 are equal, -1 if v2 is later and 1 if v1 is later.
var requiredVersion = "8.0.5";
if (Banana.compareVersion && Banana.compareVersion(Banana.application.version, requiredVersion) >= 0)
Banana.Ui.showInformation("Message", "More recent or equal than version " + requiredVersion);
else
Banana.Ui.showInformation("Message", "Older than version " + requiredVersion);
Banana.include(path)
The method Banana.include(path) includes a javascript file evaluating it.
If an error occurs, i.e. the file is not found or is not valid, the method throws an exception.
The path is relative to the current script being executed, if no protocol is specified.
The application searches for include files in this order:
1) In the same directory as the current file.
2) In the directories of the currently opened include files, in the reverse order in which they were opened.
If a protocol is defined, depending on the protocol, the path is relative to the main script's folder, the document's folder or the name of a document attacched to the current file.
- <relative_path_to_current_script>/<file_name>
- file:script/<relative_path_to_main_script>/<file_name>
- file:document/<relative_path_to_file>/<file_name>
- documents:<attachment_name>
Scripts included through the method Banana.include(path) can include other scripts through the method Banana.include(path), but not via the script's attibute @includejs. The method Banana.include(path) garantees that each distinct script is evaluated once, even if it is included more than one time from differents scripts. Path can contain ".." (parent folder), in the case the destination path is outside the main script's folder, the method will throw a security exception.
Banana.include("cashflowlib.js"); // a js file in the same folder
Banana.include("folder/cashflowlib.js"); // a js file in a subfolder
Banana.include("file:document/cashflowlib.js"); // a js file stored in the document table
Banana.Application
Banana.Application represents the interface to the program and can be accessed through Banana.application.
Properties
apiVersion
Returns the version of the implemented Js Banana API in the form of "1.2.2".
For the different versions see API Versions and the changelog.
var qtVersion = Banana.application.apiVersion; // Returns "1.2.2"
isExperimental
Returns true if the application is an experimental version.
var isExperimental = Banana.application.isExperimental;
isInternal
Returns true if the application is an internal version.
var isInternal = Banana.application.isInternal;
license
Returns an object containing informations about the active license, or null if no license is active.
The properties of the returned object are:
- licenseType (string): one of "professional" or "advanced"
- exprirationDate (string): null if no expiration, or the expiration in form of "yyyy-mm-dd"
- language (string): "all" if all languages are available, or the licensed language code, i.e: "it", "nl", ...
- isWithinMaxFreeLines(bool): (from version 10.0.7) true if you have not yet passed the limits of the demonstration mode. For accounting applications: 70 Transaction rows, 20 Budget rows, 20 rows for added table. For other applications (Invoices, Inventory, Addresses) 20 rows for any table.
isWithinMaxFreeLines returns always false if the license type is Advanced, because the rows limit is not checked
var license = Banana.application.license;
// Example:
// {
// "licenseType": "professional",
// "expirationDate": "2022-10-24",
// "language":"all",
// "isWithinMaxFreeLines":true
// }
if (!Banana.application.license || Banana.application.license.licenseType !== "advanced") {
Banana.document.addMessage("This extension requires Banana Accounting+ Advanced");
}
qtVersion
Returns the version of the used qt framework in the form of "6.4.1".
var qtVersion = Banana.application.qtVersion; // Returns "6.4.1"
serial
Returns the serial of the application in the form of "100010-320".
var serial = Banana.application.serial; // Returns "100012-320"
version
Returns the version of the application in the form of "10.0.12".
var version = Banana.application.version;
locale
Returns the locale of the application in the form of "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two- or three-letter ISO 3166 country code.
var locale = Banana.application.locale;
progressBar
Returns an object of type ProgressBar used to give the user an indication of the progress of an operation and the ability to cancel it.
var progerssBar = Banana.application.progressBar;
Methods
addMessage(msg [, idMsg])
Adds the message msg to the application. The message is showed in the pane "Messages", and in a dialog if the application option "Show Messages" is turned on.
If idMsg is not empty, the help button calls an url with script's id and message's id (idMsg) as parameters.
Banana.application.addMessage("Hello World");
See also: Table.AddMessage, Row.AddMessage, Document.AddMessage.
clearMessages()
Clears all the messages showed in the pane "Messages".
Banana.application.clearMessages();
getMessages()
Returns all messages showed in the pane "Messages".
let msgs = Banana.application.getMessages();
for (let i = 0; i < msgs.length; ++i) {
let msg = msgs[i];
Banana.console.log("Error: " + msg.message);
}
The message object contains following properties:
- message: the message in the application language;
- referer: a string describing to which the message refer (usually the file name);
- level: the level of the message as string, can be one of "debug", "info", "warning", "debug";
- helpId: the help id of the message, used to link to the documentation;
- fileUuid: an id as string that uniquely identifies the file to which the message refer or empty;
- fileName: the file name that identifies the file to which the message refer or empty;
- tableName: the table name to which the message refer, or empty;
- rowNr: the row number as number to which the message refer, or -1;
- columnName: the column name to which the message refer to, or empty;
See also: Document.getMessages.
showMessages([show])
Enable or disable the notification of new messages through the message dialog.
Banana.application.showMessages(); // Next messages are showed to the user through the message dialog.
Banana.application.showMessages(false); // Next messages will not pop up the message dialog.
openDocument(ac2FilePath [, password] [, title])
Opens the ac2 file located in filePath and returns an Object of type Banana.Document or undefined if the file is not found. The path can be relative, in this case the base directory is the path of the current document.
If the path is empty or contains a "*" or a "?" an open file dialog is showed to the user, and the title is used in the caption of the file open dialog.
With this function you can also open ISO 20022 and MT940 files, in this case a cash book with the transactions of the file is returned.
var file1 = Banana.application.openDocument("*.*");
if (!file1)
return;
var file2 = Banana.application.openDocument("c:/temp/accounting_2015.ac2");
if (!file2)
return;
Banana.Application.ProgressBar
Banana.Application.ProgressBar is the interface to the program progress bar and can be accessed through Banana.application.progressBar. The progressBar object is used to give the user an indication of the progress of an operation and the possibility to interrupt the running process. The progress bar is showed in bottom left corner of the application windows.
// Example use of a progress bar
var progressBar = Banana.application.progressBar;
progressBar.start(10);
for (var i = 0; i < 10; i++) {
...
if (!progressBar.step(1)) {
return; // Operation canceled by the user
}
}
progressBar.finish();
Properties
showDetails
If true details are showed in the progess bar. If false only the text set by the first progressBar.start() call is showed.
progressBar.showDetails = false; // Example without details: "VAT Report"
progressBar.showDetails = true; // Example with details: "Vat Report; Sales; Row: 120"
Since Banana Accounting 9.0.3.
Methods
finish()
Notifies that the operation has been completed and closes the progress bar.
Returns false if the user canceled the operation, otherwise true.
progressBar.finish();
pause()
Notifies that the operation has been paused, the cursor icon is set to the arrow cursor or poiting hand cursor. This is usually called before showing a dialog.
Banana.application.progressBar.pause();
var result = dialog.exec();
Banana.application.progressBar.resume();
resume()
Notifies that the operation has been resumed, the cursor icon is set back to an hourglass or watch cursor. This is usually called after a dialog has been closed.
Banana.application.progressBar.pause();
var result = dialog.exec();
Banana.application.progressBar.resume();
start(maxSteps)
Starts the progress indicator and defines the number of steps this operation needs before being complete.
You can call this method several times to split the progress in main and sub steps. Every call of the method start() should be paired with a call of the method finish().
Returns false if the user canceled the operation, otherwise true.
// Example use of a progress bar
var progressBar = Banana.application.progressBar;
progressBar.start(10);
for (var i = 0; i < 10; i++) {
...
if (!progressBar.step(1)) {
return; // Operation canceled by the user
}
}
progressBar.finish();
start(text, maxSteps)
Starts the progress indicator and defines the text to be showed in the progress bar as well as the number of steps this operation needs before being complete.
You can call this method several times to split the progress in main and sub steps. Every call of the method start() should be paired with a call of the method finish().
Returns false if the user canceled the operation, otherwise true.
// Example use of a progress bar
var progressBar = Banana.application.progressBar;
progressBar.start("Checking rows", 10);
for (var i = 0; i < 10; i++) {
...
if (!progressBar.step("Row: " + i.toString())) {
return; // Operation canceled by the user
}
}
progressBar.finish();
Since Banana Accounting 9.0.3.
setText(text)
Sets the text to show in the progress bar.
progressBar.setText("Checking vat rates");
Since Banana Accounting 9.0.3.
step([stepCount])
Advances the progress indicator of stepCount steps. If stepCount is not defined, it advances of one step.
Returns false if the user canceled the operation, otherwise true.
progressBar.step(1);
step(text, [stepCount])
Advances the progress indicator of stepCount steps and sets the text of the progress bar. If stepCount is not defined it advances of one step.
Returns false if the user canceled the operation, otherwise true.
progressBar.step("Row: " i.toString());
Since Banana Accounting 9.0.3.
Example multiple steps inside a block
// Two blocks of progress bar inside a progressBar
var progressBar = Banana.application.progressBar;
progressBar.start("Vat Report", 2);
// Block 1
progressBar.start("Sales", 10)
for (i = 0; i < 10; i++) {
progressBar.step("Row: " + i.toString());
}
progressBar.finish();
// Block 2
progressBar.start("Purchases", 10)
for (i = 0; i < 10; i++) {
progressBar.step("Row: " + i.toString());
}
progressBar.finish();
progressBar.finish();
Banana.Console
The Banana.console object is used to output messages to the Debug output panel or to the terminal (command prompt). The methods in this object are mainly used for Debugging purposes.
- To open the debug panel you have to enable the option "Display Debug output panel" under -> Program Options -> Tab Developer options
- The debug panel is located on the bottom of the main window near the Info and Messages panels
- In the debug panel you can choose the level of messages to shows, using the right button of the mouse. The levels are: Warnings, Debug and Info
- Debug messages can also be displayed in the terminal (command prompt) if the application is started from a terminal (command prompt)
Methods
console.critical(msg)
Display the msg in the debug panel as critical message.
Banana.console.critical("critical message");
console.debug(msg)
Display the msg in the debug panel as a debug message.
Debug messages are shown if either the 'Debug level' or 'Info level' is selected in the panel.
Banana.console.debug("Debug message");
console.info(msg)
Display the msg in the debug panel as an info message.
Info messages are shown in the panel only if the 'Info level' is selected.
Banana.console.info("Debug message");
console.log(msg)
Display the msg in the debug panel as an info message.
Log messages are shown only if in the panel 'Info level' is selected.
Banana.console.log("Debug message");
Since Banana 9.0.4
console.warn(msg)
Display the msg in the debug panel as a warning.
Banana.console.warn("Warning message");
Deprecated since Banana 9.0.4 use console.warning method instead.
console.warning(msg)
Display the msg in the debug panel as a warning.
Banana.console.warning("Warning message");
Since Banana 9.0.4
Banana.Converter
The class Banana.Converter is static only class, with static methods useful to convert various formats to and from data tables (array of arrays).
It is not possible to have instance of Banana.Converter.
Methods
arrayToObject( headers, arrData, skipVoid)
Static method.
Converts an array of arrays of string to an array of objects
- headers is an array of strings that will become the properties of the objects.
- arrData is an array containing arrays of strings
- skipVoid if true skip void lines, if not present is set to false
// read a CSV file
var ppData = Banana.Converter.csvToArray(string, ',');
// first line is header
var headers = ppData[0];
// remove first line
ppData.splice(0, 1);
// convert in array of objects
var arrayOfObjects = Banana.Converter.arrayToObject(headers, ppData, true);
// you can now access the data with a the column name used in the csv header
let name = arrayOfObjects[0]["name"]
csvToArray(string [, separator, textdelim])
Static method.
Convert a csv file (coma separated values) to an array of arrays.
The parameter string contains the text to convert. The parameter separator specifies the character that separates the values, default is a comma ','. The parameter textDelim specifies the delimiter character for text values, default is a double quote '"'.
Example:
var text = "1, 2, 3\n4, 5, 6\n7, 8, 9";
var table = Banana.Converter.csvToArray(text);
var value = table[0][1];
value == '2'; // true
flvToArray(string, fieldLengths)
Static method.
Convert a flv file (fixed length values) to an array of arrays.
The parameter string contains the text to convert. The parameter fieldLengths is an array with the lengths of the fields.
Example:
// 6 20 8
var text = "120608Phone 00002345";
var table = Banana.Converter.flvToArray(text, [6,20,8]);
var value = table[0][2];
value == '00002345'; // true
mt940ToTable(string)
Static method.
Converts a mt940 file to a table (array of array).
naturalCompare(a, b [, caseSensitive])
Compares two strings so that the string "2" is considered less then "100" as it would be with normal string compare.
This function can be passed to array.sort function.
- a first value to compare
- b second value to compare
- return value is -1 if a < b, 1 if a > b and 0 if a == b
Banana.Converter.naturalCompare(a,b);
objectArrayToCsv(headers, objArray, [separator])
Static method.
Converts an array of objects (with identical schemas) into a CSV table.
- headers An array of strings with the list of properties to export
- objArray An array of objects. Each object in the array must have the same property list.
- separator The CSV column delimiter. Defaults to a comma (,) if omitted.
- return value a string containing the CSV text.
var csvText = Banana.Converter.objectArrayToCsv(headers, objArray, ";");
stringToCamelCase(string)
Static method.
Converts a text to camel case, where only the first letter of every word is upper case.
Banana.Converter.stringToCamelCase("this is an example");
// returns "This Is An Example";
stringToLines(string)
Static method.
Convert a text in an array of lines. The end line character can be '\n', \r' or a combination of both.
Banana.Converter.stringToLines("this is\nan\nexample");
// returns ["this is", "an", "example"]
stringToTitleCase(string)
Static method.
Converts a text to title case, where only the first letter of the text is upper case.
Banana.Converter.stringToTitleCase("this is an example");
// returns "This is an example";
arrayToTsv(table [, defaultChar])
Static method.
Converts a table (array of arrays) to a tsv file (tabulator separated values). If a string contains a tab it will be replaced with defaultChar or a space if defaultChar is undefined.
Banana.Converter.arrayToTsv(table);
arrayToCsv(table)
Static method.
Converts a table (array of arrays) to a csv file (comma separated values). Double quotes in text are replaced by apos. Texts containing commas are inserted in doubles quotes.
Banana.Converter.arrayToCsv(table);
textToHash(text, algorithmName)
Static method.
Converts a text string into a hash using the algorithm passed as a parameter, to see the available algorithms see QCryptographicHash::Algorithm.
Banana.Converter.textToHash(text,algorithmName);
toDate(date[, time])
Static method.
Converts a date and/or time to a javascript date object.
The parameter date is a Date String in the formats yyyymmdd or yyyy-mm-dd.
The time parameter is a Date String in the fromats HHMM[SSZZZ] or HH:MM[:SS.ZZZ].
Banana.Converter.toDate("2015-12-31");
Banana.Converter.toDate("20151231");
toInternalDateFormat(date [, inputFormat])
Static method.
Convert the date argument in Date String Format.
Internal means Date String format "yyyy-mm-dd".
The parameter date can be a String or a Date object.
The parameter inputFormat is a string that specifies the date input format.
- If it is not specified the local date format is used
- Format use lower case characters y, m, d for example "yyyy-mm-dd".
- Possibly specify exactly the input format and also the separator used in the input date, or else use the "-" as a separator.
- For example:
- date "31.12.2024" inputFormat "dd.mm.yyyy" convert to "2024-12-31"
- date "31-12-24" inputFormat "dd.mm.yy"convert to "2024-12-31"
- date "12/31/24" inputFormat "mm/dd/yy"convert to "2024-12-31"
Example:
Banana.Converter.toInternalDateFormat("31-12-13", "dd-mm-yy");
// returns "2013-12-31"
Banana.Converter.toInternalDateFormat(new Date());
// return current date in format "yyyy-mm-dd"
toInternalNumberFormat(value [, decimalSeparator])
Static method.
Internal Number format means a Numeric String containing only number.
Converts a localized number into the a Numeric String used by the system.
The function strip all character that are not numeric or minus "-" or decimalSeparator.
Parameters:
value
(string | number):
The number to be converted. This can be a string or a number object and may include locale-specific formatting (e.g., thousand separators and a localized decimal separator).decimalSeparator
(optional, string):
Specifies the character used as the decimal separator in the input. If not provided, the function will use the decimal separator of the current locale.
The first occurrence of decimalSeparator is replaced by the "." and the others are discarded.
Returns:
- A Numeric String representing the number in the internal format, with a period (
.
) as the decimal separator and no thousand separators.
Example:
Banana.Converter.toInternalNumberFormat("1200,25", ",");
// returns "1200.25";
toInternalTimeFormat(string)
Static method.
Converts a time value to the system's internal format, represented as HH:MM:SS.ZZZ
. If the milliseconds are zero, they are omitted from the returned string.
Parameters:
value
(string | Date):- The input time value to be converted.
- Can be a string representing a time (e.g., "12:34:56.789") or a JavaScript
Date
object.
Returns:
- A string in the internal time format:
HH:MM:SS.ZZZ
. - If the milliseconds portion is
0
, it will return the format as HH:MM:SS
without the .ZZZ
part.
Banana.Converter.toInternalTimeFormat("11:24")
// returns "11:24:00";
Banana.Converter.toInternalTimeFormat(new Date(2020, 1, 1, 10, 24, 0, 0))
// returns "11:24:00";
Banana.Converter.toInternalTimeFormat(new Date());
toLocaleDateFormat(date [, format])
Static method.
Converts a date to the local format. The format is taken from the operating system settings.
The parameter date can be a string or a date object.
The parameter format specifies the date ouptut format, if it is not specified the local date format is used.
Banana.Converter.toLocaleDateFormat("2014-02-24")
// returns "24.02.2014"
toLocaleNumberFormat(value [, decimals = 2, convZero = true])
Static method.
Converts a number to the local format.
The parameter value can be a string or a number object.
The parameter decimals sets the number of decimals.
The parameter convZero sets the format returned for zero values. If false the method returns an empty string, if true it returns the zero value as string.
Example:
Banana.Converter.toLocaleNumberFormat("1200.25")
// returns "1'200,25";
toLocalePeriodFormat(startDate , endDate [, format])
Static method.
Converts a period defined by startDate and endDate to a readable string.
The parameter startDate specifies the start date of the preriod, can be a date object or a string.
The parameter endDate specifies the end date of the preriod, can be a date object or a string.
The parameter format can be empty or one of the following strings: 'short', 'long'. Default is 'long'.
Return the period as a readable string in the current language of the application.
Banana.Converter.toLocalePeriodFormat("2017-01-01", "2017-01-31"); // returns "January '17"
Banana.Converter.toLocalePeriodFormat("2017-01-01", "2017-01-31", "short"); // returns "Jan '17"
Banana.Converter.toLocalePeriodFormat("2017-01-01", "2017-01-31", "long"); // returns "January '17"
toLocaleTimeFormat(string [, format])
Static method.
Converts a time to the local format.
The parameter format specifies the time ouptut format, if it is not specified the local time format is used.
Banana.Converter.toLocaleTimeFormat("11:24:42");
// returns "11:24";
Banana.Document (Accounting)
Methods for accounting's files
Banana is built with object oriented techologies. Each file is a Banana.document class.
Accounting files are elements of class that derive from the Banana.document.
For each file there are:
- Methods, that apply to all documents, see Banana.Document (Base),
- Method specific to the Accounting class.
The following explanations relate to the accounting functions.
Date functions
endPeriod([period])
Return the end date in the form of 'YYYY-MM-DD'.
The endDate and startDate functions are used to retrieve the date of the accounting, so that you can create scripts that work on files from different years.
var dateEnd = Banana.document.endPeriod();
var dateStartFebruary = Banana.document.endPeriod('2M');
- Period:
- If period is not present the return value is the end date of the accounting.
- The period is added to the starting account date, and the last date of the period is returned.
- Period (for example 2M = 2 months) is a number followed by one of the following charachters
- D for days
- M for months
- Q for quarters
- S for semesters
- Y for years
- Assuming that the Start accounting date is 2015-01-01
- 1M return 2015-01-02
- 2M return 2015-02-28
- 2Q return 2015-06-30
- 2S return 2015-12-31
- 2Y return 2016-12-31
startPeriod ([period])
Return the end date in the form of 'YYYY-MM-DD'.
The endPeriod and startPeriod functions are used to retrieve the date of the accounting, so that you can create scripts that work on files from different years.
var dateStart = Banana.document.endPeriod();
var dateStart3Q = Banana.document.endPeriod('3Q');
- Period:
If period is not present return the start date.- Period (for example 2M = 2 months) is a number followed by one of the following charachters
- D is for Days
- M for Months
- Q for Quorters
- S for Semester
- Y for year
- With 1 the starting date of the accounting is returned.
- Assuming that the Start accounting date is 2015-01-01
- 1M return 2015-01-01
- 2M return 2015-02-01
- 2Q return 2015-04-01
- 2S return 2015-07-01
- 2Y return 2016-01-01
previousYear([nrYears])
Returns the previous year as a Banana.Document object. If the previous year is not defined or it is not found, it returns null.
- nrYears is the number of years to go back, default is one.
var previousYearDoc = Banana.document.previousYear();
var previousTwoYearDoc = Banana.document.previousYear(2);
Current accounting functions
The functions that start with "current" retrieve values calculated based on the actual accounting data, comprising:
- Opening amounts (Table accounts)
- Transactions entered in the Transactions table
currentBalance(account [, startDate, endDate, function(rowObj, rowNr, table) ])
Sum the amounts of opening, debit, credit, total and balance calculated based on the opening and all transactions for this account / group.
The calculations are performed by traversing by creating a journal (see journal() function) with all the transactions, and selecting the transactions with the parameters specified.
The computation is usually very fast. But if you have a file with many transactions especially the first query could take some time.
var currentBal = Banana.document.currentBalance('1000','','');
var openingBalance = currentBal.opening;
var endBalance = currentBal.balance;
- Return value
Is an object that has- opening the amount at the begining of the period (all transactions before)
- debit the amount of debit transactions for the period
- credit the amount of credit transactions for the period
- total the difference between debit-credit for the period
- balance opening + debit-credit for the period
- amount it the "normalized" amount based on the bclass of the account or group.
If there are multiple accounts or groups, takes the first BClass of the first.- for BClass 1 or 2 it returns the balance (value at a specific instant).
- for BClass 3 or 4 it returns the total (value for the duration).
- For BClass 2 and 4 the amount is inverted.
- openingCurrency the amount at the begining of the period in the account currency
- debitCurrency the amount of debit transactions for the period in the account currency
- creditCurrency the amount of credit transactions for the period in the account currency
- totalCurrency the difference between debit-credit for the period in the account currency
- balanceCurrency opening + debit-credit for the period in the account currency
- rowCount the number of lines that have been found and used for this computation
- bclass (double entry accounting only) is the bclass of the account or group used to express the amount.
The bclass is the value entered in the columns bclass.
It is taken in consideration the first account or group specified. If for example you query two accounts that first has bclass 2 and the second has bclass 1. The bclass would be 2.
The bclass is assigned by following this steps. :- The bclass of the specified account or group.
- The bclass of the partent group, for the same section.
- The bclass of the section.
- Account
- can be an account id, a cost center, a segment or a group.
- can be a combination of account and segments, separated by the semicolon ":"
In this case it returns all the transactions that have the indicated account and segments- 1000:A1:B1
- can be different accounts and multiple segments separated by the "|"
In this case it includes all transactions that have one of the specified accounts and one of the specified segments- 1000|1001
- 1000|1001:A1:B1
- 1000|1001:A1|A2:B1
- can be a wildCardMatching
Wildcards can be used for accounts, segments, Groups or BClass and in combination- ? Matches any single character.
- * Matches zero or more of any characters
- [...] Set of charachtes
- "100?" match "1001, 1002, 1003, 100A, ...)
- "100*" Matches all accounts starting with 100
- "100*|200*:A?" Matches all accounts starting with 100 or 200 and with segments with A and of two charachters.
- "[1234]000" Matches "1000 2000 3000 4000"
- Can be a group or a BClass.
It includes all the transactions where the account used belongs to a specified Group or BClass.
It is also possible to use wildcards.
The program first creates a list of accounts and then uses the account list.
Do non mix groups relative to normal accounts, with groups relative to cost center or segments. Calculation could provide unexpected results.- BClass (for the double entry accounting only)
- BClass=1
- BClass=1|2
- Gr for groups that are in Accounts table.
- Gr=100
- Gr=10*
- Gr=100|101|102
- GrC for group that are in the Category table of the income and expenses accounting type.
- GrC=300
- GrC=300|301
- Can be Contra Accounts or other fields selection
Transactions are included only if they have also a value corresponding
After the "&&" you can insert a field name of the table journal.- 1000&&JContraAccount=2000 returns all transactions of the account 1000 that have a contra account 2000.
As per accounts you can specify multiple contra accounts, BClass=, Gr= with also wildcards. - 1000&&JCC1=P1|P2 will use only transactions on account 1000 and that also have the CC1=.P1 or .P2
- Do not mix accounts or groups with cost centers ("1020|,RF2" or ",RF2|10"). It only returns the cost center amount.
- StartDate
- is a string in form 'YYYY-MM-DD' or a date object.
- If startDate is empty the accounting start date is taken.
- End date:
- is a string in form 'YYYY-MM-DD' or a date object.
- If endDate is empty the accounting end date is taken.
- function(rowObj, rowNr, table)
This fuction will be called for each row of the selected account.
The function should return true if you want this row to be included in the calculation.
function exec( string) {
// We retrive the total sales (account 4000) only for the cost center P1
var balanceData = Banana.document.currentBalance('4000','', '', onlyCostCenter);
// sales is a revenue so is negative and we invert the value
var salesCC1 = -balanceData.total;
// display the information
Banana.Ui.showText("Sales of Project P1: " + salesCC1);
}
// this function returns true only if the row has the cost center code "P1"
function onlyCostCenter( row, rowNr, table){
if(row.value('JCC1') === 'P1') {
return true;
}
return false;
}
Examples
Banana.document.currentBalance("1000") // Account 1000
Banana.document.currentBalance("1000|1010") // Account 1000 or 1010
Banana.document.currentBalance("10*|20*") // All account that start with 10 or with 20
Banana.document.currentBalance("Gr=10") // Group 10
Banana.document.currentBalance("Gr=10|20") // Group 10 or 20
Banana.document.currentBalance(".P1") // Cost center .P1
Banana.document.currentBalance(";C01|;C02") // Cost center ;C01 and C2
Banana.document.currentBalance(":S1|S2") // Segment :S1 and :S2
Banana.document.currentBalance("1000:S1:T1") // Account 1000 with segment :S1 or ::T1
Banana.document.currentBalance("1000:{}") // Account 1000 with segment not assigned
Banana.document.currentBalance("1000:S1|S2:T1|T2") // Account 1000 with segment :S1 or ::S2 and ::T1 or ::T2
Banana.document.currentBalance("1000&&JCC1=P1") // Account 1000 and cost center .P1
currentBalances(account, frequency [, startDate, endDate, function(rowObj, rowNr, table) ])
It returns the time series balance for the specified periods. It is used for chart rendering, with one command you can have the monthly data for an account.
Sum the amounts of opening, debit, credit, total and balance for all transactions for this account and returns the values according to the indicated frequency indicated.
The calculations are perfermed by traversing by creating a journal (see journal() function) with all the transactions , and selecting the transactions with the parameters specified.
The computation is usually very fast. But if you have a file with many transactions especially the first query could take some time.
var currentBalances = Banana.document.currentBalances('1000', 'M');
var openingBalance = currentBalances[0].opening;
var endBalance = currentBalances[0].balance;
- Return value
Return an array of objects that have- opening the amount at the begining of the period (all transactions before)
- debit the amount of debit transactions for the period
- credit the amount of credit transactions for the period
- total the difference between debit-credit for the period
- balance opening + debit-credit for the period
- amount it the "normalized" amount based on the bclass of the account or group.
If there are multiple accounts or groups, takes the first BClass of the first.- for BClass 1 or 2 it return the balance (value at a specific instant).
- for BClass 3 or 4 it return the total (value for the duration).
- For BClass 2 and 4 the amount is inverted.
- openingCurrency the amount at the begining of the period in the account currency
- debitCurrency the amount of debit transactions for the period in the account currency
- creditCurrency the amount of credit transactions for the period in the account currency
- totalCurrency the difference between debit-credit for the period in the account currency
- balanceCurrency opening + debit-credit for the period in the account currency
- rowCount the number of lines that have bben found and used for this computation
- bclass (double entry accounting only) is the bclass of the account or group used to express the amount.
The bclass is the value entered in the columns bclass.
It is taken in consideration the first account or group specified. If for example you query two accounts, the first has bclass 2 and the second has bclass 1. The bclass would be 2.
The bclass is assigned by following this steps. :- The bclass of the specified account or group.
- The blcass of the partent group, for the same section.
- The blcass of the section.
- startDate period's start date
- endDate period's end date
- Account
- can be an account id, a cost center or a segment.
- can be a combination of account and segments, separeted by the semicolon ":"
In this case it returns all the transactions that have the indicated account and segments- 1000:A1:B1
- can be different accounts and multiple segments separated by the "|"
In this case it includes all transactions that have one of the specified accounts and one of the specified segments- 1000|1001
- 1000|1001:A1:B1
- 1000|1001:A1|A2:B1
- can be a wildCardMatching
Wildcards can be used for accounts, segments, Groups or BClass and in combination- ? Matches any single character.
- * Matches zero or more of any characters
- [...] Set of charachtes
- "100?" match "1001, 1002, 1003, 100A, ...)
- "100*" Matches all accounts starting with 100
- "100*|200*:A?" Matches all accounts starting with 100 or 200 and with segments with A and of two charachters.
- "[1234]000" Matches "1000 2000 3000 4000"
- Can be a group or a BClass.
It includes all the transactions where the account used to belong to a specified Group or BClass.
It is also possible to use wildcards.
The program first create a list of accounts and then use the account list.
Do non mix mix groups relative to normal accounts, with groups relative to cost center or segments. Calculation could provide unexpected results.- BClass (for the double entry accounting only)
- BClass=1
- BClass=1|2
- Gr for groups that are in Accounts table.
- Gr=100
- Gr=10*
- Gr=100|101|102
- GrC for group that are in the Category table of the income and expenses accounting type.
- GrC=300
- GrC=300|301
- Can be Contra Accounts or other fields selection
Transactions are included only if they have also a value corresponding
After the "&&" you can insert a field name of the table journal.- 1000&&JContraAccount=2000 return all transctions of the account 1000 that have a contra account 2000.
As per accounts you can specify multiple contra accounts, BClass=, Gr= with also wildcards. - 1000&&JCC1=P1|P2 will use only transactions on account 1000 and that also have the CC1=.P1 or .P2
- Do not mix accounts or groups with cost centers ("1020|,RF2" or ",RF2|10"). It only returns the cost center amount.
- Frequency
- Specifiy the frequency to be returned, is one of the following charachters
- D for daily
- W for weekly
- M for montly
- Q for quarterly
- S for semeterly
- Y for yearly
- StartDate
- is a string in form 'YYYY-MM-DD' or a date object.
- If startDate is empty the accounting start date is taken.
- End date:
- is a string in form 'YYYY-MM-DD' or a date object.
- If endDate is empty the accounting end date is taken.
- function(rowObj, rowNr, table)
This fuction will be called for each row of the selected account.
The function should return true if you want this row to be included in the calculation.
function exec( string) {
// We retrive the montly total sales (account 4000) only for the cost center P1
var balanceData = Banana.document.currentBalances('4000', 'M', '', '', onlyCostCenter);
// sales is a revenue so is negative and we invert the value
var salesCC1 = -balanceData[0].total;
// display the information
Banana.Ui.showText("Sales of Project P1: " + salesCC1);
}
// this function return true only if the row has the cost center code "P1"
function onlyCostCenter( row, rowNr, table){
if(row.value('JCC1') === 'P1') {
return true;
}
return false;
}
Examples
Banana.document.currentBalances("1000", 'M')
// Montly values for account 1000 and for the accounting start and end period
// See also the examples for the function currentBalance
currentCard(account [, startDate, endDate, function(rowObj, rowNr, table)])
Return for the given account and period a Table object with the transactions for this account.
Row are sorted by JDate
parameters:
- account can be any accounts, cost center or segment as specifiend in currentBalance.
- startDate any date or symbol as specifiend in currentBalance.
- endDate any date or symbol as specifiend in currentBalance.
Return columns the same as for the Journal() function.
var transactions = Banana.document.currentCard('1000','2015-01-01','2015-12-31');
currentInterest( account, interestRate, [startDate, endDate, , function(rowObj, rowNr, table)])
Returns the calculated interest on the specified account.
Interest is calculated on the effective number of days for 365 days in the years.
- account is the account or group (same as in the function currentBalance)
- interestRate. In percentage "5", "3.25". Decimal separator must be a "."
- If positive it calculates the interest on the debit amounts.
- If negative it calculates the interest on the credit amounts.
- startDate, endDate, function see the currentBalance description.
If no parameters are specified it calculate the interest for the whole year.
// calculate the interest debit for the whole period
var interestDebit = Banana.document.currentInterest('1000','5.75');
// calculate the interest credit for the whole period
var interestDebit = Banana.document.currentInterest('1000','-4.75');
Budget Functions
These functions are similar to the "current" functions, but they work on the budget data. They consider:
- The opening amount (table Accounts and Categories)
- Transactions entered in the Budget table.
For detailed information check the documentation on the equivalent "current" functions.
When using the API in the column Formula of the Table Budget a special budget API is available that allows you to use predefined periods instead of dates, like:
- "MC" current month
- "QC" current trimester
- "MP" previous month
- "QP" previous quarter
In the formula "budgetBalance('1000', 'MP'); the program will calculate automatically the start and end date of the month, based on the Date of the budget transaction.
budgetBalance(account [, startDate, endDate, function(rowObj, rowNr, table)])
Sums the amounts of opening, debit, credit, total and balance for all budget transactions for this accounts .
var budget = Banana.document.budgetBalance('1000');
It works the same as the function currentBalance, but for the budgeting data.
budgetBalances(account, frequency [, startDate, endDate, function(rowObj, rowNr, table)])
Time series function. Sums the amounts of opening, debit, credit, total and balance for all budget transactions for this account and returns the values according to the indicated frequency indicated.
var budgets = Banana.document.budgetBalances('1000', 'M');
It works the same as the function currentBalances, but for the budgeting data.
budgetCard(account [, startDate, endDate, function(rowObj, rowNr, table)])
Returns, for the given account and period, a Table object with the budget account card.
var card = Banana.document.budgetCard('1000');
It works the same as the function currentCard, but for the budgeting data.
budgetExchangeDifference( account, [date, exchangeRate])
Returns the unrealized exchange rate Profit or Loss o the account at the specified date.
- account must be a valid account number not in base currency
- date
- a date that is used to calculate the balance
- if empty calculate up to the end of the period
- exchangeRate
- if empty use the historic exchange rate for the specified date or the current if not a valid exchange rate for the date are found.
- if "current" use the current exchange
- if number for example "1.95" use the specified exchange rate.
- Return value
- Positive number (debit) are exchange rate Loss.
- Negative number (credit) are exchange rate Profit.
- empty if no difference or if the account has not been found or not a multicurrency accounting file.
// unrealized exchange rate profit or loss for the account 1000
// last balance and current exchange rate
var exchangeRateDifference = Banana.document.budgetExchangeRateDifference('1000');
// at the end of Semptember and hystoric exchange rate
var exchangeRateDifference = Banana.document.budgetExchangeRateDifference('1000', "2017-09-31");
// at the end of Semptember and current exchange rate
var exchangeRateDifference = Banana.document.budgetExchangeRateDifference('1000', "2017-09-31", "current");
// at the end of Semptember and specified exchange rate
var exchangeRateDifference = Banana.document.budgetExchangeRateDifference('1000', "2017-09-31", "1.65");
budgetInterest( account, interestRate, [startDate, endDate, function(rowObj, rowNr, table)])
Return the calculated interest for the budget transactions.
It works the same as the function currentInterest, but for the budgeting data.
// calculate the interest debit for the whole period
var interestDebit = Banana.document.budgetInterest('1000','5.75');
// calculate the interest credit for the whole period
var interestDebit = Banana.document.budgetInterest('1000','-4.75');
Projections functions
This function is a mix of actual and budget data. It has a parameter projectionStartDate that defines up to when to use actual data and budget data.
The value of a projection is calculated as follows:
- It uses the actual data up to the day before the projectionStartDate.
- From the projectionStartDate it uses the budgeting data.
Assume you have prepared the budget for the year and you have entered accounting data up to the end of March (2015-03-31).
With the projectionBalance function you can have the projected balance up to the end of year, comprised from the actual data up to end of March and the budgeting data starting form 1. April.
In this case the projectionStartDate should be "2015-04-01".
projectionBalance(account, projectionStartDate [, startDate, endDate, function(rowObj, rowNr, table) ])
Same as currentBalance but use the budget data starting from the projectionStartDate.
This function calculates a projection of the end of year result (or specified period) combining the current data and the budget data for the period not yet booked.
If projectionStartDate is empty the result will be the same as currentBalance.
If you have already booked the 1. semester and would like to have a projection up to the end of the year
// We have booked the 1. semester and would like to have
// a projection up to the end of the yer
var cashProjection = Banana.document.projectionBalance('1000','2015-07-01');
var cashEnd = projection.balance;
var salesProjection = Banana.document.projectionBalance('3000','2015-07-01').total;
var salesForYear = -salesProjection.total;
projectionBalances(account, projectionStartDate, frequency [, startDate, endDate, function(rowObj, rowNr, table) ])
Same as currentBalances but use the budget data starting from the projectionStartDate.
projectionCard(account, projectionStartDate [, startDate, endDate, function(rowObj, rowNr, table) ])
Same as currentCard but use the budget data starting from the projectionStartDate.
If projectionStart date is empty result will be the same s currentCard.
var transactions = Banana.document.projectionCard('1000','2015-01-01','','');
Descriptions and Reporting functions
accountDescription(account [,column])
Return the Description of the specified account.
- Account can be an account or a Group (Gr=)
- Column can be an alternative column name to retrieve.
var descriptionAccount = Banana.document.accountDescription('1000');
var descriptionGroup = Banana.document.accountDescription('Gr=10');
var gr = Banana.document.accountDescription('1000','Gr');
accountsReport([startDate, endDate])
Returns the account report for the specified period. Start and end date can be a string in form 'YYYY-MM-DD' or a date object.
var report = Banana.document.accountsReport();
var report = Banana.document.accountsReport('2017-01-01', '2017-03-31');
Journal
This function retrieves an array of transactions, with one line per account. The Journal is the basic data structure for all accounting-related calculations, like account cards, balance sheet, VAT report.
See an Example extension for journal reporting.
Journal Structure
The software, generate the Journal from the data that the user enter in the Accounts, Categories, Transactions and Budget Table.
- For each movement affecting an account a row in the Journal is created.
-
- The Journal contains separate line for Current data (Transactions) and for Budget Data. (Each Journal line specifies the data source origin; it can be Current or Budget.
If both transaction and budget data exist, the Journal includes separate lines for Current and Budget transactions for each account.
The Journal i composed by this elements:
- Opening amounts.
A line is generated for each account with an opening balance.- OriginType is ORIGINTYPE_CURRENT.
- AccountType is set accortding to the account.
- Double-entry transactions or income and expense accounts.
- OriginType is ORIGINTYPE_CURRENT.
- Transactions with Debit and Credit accounts.
The Journal will generate two lines.- One for the Debit account, with the corresponding amount.
- One for the Credit account, with the corresponding amount.
- Transactions with Debit and Credit accounts plus VAT.
The Journal will generate three lines:- One for the Debit account, with the corresponding amount.
- One for the Credit account, with the corresponding amount.
- One for the VAT account, with the corresponding amount.
- AccountType is ACCOUNTTYPE_NORMAL.
- Transactions with cost centers.
- For each cost center used (CC1, CC2, CC3), a separate Journal line is created with the cost center account and its corresponding amount.
- AccountType is ACCOUNTTYPE_CC1,ACCOUNTTYPE_CC2,ACCOUNTTYPE_CC3.
- The amount is the effective amount registered on the account.
- Exclusive or inclusive of VAT, depending on the operation.
- Positive amounts indicate debits, while negative amounts indicate credits.
- In case of an error, the amount is set to zero.
- Segments are stored in dedicated columns (Segment1, Segment2, … Segment10).
- Budget Table Transactions
- The software generate, in a similar way as for Transactions, also lines for the Budget data (Budget Table)
- The generated line include has the Origin Type ORIGINTYPE_BUDGET.
journal([originType = ORIGINTYPE_NONE, int accountType = ACCOUNTTYPE_NONE])
This function returns a Table object containing all registered amounts for the specified parameters.
Parameters:
- originType - Specifies which transaction rows to filter. Possible values:
- ORIGINTYPE_NONE (default)
No filter is applied; all rows are returned, including both current and budget transactions.
For current transactions ORIGINTYPE_NONE = 1
For budget transactoins ORIGINTYPE_NONE = 2 - ORIGINTYPE_CURRENT
Returns only current transactions; ORIGINTYPE_CURRENT = 1. - ORIGINTYPE_BUDGET
Returns only budget transactions; ORIGINTYPE_BUDGET = 2.
- accountType - Specifies which account rows to filter. Possible values:
- ACCOUNTTYPE_NONE (default)
No filter is applied; all account rows are returned. - ACCOUNTTYPE_NORMAL
Returns only normal account rows. - ACCOUNTTYPE_CC1
Returns only rows for Cost Center 1 (CC1). - ACCOUNTTYPE_CC2
Returns only rows for Cost Center 2 (CC2). - ACCOUNTTYPE_CC3
Returns only rows for Cost Center 3 (CC3). - ACCOUNTTYPE_CC
Returns all Cost Center rows (CC1, CC2, CC3), equivalent to using ACCOUNTTYPE_CC1 | ACCOUNTTYPE_CC2 | ACCOUNTTYPE_CC3.
// Get current transactions for normal accounts (exclude budget transactions)
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL);
// Get budget transactions for normal accounts (exclude current transactions)
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_BUDGET, Banana.document.ACCOUNTTYPE_NORMAL);
// Get current and budget transactions for normal accounts
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_NONE, Banana.document.ACCOUNTTYPE_NORMAL);
// Get current and budget transactions for all accounts
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_NONE, Banana.document.ACCOUNTTYPE_NONE);
Returned Table Structure:
The returned table contains all the columns of the Transactions table, plus the following additional columns:
- JOriginType - Defines the transaction's origin type:
- ORIGINTYPE_CURRENT
Value is 1 (Current transactions). - ORIGINTYPE_BUDGET
Value is 2 (Budget transactions).
- JOriginFile - The file name where the transaction originates.
- JTableOrigin - The source table.
- JRowOrigin - The row number of the table where the transaction is located (rows start from 0).
- JRepeatNumber - The progressive repetition number for budget transactions.
- JOperationType - Indicates the type of transaction:
- OPERATIONTYPE_NONE
Value is 0.
Transaction not used for calculation. - OPERATIONTYPE_OPENING
Value is 1.
Transaction used for opening balance calculation; the row is generated from:- The Opening balance column in the Accounts table.
- Transactions with the DocType column with value '01'.
- OPERATIONTYPE_CARRYFORWARD
Value is 2.
OperationType used only in account cards.
It is the opening balance or the balance of the account prior to the begin of the period of the account card.
If the account card is for the month of september, the carryforward amount would be the account balance prior to any transactions of september. - OPERATIONTYPE_TRANSACTION
Value is 3.
The row is a normal transaction and is generated from:- Transactions table if JOriginType = ORIGINTYPE_CURRENT.
- Budget table if JOriginType = ORIGINTYPE_BUDGET.
- OPERATIONTYPE_INVOICESETTLEMENT
Value is 21.
These are rows that are genereted when creating Customer or Suppliers cards.
They are used to settle invoices, payed.
- JDate - The transaction date.
- JDescription - The transaction description.
- JAccount - The account for this transaction. One row per account (AccountDebit, AccountCredit, AccountVat, CC1, CC2, CC3). Segments are not included.
- JAccountDescription - The account description.
- JAccountClass - The BClass number of the account.
- JAccountGr - The Group (Gr) of the account.
- JAccountGrDescription - The Group description of the account.
- JAccountGrPath - The complete Group hierarchy path. It includes all the Gr tree.
- JAccountCurrency - The currency of the account.
- JAccountType - The account type as defined above (ACCOUNTTYPE_NORMAL, ACCOUNTTYPE_CC1, …).
- JAmount - The exact amount in basic currency (positive = debit, negative = credit).
- JAmountAccountCurrency - The amount in account currency (positive = debit, negative = credit).
- JTransactionCurrency - The currency of the transaction.
- JAmountTransactionCurrency - The amount in transaction currency. For account with currency not in transactions currency the exchange rate of the transaction is used.
- JTransactionCurrencyConversionRate - The conversion rate to transaction currency.
- Multiply the transaction amount in basic currency by this rate to get the transaction currency amount.
- This rate has 12 significant figures to minimize conversion differences; only in the case of very large conversions can there be conversion differences.
- JVatIsVatOperation - 'true' if this row has a VAT code.
- JVatCodeWithoutSign - The VAT code, excluding a preceding "-" (e.g., "-V10" becomes "V10"). Useful for grouping transactions by the same VatCode.
- JVatCodeDescription - Description of the VAT code.
- JVatCodeWithMinus - 'true' if the VAT code has a "-" prefix.
- JVatCodeNegative - 'true' if the VAT amount is negative (deductible VAT).
- JVatTaxable - The VatTaxable amount, following the sign of JVatCodeNegative.
- VatTwinAccount - The account where the net amount (excluding VAT) is registered.
- Example: If the gross amount is CHF 1100 (100 VAT + 1000 net), VatTwinAccount is the account where CHF 1000 is registered.
- The sign of VatTwinAccount follows the VatAccount:
- If VAT is registered in debit, VatTwinAccount = AccountDebit.
- If VAT is registered in credit, VatTwinAccount = AccountCredit.
- JContraAccount - The contra account (based on the other accounts and the sequence in the Transactions table).
- JContraAccountType - Specifies the contra account type:
- CONTRAACCOUNTTYPE_NONE
No contra account. - CONTRAACCOUNTTYPE_DIRECT
When debit and credit accounts exist on the same row. - CONTRAACCOUNTTYPE_MULTIPLEFIRST
The first row of a transaction involving multiple accounts (first transaction after a row with debit and credit accounts or with a different date). - CONTRAACCOUNTTYPE_MULTIPLEFOLLOW
A subsequent row following a CONTRAACCOUNTTYPE_MULTIPLEFIRST, with the same date. - CONTRAACCOUNTTYPE_VAT
VAT Account row.
- JContraAccountGroup – The row number corresponding to CONTRAACCOUNTTYPE_MULTIPLEFIRST.
- JCC1 - Cost Center 1 (without preceding sign).
- JCC2 - Cost Center 2 (without preceding sign).
- JCC3 - Cost Center 3 (without preceding sign).
- JSegment1 ... JSegment10 - Segments related to the account.
- JDebitAmount - Debit amount in basic currency.
- JCreditAmount - Credit amount in basic currency.
- JDebitAmountAccountCurrency - Debit amount in account currency.
- JCreditAmountAccountCurrency - Credit amount in account currency.
- JBalance - Balance (for account cards) in basic currency.
- JBalanceAccountCurrency - Balance (for account cards) in account currency.
Examples:
// Get the Journal table of all transactions for normal accounts
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL);
//Read Journal table row by row
for (var i = 0; i < journal.rowCount; i++) {
var tRow = journal.row(i);
//Check if the type of transaction is a normal transaction generated from the Transactions or Budget table
if (tRow.value('JOperationType') == Banana.document.OPERATIONTYPE_TRANSACTION) {
var jDate = tRow.value('JDate'); // the transaction date
var jDescription = tRow.value('JDescription'); // the transaction description
var jAccount = tRow.value('JAccount'); // the transaction account, one row per account
var jContraAccount = tRow.value('JContraAccount'); // the transaction contra account
var jAmount = tRow.value('JAmount'); // the transaction amount
//...
}
}
journalCustomersSuppliers([originType = ORIGINTYPE_NONE, int accountType = ACCOUNTTYPE_NONE])
Same as journal with additional settlements rows for closing invoices and additional columns:
- JInvoiceDocType: specifies the type of document (see column DocType)
- JInvoiceAccountId: customer account id from table accounts
- JInvoiceCurrency: the currency of the invoice, same as customer account currency from table accounts
- JInvoiceStatus: paidInvoice (the invoice was offset with the payment that refers to the same document), paidOpening (the invoice was offset with the opening balance of the customer account)
- JInvoiceDueDate: invoice expiration date
- JInvoiceDaysPastDue
- JInvoiceLastReminder
- JInvoiceLastReminderDate
- JInvoiceIssueDate
- JInvoiceExpectedDate
- JInvoicePaymentDate
- JInvoiceDuePeriod
- JInvoiceRowCustomer (1=Customer, 2=Supplier)
invoicesCustomers()
Returns a table with the customers' invoices from the transaction table. A customer group must be defined and invoices must be numbered using the column DocInvoice.
See:
// Print the content of the table invoicesCustomers
var invoicesCustomers = Banana.document.invoicesCustomers();
if (invoicesCustomers) {
for (var i = 0; i < invoicesCustomers.rowCount; i++) {
var tRow = invoicesCustomers.row(i);
var jsonString = tRow.toJSON();
if (jsonString.length > 0) {
var jsonRow = JSON.parse(jsonString);
for (var key in jsonRow) {
if (jsonRow[key])
Banana.console.debug(key + ": " + jsonRow[key].toString());
}
}
}
}
invoicesSuppliers()
Returns a table with the suppliers' invoices from the transaction table. A supplier group must be defined and invoices must be numbered using the column DocInvoice.
See:
// Print the content of the table invoicesSuppliers
var invoicesSuppliers = Banana.document.invoicesSuppliers();
if (invoicesSuppliers ) {
for (var i = 0; i < invoicesSuppliers.rowCount; i++) {
var tRow = invoicesSuppliers.row(i);
var jsonString = tRow.toJSON();
if (jsonString.length > 0) {
var jsonRow = JSON.parse(jsonString);
for (key in jsonRow) {
if (jsonRow[key])
Banana.console.debug(key + ": " + jsonRow[key].toString());
}
}
}
}
Available columns in invoicesCustomers and invoicesSuppliers table
- CounterpartyId Customer or supplier accountId
- Invoice Invoice number
- ObjectType Type of object in field ObjectJsonData (values are: Counterparty, InvoiceDocument, InvoiceLineItem, InvoiceTotal, Transaction)
- ObjectIndex Internal index used to print the invoice documents
ObjectJSonData Contains a json object. Available object types: Counterparty, InvoiceDocument, InvoiceLineItem, InvoiceTotal, Transaction (Example of row with a counterparty object):
{"Counterparty":{"customer_info":
{"balance":"4176000.00","balance_base_currency":"4176000.00","business_name":"Banana.ch","first_name":"Domenico",
"last_name":"Zucchetti","number":"411001","origin_row":"950","origin_table":"Accounts"}}}
- Date Invoice document date
- TransactionDate Original Transaction date
- Description Original Transaction description
- Debit Object amount in debit
- Credit Object amount in credit
- Balance Incremental balance
- Currency Object currency
- InvoiceExpectedDate
- InvoiceDueDate
- InvoiceDuePeriod
- InvoiceDaysPastDue
- InvoicePaymentDate
- InvoiceLastReminder
- InvoiceLastReminderDate
- Status
- JTableOrigin
- JRowOrigin
Exchange rate functions
exchangeRate( currency, [date])
Returns the exchange rate that converts the amount in currency in basic currency as object with the properties 'date' and 'exchangeRate'. Returns null if no exchange rate is found.
The exchange rate is retrieved from the Currency table, already considering the multiplier.
- If no date is specified the exchange rate without date is used.
- If a date is specified it retrieves the exchange rate with the date minor or equal the specified date.
Vat functions
vatBudgetBalance(vatCode[, startDate, endDate, function(rowObj, rowNr, table) ])
Sum the vat amounts for the specified vat code and period, using the Budget data.
var vatTotal = Banana.document.vatBudgetBalance('V15');
vatBudgetBalances(vatCode, frequency, [, startDate, endDate, function(rowObj, rowNr, table) ])
Sum the vat amounts for the specified vat code and period, using the Budget data and returns the values according to the indicated frequency indicated.
var vatTotal = Banana.document.vatBudgetBalances('V15', 'Q');
vatCurrentCard(vatCode[, startDate, endDate, function(rowObj, rowNr, table) ])
Retrieve the transactions relative to the specified VatCode.
var vatTransactions = Banana.document.vatCurrentCard('V15');
vatCurrentBalance(vatCode[, startDate, endDate, function(rowObj, rowNr, table) ])
Sum the vat amounts for the specified vat code and period.
For more info see :
- explanations of the function currentBalance.
- Vat Extension Example
- Example files are available on github/General/CaseStudies.
- Solutions making use of the VAT api.
Example:
var currentVat = Banana.document.vatCurrentBalance('V15','','');
var vatTaxable = currentVat.vatTaxable;
var vatPosted = currentVat.vatPosted;
- Return value:
Is an object that has- vatTaxable the amount of the taxable column
(the sign is the same as the vatAmount) - vatAmount the amount of vat
- vatNotDeductible the amount not deductible
- vatPosted VatAmount - VatNotDeductible
- rowCount the number of lines that have been found and used for this computation
- VatCode
One or more VatCode defined in the tabel Vat Codes.
Multiple vat code can be separated by "|" for example "V10|V20", or you can use vildcard "V*".
vatCurrentBalances(vatCode, frequency [, startDate, endDate, function(rowObj, rowNr, table) ])
Sum the vat amounts for the specified vat code and period and returns the values according to the indicated frequency indicated.
For more info see :
- explanations of the function currentBalances.
- Example files are available on github/General/CaseStudies.
- Solutions making use of the VAT api.
Example:
var currentVat = Banana.document.vatCurrentBalances('V15', 'Q');
var vatTaxable = currentVat[0].vatTaxable;
var vatPosted = currentVat[0].vatPosted;
- Return value:
Is an object that has- vatTaxable the amount of the taxable column
(the sign is the same as the vatAmount) - vatAmount the amount of vat
- vatNotDeductible the amount not deductible
- vatPosted VatAmount - VatNotDeductible
- rowCount the number of lines that have bben found and used for this computation
- VatCode
One or more VatCode defined in the tabel Vat Codes.
Multiple vat code can be separated by "|" for example "V10|V20", or you can use vildcard "V*". - Frequency
- Specifiy the frequency to be returned, is one of the following charachters
- D for daily
- W for weekly
- M for montly
- Q for quarterly
- S for semeterly
- Y for yearly
vatProjectionBalance(vatCode, projectionStartDate, [, startDate, endDate, function(rowObj, rowNr, table) ])
Same as vatCurrenBalance but use the budget data starting from the projectionStartDate.
var projectionVat = Banana.document.vatProjectionBalance('V15','','');
var vatTaxable = projectionVat.vatTaxable;
var vatPosted = projectionVat.vatPosted;
vatProjectionBalances(vatCode, projectionStartDate, frequency, [, startDate, endDate, function(rowObj, rowNr, table) ])
Same as vatCurrenBalances but use the budget data starting from the projectionStartDate.
var projectionVat = Banana.document.vatProjectionBalances('V15', '2017-03-01', 'Q');
var vatTaxable = projectionVat[0].vatTaxable;
var vatPosted = projectionVat[0].vatPosted;
vatProjectiontCard(vatCode, projectionStartDate, [, startDate, endDate, function(rowObj, rowNr, table) ])
Same as vatCurrentCard but use the budget data starting from the projectionStartDate.
var vatTransactions = Banana.document.vatProjectiontCard('V15','2015-01-01','','');
vatReport([startDate, endDate])
Returns the vat report for the specified period.
Start and end dates are strings in form 'YYYY-MM-DD' or a date object. If startDate is empty the accounting start date is taken. If endDate is empty the accounting end date is taken.
var vatReport = Banana.document.vatReport('','');
Banana.Document (Base)
Banana.Document is the interface to a document in Banana Accounting. The currently opened document can be accessed through the property Banana.document. A document can be also opened with the method Banana.application.openDocument.
Properties
cursor
Return a Cursor object with the current position of the cursor and the range of the selected rows.
var currentCursor = Banana.document.cursor;
locale
Return the locale of the document in the form of "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two- or three-letter ISO 3166 country code.
var locale = Banana.document.locale;
rounding
Return the rounding context of the current file that can be used with the SDecimal math functions.
var rounding = Banana.document.rounding;
tableNames
Return an array with the xml names of the tables in the document.
var tableNames = Banana.document.tableNames;
The tables in the document vary depending on the type of accounting. For example in a multi-currency accounting with VAT these are the tables:
- Accounts,Transactions,Budget,Totals,VatCodes,ExchangeRates,Items,Documents,FileInfo
uuid
Return the uuid (universally unique identifier) fo the document.
var uuid = Banana.document.uuid; // Ex.: "123e4567-e89b-12d3-a456-426652340000"
Methods
addMessage(msg[, idMsg])
Add the message msg to the document. The message is showed in the pane "Messages", and in a dialog if the application option "Show Messages" is turned on.
If idMsg is not empty, the help button calls an url with script's id and message's id (idMsg) as parameters.
See also: Application.AddMessage, Table.AddMessage, Row.AddMessage.
Banana.document.addMessage("Message text");
applyDocumentChange(docChange)
Apply a DocumentChange to the document. Returns true if the docChange has been applied, otherwise false.
A dialog showing the changes is showed to the user asking for confirmation.
var documentChange = {
"format": "documentChange",
//...
};
Banana.document.applyDocumentChange(documentChange);
clearMessages()
Clear all the document's messages showed in the pane "Messages".
Banana.document.clearMessages();
getMessages([tableName, rowNr])
Returns all messages showed in the pane "Messages", that refer to this document and optionally to given table and row number.
let msgs = Banana.application.getMessages();
for (let i = 0; i < msgs.length; ++i) {
let msg = msgs[i];
Banana.console.log("Error: " + msg.message);
}
The message object contains following properties:
- message: the message in the application language;
- referer: a string describing to which the message refer (usually the file name);
- level: the level of the message as string, can be one of "debug", "info", "warning", "debug";
- helpId: the help id of the message, used to link to the documentation;
- fileUuid: an id as string that uniquely identifies the file to which the message refer or empty;
- fileName: the file name that identifies the file to which the message refer or empty;
- tableName: the table name to which the message refer, or empty;
- rowNr: the row number as number to which the message refer, or -1;
- columnName: the column name to which the message refer to, or empty;
See also: Application.getMessages.
getScriptSettings()
Get the settings of the script saved in the document. You use this method to get settings that are private to the running script. It is possible to save the settings of the script through the method "setScriptSettings".
With this method Settings are saved and restored under the script id, If you change the script's id you will lose the saved settings.
Example:
// Initialise parameter
param = {
"searchText": "",
"matchCase": "false",
"wholeText": "false"
};
// Readscript settings
var strData = Banana.document.getScriptSettings();
if (strData.length > 0) {
var objData = JSON.parse(strData);
if (objData)
param = objData;
}
getScriptSettings(id)
Return the settings saved in the document under the id 'id'.
You use this method to get settings that are shared between scripts. As id we recommend to use a substring of the script's id. For example if you have the scripts 'ch.banana.vat.montlyreport' and 'ch.banana.vat.endofyearreport', then you can use as id 'ch.banana.vat'.
Example:
// Initialise parameter
param = {
"searchText": "",
"matchCase": "false",
"wholeText": "false"
};
// Readscript settings
var strData = Banana.document.getScriptSettings('ch.banana.vat');
if (strData.length > 0) {
var objData = JSON.parse(strData);
if (objData)
param = objData;
}
info(section, id)
Return the info value of the document referenced by section and id. Section and Id correspond to the xml name listed in the Info table, see command File info in menu "Tools" and set the view to complete to see the XML columns. If the value referenced by section and id doesn't exist, an object of type undefined is returned.
Example:
This is not an exhaustive list. For an exhaustive list run the command Menu Tools > File info, and switch to the view Complete.
// Get some value of the accounting file
var FileName = Banana.document.info("Base","FileName");
var DecimalsAmounts = Banana.document.info("Base","DecimalsAmounts");
var HeaderLeft = Banana.document.info("Base","HeaderLeft");
var HeaderRight = Banana.document.info("Base","HeaderRight");
var BasicCurrency = Banana.document.info("AccountingDataBase","BasicCurrency");
// For openingDate and closureDate use instead startDate and endDate
var openingDate = Banana.document.info("AccountingDataBase","OpeningDate");
var closureDate = Banana.document.info("AccountingDataBase","ClosureDate");
// For file accounting type
var FileType = Banana.document.info("Base","FileType");
var FileGroup = Banana.document.info("Base","FileTypeGroup");
var FileNumber = Banana.document.info("Base","FileTypeNumber");
// For customer settings
var customersGroup = Banana.document.info("AccountingDataBase","CustomersGroup");
var suppliersGroup = Banana.document.info("AccountingDataBase","SuppliersGroup");
FileTypeGroup / FileTypeNumber combinations:
- 100 Double entry accounting
- 100 No VAT
- 110 With VAT
- 120 Multi Currency
- 130 Multi Currency with VAT
- 110 Income and Expense accounting
- 100 No VAT
- 110 With VAT
- 130 Cash Book
- 100 No VAT
- 110 With VAT
- 400 Address / Labels
- 110 Labels
- 120 Address
scriptSaveSettings(string)
Save the settings of the script in the document. The next time the script is run, it is possible to read the saved settings with "scriptReadSettings".
With this method Settings are saved and restored under the script id, If you change the script's id you will lose the saved settings.
Example:
// Save script settings
var paramString = JSON.stringify(param);
var value = Banana.document.scriptSaveSettings(paramString);
Deprecated. Use setScriptSettings instead.
scriptReadSettings()
Return the saved settings of the script.
With this method Settings are saved and restored under the script id, If you change the script's id you will lose the saved settings.
Example:
// Initialise parameter
param = {
"searchText": "",
"matchCase": "false",
"wholeText": "false"
};
// Readscript settings
var strData = Banana.document.scriptReadSettings();
if (strData.length > 0) {
var objData = JSON.parse(strData);
if (objData)
param = objData;
}
Deprecated. Use getScriptSettings instead.
setScriptSettings(value)
Save the settings of the script in the document. It is possible to read the saved settings of the script with the method "getScriptSettings".
With this method Settings are saved and restored under the script id, If you change the script's id you will lose the saved settings.
Example:
// Save script settings
var paramString = JSON.stringify(param);
var value = Banana.document.setScriptSettings(paramString);
setScriptSettings(id, value)
Save the settings in the document under the id 'id'. It is possible to read the saved settings with "getScriptSettings(id)".
You use this method to set settings that are shared between scripts. As id we recommend to use a substring of the script's id. For example if you have the scripts 'ch.banana.vat.montlyreport' and 'ch.banana.vat.endofyearreport', then you can use as id 'ch.banana.vat'.
Example:
// Save script settings
var paramString = JSON.stringify(param);
var value = Banana.document.setScriptSettings('ch.banana.vat', paramString);
table(xmlTableName)
Return the table referenced by the name xmlTableName as a Table object, or undefined if it doesn't exist.
Banana.document.table("Accounts");
table(xmlTableName, xmlListName)
Return the table referenced by the name xmlTableName with the rows of the list xmlListName as a Table object, or undefined if the table or the list don't exist. The default list is the 'Data' list.
Banana.document.table("Transactions", "Examples");
Banana.document.table("Transactions").list("Examples"); // alternative way
See also: Table.list, Table.listNames.
value(tableName, rowNr, columnName)
Return the value in table tableName, row rowNr and column columnName as string. If the table, row or column are not found, it returns an object of type undefined.
Banana.document.value("Accounts", 5, "Description")
Banana.Document (Invoice)
This API is available only for Estimates & Invoices Application.
calculateInvoice(string)
It receives the Invoice JSON Object as a parameter and completes the fields by calculating their values, returning a string containing the complete structure of a Invoice.
var invoiceObj = (Invoice JSON Object)
invoiceObj = JSON.parse(Banana.document.calculateInvoice(JSON.stringify(invoiceObj)));
For example, it is possible to use this function together with the DocumentChange API to import invoices into the accounting.
printInvoice(string)
// Before printing you can adapt the content through templates
var invoiceObj = (Invoice JSON Object)
// Updates Document title
invoiceObj.document_info.title = invoiceObj.document_info.description;
Banana.document.printInvoice(JSON.stringify(invoiceObj));
Banana.Document.Column
The Banana.Document.Column class provide informations about a column.
The column's informations are described on the documentation page of dialog Columns setup, The column's informations are dependent of the view, therefore the same column can have a different headers depending on the view.
Example:
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var colHeader = tColumn.header;
This class was introduced in BananaPlus 10.1.7.23164.
Properties
alignment
Returns the column's alignment as string.
The returned string is one of:
- left
- center
- right
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var alignment = tColumn.alignment;
dataType
Returns the column's data type as string.
The returned string is one of:
- text
- number
- amount
- date
- time
- bool
- timestamp
- timecounter
- links
- textmultiline
- xml
- html
- json
- mime
- markdowm
- textencrypted
- none
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var dataType = tColumn.dataType;
decimal
Return the number of decimals for columns of type 'amount' of 'number'.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var decimals = tColumn.decimals;
description
Return the column's description.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var description = tColumn.description;
excludeFromPrinting
Return true if the column is to be excluded from printing, false otherwise.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var excludedFromPrinting = tColumn.excludedFromPrinting;
format
Return the column's format.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var format = tColumn.format;
header
Return the column's header.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var header = tColumn.header;
header2
Return the column's header 2.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var header2 = tColumn.header2;
style
Return the column's format as object with the properties 'fontSize' as integer, 'bold' as boolean and 'italic' as boolean.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var style = tColumn.style;
var fontSize = style.fontSize;
var isBold = style.bold;
var isItalic = style.italic;
visible
Return true if the column is visible, false otherwise.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var visible = tColumn.visible;
editable
Return true if the column is editable, false otherwise.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var editable= tColumn.editable;
This property was introduced in BananaPlus 10.1.20.
width
Return the column's width in millimeters.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var width = tColumn.width;
Methods
No methods are defined for this class.
Banana.Document.Cursor
Banana.Document.Cursor is the interface to the cursor and can be accessed through Banana.document.cursor.
Properties
tableName
Return the xml name of the current table.
var currentTable = Banana.document.cursor.tableName;
rowNr
Return the number of the current row.
var currentRow = Banana.document.cursor.rowNr;
columnName
Return the xml name of the current column.
var currentColumn = Banana.document.cursor.columnName;
selectionTop
Return the index of the top row of the current selection.
var currentSelectionTop = Banana.document.cursor.selectionTop;
selectionBottom
Return the index of the bottom row of the current selection.
var currentSelectionBottom = Banana.document.cursor.selectionBottom;
Banana.Document.Row
Banana.Document.Row is the interface of a row.
Properties
isEmpty
Return true if the row is completly empty.
var isEmpty = tRow.isEmpty;
rowNr
Return the index of the row.
var rowNr = tRow.rowNr;
style
Return the column's format as object with the properties 'fontSize' as integer, 'bold' as boolean and 'italic' as boolean.
var tRow = Banana.document.table("Transactions").row(10);
var style = tRow.style;
var fontSize = style.fontSize;
var isBold = style.bold;
var isItalic = style.italic;
This method was introduced in BananaPlus 10.0.12.088.
uniqueId
Return the unique id (an interger value) of the row.
Banana assign to every new row a unique id, this value is fix a will never change.
var uniqueId = tRow.uniqueId;
Methods
When using columnName it must always be a valid nameXml of a column.
addMessage(msg [, columnName] [, idMsg])
Add the message msg to the document. The message is showed in the pane "Messages", and in a dialog if the application option "Show Messages" is turned on.
If idMsg is not empty, the help button calls an url with message's id (idMsg) as parameter.
If columnName is not empty, the message is connected to the column columnName. With a double click over message in the message pane, the cursor jump to the corresponding table, rowNr and columnName.
See also: Application.AddMessage, Table.AddMessage, Document.AddMessage.
var accountsTable = Banana.document.table("Accounts");
var tRow = accountsTable.row(4);
tRow.addMessage("Message text");
toJSON([columnNames])
Return the row as JSON string. If the parameter columnNames is defined, only the columns in the array are included in the file.
// Return all the columns of the row
var json = tRow.toJSON();
// Return only the defined columns of the row
var json = tRow.toJSON(["Account", "Description", "Balance"]);
value(columnName)
Return a String in the format corresponding to the column Data type.
- If the column is not found or the object is invalid it return an undefined value.
- See Table Content and Cell value for more information on the format of the returned String.
- If the column is numeric or amount type the return value is a Numeric String.
- If the column is Date type the return value is a Date String.
var accountsTable = Banana.document.table("Accounts");
var tRow = accountsTable.row(4);
var description= tRow.value("Description"); // example "Cash account"
Banana.Document.Table
Banana.Document.Table is the interface of a table.
When using table it must always be a valid nameXml of a table.
To view the nameXml of a table: menu Data > Table Setup.
var table = Banana.document.table("Accounts"); // 'Accounts' is the nameXml of the table Accounts
When using columnName it must always be a valid nameXml of a column.
To view the nameXml of a column: menu Data > Column Setup > Settings.
var table = Banana.document.table("Accounts");
var account = table.value(3,'Account'); // 'Account' is the nameXml of the column account of Accounts table
Table content
A table is a read only data structure that contains
- Rows of type Banana.Document.Row.
- Columns of type Banana.Document.Column.
Cell content and format
The cell content is a String text, returned by the function value is retrieved with the always in text format.
- String column
Contain a String with any alphanumeric value.
Examples: "", "text", "1234ab - Numeric and Amounts columns
Contains a Numeric String. Javascript String containing only digit characters, including a decimal separator "." and minus sign at the beginning.
See Banana.SDecimal class.
Examples: (positive number "12345.67", negative number "12345.67") - Date columns
Contains a Date String with a date in the format "yyyy-mm-dd"
Example: "2025-12-31".
See Banana.Converter class. - Time columns
Contains a String with a time in the format "hh:mm:ss:zzz" or without milliseconds "h:m:ss:zz" .
Examples: ("04:04:36:089", "4:4:36:89");
See Banana.Converter class. - Boolean columns,
Contains a String with values 1 (true) or empty (false).
Properties
name
Return the xml name of the table.
var table = Banana.document.table("Accounts");
var tName = table.name;
columnNames
Return the xml names of the table's columns as an array of strings.
var table = Banana.document.table("Accounts");
var tColumnNames = table.columnNames;
The columns vary depending on the table and accounting type. For example in the Transactions table of a multi-currency accounting with VAT these are the columns:
SysCod, Section, Date, DateDocument, DateValue, Doc, DocProtocol, DocType, DocOriginal, DocInvoice, InvoicePrinted, DocLink, ExternalReference, ItemsId, Description, Notes, AccountDebit, AccountDebitDes, AccountCredit, AccountCreditDes, Quantity, ReferenceUnit, UnitPrice, AmountCurrency, ExchangeCurrency, ExchangeRate, ExchangeMultiplier, Amount, Balance, VatCode, VatAmountType, VatExtraInfo, VatRate, VatRateEffective, VatTaxable, VatAmount, VatAccount, VatAccountDes, VatPercentNonDeductible, VatNonDeductible, VatPosted, VatNumber, Cc1, Cc1Des, Cc2, Cc2Des, Cc3, Cc3Des, Segment, DateExpiration, DateExpected, DatePayment, LockNumber, LockAmount, LockProgressive, LockLine
listName
Return the xml name of the list that this table object references to. The default list is the 'Data' list.
var table = Banana.document.table("Accounts");
var tListName = table.listName;
listNames
Return the xml names of the available lists as an array. The default list is the 'Data' list.
var table = Banana.document.table("Accounts");
var tListNames = table.listNames;
rowCount
Return the number of rows in the table.
var table = Banana.document.table("Accounts");
var tRowCount = table.rowCount;
rows
Return the rows of the table as an array of Row objects.
var table = Banana.document.table("Accounts");
var tRows = table.rows;
Note: In a loop use the method table.row(rowNr) instead of table.rows[rowNr]. The property rows can be very expensive with large tables and slow down or block the execution of the script.
viewNames
Return the xml names of the available views as an array.
var table = Banana.document.table("Accounts");
var tViewNames = table.viewNames;
This property was introduced in BananaPlus 10.0.12.088.
Methods
addMessage(msg, rowNr [, columnName] [, idMsg])
Add the message msg to the queue of the document. The message is showed in the pane "Messages", and in a dialog if the application option "Show Messages" is turned on.
If idMsg is not empty, the help button calls an url with message's id (idMsg) as parameter.
If rowNr is different than "-1" the message is connected to the row rowNr. if columnName is not empty, the message is connected to the column columnName. With a double click over message in the message pane, the cursor jump to the corresponding table, rowNr and columnName.
See also: Application.AddMessage, Row.AddMessage, Document.AddMessage.
var table = Banana.document.table("Accounts");
table.addMessage("Message string", 3, "description");
column(columnName [, viewName])
Return the Column with the given name in the given view as Column Object.
The viewName is optional, if not defined the view number 1 (usually the "Base" view) or if not present the first view in the list is taken.
The column's informations are dependent of the view, therefore the same column can have for example different headers depending on the given view.
var tColumn = Banana.document.table("Transactions").column("Description", "Base");
var colHeader = tColumn.header;
This method was introduced in BananaPlus 10.0.12.088.
extractRows( function(rowObj, rowNr, table), tableTitle)
Return an array of rows filled with all row elements that pass a test (provided as a function) and show them in the table "Selections".
The title of the table is set to tableTitle.
function accountStartsWith201(rowObj,rowNr,table) {
// Return true if account start with '201'
return rowObj.value('Account').startsWith('201');
}
var tableAccount = Banana.document.table('Accounts');
// Show a table with all accounts that start with '201'
tableAccount.extractRows(accountStartsWith201, 'Accounts that start with 201');
findRows( function(rowObj, rowNr, table))
Return an array of Row objects that pass a test (provided as a function).
function accountStartsWith201(rowObj,rowNr,table) {
// Return true if account start with '201'
return rowObj.value('Account').startsWith('201');
}
var tableAccount = Banana.document.table('Accounts');
// Find rows of all accounts that start with '201'
var rows = tableAccount.findRows(accountStartsWith201);
findRowByValue(columnName, value)
Return the first row as Row object that contains the value in the the column columnName. Or undefined if any row is found.
var cashAccountRow = Banana.document.table('Accounts').findRowByValue('Account','1000');
if (!cashAccountRow)
//Row not found
list(xmlListName)
Return a new table object with the rows of the list xmlListName, or undefined if the list xmlListName doesn't exist.
var recurringTransactions = Banana.document.table('Transactions').list('Recurring');
var archivedProducts = Banana.document.table('Products').list('Archive');
progressiveNumber(columnName [, includeArchive])
Return the progressive number for the column columnName. If includeArchive is true, the Archive table is also take into account.
As API Version 1.2.2 or BananaPlus Version 10.0.13.240 this method works also with alphanumeric ("DOC-021") and composite ("2022-021") numbers. For example, if the last used number is "DOC-021" this method returns "DOC-022", if the the last used number is "2022-021" this method returns "2022-022".
var trasactionsTable = Banana.document.table("Transactions");
var nextDocNr = trasactionsTable.progressiveNumber("Doc");
var invoicesTable = Banana.document.table("Invoices", true);
var nextInvoiceNr = invoicesTable.progressiveNumber("Id", true);
row(rowNr)
Return the Row at index rowNr as Row Object, or undefined if rowNr is outside the valid range.
var table = Banana.document.table("Accounts");
var row = table.row(3);
toJSON([columnNames])
Return the table data content as JSON string. If the parameter columnNames is defined, only the columns in the array are included in the file.
var table = Banana.document.table("Accounts");
var json = table.toJSON();
toHtml([columnNames, formatValues])
Return the table data content as Html file. If the parameter columnNames is defined, only the columns in the array are included in the file. If formatValues is set to true, the values are converted to the locale format.
Example:
//Show the whole row content of the table Accounts
Banana.Ui.showText(Banana.document.table('Accounts').toHtml());
//Show some columns and format dates, amounts, ... as displayed in the program
Banana.Ui.showText(
Banana.document.table('Accounts').toHtml(['Account','Group','Description','Balance'],true)
);
toTsv([columnNames])
Return the table as Tsv file (Tab separated values). If the parameter columnNames is defined, only the columns in the array are included in the file.
var table = Banana.document.table("Accounts");
var tsv = table.toTsv();
value(rowNr, columnName)
Return the value in row rowNr and column columnName as string. Or undefined if the row or column are not found.
- If the rowNr or column is not found it returns an undefined value .
- See Table Content and Cell value form more information on the format of the returned String.
var table = Banana.document.table("Accounts");
var account = table.value(3,'Account');
var description = table.value(3,'Description'); // "Cash Account"
Banana.IO
The Banana.IO is a static class that contains static methods used to read and write to files.
Introduction
The API Banana.IO and Banana.IO.LocalFile allow a script to read or write to files in a secure way. The script can only read or write to files that are first selected by the user through the corresponding dialogs, except for files that resides in the script package. The script has no direct access to files on the file system. After the script finishes, the permissions to write or read files are removed.
For example to write the result of a script to a file:
var fileName = Banana.IO.getSaveFileName("Select save file", "", "Text file (*.txt);;All files (*)");
if (fileName.length) {
var file = Banana.IO.getLocalFile(fileName)
file.codecName = "latin1"; // Default is UTF-8
file.write("Text to save ...");
if (!file.errorString) {
Banana.IO.openPath(fileContent);
} else {
Banana.Ui.showInformation("Write error", file.errorString);
}
} else {
Banana.Ui.showInformation("Info", "no file selected");
}
To read the content from a file:
var fileName = Banana.IO.getOpenFileName("Select open file", "", "Text file (*.txt);;All files (*)")
if (fileName.length) {
var file = Banana.IO.getLocalFile(fileName)
file.codecName = "latin1"; // Default is UTF-8
var fileContent = file.read();
if (!file.errorString) {
Banana.IO.openPath(fileContent);
} else {
Banana.Ui.showInformation("Read error", file.errorString);
}
} else {
Banana.Ui.showInformation("Info", "no file selected");
}
To read the content of a file contained in the script package:
let file = Banana.IO.getLocalFile("file:script/changelog.md")
let text = file.read()
Methods
fileCompleteBaseName(path)
Static method.
The method fileCompleteBaseName Returns the complete base name of the file without the path. The complete base name consists of all characters in the file up to (but not including) the last '.' character.
The parameter path is path inclusive the file name to be selected.
let path = "file:script/../test/testcases/MyTestFile.csv"
let fileName = Banana.IO.fileCompleteBaseName(path); // fileName = MyTestFile.csv
getOpenFileName(caption, path, filter)
Static method.
The method getOpenFileName returns an existing file selected by the user. If the user presses Cancel, it returns an empty string. The file selected by the user is then allowed to be read, but not written.
The parameter caption is the caption of the dialog.
The parameter path is path inclusive the file name to be selected. If the path is relative, the current open document path or the user's document path is used.
The parameter filter set the files types to be showed. If you want multiple filters, separate them with ';;', for example: "Text file (*.txt);;All files (*)".
var fileName = Banana.IO.getOpenFileName("Select file to read", "", "Text file (*.txt);;All files (*)")
Since: Banana Accounting 9.0.7, only in Banana Experimental
getSaveFileName(caption, path, filter)
Static method.
The method getSaveFileName returns an existing file selected by the user. If the user presses Cancel, it returns an empty string. The file selected by the user is then allowed to be read and written.
The parameter caption is the caption of the dialog.
The parameter path is path inclusive the file name to be selected. If the path is relative, the current open document path or the user's document path is used.
The parameter filter set the files types to be showed. If you want multiple filters, separate them with ';;', for example: "Text file (*.txt);;All files (*)".
var fileName = Banana.IO.getSaveFileName("Select file to write", "", "Text file(*.txt);;All files (*)")
getLocalFile(path)
Static method.
The method getLocalFile(path) returns an object of type Banana.IO.LocalFile that represents the requested file. This method always returns a valid Banana.IO.LocalFile object.
The parameter path to the file.
The path can be relative to the script's folder:
file:script/<relative_path_to_script_folder>/<file_name>
openUrl(path)
Static method.
The method openUrl(path) opens the file referred by path in the system default application.
The parameter path to the file.
openPath(path)
Static method.
The method openPath(path) shows the folder containing the file referred by path in the system file manager.
The parameter path to the file.
Banana.IO.LocalFile
The LocalFile class represents a file on the local file system. See Banana.IO for an example.
Properties
codecName
The name of the codec to be used for reading or writing the file. Default is 'UTF-8'.
errorString
Read only. The string of the last occured error. If no error occured it is empty.
Methods
read()
Returns the content of the file. This function has no way of reporting errors. Returning an empty string can mean either that the file is empty, or that an error occurred. Check the content of the property errorString to see if an error occured.
write(text [, append])
Write text to the file. If append is set to true, text is appended to the file. Returns true if the operation was succesfully, false otherwise.
Banana.Report
The class Banana.Report enables you to create reports, preview, print and export to pdf or other formats.
Introduction
The report logic is similar to the HTML / CSS logic:
- Create a Report object .
- A report contains a list of ReportElements (paragraphs, texts, tables and other)
- The element can contain other sub-elements
- For each element you can add a class that is used for rendering the element
- Create a StyleSheet using the Banana.Report.newStyleSheet() function.
- Add syle elements to the stylesheet.
- A stylesheet is composed of StyleElements.
- You preview and print a report by passing the Report and the Stylesheet object.
// Example "Hello World" report
// Create a report object
var report = Banana.Report.newReport("Report title");
report.addParagraph("Hello World !!!", "styleHelloWorld");
// Create stylesheet object
var stylesheet = Banana.Report.newStyleSheet();
// Add style elements to the stylesheet object
var style = stylesheet.addStyle(".styleHelloWorld");
style.setAttribute("font-size", "96pt");
style.setAttribute("text-align", "center");
style.setAttribute("margin-top", "50mm");
var style2 = stylesheet.addStyle("@page");
style2.setAttribute("size", "landscape");
// Print preview using the report and the stylesheet
Banana.Report.preview(report, stylesheet);
Report structure
Each report sturcture has:
- A Report Element list.
- A Header Element list.
- A Footer Element list.
Methods
logoFormat(name)
Returns the logo format with 'name'. The returned object is of type Banana.Report.ReportLogo.
Returns null if no logo format with name 'name' exists.
Logo formats are defined through the dialog File → Logo Setup .
var headerLogoSection = report.addSection("");
var logoFormat = Banana.Report.logoFormat("Logo");
if (logoFormat) {
var logoElement = logoFormat.createDocNode(headerLogoSection, reportStyle, "logo");
report.getHeader().addChild(logoElement);
}
Since: Banana Accounting 9.0.4
logoFormatsNames()
Returns a list with the logo formats names.
Logo formats are defined through the dialog File → Logo Setup .
var logoNames = Banana.Report.logoFormatsNames();
// returns ["logo", "first_page_logo", "invoice_logo", ...]
Since: Banana Accounting 9.0.4
newReport(title)
Creates a report with title 'title'. The returned object is of type Banana.Report.ReportElement.
To the report you can then add the desired elements, like paragraphs, texts, tables, and so on that construct the structure of the report.
var report = Banana.Report.newReport("Report title");
newStyleSheet()
Creates an empty stylesheet. The returned object is of type Banana.Report.ReportStyleSheet.
To the stylesheet you can add the styles that format the report.
var stylesheet = Banana.Report.newStyleSheet();
newStyleSheet(fileName)
Creates a stylesheet from a file. The file has the same syntax as CSS stylesheets. The file path is relative to the script's path. The path can't contain a '..'' (parent directory).
The returned object is of type Banana.Report.ReportStyleSheet.
You can add further styles to the returned stylesheet.
var reportStyles = Banana.Report.newStyleSheet("styles.css");
*** Content of file styles.css ***
.helloWorldStyle
{
font-size: 96pt;
text-align: center;
margin-top: 50mm;
}
@page
{
size: landscape;
}
*** End of file styles.css ***
preview(report, stylesheet)
Opens a print preview Dialog and shows the report with the given stylesheet.
The param report is an object of type Banana.Report.ReportElement. The param stylesheet is an object of type Banana.Report.ReportStyle.
The page orientation is given by the stylesheet. The default size and orientation is taken from the default printer, or can be set through the stylesheet.
// Set landscape orientation
stylesheet.addStyle("@page {size: landscape}");
// Set page size and orientation
stylesheet.addStyle("@page {size: A5 lanscape}");
// Displays the report
Banana.Report.preview(report, stylesheet);
preview(title, reports, stylesheets)
Opens a print preview Dialog with title 'title' and shows the reports with the given stylesheets. This method allows you to print two or more distinct reports together.
The param report is an array of objects of type Banana.Report.ReportElement. The param stylesheet is an array of objects Banana.Report.ReportStylesheet.
Each report's title will appear in the index of the printed pdf. The numbering of pages will restart from 1 at the beginning of each printed report.
The page orientation is given by the stylesheet. The default size and orientation is taken from the default printer, or can be set through the stylesheet.
var docs = [];
var styles = [];
// Report
for (var i = 0; i < 10; i++) {
var report = Banana.Report.newReport("Report title");
report.addParagraph("Hello World #" + i + " !!!", "styleHelloWorld");
report.setTitle("Document " + i); // The report's title will appear in the pdf's index
report.getFooter().addFieldPageNr();
docs.push(report);
// Styles
var stylesheet = Banana.Report.newStyleSheet();
var style = stylesheet.addStyle(".styleHelloWorld");
style.setAttribute("font-size", "24pt");
style.setAttribute("text-align", "center");
style.setAttribute("margin-top", "10mm");
var style2 = stylesheet.addStyle("@page");
style2.setAttribute("size", "landscape");
styles.push(stylesheet);
}
// Print preview of 10 documents together
Banana.Report.preview("Multi documents printing example", docs, styles);
Since Banana Accounting 9.0.4
qrCodeImage(text, qrCodeParam)
Creates a QRCode image according to the passed text. The returned object is a svg image.
- qrCodParam.errorCorrectionLevel
string value H (high), L (low), M (medium), Q (quartile) (default value M) - qrCodeParam.binaryCodingVersion
int value from 0 to 40 (default value 40) - qrCodeParam.border
int value from 0 to 100 (default value 0) - qrCodeParam.errorMsg
in case of error the method returns the error message in this property
since: Banana Accounting+
var text = 'hello world';
var qrCodeParam = {};
qrCodeParam.errorCorrectionLevel = 'M';
qrCodeParam.binaryCodingVersion = 25;
qrCodeParam.border = 0;
var qrCodeSvgImage = Banana.Report.qrCodeImage(text, qrCodeParam);
if (qrCodeParam.errorMsg && qrCodeParam.errorMsg.length>0) {
Banana.document.addMessage(qrCodeParam.errorMsg);
}
if (qrCodeSvgImage) {
var repDocObj = Banana.Report.newReport('Printing QRCode img');
repDocObj.addImage(qrCodeSvgImage, 'qrcode');
}
setFirstPageNumber(pageNr)
The passed argument pageNr will be used by the method Banana.Report.ReportElement.addFieldPageNr as first page number.
Example: Hello world
// Simple test script using Banana.Report
//
// @id = ch.banana.script.report.helloworld
// @api = 1.0
// @pubdate = 2017-01-02
// @publisher = Banana.ch SA
// @description = Report Hello world
// @task = app.command
// @doctype = *
// @inputdatasource = none
// @timeout = -1
//
function exec(string) {
// Create the report
var report = Banana.Report.newReport("Report title");
// Add a paragraph to the report
report.addParagraph("Hello World !!!", "helloWorldStyle");
// Define some styles
var stylesheet = Banana.Report.newStyleSheet();
var style = stylesheet.addStyle(".helloWorldStyle");
style.setAttribute("font-size", "96pt");
style.setAttribute("text-align", "center");
style.setAttribute("margin-top", "50mm");
var style2 = stylesheet.addStyle("@page");
style2.setAttribute("size", "landscape");
// Open Preview
Banana.Report.preview(report, stylesheet);
}
An example with tables, page breaks and differents styles
Result
Script
// Test script using Banana.Report
//
// @id = ch.banana.script.report.report
// @api = 1.0
// @pubdate = 2017-01-02
// @publisher = Banana.ch SA
// @description = Test report api
// @task = app.command
// @doctype = *
// @outputformat = none
// @inputdatasource = none
// @timeout = -1
//
function exec(string) {
// Report
var report = Banana.Report.newReport("Report title");
var pageHeader = report.getHeader()
pageHeader.addClass("header");
pageHeader.addText("Page header");
report.getFooter().addFieldPageNr();
var watermark = report.getWatermark();
watermark.addParagraph("Sample built with Script Report API");
report.addParagraph("Report title", "titleStyle");
report.addParagraph("1. Text", "chapterStyle").setOutline(1);
report.addParagraph("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do " +
"eiusmod tempor incididunt ut labore et dolore magna aliqua. " +
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip " +
"ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit " +
"esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
var paragraph2 = report.addParagraph();
paragraph2.addText("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do ");
paragraph2.addText("eiusmod tempor incididunt ut labore et dolore magna aliqua. ", "blueStyle");
paragraph2.addText("Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ", "boldStlyle");
paragraph2.addText("ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit ", "underlineStyle boldStyle");
paragraph2.addText("esse cillum dolore eu fugiat nulla pariatur.");
paragraph2.addLineBreak();
paragraph2.addText("Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", "italicStyle");
report.addParagraph("2. Table", "chapterStyle").setOutline(1);
var table = report.addTable();
table.getCaption().addText("Table caption");
var tableHeader = table.getHeader();
var tableHeaderRow = tableHeader.addRow();
tableHeaderRow.addCell("Description", "", 2);
tableHeaderRow.addCell("Income");
tableHeaderRow.addCell("Expense");
tableHeaderRow.addCell("Balance");
var tableRow = table.addRow();
tableRow.addCell();
tableRow.addCell("Initial balance");
tableRow.addCell();
tableRow.addCell();
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("157.00")).addClass("balanceStyle");
var tableRow = table.addRow();
tableRow.addCell(Banana.Converter.toLocaleDateFormat("2014-02-11"));
tableRow.addCell("Transfer from post office account");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("500.00"));
tableRow.addCell();
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("657.00")).addClass("balanceStyle");
var tableRow = table.addRow();
tableRow.addCell(Banana.Converter.toLocaleDateFormat("2014-02-20"));
tableRow.addCell("Various payments");
tableRow.addCell();
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("7250.00"));
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("-6593.00")).addClass("balanceStyle negativeStyle");
var tableRow = table.addRow("totalrowStyle");
tableRow.addCell();
tableRow.addCell("Total transactions");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("500.00"));
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("7250.00"));
tableRow.addCell(Banana.Converter.toLocaleNumberFormat("-6593.00")).addClass("balanceStyle negativeStyle");
report.addParagraph("3. Bookmarks and links", "chapterStyle").setOutline(1);
report.addParagraph("3.1 Internal links", "chapter2Style").setOutline(2);
report.addParagraph("-> link to bookmark on page 2").setLink("bookmarkpage2");
report.addParagraph("3.2 External links", "chapter2Style").setOutline(2);
report.addParagraph("-> link to Banana.ch web page").setUrlLink("http://www.banana.ch");
report.addPageBreak();
var chapter4 = report.addParagraph("4. Pages", "chapterStyle");
chapter4.setOutline(1);
report.addParagraph("Bookmark on page 2").setBookmark("bookmarkpage2");
// Styles
var docStyles = Banana.Report.newStyleSheet();
var pageStyle = docStyles.addStyle("@page");
pageStyle.setAttribute("margin", "20mm 20mm 20mm 20mm");
var headerStyle = docStyles.addStyle("phead");
headerStyle.setAttribute("padding-bottom", "1em");
headerStyle.setAttribute("margin-bottom", "1em");
headerStyle.setAttribute("border-bottom", "solid black 1px");
var footerStyle = docStyles.addStyle("pfoot");
footerStyle.setAttribute("text-align", "right");
var paragraphStyle = docStyles.addStyle("p");
paragraphStyle.setAttribute("margin-top", "0.5em");
var captionStyle = docStyles.addStyle("caption");
captionStyle.setAttribute("margin-top", "1em");
var titleStyle = docStyles.addStyle(".titleStyle");
titleStyle.setAttribute("font-size", "24");
titleStyle.setAttribute("text-align", "center");
titleStyle.setAttribute("margin-bottom", "1.2em");
docStyles.addStyle(".chapterStyle", "font-size:16; margin-top:2em; margin-bottom:0.2em");
docStyles.addStyle(".chapter2Style", "font-size:12; margin-top:1.4em; margin-bottom:0.2em");
var tableStyle = docStyles.addStyle("table");
tableStyle.setAttribute("border", "2px solid red");
docStyles.addStyle("td", "border: 1px dashed black; padding: 2px;");
var tableColStyle = docStyles.addStyle(".balanceStyle");
tableColStyle.setAttribute("background-color", "#E0EFF6");
tableColStyle.setAttribute("text-align", "right");
var totalRowStyle = docStyles.addStyle(".totalrowStyle");
totalRowStyle.setAttribute("font-weight", "bold");
var totalBalanceStyle = docStyles.addStyle(".totalrowStyle td.balanceStyle");
totalBalanceStyle.setAttribute("text-decoration", "double-underline");
docStyles.addStyle(".blueStyle", "color:blue");
docStyles.addStyle(".underlineStyle", "text-decoration:underline;");
docStyles.addStyle(".italicStyle", "font-style:italic;");
docStyles.addStyle(".boldStyle", "font-weight:bold");
// Open Preview
Banana.Report.preview(report, docStyles);
}
Banana.Report.ReportElement
The class Banana.Report.ReportElement represents the report itself and every element in the report, such as sections, paragraphs, tables, texts and the report itself.
Once you create a new report through the method Banana.Report.newReport() you can start adding sections, paragraphs, texts, tables and so on.
When you add an element with one of the add methods, you get as return value an object of type
Elements as a container of other elements
Banana.Report.ReportElement that represents the added element.
To this object you can add further elements and by this way construct the structure of the report.
Report
+ Paragraph
+ Table
+ Row
+ Cell
+ Cell
+ Row
+ Cell
+ Cell
...
Even if this interface allows you to add tables to text elements or columns to paragraphs, the result will be undefined.
Formatting text size, text color, margins, and so on are set separately through a Banana.Report.ReportStyleSheet object.
Methods
addAttachment(name, content)
Add an attachment to the document.
- The param name defines the name of the attachment inclusive extention (.png, .pdf, .xml) that will appear in print preview attachment's list on in the printed pdf.
- The param content contains the path to the file to attach or the data to attach.
- The path can be relative to the script's folder, the document's folder, the name of a document attacched to the file or a data uri scheme (for images imbedded in the document).
- file:script/<relative_path_to_script_folder>/<image_name>
- file:document/<relative_path_to_file_folder>/<image_name>
- documents:<document_name>
- data:[<media type>][;charset=<character set>][;base64],<data>
Example:
//Create the report
var report = Banana.Report.newReport('Report attachments');
//Add a paragraph with some text
report.addParagraph('Report with attachments');
//Attach file on computer path relative to the accounting file
report.addAttachment('doc1.pdf', 'doc1.pdf');
report.addAttachment('doc2.pdf', 'documents/doc2.pdf');
//Attach text files created on the fly
//We use the prefix 'data:...' to tell that the string is not an url but is itself the content of the file
report.addAttachment('text file 1.txt', 'data:text/plain;utf8,This is the content of the text file 1.');
report.addAttachment('text file 2.txt', 'data:text/plain;utf8,This is the content of the text file 2.');
report.addAttachment('text file 3.txt', 'data:text/plain;utf8,This is the content of the text file 3.');
//Attach an image stored in the document table
//We use the prefix 'document:...'
report.addAttachment('logo.jpg', 'documents:logo');
//Add an xml element
//We just add the new created Banana.Xml.newDocument
var xmlDocument = Banana.Xml.newDocument("eCH-0217:VATDeclaration");
var rootNode = xmlDocument.addElement("eCH-0217:VATDeclaration");
rootNode.addElement("title").addTextNode("Vat Declaration 2018");
report.addAttachment('vat_declaration.xml', xmlDocument);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
Since Banana Accounting 9.0.4
addClass(classes)
Add classes to the node. A class binds the element to the corresponding class style definend in Banana.Report.ReportStyleSheet as used in CSS Stylesheets.
var report = Banana.Report.newReport("Report title");
report.addParagraph("1250.00").addClass("balanceStyle");
addDocInfo(name, value [, description])
Add document's informations to the document. When you generate multiple documents from your script and want to export them as separated pdfs, document's informations are used by the application to build meaningful file names for the exported pdf files, like "Invoice 1234 - Joe Black.pdf". The document's information "name" contains the default file name used by the application. The user when creating the pdf files, can choose to use the default "name", or combine freely the other document's informations for the file names.
For the following names, the application add a default description. For other names, like "doc_status", you can add your own description.
name
doc_title
doc_number
doc_date
doc_amount
doc_currency
customer_number
customer_name
customer_city
customer_email
account
cur_date
cur_time
You can add document's informations only to a document object.
report.addDocInfo("name", "Invoice 1234 - Joe Black.pdf");
report.addDocInfo("doc_title", "Invoice 1234");
report.addDocInfo("doc_number", "1234");
report.addDocInfo("customer_name", "Joe Black");
report.addDocInfo("doc_amount", "1023.00");
report.addDocInfo("doc_status", "paid", "Document status");
addSection([classes])
Add a section and return the created section as a Banana.Report.ReportElement object.
You can add sections only to sections, cells, captions, headers or footers.
var report = Banana.Report.newReport("Report title");
//Add a section with a style
var section = report.addSection("sectionStyle");
section.addParagraph("First paragraph");
section.addParagraph("Second paragraph");
addParagraph([text, classes])
Add a paragraph and return the created paragraph as a Banana.Report.ReportElement object.
You can add paragraphs only to sections, cells, captions, headers or footers.
var report = Banana.Report.newReport("Report title");
//Add an empty paragraph
report.addParagraph(" ");
//Add a paragraph with a text
report.addParagraph("Hello World !!!");
//Add a paragraph with a text and a style
report.addParagraph("Hello World !!!", "styleHelloWorld");
addHeader1..6([text])
The methods addHeader1 to addHeader6 add an header and return the created header as a Banana.Report.ReportElement object. The corresponding outline from 1 to 6is set automatically.
You can add headers only to sections, and documents.
var report = Banana.Report.newReport("Report title");
//Add headers
report.addHeader1("Header 1");
report.addHeader2("Header 1.2");
report.addParagraph("Some text.");
report.addHeader1("Header 2");
report.addHeader2("Header 2.1");
report.addParagraph("Some text.");
report.addHeader2("Header 2.2");
report.addParagraph("Some text.");
addText(text [, classes])
Add a text node and return the created text node as a Banana.Report.ReportElement object.
You can add texts only to sections, paragraphs, cells, captions, headers or footers.
var report = Banana.Report.newReport("Report title");
//Add a text
report.addText("Hello world !!!");
//Add a text with a style
report.addText("Hello world !!!", "styleHelloWorld");
addStructuredText(text, format, [, stylesheet])
Add a structured text to the document.
Supported formats are
'md'
Structured github markdown.
'html'
'text'
The function returns the new section containing the structured text as a Banana.Report.ReportElement object.
You can add structured text only to sections, paragraphs, cells, captions, headers or footers.
Example for Markdown text
// Report
var report = Banana.Report.newReport("Report title");
// Styles
var stylesheet = Banana.Report.newStyleSheet();
// Add Markdown text
let mdText = "# Header 1\n";
mdText += "## Header 2\n";
mdText += "### Header 3\n";
mdText += "Markdown text with **bold** and *italic*. \n";
mdText += "[Markdown link](https://www.banana.ch) \n";
mdText += "* List row 1\n";
mdText += "* List row 2\n";
mdText += "* List row 3\n";
report.addStructuredText(mdText, "md");
// Print preview
Banana.Report.preview(report, stylesheet);
Example for simple Html text
// Report
var report = Banana.Report.newReport("Report title");
// Styles
var stylesheet = Banana.Report.newStyleSheet();
// Add html text
let htmlText = "<h1 style=\"color: red\">Header 1 Red</h1>\n";
htmlText += "<p style=\"color: blue\">Paragraph blue</p>\n";
report.addStructuredText(htmlText, "html");
//Print preview
Banana.Report.preview(report, stylesheet);
Example for full Html text
If you add a full html (with head and style element), you should pass a stylesheet parameter. The styles defined in the html style element are added to the report stylesheet. If not the styles defined in the html style element are lost, and like in this example the paragraphs are not coloured with red and blue.
// Report
var report = Banana.Report.newReport("Report title");
// Styles
var stylesheet = Banana.Report.newStyleSheet();
// Add html text
let htmlText = "<html>\n";
htmlText += "<head>\n";
htmlText += "<style>\n";
htmlText += "p.blue {color: blue;}\n";
htmlText += ".red {color: red;}\n";
htmlText += "</style>\n";
htmlText += "</head>\n";
htmlText += "<body>\n";
htmlText += "<h1 class=\"red\">Header 1 Red</h1>\n";
htmlText += "<p class=\"blue\">Paragraph blue</p>\n";
htmlText += "</body>\n";
htmlText += "</html>\n";
report.addStructuredText(htmlText, "html", stylesheet);
//Print preview
Banana.Report.preview(report, stylesheet);
Example for Plain text
// Report
var report = Banana.Report.newReport("Report title");
// Styles
var stylesheet = Banana.Report.newStyleSheet();
// Plain Text
let plainText = "Testo riga 1\n";
plainText += "Testo riga 2\n";
plainText += "Testo riga 3\n";
// Add plain text
report.addStructuredText(plainText, "text");
// Print preview
Banana.Report.preview(report, stylesheet);
addTable([classes])
Add a table and return the created table as a Banana.Report.ReportElement object.
You can add tables only to the report or sections.
var report = Banana.Report.newReport("Report title");
var myTable = report.addTable("myTable");
addColumn([classes])
Add a column and return the created column as a Banana.Report.ReportElement object.
You can add columns only to tables.
var column1 = myTable.addColumn("column1");
var column2 = myTable.addColumn("column2");
var column3 = myTable.addColumn("column3");
addRow([classes])
Add a row and return the created row as a Banana.Report.ReportElement object.
You can add rows only to tables, table headers or table footers.
var tableRow = myTable.addRow();
...
addCell([span])
Add an empty cell and return the created cell as a Banana.Report.ReportElement object.
You can add cells only to rows. You can span cells over columns but not over rows.
tableRow.addCell(); //span empty cell over 1 column (default value)
tableRow.addCell("", 3); //span empty cell over 3 columns
...
addCell(text [,classes, span])
Add a cell to the node and return the created cell as a Banana.Report.ReportElement object.
You can add cells only to rows.You can span cells over columns but not over rows.
tableRow.addCell("Bank", "firstCellStyle", 3); //span cell over 3 columns
tableRow.addCell("1200.65", "secondCellStyle, 1); //span cell over 1 column
...
addLineBreak()
Add a line break and return the created line break as a Banana.Report.ReportElement object.
You can add line breaks only to paragraphs or cells.
// Add a line break to a paragraph
var p = report.addParagraph(" ");
p.addLineBreak();
// Add a line break to a cell
var c = tableRow.addCell();
c.addLineBreak();
addPageBreak()
Add a page break node and return the created page beak as a Banana.Report.ReportElement object.
You can add page breaks only to the report or sections.
var report = Banana.Report.newReport("Report title");
...
report.addPageBreak();
...
addImage(path [,classes])
Add an image and return the created image as a Banana.Report.ReportElement object. Supported formats are:
png
jpg
svg
The path can be relative to the script's folder, the document's folder, the name of a document attacched to the file or a data uri scheme (for images imbedded in the document).
- file:script/<relative_path_to_script_folder>/<image_name>
- file:document/<relative_path_to_file_folder>/<image_name>
- documents:<document_name>
- data:[<media type>][;charset=<character set>][;base64],<data>
You can add images only to sections, paragraphs, cells, captions, headers or footers.
The parameter path can be absolute or relative to the script path.
var report = Banana.Report.newReport("Report title");
// Add an image located in the script folder
report.addImage("file:script/logo_abc.jpg");
// Add an image located in the dcoument folder
report.addImage("file:document/logo_mnp.jpg");
// Add an image saved in the table documents
report.addImage("documents:logo_xyz.jpg");
// Add an image (a red dot) included in the document
report.addImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==");
// Add a SVG base64 image
report.addImage("data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==");
addImage(path, widht, height [,classes])
Overloaded method to add an image and return the created image as a Banana.Report.ReportElement object.
The parameters width and height have the same syntax as css length values. They can be absolute (ex.: "30px", "3cm", ... ) or relative (ex.: "50%", "3em", ...).
var report = Banana.Report.newReport("Report title");
report.addImage("documents:image_logo", "3cm", "5cm");
addFieldPageNr([classes])
Add a field containg the page number and return the created field as a Banana.Report.ReportElement object.
You can add this field only to sections, paragraphs, cells, captions, headers or footers.
var report = Banana.Report.newReport("Report title");
...
// Add the page number to the paragraph
report.addParagraph("Page ").addFieldPageNr();
// Add a page number to the footer
var footer = report.getFooter();
footer.addText("Page ");
footer.addFieldPageNr();
excludeFromTest()
Mark the field to not be tested during a test case. The value is in any case outputed to the test results, it is just ignored during the comparison of the test results.
This is useful, for example, for text fields containing the current date.
var currentDate = Banana.Converter.toLocaleDateFormat(new Date());
var textfield = report.getFooter().addText(currentDate);
textfield.excludeFromTest();
getWatermark()
Return the watermark element.
Only the report has a watermak element.
var watermark = report.getWatermark();
watermark.addParagraph("Watermark text");
getHeader()
Return the header of the element.
Only tables and the report have an header element.
var report = Banana.Report.newReport("Report title");
//Report
var reportHeader = report.getHeader();
reportHeader.addClass("header");
reportHeader.addText("Header text");
//Table
var table = report.addTable("myTable");
var tableHeader = table.getHeader();
tableRow = tableHeader.addRow();
tableRow.addCell("Description");
tableRow.addCell("Amount");
getFooter()
Return the footer of the element.
Only tables and the report have a footer element.
//Report
var footer = report.getFooter();
footer.addText("Footer text");
getCaption()
Return the caption of the element.
Only tables have a caption element.
var table = report.addTable("MyTable");
var caption = table.getCaption();
caption.addText("Table caption text", "captionStyle");
getChildren()
Return the children of the element as an array.
var report = Banana.Report.newReport("Report title");
let section = report.addSection();
section.addParagraph("some text 1");
section.addParagraph("some text 2");
let count = section.getChildren().length; // count == 2
This method was introduced in BananaPlus 10.0.12.151.
getParent()
Return the parent of the element, or null if the element is the root element.
var report = Banana.Report.newReport("Report title");
let section = report.addSection();
let paragraph = section.addParagraph("some text");
let root = paragraph.getRoot(); // root == report
This method was introduced in BananaPlus 10.0.12.151.
getRoot()
Return the root element.
var report = Banana.Report.newReport("Report title");
let section = report.addSection();
let paragraph = section.addParagraph("some text");
let parent = paragraph.getParent(); // root == paragraph
This method was introduced in BananaPlus 10.0.12.151.
getTag()
Return the tag of the element, like 'body', 'p', 'table', 'td' and so on.
var report = Banana.Report.newReport("Report title");
...
report.getTag(); // returns 'body'
footer.getTag(); // returns 'pfoot'
...
getTitle()
Return the title of the element.
Only a document element have a title.
var report = Banana.Report.newReport("My Report Title");
var title = report.getTitle(); // return 'My Report Title'
setOutline(level)
Set the outline level, this is used to create the index when exporting to pdf.
report.addParagraph("1. Text").setOutline(1);
setBookmark(bookmark)
Set a bookmark (or anchor), this is used in conjunction with setLink().
report.addParagraph("Bookmark on page 2").setBookmark("bookmarkpage2");
setLink(bookmark)
Set a link to a bookmark. See setBookmark().
report.addParagraph("-> link to bookmark on page 2").setLink("bookmarkpage2");
setPageBreakBefore()
Set to insert a page break before the element.
// Insert a page break before a paragraph
report.addParagraph("Hello world!!!").setPageBreakBefore();
// Insert a page break before a table
/* first create a table then... */
myTable.setPageBreakBefore();
setSize(width, height)
Set the size of the element.
The parameters width and height have the same syntax as css length values. They can be absolute (ex.: "30px", "3cm", ... ) or relative (ex.: "50%", "3em", ...).
You can only set the size of an image element.
var image = report.addImage("C:/Documents/Images/img.jpg");
image.setSize("3cm", "6cm");
setStyleAttribute(attr_name, attr_value)
Set a style attribute to the element. Attributes ids and values follow the CSS specification. This attibute correspont to the inline styles in Css.
paragraph.setAttribute("font-size", "24pt");
setStyleAttributes(attributes)
Set style attributes to the element. Attributes ids and values follow the CSS specification. Those attributes correspond to the inline styles in Css.
paragraph.setAttribute("font-size:24pt;font-weight:bold;");
setTitle(title)
Set the title of the element.
Title can be only set to a document element.
document.setTitle("Annual report");
setUrlLink(link)
Set a link to an external file (file://...) or a web page (http://....).
To the element the class "link" is automatically added.
report.addParagraph("Link to Banana.ch web page").setUrlLink("http://www.banana.ch");
Banana.Report.ReportLogo
The class Banana.Report.ReportLogo represents the format of a logo's section.
With a Banana.Report.ReportLogo object you can create and insert a logo's section in the report document. The logo format is defined through the dialog File → Logo Setup.
With this class you don't have to rewrite your scripts to change the logo's section, you can just change the format in the dialog Logo Setup, and the script will apply the new format automatically.
Methods
createDocNode(textNode, stylesheet, disambiguosClass)
Create a new Report Element that represent the logo's section as defined in the dialog File → Logo Setup.
The param textNode is the text node to insert within in the logo section.
The param stylesheet is the stylesheet where the styles needed by the logo section are inserted.
The param disambiguosClass is a string used to prevent clashes with stylesheet class names.
// Get the logo format
var headerLogoSection = report.addSection("");
var logoFormat = Banana.Report.logoFormat("Logo");
if (logoFormat) {
// Use the format as defined in the dialog File --> Logo Setup
var logoElement = logoFormat.createDocNode(headerLogoSection, repStyleObj, "logo");
report.getHeader().addChild(logoElement); }
else {
// If the format 'logo' is not defined, insert an image
report.addImage("documents:logo", "logoStyle");
}
Banana.Report.ReportStyleSheet
The class Banana.Report.ReportStyleSheet is used to set the styles to format a report.
It contains multiple Banana.Report.ReportStyle objects.
Create a report stylesheet
A report stylesheet object is created using the function Banana.Report.newStylesheet().
// Create a new stylesheet for the report
var stylesheet = Banana.Report.newStyleSheet();
Page size and orientation
At this moment the report is rendered based on the page size defined in the default printer device.
You can't define a page size, but you can set the orientation with the Style @page.
Page orientation can't be set only once per report, you can't switch from potrait to landscape.
var stylesheet = Banana.Report.newStyleSheet();
stylesheet.addStyle("@page").setAttribute("size", "landscape");
Methods
addStyle(selector)
Create a new style with the given selector. The return object is of type Banana.Report.ReportStyle.
The syntax of selector follows the CSS specification.
- Style name without a preceding dot are reserved predefined tags like "td", "p", "table",... ( e.g. 'addStyle("td")' )
- Style name for a new custom class need a preceding dot "." ( e.g. 'addStyle(".myStyle")' )
The dot name is not used when adding the class name to the element
report.addParagraph("Text to print 24pt", "myStyle");
var style = stylesheet.addStyle(".myStyle");
myStyle.setAttribute("font-size", "24pt");
myStyle.setAttribute("text-align", "center");
report.addCell("Text to print");
var styleTd = stylesheet.addStyle("td");
styleTd.setAttribute("font-weight", "bold");
addStyle(selector, attributes)
Create a new style with the given selector and attributes. The return object is of type Banana.Report.ReportStyle.
The syntax of selector and attributes follow the CSS specification.
var style2 = stylesheet.addStyle(".style2", "font.size: 24pt; text-align: center");
parse(text)
Load the styles from the given text. The text follow the CSS specification.
stylesheet.parse(
"p.style1 {font-size:24pt; text-align:center;}" +
"@page {size:A4 landscape;}"
);
See the How to use CSS file tutorial example.
The selector
The selector follows the css syntax.
Example of selectors:
- .xyz
Select all elements with class xyz. It is used with a preceding dot "." before the class name.
When you set the class to a ReportElement you enter the name without "." - table
Select all tables - table.xyz
Select all tables with class xyz - table.xyz td
Select all cells in tables with class xyz
Example of tag selectors:- @page
Select the page - body
Select the content of the report - phead
Select the page header - pfoot
Select the page footer - div
Select the section - p
Select the paragraph - table
Select the table - caption
Select the caption - thead
Select the table header - tbody
Select the table body - tfoot
Select the table footer - tr
Select the table row - td
Select the table cell
You can get the tag of an element through the method getTag();
Function for adding styles
When you have multiple styles it would be helpful to add a function for all the styles you need. For example:
function exec() {
// Create a new report object with the title "Report title"
var report = Banana.Report.newReport("Report title");
// Add example text for each style in the report
report.addParagraph("Hello World", "title"); // Example text for title style
report.addParagraph("Subtitle Example", "subtitle"); // Example text for subtitle style
report.addParagraph("Header Example", "header"); // Example text for header style
report.addParagraph("Data Example", "data"); // Example text for data style
report.addParagraph("Centered Text Example", "centerAlign"); // Example text for center alignment
report.addParagraph("Right-Aligned Text Example", "rightAlign"); // Example text for right alignment
report.addParagraph("Footer Example", "footer"); // Example text for footer style
// Create a new stylesheet object for the report
var stylesheet = Banana.Report.newStyleSheet();
// Call the function to define and apply styles to the stylesheet
addStyles(stylesheet);
// Display the report in a preview window with the applied stylesheet
Banana.Report.preview(report, stylesheet);
}
// Function that defines all the CSS styles for the report elements
function addStyles(stylesheet) {
// Style for headers: bold font and a bottom border
stylesheet.addStyle(".header", "font-weight: bold; border-bottom: 1px solid black;");
// Style for data cells: padding and a light bottom border
stylesheet.addStyle(".data", "padding: 5px; border-bottom: 0.5px solid #ddd;");
// Style to center-align text
stylesheet.addStyle(".centerAlign", "text-align: center");
// Style to right-align text
stylesheet.addStyle(".rightAlign", "text-align: right");
// Style for the main title: larger font, bold, centered, with top margin
stylesheet.addStyle(".title", "font-size: 16px; font-weight: bold; text-align: center; margin-top: 20px;");
// Style for subtitles: smaller font, centered, with bottom margin
stylesheet.addStyle(".subtitle", "font-size: 10px; text-align: center; margin-bottom: 20px;");
// Style for the footer: small font, centered, with top margin
stylesheet.addStyle(".footer", "text-align: center; font-size: 8px; margin-top: 20px;");
}
Banana.Report.ReportStyle
The class Banana.Report.ReportStyle represents a single style in Banana.ReportStyleSheet object.
It is used to set the style attributes.
Methods
setAttribute(attr_name, attr_value)
Set the attribute value. Attributes' ids and values follow the CSS specification.
style.setAttribute("font-size", "24pt");
setAttributes(attributes)
Set attributes values. Attributes' ids and values follow the CSS specification.
style.setAttributes("font-size:24pt;font-weight:bold;");
Supported properties
font
font-family
font-size
font-style
font-weight
margin [top, right, bottom, left]
margin-top
margin-bottom
margin-left
margin-right
padding
padding-top
padding-bottom
padding-left
padding-right
hanging-ident
text-align
text-decoration
text-ellipsis
vertical-align
color
background-color
border
border-top
border-top-style
border-top-color
border-top-width
border-bottom
border-bottom-style
border-bottom-color
border-bottom-width
border-left
border-left-style
border-left-color
border-left-width
border-right
border-right-style
border-right-color
border-right-width
display
overflow
float
text-wrap
width
max-width
min-width
height
page-break-after
column-break-after
line-break-after
page-break-before
column-break-before
line-break-before
page-break-inside
line-break-inside
size
position
left
top
right
bottom
transform
Supported transformations are: matrix, translateX, translateY, translate, rotate, scaleX, scaleY, scale, skewX, skewY and skew
transformOrigin
orphans
fill-empty-area
Non standard attributes and values
width-sym
This attribute contains a string. Columns with the same width-sym will be laid out with the same width.
layout-sym
This attribute is a string. Tables with the same layout-sym attribute will have the same layout for the width of the columns.
overflow
This attribute has the non standard value "shrink". The content of the node will be down scaled to fit given space.
style.setAttribute("overflow", "shrink");
overflow-shrink-max
This attibute set the maximal down scaling factor (like 0.6).
style.setAttribute("overflow-shrink-max", "0.6");
text-decoration
This attribute can also contain the values "double-underline" or "double-strong-underline".
style.setAttribute("text-decoration", "underline");
border-style
This attribute can also contain the values "double" and "double-strong".
style.setAttribute("border-style", "double");
flexible-width
This attribute can contain the value "always" and is only used with columns. If, in a table, one or more columns have the attribute "flexible-widht", only those columns are enlarged to get the desired table width, untouching the others. Otherwise all columns are enlarged.
fill-empty-area
With this attribute you can fill the remaing space of your page with lines. Lines can be defined through the attribute, which is a string and contains the color, the style and the width of the line.
Style can be: solid, dash or dot.
Examples:
var style1 = stylesheet.addStyle("@page", "black solid 1");
var style2 = stylesheet.addStyle("@page", "green dash 0.5");
Report FAQ
How can I set the orientation of the page and the margins
// Set landscape orientation
styleSheet.addStyle("@page", "size: landscape");
// Page margins top, right, bottom, left
styleSheet.addStyle("@page", "margin: 20mm 20mm 20mm 25mm");
How can I set the size of the page
// Set page size
styleSheet.addStyle("@page", "size: A5");
How can I set the margins of page header and footer
styleSheet.addStyle("phead", "margin-bottom:2em");
styleSheet.addStyle("pfoot", "margin-top:2em");
How can I print the page number on the right of the page footer
document.getFooter().addFieldPageNr("alignright");
stylesheet.addStyle("pfoot", "text-align:right");
Can I print the total number of pages
No
I like a style implemented in a report of Banana Accounting, where can I get the used stylesheet?
In print preview export the report as html and look at the code. You will find the used styles.
Banana.SDecimal
The Banana.SDecimal is a static only class, with static method for high precision decimal calculation.
Static functions only
Banana.SDecimal is a class that provides static methods only.
- Instances of of Banana.SDecimal are not allowed
- The class has not a constructor for Banana.SDecimal.
- Using "new Banana.SDecimal(0)" is an error.
- Calling the method using a variable for example "value.add("123") is an error.
- Static functions take as arguments strings Numeric String (example "1234.56").
- Most functions return a Numeric String (example "1234.56").
Numeric String (Numeric Javascript String)
A Numeric String, a normal Javascript String that contains only numeric data.
- Use Numeric String with the Banana.SDecimal methods to avoid the use of Javascript floating point arithmetic that is not suitable for accounting calculations due to the rounding differences. It is used instead of a Javascript Number.
- The Banana.SDecimal method uses Numeric String as arguments and return values.
- Numeric String are also referred as Internal Numeric Format (for example toInternalNumberFormat).
Characteristics of a Numeric String
- Numeric Strings use only numeric characters, for example '10.00' or '-10'.
- The point '.' is used as a decimal separator.
- Thousand separator are not allowed
- Negative numbers have a minus "-" sign preceding the number ("-1234.56").
- An empty string is considered equal to zero. The following value are the same
- Provide up to 34 digits of numeric precision.
Numeric String initialization examples
If you need to instantiate a Numeric String Prior to using a variable simply assign an empty string.
var balance = ""; // empty Numeric String same as "0"
var balance = "0"; // same as ""
var balance = "1234";
var balance = "1234.00"; //same as "1234"
var balance = "1234.56"; // number with 2 decimals places
var balance = "1234.56789"; // number with 4 decimals places
var balance = "-1234"; //negative number
var balance = "-1234.00"; //negative number same as "-1234"
var balance = "1234.56789"; // negative number with 4 decimals places
// convert a string containing a numeric value in international format to a Numeric String format
var textAmount1 = Banana.Converter.toInternalNumberFormat("1'234,56", ",");
Basic calculations
Use Banana.SDecimal methods for adding, dividing and subtracting Numeric Strings.
// sum '6.50+3.50' and use the default 2 decimal digits
var r = Banana.SDecimal.add('6.50', '3.50'); // return '10.00'
// divide '10/2' and use the default 2 decimal digits
var r = Banana.SDecimal.divide('10', '2'); // return '5.00'
// divide '10/2' and use 5 decimal digits
var r = Banana.SDecimal.divide('10', '2', {'decimals':5}); // return '5.00000'
Sum of two amounts
Examples of Banana.SDecimal methods for adding two Numeric Strings.
// Example input text amounts
var textAmount1 = "1234.56"; // A valid number in string format
var textAmount2 = "-789.12"; // Another valid number in string format
// Perform the addition using Banana.SDecimal.add
var sum = Banana.SDecimal.add(textAmount1, textAmount2);
Convert two amounts from local number format and add
Prior to adding the amounts must be converted to a Numeric String.
Then you can use the Banana.SDecimal.add method.
// Example input text amounts
var textAmount1 = Banana.Converter.toInternalNumberFormat("1'234,56", ","); // A valid number in local format
var textAmount2 = Banana.Converter.toInternalNumberFormat("-789,12", ","); // Another valid number in local format
// Perform the addition using Banana.SDecimal.add
var sum = Banana.SDecimal.add(textAmount1, textAmount2);
Check if an amount is negative
if (Banana.SDecimal.sign('-789.12') < 0) {
// amount is negative
}
Amounts values from Banana.document.table
Within the table, the value amounts and numeric columns are already in Numeric String format.
- You can pass the retrieved values "row.value("Opening");" to the Banana.SDecimal methods.
The example that calculates the total of debits and credits, and the balance of the account in the row "0" of the table.
function calculateBalanceTotal() {
let accountsTable = Banana.document.table("Accounts"); // Reads from table Accounts
let row = accountsTable.row(0); // take the first row (index 0) or the table
let opening = row.value("Opening"); // row.value("column_name_xml") already returns the text in Banana.SDecimal format
let debit = row.value("Debit"); // row.value("column_name_xml") already returns the text in Banana.SDecimal format
let credit = row.value("Credit"); // row.value("column_name_xml") already returns the text in Banana.SDecimal format
let total = Banana.SDecimal.subtract(debit, credit);
let balance = Banana.SDecimal.add(total, opening);
return balance;
}
Sum the balance column
Within the table, the value of the columns number and amounts are already returned in Numeric String format.
You can pass the value directly to the Banana.SDecimal methods.
The example sums all balances of normal accounts.
function calculateBalanceTotal() {
// Get the "Accounts" table
let accountsTable = Banana.document.table("Accounts");
let totalBalance = ""; // instatiate a numeric string
for (let i = 0; i < accountsTable.rowCount; i++) {
let row = accountsTable.row(i);
let account = row.value("Account");
// Only rows with normal accounts (not cost centers or segments)
if (account && !account.startsWith(".") && !account.startsWith(",") && !account.startsWith(";") && !account.startsWith(":")) {
let balance = row.value("Balance"); // get the balance value already in SDecimal format
totalBalance = Banana.SDecimal.add(totalBalance, balance); // Add the balance amounts
}
}
return totalBalance;
}
Rounding context
Functions can be passed a rounding context that specify the rounding properties:
- decimals is the number of decimal digits (default value is 2)
- null returns the value unrounded.
- '0' returns with no decimals.
- '1' to '33' returns the value with the indicated number of decimals.
- mode is the rounding mode (default value is HALF_UP)
- Banana.SDecimal.HALF_UP the amount is rounded to the nearest. The 0.5 are rounded up.
- Banana.SDecimal.HALF_EVEN the amount is rounded to the nearest. The 0.5 are rounded up or down based on the preceding digit.
If the rounding context is omitted no rounding is done.
Rounding context of the accounting file
All Banana document files have a rounding context that can be retrieved with the property Banana.document.rounding (see Banana.document).
Examples:
// no context
var r = Banana.SDecimal.divide('10', '3'); // return '3.3333333333333333333333333'
// with context
var context = {'decimals' : 4, 'mode' : Banana.SDecimal.HALF_UP};
var r = Banana.SDecimal.divide('10', '3', context); // return '3.3333'
var r = Banana.SDecimal.divide('10', '3', {'decimals':0}); // return '3'
// use the rounding property (accounting file 2 decimals)
var r = Banana.SDecimal.divide('10', '3', Banana.document.rounding); // return '3.33'
Methods
Here are the list of all available methods of the SDecimal class.
abs(value1, [, roundingContext])
Static method.
Returns the absolute value of value1
removing its sign. The result is optionally rounded based on the specified roundingContext
.
Parameters:
value1
(string): The Numeric String whose absolute value is to be calculated.roundingContext
(optional): A rounding specification (e.g., number of decimal places). If provided, the result will be rounded accordingly.
Returns:
- A Numeric String representing the absolute value of
value1
, optionally rounded.
var r = Banana.SDecimal.abs('-10') // return '10.00'
add(value1, value2 [, roundingContext])
Static method.
Returns the sum of value1 and value2.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.add('6.50', '3.50'); // return '10.00'
compare(value1, value2)
Static method.
Parameters:
- value1 and value2 are Numeric String.
- return value is a Numeric String.
Returns an integer value:
- 1 if value1 > value2
- 0 if value1 = value2
- -1 if value1 < value2
Banana.SDecimal.compare('3.50', '2'); // return '1'
Banana.SDecimal.compare('3.00', '3'); // return '0'
divide(value1, value2 [, roundingContext])
Static method.
Returns value1 divided by value2.
Parameters:
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.divide('6', '3'); // return '2.00'
isZero(value)
Static method.
Returns a boolean
- true if value is zero
- false if value is not zero
var r = Banana.SDecimal.isZero('3.00'); // return 'false'
max(value1, value2 [, roundingContext])
Static method.
Returns the max between value1 and value2.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.max('6', '3'); // return '6.00'
min(value1, value2 [, roundingContext])
Static method.
Returns the min between value1 and value2.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.min('6', '3'); // return '3.00'
multiply(value1, value2 [, roundingContext])
Static method.
Returns value1 multiplied by value2.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.multiply('6', '3'); // return '18.00'
remainder(value1, value2 [, roundingContext])
Static method.
Divide value1 by value2 and returns the reminder.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.reminder('10', '3'); // return '1.00'
round(value1, [, roundingContext])
Static method.
Returns value1 round to the spcified rounding context.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.round('6.123456'); // no context no rounding
r = Banana.SDecimal.round('6.123456', {'decimals':2}); // return '6.12'
roundNearest(value1, nearest, [, roundingContext])
Static method.
Returns value1 round to the specified minimal amount.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.roundNearest('6.17', '0.1'); // return '6.1'
r = Banana.SDecimal.roundNearest('6.17', '0.05', {'decimals':2}); // return '6.15'
invert(value, [, roundingContext])
Static method.
The invert
function reverses the sign of a numeric value. If the input is positive, it returns the corresponding negative value. If the input is negative, it returns the corresponding positive value. The result is optionally rounded based on the provided roundingContext
.
Parameters:
value
(string): The Numeric string whose sign is to be inverted.roundingContext
(optional): A rounding specification (e.g., number of decimal places). If provided, the result will be rounded accordingly.
Returns:
- A Numric String representing the value with its sign inverted, optionally rounded.
var a = Banana.SDecimal.invert('5'); //return '-5'
var b = Banana.SDecimal.invert('-2.50'); //return '2.50'
sign(value)
Static method.
Returns an integer value
- 1 if value > 0
- 0 if value = 0
- -1 if value < 0
var r = Banana.SDecimal.sign('-5'); // return '-1'
subtract(value1, value2 [, roundingContext])
Static method.
Subtract value2 from value1 and returns the result.
- value1 and value2 are Numeric String.
- return value is a Numeric String.
var r = Banana.SDecimal.subtract('10', '3'); // return '7.00'
Locale conversion
To convert to and from the locale format use the Banana.Converter functions
- Banana.Converter.toInternalNumberFormat(value [, decimals, convZero])
- Banana.Converter.toLocaleNumberFormat(value [, decimalSeparator])
var sum = Banana.SDecimal.add('10000', '2000'); // return '12000.00'
var printValue = Banana.Converter.toLocaleNumberFormat(sum); // return "12'000.00"
Banana.Script
Banana.Script represents the interface to the script file and can be accessed through Banana.script. It is used to get the parameter values defined in the script. For example if you want to print out in a report the publishing date of the script.
Properties
Methods
getParamValue(paramName)
Return the value defined in the script file of the parameter paramName. Return an empty string or the internal default value if the parameter is not defined. Return the first found value, if the parameter is defined multiple times.
Banana.script.getParamValue('pubdate'); // returns for example '2016-05-11'
getParamValues(paramName)
Return all the values defined in the script file of the param paramName . Return an empty array if the parameter paramName is not defined.
// Script.js example:
// ...
// @authors = Pinco
// @authors = Pallino
// ...
Banana.script.getParamValues('authors'); // returns ['Pinco', 'Pallino']
getParamLocaleValue(paramName)
Return the localized value defined in the script file of the param paramName. Return an empty string the parameter is not defined.
// Script.js example:
// ...
// @description = English desciption
// @description.it = Descrizione italiana
// @description.de = German Beschreibung
...
Banana.script.getParamLocaleValue('description'); // returns 'Descrizione italiana' for a system running with the locale 'italian'.
getPath()
Return the path where the extension is located on the computer.
Banana.script.getPath(); // returns for example '/Users/banana.ch/.../ch.banana.application.invoice.default.sbaa'
Banana.Test
The Banana.Test class is used to run unit tests of Banana Extensions.
See also working with the Banana Extensions Test Framework.
Banana Extensiong TestFramework
The Banana Extensions Test Framework is like an usual Unit Test Framework.
Two methodologies are available:
- Verify results
Through assert methods the user can verify some conditions, in case that a condition didn't meet the test fail and it is interrupted.
For example you verify that a method returns a determined value.
Ex.: Test.assertIsEqual(totalVatAmount(), "5000.00");
- Log results and compare them with previous results (expected results)
Through the Banana.Test.Logger methods, you can log test results. Test results are stored under the test/testresults folder. They will be compared at the end of the test with the expected results stored under the folder test/testexpected (results form previous tests), if any difference is found, the test is marked as failed and the differences showed to the user.
In this case you don't care about the exact value returned by a method, but you verify that the method returns the same value across different versions of the BananaApp or Banana Accounting.
Ex.: Test.logger.addKeyValue("Total VAT amount", totalVatAmount());
Create a test case
To create a test case look at the example SampleExtensions/TestFramework.
Run a test case
You can run a test case in two ways (both available starting at Banana Accounting 9.0.4):
- Through the Manage Apps dialog
- Open the Manage Apps dialog
- Select the Banana Extension to test
- Click over 'Show details'
- Click on the button 'Run test case'
- Through the Command line
- banana90.exe -cmd=runtestsapps -p1=path_to_testcase.js|folder
- As parameter p1 you can specify the path to a test case file, or the path of a folder
- In case of a folder all files in the folder and subfolders ending with test.js are run
Test case folder structure
This is the default test structure of a test case. All the files used for the test case are stored in a folder named test.
In the dialog Manage apps the button 'Run test case' button is showed only if the application find a file named test/<same_name_bananaextemsopm>.test.js.
ch.banana.script.bananaapp.js # BananaApps
ch.banana.script.bananaapp2.js
...
test/
ch.banana.script.bananaapp.test.js # BananaApps Test Cases
ch.banana.script.bananaapp2.test.js
...
testcases/
*.ac2 # ac2 files for the test cases
...
testexpected/ # Expected test results used for verifying the current results
ch.banana.script.bananaapp.test/
*.txt
ch.banana.script.bananaapp2.test/
*.txt
...
testresults/ # Current test results
ch.banana.script.bananaapp.test/
*.txt
ch.banana.script.bananaapp2.test/
*.txt
...
Logger output format
The results are saved in .txt with the Latex format. Yes, it means that you can convert the output files in pdf, and look at the results without the log structure commands.
Short example
For a complete example look a SampleExtensions/TestFramework.
// @id = ch.banana.script.bananaapp.test
// @api = 1.0
// @pubdate = 2018-03-30
// @publisher = Banana.ch SA
// @description = Simple test case
// @task = app.command
// @doctype = *.*
// @docproperties =
// @outputformat = none
// @inputdataform = none
// @timeout = -1
// Register test case to be executed
Test.registerTestCase(new TestLoggerSimpleExample());
// Here we define the class, the name of the class is not important
function TestLoggerSimpleExample() {
}
// Test method, every method starting with 'test' will be automatically executed
TestLoggerSimpleExample.prototype.testOk = function() {
Test.logger.addText("This test will pass :-)");
Test.assert(true);
}
The Test object
When a script is run as a test case, a global object named Test is exposed to the script. This object defines properties and methods for executing the test case.
Test.logger.addKeyValue("count", 4);
Test.assert(true);
Properties
logger
The property logger returns an object of type Banana.Test.Logger that permits to log test results. If the script is not run though the Banana Apps functionality this object is null.
var testLogger = Test.logger;
testLogger.addKeyValue("count", 4);
Methods
assert(condition, message)
This method verifies if the condition is true. If the condition is true the test continues, else an exception is thrown and the message message is inserted in the test results.
Test.assert(true, "This test will pass");
assertEndsWidth(string, endString)
This method verifies if text string ends with the text endString. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertEndsWith("This string ends with the text", "the text");
assertIsEqual(actual, expected)
This method verifies if actual equal to expected. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertIsEqual("Those strings are equal", "Those strings are equal");
assertGreaterThan(actual, expected)
This method verifies if actual is greather than expected. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertGreaterThan(10, 8);
assertGreaterThanOrEqual(actual, expected)
This method verifies if actual is greather than or equal to expected. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertGreaterThanOrEqual(8, 8);
assertLessThan(actual, expected)
This method verifies if actual less than expected. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertLessThan(8, 10);
assertLessThanOrEqual(actual, expected)
This method verifies if actual less than or equal to expected. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertLessThanOrEqual(10, 10);
assertMatchRegExp(string, pattern)
This method verifies if string math the regula expression defined by pattern. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertMatchRegExp("This string match the regual expression", /match/);
assertStartsWith(string, startString)
This method verifies if text string starts with the text startString. If the condition is true the test continues, else an exception is thrown and a fatal error is inserted in the test results.
Test.assertStartsWith("This string start with the text", "This string");
closeDocument(document)
Close a document previously opened for testing. Only documents opened via Banana.application.openDocument can be closed. Document opened during tests have to be closed before the test ends.
let testDoc = Banana.application.openDocument("testfile.ac2");
// Do some tests on testDoc
Test.closeDocument(testDoc);
registerTestCase(testCase)
This method register a testCase (an object) to be run as test.
// Register test case to be executed
Test.registerTestCase(new TestLoggerSimpleExample());
setDocument(document)
Set the current document returned by Banana.document.
let testDoc = Banana.application.openDocument("testfile.ac2");
// Do some tests on testDoc
Test.setDocument(testDoc);
Test.closeDocument(testDoc);
setTableValue(tableName, rowNr, columnName, value)
Set the value in table tableName, row rowNr and column columnName. The value is a string, and follow the internal format for numbers, dates, times and boolean.
let testDoc = Banana.application.openDocument("testfile.ac2");
Test.setDocument(testDoc);
Test.setTableValue("Invoices", 3, "Description", "Test Invoice 3");
Test.setTableValue("Invoices", 3, "Date", "2023-09-26");
Test.setTableValue("Items", 12, "UnitPrice", "1200.50");
Test.closeDocument(testDoc);
Banana.Test.Logger
The class Banana.Test.Logger contains methods to log test results.
Methods
addSection(key)
This method inserts a new section named key in the test results. A section is like a chapter 1. A section ends at the end of the test or when the method addSection is called again.
addSubSection(key)
This method inserts a new subsection named key in the test results. A section is like a chapter 1.1. A subsection ends at the end of the test or when the methods addSection or addSubSection are called again.
addSubSubSection(key)
This method inserts a new subsubsection named key in the test results. A section is like a chapter 1.1.1. A subsubsection ends at the end of the test or when the methods addSection, addSubSection or addSubSubSection are called again.
addComment(key)
This method inserts a comment in the test results. Test comments are discarded when comparing with the expected test results.
addCsv(key, table [, columns, separator, comment])
This method inserts the content of a csv text (comma separated values) in the test results.
The optional argument columns let you specify the subset of columns to output and in which order.
The optional argument separator if defined is used as the value's separator. If it is not defined the programm automatically determines the separator from one of '\t' (tabulator), ',' (comma) and ';' (semicolon).
// This output all columns
Test.logger.addTable("This is a table", Banana.document, columns);
// This output only the columns Date, Description and Amount
Test.logger.addTable("This is a table", Banana.document, ["Date", "Description", "Amount"]);
addInfo(key, value)
This method inserts an information in the test results. Test informations are discarded when comparing with the expected test results. Compared to addComment' the key/value information is printed in case you publish the latex result as a pdf.
Test.logger.addInfo("Current date", new Date().toLocaleDateString());
addFatalError(key)
This method inserts a fatal error in the test. If a fatal error is inserted, event in case the results are identical to the expected results, the test fails, and the error message reported to the test differences.
Test.logger.addFatalError("This is a fatal error message");
addJson(key, jsonString [, comment])
This method inserts a json string in the test results. The json string is formatted with identation and the formatted string outputted line by line. If the jsonString contains 'carriage return' characters, then it will be outputted as it is. If the string is not a valid json, the string is outputted as it is.
var obj = {
'count': 100,
'color': "yellow"
};
Test.logger.addJsonValue("Param", JSON.stringify(obj));
addKeyValue(key, value [, comment])
This method inserts a test value in form of key and value. The parameter value is of type string.
Test.logger.addKeyValue("Row count", Banana.document.table("Transactions").rowCount);
addPageBreak()
This method inserts a page break. Page Breaks are discarded when comparing with the expected test results. They are just useful when the output is converted to a pdf file for inspecting visually the results.
Since Banana 9.0.4
addRawText(text [, insertEndl])
This method inserts a raw string in the test results without any modification or cleaning.
The optional parameter insertEndl defaults to true. If true an endl in inserted after the text.
addReport(key, report [, comment])
This method inserts the content of a Banana.Report object in the test results. Only the text elements are inserted, not the element's styles.
var report = Banana.Report.newReport("Report title");
report.addParagraph("Hello World !!!", "styleHelloWorld");
Test.logger.addReport("This is a report", report);
addTable(key, table [, columns, comment])
This method inserts the content of a Banana.Table object in the test results.
The optional argument columns let you specify the subset of columns to output and in whitch order.
// This output all columns
Test.logger.addTable("This is a table", Banana.document, columns);
// This output only the columns Date, Description and Amount
Test.logger.addTable("This is a table", Banana.document, ["Date", "Description", "Amount"]);
addText(key)
This method inserts a simple string in the test results.
addXml(key, xmlString [, comment])
This method inserts an xml string in the test results. The xml string will be formatted with identation and the formatted string outputted line by line. If the xmlString contains 'carriage return' characters, then it will be outputted as it is. If the string is not a valid xml, the string is outputted as it is.
var xml =
"<note>" +
"<to>Pinco</to>" +
"<from>Pallino</from>" +
"<heading>Reminder</heading>" +
"<body>Don't forget me this weekend!</body>" +
"</note>";
Test.logger.addXmlValue("This is a xml value", xml);
getElapsedTime()
This method returns the elapsed test execution time in milliseconds.
newLogger(logname)
This method returns a new logger, results are written in a separated log file named logname. With this methods you can split test results over several files.
If you have a lot of test results it is advised to split the results over more folder and files. This makes it easy to verify the differences between tests.
As a generale rule, if you feed the test with two or more *.ac2 files, split the results in separate files.
Test.logger.addText("This test split the results over more files and folder");
// Write results in a new file called testresults
var testLogger = Test.logger.newLogger("testresults");
testLogger.addText("This text will be written in file testresults.txt");
testLogger.close();
// Write results in a new folder called testgroup
var groupLogger = Test.logger.newGroupLogger("testgroup");
// Write results in a new file called testgroup/testresults1
var test1Logger = groupLogger.newLogger("testresults1");
test1Logger.addText("This text will be written in file testgroup/testresults1.txt");
test1Logger.close();
// Write results in a new file called testgroup/testresults2
var test2Logger = groupLogger.newLogger("testresults2");
test1Logger.addText("This text will be written in file testgroup/testresults2.txt")
test2Logger.close();
groupLogger.close();
newGoupLogger(groupname)
This method returns a new logger, results are written in a separated folder named groupname. With this methods you can split test results over several folders.
If you have a lot of test resutls it is advised to split the results over more folder and files. This makes it easy to verify the differences between tests.
close()
Close the logger for writting and free the reserved system resources (handle, ,memory, ...). This method shold be called for every new logger created with the methods newLogger and newGroupLogger.
Reserved methods
Those methods are used by the BananaApps Test Framework, and should not be directly used.
addTestInfo(key, value)
This method is called automatically by the framework to insert in a test info value like the test name, the running date and time, ...
addTestBegin(key [, comment])
This method is called automatically by the framework to insert in the log file an indication when a test method is started.
addTestEnd()
This method is called automatically by the framework to insert in the log file an indication when a test method is finished. The framework will also automatically insert information about the elapsed time.
addTestCaseBegin(key [, comment])
This method is called automatically by the framework to insert in the log file an indication when a test case is started.
addTestCaseEnd()
This method is called automatically by the framework to insert in the log file an indication when a test case is finished. The framework will also automatically insert an information about the elapsed time.
Banana.Translations
The Banana.Translations class is used to access translators.
Translators let you translate strings to languages other than the application's language.
For a description how to internationalise your extension see the page Extension's Translations
// Exemple for function QT_TRANSLATE_NOOP
var myReportTexts = {};
myReportTexts.account_card = QT_TRANSLATE_NOOP("MyReport", "Account card"); // Mark text for translation
// NB: The variable myReportTexts.account_card contains the source code string "Account card"
// You need a Banana.Translator object to translate it in the desired language
// Get translator for the document's language
var documentLanguage = "en"; //default
if (Banana.document) {
documentLanguage = Banana.document.locale.substring(0,2);
}
var docTranslator = Banana.Translations.getTranslator(documentLanguage, "MyReport");
// Translate to the document's language
var myReportTranslatedText = docTranslator.tr(myReportTexts.account_card);
Methods
getTranslator(locale, context)
Returns a translator for the given local and context.
If no translation for the locale is found, the returned translator is not valid (i.e.: translator.valid returns false). A not valid translator returns the text untranslated as it is in the source code.
var myReportTexts = {};
myReportTexts.account_cards = QT_TRANSLATE_NOOP("MyReport", "Account card");
// Translate to Italian
var trIt = Banana.Translations.getTranslator("it", "MyReport");
var textIt = itTr.tr(myReportTexts.account_cards);
translate(context, text, disambiguation, n)
Translate a string in the language of the application in the specified context.
var myReportTexts = {};
myReportTexts.account_cards = QT_TRANSLATE_NOOP("MyReport", "Account card");
// Translate to the application's language
var text = Banana.Translations.translate("MyReport", myReportTexts.account_cards);
Banana.Translations.Translator
The class Banana.Translations.Translator let you translate strings.
Properties
context
Returns the context of the translator.
language
Returns the language of the translator.
valid
Returns true if the translator is valid.
An invalid translator simply returns the text untranslated as written in the source code.
Methods
tr(text [, disambiguation , n])
Translate a string in the language and context of the translator
// Get translator for the document's language
var documentLanguage = "en"; //default
if (Banana.document) {
documentLanguage = Banana.document.locale.substring(0,2);
}
var docTranslator = Banana.Translations.getTranslator(documentLanguage, "MyReport");
// Translate to the document's language
var myReportTranslatedText = docTranslator.tr(myReportTexts.account_card);
translate(context, text [, disambiguation , n])
Translate a string in the language of the translator in the specified context.
// Get translator for the document's language
var documentLanguage = "en"; //default
if (Banana.document) {
documentLanguage = Banana.document.locale.substring(0,2);
}
var docTranslator = Banana.Translations.getTranslator(documentLanguage, "MyReport");
// Translate to the document's language
var myReportTranslatedText = docTranslator.translate("MyReport", myReportTexts.account_card);
Banana.Ui
This class Banana.Ui contains methods to interact with user interface.
Add Message
You can display information to the user by using the following functions:
- Banana.document.addMessage()
- Banana.document.clearMessages()
- table.addMessage()
- row.AddMessage()
- Banana.application.addMessage()
- Banana.application.getMessages()
Simple Display and Input
For simple display and input of data from the user you can use the Banana.Ui Methods likes:
- showText()
Show the given text in a dialog with the given title. - showQuestion()
how the user a question dialog with Yes and No buttons. - getText()
Show the user a dialog asking to insert a text. - getDouble()
Show the user a dialog asking to insert a double. - getItem()
Show the user a combo box dialog asking to select an item from a list.
Structured data input
The openPropertyEditor() function create a structured dialog for entering data.
It is particularity useful for letting the user customize the extension.
Creating Widgets
With QT Creator you can design any kind of widget and use it in the extension to visualize o get data from the user.
Banana.Ui Methods
This class Banana.Ui contains methods to interact with user interface.
createPropertyEditor(title, params, [dialogId])
Create a dialog to set given params. To display the dialog use the method exec(). To get the modified parameters use the method getParams().
It used in combination of the openPropertyEditor.
For more information on how tu use see:
Public slots:
- void addCustomCommand(functionName, commandLabel)
//allows to call a function of the script from a command in the dialog - void addImportCommand()
//allows to import the extension's settings from other files - QJSValue getParams()
//returns the params of the dialog - void setParams(QSJValue params)
//allows to set the params of the dialog
createUi(uiFilePath)
Read the file uiFilepath and return an object representing the dialog. The uiFileName has to be in the same directory as the running script. You can also load a ui file from the table documents with the prefix 'documents:', ex.: 'documents:calculator.ui', For details and examples see Script dialogs or the tutorial JavaScript Tutorial 1.
Every widget defined in the ui file is exposed to the script environment and you can interact with them like in c++ code. You find further details under Banana.Ui.Widget.
If an error occurred undefined is returned.
Example:
@includejs = ch.banana.calculator.dialog.js; // Define the class Calculator
// that control the .ui file
...
var calculatorUi = Banana.Ui.createUi("ch.banana.calculator.dialog.ui");
var calcJs = new Calculator(calculatorUi);
Banana.application.progressBar.pause(); // Pause wait cursor
calclatorUi.exec(); // Show the dialog
Banana.application.progressBar.resume(); // Restart wait cursor
getDouble(title, label [, value , min, max, decimals])
Show the user a dialog asking to insert a double. Return the inserted double or undefined if the user clicked cancel.
var a = Banana.Ui.getDouble("Title text", "Label text");
var b = Banana.Ui.getDouble("Title text", "Label text", "10.0");
getInt(title, label [, value, min, max, steps])
Show the user a dialog asking to insert an integer. Return the inserted integer or undefined if the user clicked cancel.
var a = Banana.Ui.getInt("Title text", "Label text");
var b = Banana.Ui.getInt("Title text", "Label text", "5", "1", "10","1");
getItem(title, label, items [, current, editable])
Show the user a combo box dialog asking to select an item from a list. Return the selected item or undefined if the user clicked cancel.
var value = Banana.Ui.getItem("Input", "Choose a value", ["a","b","c","d","e"], 2, false);
getItems(title, label, items [, selectedItems])
Show the user a list dialog asking to select one or more items from a list. Return the selected items or undefined if the user clicked cancel.
var value = Banana.Ui.getItems("Input", "Choose one or more values", ["a","b","c","d","e"], ["b","c"]);
Since: Banana Experimental 9.1.0
getPeriod(title, startDate, endDate [, selectionStartDate, selectionEndDate, selectionChecked])
Show the user a dialog asking to select a period like the tab Period. Return an object with the atributes 'startDate', 'endDate' and 'hasSelection' or undefined if the user clicked cancel. Date values are in the format "YYYY-MM-DD".
var period = Banana.Ui.getPeriod("Title text", "2016-01-01", "2016-12-31");
if (period) {
var selectedStartDate = period.startDate; // return the start date of the selected period
var selectedEndDate = period.endDate; // return the end date of the selected period
}
getText(title, label [, text])
Show the user a dialog asking to insert a text. Return the inserted text or undefined if the user clicked cancel.
var text = Banana.Ui.getText("Title text","Label text");
openPropertyEditor(title, params, [dialogId])
For more information:
Show the user a dialog asking to set given params.
Return the modified params or undefined if the user clicked cancel.
- See Invoice Extension containing examples with this method.
- see the structure example on GitHub

showHelp(uiFileName)
Show the help of a dialog. The help is loaded from the Banana.ch web site.
showInformation(title, msg)
Show the user an information dialog.
Banana.Ui.showInformation("Information", 'Insert here the text of the information.');
showQuestion(title, question)
Show the user a question dialog with Yes and No buttons. Return true if the user clicked Yes, otherwise false.
var answer = Banana.Ui.showQuestion("Question title", "Insert here the text of the question");
showText(text)
Show the given text in a dialog. The text can be plain text of html and span over multiple lines. If the text is in html the title is taken form the html. The dialog enables the user to save the content in the formats html, pdf, odf and txt.
The use of pixels to set the font sizes is not supported, the text is not rendered properly.
// Normal text
Banana.Ui.showText("Insert here the text.");
// Html text
Banana.Ui.showText('<html><header><title>This is title</title></header><body>Hello world</body></html>');
showText(title, text)
This is an overloaded function.
Show the given text in a dialog with the given title. The text can be plain text of html and span over multiple lines. The dialog enables the user to save the content in the formats html, pdf, odf and txt.
showText(title, text, options)
This is an overloaded function.
Show the given text in a dialog with the given title. The text can be plain text of html and span over multiple lines. The dialog enables the user to save the content in the formats html, pdf, odf and txt.
Through the object options it is possible to set the following additional parameters:
- codecName: the name of the codec to be used in case the content will be saved as txt file. Default is 'UTF-8'
- outputFileName: the file name without path to be used in case the content will be saved. The path is current open document path or the user's document path.
var options = {
'codecName' : "latin1", // Default is UTF-8
'outputFileName' : "prova.txt"
}
Banana.Ui.showText("Title", "some text...", options);
Extension Widget Ui Example
This is an example dialog to search in the whole accounting a text.
This example is also found in the tutorial file JavaScript Tutorial 1 under the table documents at code 742.
The dialog:

All the properties and public slots of the widgets in the dialogs will be accessible from the script.
Example UI code
The script file ch.banana.scripts.find.js
- Display the the Ui Widget using the Banana.Ui.createUi().
- Get the text from the user-
- Use the function searchInTables()
- Notify the user when the text has been found with the table.addMessage() function
/**
* This example search a text in all the tables of the document,
* and show the matches in the messages pane.
*/
// @id = ch.banana.scripts.find
// @version = 1.3
// @date = 2019-12-06
// @publisher = Banana.ch SA
// @description = Find in whole accounting
// @description.it = Cerca in tutta la contabilità
// @description.de = Suchen in der gesamten Buchhaltung
// @description.fr = Chercher dans toute la comptabilité
// @task = app.command
// @doctype = nodocument
// @inputdatasource = none
// @timeout = -1
/**
* param values are loaded from Banana.document, edited through dialog and saved to Banana.document
* This array object is like a map (associative array) i.e. "key":"value", see initParam()
* Examples of keys: searchText, wholeText, ...
*/
var param = {};
/** Dialog's functions declaration */
var dialog = Banana.Ui.createUi("ch.banana.scripts.find.ui"); // use "documents:742.ui" in template file
/** Dialog Objects declaration */
var findNextButton = dialog.findChild('findNextButton');
var helpButton = dialog.findChild('helpButton');
var closeButton = dialog.findChild('closeButton');
var searchTextLineEdit = dialog.findChild('searchTextLineEdit');
var matchCaseCheckBox = dialog.findChild('matchCaseCheckBox');
var wholeTextCheckBox = dialog.findChild('wholeTextCheckBox');
dialog.checkdata = function () {
var valid = true;
if (searchTextLineEdit.text.length <= 0) {
Banana.Ui.showInformation("Error", "Search text can't be empty");
valid = false;
}
if (valid) {
dialog.accept();
}
};
dialog.showHelp = function () {
Banana.Ui.showHelp("ch.banana.script.find");
};
dialog.closeDialog = function () {
dialog.close();
};
/** Dialog's events declaration */
findNextButton.clicked.connect(dialog, dialog.checkdata);
helpButton.clicked.connect(dialog, dialog.showHelp);
closeButton.clicked.connect(dialog, dialog.closeDialog);
/** Main function */
function exec(inData) {
//calls dialog
// var rtnDialog = true;
var rtnDialog = dialogExec();
//search text in the whole accounting
if (rtnDialog && Banana.document) {
Banana.document.clearMessages();
searchInTables();
}
}
/** Show the dialog and set the parameters */
function dialogExec() {
// Read saved script settings
initParam();
if (Banana.document) {
var data = Banana.document.getScriptSettings();
if (data.length > 0) {
param = JSON.parse(data);
}
}
// Text at cursor position
var cursor = Banana.document.cursor;
var columnName = cursor.tableName === 'Documents' && cursor.columnName == 'Attachments' ? 'Description' : cursor.columnName;
param["searchText"] = Banana.document.value(cursor.tableName,cursor.rowNr,columnName);
searchTextLineEdit.text = param["searchText"];
// Set dialog parameters
if (param["matchCase"] == "true")
matchCaseCheckBox.checked = true;
else
matchCaseCheckBox.checked = false;
if (param["wholeText"] == "true")
wholeTextCheckBox.checked = true;
else
wholeTextCheckBox.checked = false;
Banana.application.progressBar.pause();
var dlgResult = dialog.exec();
Banana.application.progressBar.resume();
if (dlgResult !== 1)
return false;
// Read dialog parameters
param["searchText"] = searchTextLineEdit.text;
if (matchCaseCheckBox.checked)
param["matchCase"] = "true";
else
param["matchCase"] = "false";
if (wholeTextCheckBox.checked)
param["wholeText"] = "true";
else
param["wholeText"] = "false";
// Save script settings
var paramString = JSON.stringify(param);
var value = Banana.document.setScriptSettings(paramString);
return true;
}
/** Initialize dialog values with default values */
function initParam() {
param = {
"searchText": "",
"matchCase": "false",
"wholeText": "false"
};
}
/** Search a text in the accounting's tables */
function searchInTables() {
var searchText = param["searchText"];
if (param["matchCase"] === "false")
searchText = searchText.toLowerCase();
var tables = Banana.document.tableNames;
// Tables
for (var t=0; t < tables.length; t++) {
var table = Banana.document.table(tables[t]);
var columns = table.columnNames;
// Rows
for (var r=0; r < table.rowCount; r++) {
// Columns
for (var c=0; c < columns.length; c++) {
var textFound = false;
var text = table.value(r, columns[c]);
if (param["matchCase"] === "false")
text = text.toLowerCase();
// Find text
if (param["wholeText"] === "true") {
if (text === searchText)
textFound = true;
} else {
if (text.indexOf(searchText) >= 0)
textFound = true;
}
// Show message
if (textFound) {
table.addMessage("Text \"" + param["searchText"] +
"\" found in \"" + table.value(r, columns[c]) + "\"", r, columns[c]);
}
}
}
}
}
UI file
The UI file has been created using QT Creator
- Install Qt Creator
- Draw the dialog with Qt Creator
- Save the dialog in a .ui file,
- Load the .ui file in the script through the function Banana.Ui.createUi()
The .ui file: ch.banana.scripts.find.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgFind</class>
<widget class="QDialog" name="DlgFind">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>193</height>
</rect>
</property>
<property name="windowTitle">
<string>Find</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>40</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="searchTextLabel">
<property name="text">
<string>Search &text</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="searchTextLineEdit"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Options</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="matchCaseCheckBox">
<property name="text">
<string>&Match case</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="wholeTextCheckBox">
<property name="text">
<string>&Whole text</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="findNextButton">
<property name="text">
<string>&Find</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="helpButton">
<property name="text">
<string>Help</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>matchCaseCheckBox</tabstop>
<tabstop>findNextButton</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
Banana.Ui.Widget
Every widget defined in a ui file is exposed to the script engine.
You can get a particular widget through it's name and the method findChild:
For every widget you have access to:
- properties
- public slots
- signals
If a method is not defined as public slot in c++ qt api, it will not be available to the script engine. Some widgets are wrapped so that you have access to additional methods, see next chapter Wrapped widgets.
For complete examples see the page Script dialogs or the tutorial JavaScript Tutorial 1 (documents 740 'QTableWidget interaction' and 742 'Find dialog').
Example:
// Load ui file
var dialog = Banana.Ui.createUi("ch.banana.scripts.find.ui");
// Get the label/widget through it's name
var statusLabel = dialog.findChild('statusLabel');
// Set the text of label/widget
statusLabel.setText('Hello!');
// Connect button box accepted signal to the dialog close method
var buttonBox = dialog.findChild("buttonBox");
buttonBox.accepted.connect(function() {dialog.close();});
Banana.application.progressBar.pause(); // Pause wait cursor
dialog.exec(); // Show the dialog
Banana.application.progressBar.resume(); // Restart wait cursor
Signals
You have three ways to connect signals to methods.
// Method1: Connect a signal to a function
function findNext() {
Banana.console.log('find next');
}
findNextButton.clicked.connect(findNext);
// Method2: Connect a signal to an object method
var object = {}
object.onClicked = function() {
Banana.console.log('clicked');
};
findNextButton.clicked.connect(object, object. onClicked);
// Method3: Connect a signal to an inline function
findNextButton.clicked.connect(
function(){Banana.console.log('clicked');}
);
Wrapped widgets
The widgets listed below have been wrapped to let you use additional methods that are not exposed to the script engine because they are not declared as public slots.
Hereby only the additional available methods are listed. Their usage and parameters correspond to the c++ counterpart.
QObject
Methods:
findChild(name)
QComboxBox
Methods:
addItem(text)
addItems(texts)
count()
insertItem(index, text)
insertItems(index, texts)
removeItem(index)
QTableWidget
Since: Banana Experimental 9.1.0
Properties:
currentColumn
currentRow
Methods:
currentItem()
item(row, column)
setColumnWidth(column, width)
setEditTriggers(triggerFlag)
setHorizontalHeaderLabels(labels)
setColumnCount(columns)
setCurrentCell(row, column)
setRowCount(rows)
QTableWidgetItem
Properties:
background
checkState
flags
foreground
text
Extensions Dialog PropertyEditor
The Dialog Property Editor allows to create a flexible dialog that allows the user to enter data.
The structure and content of the Dialog is defined with a JSon.
It is useful for extensions settings and in particulary in the settingsDialog() function.
createPropertyEditor(title, params, [dialogId])
Create a dialog to set given params. To display the dialog use the method exec(). To get the modified parameters use the method getParams(). The structure of params is described in the openPropertyEditor paragraph.
Public slots:
- void addCustomCommand(functionName, commandLabel)
//allows to call a function of the script from a command in the dialog - void addImportCommand()
//allows to import the extension's settings from other files - QJSValue getParams()
//returns the params of the dialog - void setParams(QSJValue params)
//allows to set the params of the dialog
function exec(inData, options) {
let params = {};
params.version = '1.0';
params.data = [];
let editor = Banana.Ui.createPropertyEditor('Dialog Title', params, 'pageAnchor');
let param = {};
param.name = 'header';
param.title = 'header';
param.type = 'string';
param.value = 'this is an example of header';
param.defaultvalue = 'my header';
param.readValue = function () {
param.header = this.value;
}
params.data.push(param);
editor.setParams(params);
editor.addImportCommand();
editor.addCustomCommand("functionName1", "label pushbutton 1");
editor.addCustomCommand("functionName2", "label pushbutton 2");
let rtnValue = editor.exec();
if (parseInt(rtnValue) === 1) {
// Read data from dialog
params = editor.getParams();
Banana.console.debug(JSON.stringify(params));
}
}
function functionName1(params) {
Banana.console.debug("called functionName1");
Banana.console.debug(JSON.stringify(params));
for (var i = 0; i < params.data.length; i++) {
if (params.data[i].name === 'header') {
params.data[i].value = 'hello world';
}
}
return params;
}
function functionName2(params) {
Banana.console.debug("called functionName2");
Banana.console.debug(JSON.stringify(params));
return params;
}
openPropertyEditor(title, params, [dialogId])
Show the user a dialog asking to set given params.
Return the modified params or undefined if the user clicked cancel.
See Invoice Extension containing examples with this method.
Params is an object containing:
- version
A string with a version number. Required '1.0'; - data
An array containing the elements of the property editors.
Element properties of the array
- name: param's key (unique id)
- title: param's title, which appears in the left column "property"
- parentObject (optional):
- Should be the name (id) of the parent's element.
- It let you define a tree structure, as the following one:

see the structure example on GitHub
- type (optional):
- string (default)
A single line of text - multilinestring
A text area with multiple lines - bool
checkbox for setting true/false value - date
calendar popup for date selection - combobox
Use the property items for setting a list of values - color
Color dialog box for color selection - font
Combobox that lets the user select a font family
- value: the value, which appears in the right column "value". For type bool: true/false, for type string and multilinestring a text. For type combox the selected text.
- defaultvalue (optional): value used by Restore Defaults button. If the param has this property the button Restore Defaults will be available.
- items: array of strings. Used by type combobox.
- collapse (optional): true/false. By default the dialog expand all items. If collapse is true the item will not be expanded.
- enabled (optional): true/false. If false the value will appears grey and the user cannot change the value (default: true)
- editable (optional): true/false. If false the user cannot change the value, available only for string and multilinestring types (default: true)
- tooltip (optional): text which appears over the item without clicking on the item
- errorId (optional): error id that identify an error. The error id is used to link the error to the corresponding help page
- errorMsg (optional): error string that describe an error. If a parameter has this property set, the label will be show in red and the error showed on the right of the name.
Validating data
Before accepting data you can validate them using the method validateParams(). If this method returns false the dialog will prevent to close.
function validateParams(params) {
for (var i = 0; i < params.data.length; i++) {
if (params.data[i].value != "myValue") {
params.data[i].errorMsg = "this object is not valid";
return false;
}
}
return true;
}
Example code openPropertyEditor
var paramList = {};
paramList.version = '1.0';
paramList.data = [];
// bool
var param = {};
param.name = 'print_header';
param.title = 'print header';
param.type = 'bool';
param.value = true;
param.readValue = function() {
param.print_header = this.value;
}
paramList.data.push(param);
// combobox
var param = {};
param.name = 'methodId';
param.title = 'Method ID';
param.type = 'combobox';
param.value = 'item01';
param.items = ['item01', 'item02', 'item03'];
param.readValue = function () {
param.methodId= this.value;
}
paramList.data.push(param);
var dialogTitle = 'Settings';
var pageAnchor = 'dlgSettings';
if (Banana.Ui.openPropertyEditor(dialogTitle, paramList, pageAnchor))) {
for (var i = 0; i < paramList.data.length; i++) {
// Read values to param (through the readValue function)
paramList.data[i].readValue();
}
Banana.Xml
The Banana.Xml class is used to parse and access xml data.
Since: Banana Accounting 9.0.5
Introduction
The API Banana.Xml and Banana.Xml.XmlElement implement a subset of the DOM Document Object Model interface. The most used properties and methods are implemented.
For example the list of books in the following xml file:
<Library updated="2016-10-31">
<Book>
<Title>Paths of colours</Title>
<Author>Rosa Indaco</Author>
</Book>
<Book>
<Title>Accounting exercises</Title>
<Author>Su Zhang</Author>
</Book>
</Library>
Can be retrieved with the following code:
var xmlFile = Banana.Xml.parse(xml);
var xmlRoot = xmlFile.firstChildElement('Library');
var updateDate = xmlRoot.attribute('updated');
var bookNode = xmlRoot.firstChildElement('Book'); // First book
while (bookNode) {
// For each book in the library
var title = bookNode.firstChildElement('Title').text;
var authorNode = bookNode.firstChildElement('Author');
var author = authorNode ? authorNode.text : 'unknow';
bookNode = bookNode.nextSiblingElement('Book'); // Next book
}
Properties
errorString
Read only. The string of the last occured error. If no error occured it is empty.
Since Banana 9.0.4
Methods
newDocument(name)
The method newDocument(name) creates a new Xml document and returns it as a Banana.Xml.XmlElment object.
Since Banana 9.0.4
parse(xml)
The method parse(xml) parses a xml data and returns an object of type Banana.Xml.XmlElment that represents the parsed xml. If the xml data is not valid, this method returns null, the occured error can be retrieved through the property errorString.
var xmlFile = Banana.Xml.parse(xml);
var xmlRoot = xmlFile.firstChildElement('Bookshelf'); // The root element is named 'Bookshelf' in this example
save(xmlElement)
The method newDocument(name) returns a Banana.Xml.XmlElment as a string.
Since Banana 9.0.4
validate(xmlElement, schemaFilePath)
The method validate(xmlElement, schemaFilePath) validates a Banana.Xml.XmlElment against a shema. The schema is passed as a path relative to the script path. The method returns true if the validation passed, otherwise it returns false. The occured validation error can be retrieved though the property errorString.
// Create document
var xmlDocument = Banana.Xml.newDocument("eCH-0217:VATDeclaration");
var rootNode = xmlDocument.addElement("eCH-0217:VATDeclaration");
...
// Validate against schema (schema is passed as a file path relative to the script)
var schemaFileName = "eCH-0217-1-0.xsd";
if (Banana.Xml.validate(xmlDocument, schemaFileName)) {
Banana.Ui.showInformation("Validation result", "Xml document is valid against " + schemaFileName);
} else {
Banana.Ui.showInformation("Validation result", "Xml document is not valid againts " + schemaFileName + ": " + Banana.Xml.errorString);
}
Since Banana 9.0.4
Banana.Xml.XmlElement
The XmlElement class represents an Xml element. See Banana.Xml for an example.
Since: Banana Accounting 9.0.3
Properties
nodeName
The read only property nodeName returns the node name of the xml element.
parent
The read only property parent returns the parent of this Xml element as a Banana.Xml.XmlElment object. If this is the root element, it returns null.
text
The read only property text returns the text of this Xml element and their childs.
value
This is a synomin of the property text.
Methods
addProcessingInstruction(target, data)
Adds a new processing instruction to the document.
xmlDoc.addProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"');
Since Banana 9.0.4
addElement(name)
Adds a new Banana.Xml.XmlElement with the specified name to the document and returns it.
Since Banana 9.0.4
addElementNs(ns, name)
Adds a new Banana.Xml.XmlElement with the specified name and namespace to the document and returns it.
Since Banana 9.0.4
addComment(text)
Adds a comment note to the document, and returns it as a Banana.Xml.XmlElement object.
Since Banana 9.0.4
addTextNode(text)
Adds a new Xml TextNode to the document and returns it as a Banana.Xml.XmlElement object.
Since Banana 9.0.4
attribute(name [, defaultValue])
Returns the value of the attribute with the specified name as a string. If no attibute with the specified name is found, the defaultValue or an empty string is returned.
attributeNS(ns, name [, defaultValue])
Returns the value of the attribute with the specified name and namespace as a string. If no attibute with the specified name is found, the defaultValue or an empty string is returned.
createElement(name)
Creates a new Banana.Xml.XmlElement with the specified name and returns it. It doesn't add it to the document.
Since Banana 10.1
elementsByTagName(name)
Returns an array containing all descendants of this element with the specified name.
firstChildElement([name])
Returns the first child element with the specified name if name is non-empty, otherwise it returns the first child element. Returns null if no such child exists.
var bookNode = xmlRoot.firstChildElement('Book'); // First book
while (bookNode) {
// For each book in the library
var title = xmlFile.firstChildElement('Title').text();
bookNode = bookNode.nextSiblingElement('Book'); // Next book
}
hasChildElements([name])
Returns true if this element contains one or mode elemets with the specified name.
hasAttribute(name)
Returns true is the attribute with the specified name exists.
hasAttributeNS(ns, name)
Returns true if the attribute with the specified name and namespace exists.
lastChildElement([name])
Returns the last child element with the specified name if name is non-empty, otherwise it returns the last child element. Returns null if no such child exists.
namespaceURI()
Returns the namespace URI of this node or an empty string if the node has no namespace URI.
Since Banana 9.0.4
nextSiblingElement([name])
Returns the next sibling element with the specified name if name is non-empty, otherwise returns any next sibling element. Returns null if no such sibling exists.
prefix()
Returns the namespace prefix of the node or an empty string if the node has no namespace prefix.
Since Banana 9.0.4
previousSiblingElement([name])
Returns the previous sibling element with the specified name if name is non-empty, otherwise returns any previous sibling element. Returns null if no such sibling exists.
removeChild(oldChild)
Removes oldChild from the list of children. oldChild must be a direct child of this node. Returns a new reference to oldChild on success or a null node on failure.
Since Banana 10.1
replaceChild(newChild, oldChild)
Replaces oldChild with newChild. oldChild must be a direct child of this node.
Since Banana 10.1
setAttribute(name, value)
Adds an attribute with the qualified name name with the value value.
Since Banana 9.0.4
setAttributeNs(ns, name, value)
Adds an attribute with the qualified name name and the namespace URI ns with the value value.
Since Banana 9.0.4
setPrefix(value)
If the node has a namespace prefix, this function changes the namespace prefix of the node to pre. Otherwise this function does nothing.
Since Banana 9.0.4
DocumentChange API
The DocumentChange API is allows to make changes to an open accounting file. There are two possibility to program an extension:
- Create a DocumentChange JSON (documentChange) and use the Banana.document.applyDocumentChange(documentChange)
- Create a DocumentChange JSON (documentChange) and return it in the exec() function.
Logic of the change process
Contrary to other APIs that allow to directly modify the data, Banana Accounting has decided for an approach that gives the user full control of such data.
- You cannot directly modify the content of a file.
- You must create an Extension that return a Document Change JSON.
- Banana Accounting use the JSON and Apply the contained change to the existing file.
- The program shows to the user what changes will take place and will ask the permission to apply the changes. Changes are discarded if not approved.
- If the user agrees, the changes are applied to the document.
- The user can undo and redo the changes.
Use Cases
The DocumentChange API can be used for:
- Add, modify and delete rows in a Table.
- Add, modifify and remove columns in a Table.
- Modify the File Properties
- Importing Transactions.
- Importing Accounts, Suppliers and Customers.
- Importing Invoice and Estimates.
- Create sort of "macro" that takes a user input to create one or multiple transactions.
- Calculate and modify columns content.
Examples
- Examples Rows
- Examples Columns
- Example FileProperties
- Examples General
- Examples Invoices
- Example Change Date
Document Change Extension
Is a Banana Extension that return a Document Change JSON :
- It can be a Productivity or Import Extension.
- The Extensions main function exec() returns a JSON document that describes what changes will be applied to the file content.
- The extension must create and return a Document Change JSON that contains the change that will be applied to the existing data.
Example of an Extension returning a DocumentChange
The extension creates a DocumentChange JSON and returns it to the program.
// Creates a JSON DocumentChange which adds a row to the transaction table.
//
// @id = ch.banana.example.documentchange
// @api = 1.0
// @pubdate = 2024-03-25
// @doctype = *.*
// @description = JSON Change adding a row
// @task = app.command
// @timeout = -1
function exec() {
var strChange = ` {
"format": "documentChange",
"error": "",
"data": [
{
"document": {
"cursorPosition": {
"operation": "move",
"tableName": "Transactions",
"columnName": "Description",
"rowNr": -1
},
"dataUnits": [ {
"nameXml": "Transactions",
"data": {
"rowLists": [ {
"rows": [ {
"fields": {
"Date": "2025-03-25",
"Description": "Total sales 25-03-2025",
"Amount": "2000"
},
"operation": {
"name": "add"
},
"style": {
"fontSize": 12,
"bold": true,
"color": "red",
"background-color": "#00FFFF"
}
} ]
} ]
}
} ],
"fileVersion": "1.0.0",
"id": ""
}
} ]
} `;
var jsonChange = JSON.parse(strChange);
return jsonChange;
}
DocumentChange JSON
The DocumenChange Json is a JSON object that contains the following elements.
- format need to be "documentChange"
- error used to return an error from the script.
- creator information regarding the change.
It will be automatically added by the program.- executionDate time stamp of the script that has created the change.
- executionTime h.
- name (description) comment .
- version version of the script.
data is a JSON array of JSON objects (document) with the changes to be applied.
- Each element of the array is a single change.
- Changes are applied in sequence.
- document is a change to be applied to the accounting file
- id document identifier (usually empty).
"id":"currentRow" used by JsAction::updateRow() - dataUnits the element to be changed (corresponds to the table in the accounting file).
- fileVersion the version of the documentChange specification
- cursorPosition cursor position when changes have been applied (see example code)
- operation "move" The cursor moves to the last position of the content (the only attribute available at the moment. Future attributes: select, deselect)
- tableName xml tablename, where to position the cursor
- columnName xml columnname, where to position the cursor
- rowNr index of the row, where to position the cursor (-1 move to the last row of the table)
Properties of DataUnits
The dataUnits array element defines the dataUnits which is going to be changed and includes also the list of changes.
- nameXml is the xml name of the data structure.
It can be- A name of an existing Table ("Account, Transactions, ...)
- FileInfo for the file properties (Menu > Tools > File Info).
See Example DocumentChange FileProperties.
- nid is the id of the data structure. It is optional and can be passed in place of the nameXml
- rowLists Is an array containing rows
- rows Is an array containing all the rows can be also defined as "Views" when we are working with columns
- fields Is an Object which with the column names that are going to be modified and the value.
(Example: "fields": {"Date": "2019-01-05", "Description": "Sell of goods"} - style Is an object which define the row style
- fontSize define the size of the font, can ben one of 8, 10, 12, 14 or 0 (use default style)
- bold true for bold
- italic true for italic
- color the text color (From version 10.1.20)
- "none" the color will be removed.
- background-color the background color for the row. (From version 10.1.20)
- "none" the color will be removed.
- operation Is an object which defines the operation that has to be executes on the relative row or column.
- name define the type of operation
- add, add a new row
- sequence: 1.1 to add after the row 1.
- sequence: 1.2 to add after the 1.1
- if no sequence is given the row is added to the end of the table.
- delete
sequence indicates the row or column to be deleted from the accounting file. - modify
sequence indicates the row or column we want to modify with the previously specified fields or properties - move
sequence indicates the row or column we want to move and moveTo the row or column destination; - replace
sequence indicates the row or column we want to replace with the previously specified fields or properties;
- sequence
Is the row or column number. The sequence is always referred to the status of the file, prior to the changes.- Use 1.1 to add a new row after the existing row at line 1.
- viewList Is an object containing the array views
- views Is an array containing views
- view Is an array of columns
Example Document Change JSON
The Document Change consists of a JSON object with a list of document changes (data). Each document change (document) contains the list of changes that must be applied to the accounting file. The basic structure is:
{
"format": "documentChange",
"error": "",
"data": [{
//First document
"document": {
"id": "firstChange",
"dataUnits": [{
"data": {
"rowLists": [{
"nameXml": "Base",
"rows": [{
"operation": {
"name": "modify"
},
"fields": {
"SectionXml": "Base",
"IdXml": "HeaderLeft",
"ValueXml": "Changed header1 with documentChange"
}
}]
}],
},
"nameXml": "FileInfo",
"nid": ""
}]
}
}, {
//Second document
"document": {
"id": "secondChange",
"dataUnits": [{
"data": {
"rowLists": [{
"rows": [{
"operation": {
"name": "delete",
"sequence": "10"
}
}]
}]
},
"nameXml": "Transactions"
}]
}
}, {
//Third document
"document": {
"id": "secondChange",
"dataUnits": [{
"data": {
"rowLists": [{
"rows": [{ // remove the existing account at line 7
"operation": {
"name": "delete",
"sequence": "7"
}
}, { // add a new account at line 7
"fields": {
"Date": "2025-01-04",
"Description": "Bank Account",
"Account": "1001"
},
"operation": {
"name": "add",
"sequence": "7"
}
}]
}]
},
"nameXml": "Accounts"
}]
}
}, {
//Fourth document
"document": {
"id": "secondChange",
"dataUnits": [{
"data": {
"rowLists": [{
"rows": [{ //add first transaction
"fields": {
"Date": "2025-01-04",
"Description": "Purchase of goods",
"AccountDebit": "4200",
"AccountCredit": "2001",
"Amount": "1300"
},
"operation": {
"name": "add"
}
},
{ // add second transaction, using the account added in the previous document
"fields": {
"Date": "2025-01-05",
"Description": "Sell of goods",
"AccountDebit": "1001",
"AccountCredit": "3000",
"Amount": "1500"
},
"operation": {
"name": "add"
}
}
]
}]
},
"nameXml": "Transactions"
}]
}
}]
}
Sequence property for rows
When modifying, deleting rows you need to specify the sequence.
- The sequence is the existing row number.
- The first row is 0.
- The number refer always to existing row number.
- If the row number refer to a non existing row, the single/whole ?? change is refused.
- When deleting or inserting a new row the existing row numbers are not changed.
- When adding use a decimal value.
- sequence 1.1 means the row will be added after the row 1.
- sequence 1.2 means the row will be added after the row 1.1.
- sequence -1 means the row will be added before the 0.
- When adding or moving you can use any sequence number, if will simply be used for sorting.
Sequence numbers and operation:
- Command Modify.
The number of the row to be modified.
For example sequence: 1, will change the existing row 1 - Command Replace.
The number of the row to be replaced.
The content of the row is completely replaced. It is like removing a line and adding a new one.
For example sequence: 1, will replace the exiting row 1 - Command Delete.
The number of the row to be deleted,
For example sequence: 1, will remove the existing row 1 - Command Move.
The number of the row to be moved.
For example sequence: 1, moveTo: 5.1 will move row 1 after the existing row 5. - Command Add.
The index of the row to be added.
Use -1 or -10 to add a row before the 0.
For example 1.1 add a line after the row 1.
If no sequence is indicated, the new row will be appended.
The engine applies the changes using the following logic:
- It first process the instructions to modify the rows.
- The existing rows sequence remains unchanged.
- It add the new rows.
- Therefore you cannot modify a rows that has been added.
- It remove the rows to be deleted.
- It sort the rows using the new sequence number.
For unchanged rows the existing sequence number is used.
Sequence property for columns
For columns the sequence property is used to specify the display sequence.
Document for Multiple change steps
Within the same DocumentChange JSon you can have a series of changes that will be applied in several steps. This allows to do complex changes to the accounting file, without triggering errors.
For example s assume you need to remove and add accounts and transactions at the same time. If you add transactions that use a new account before the account is added, there will be an error. The multi-step approach allows you to submit a change that ensures system integrity. In this case the script will return a JSON object with a list of document changes,
- First document: Change the accounting settings
- Second document: Remove existing transactions
- Third document: Remove and add accounts
- Fourth document: Add the new transactions
The "data" element is an array of object of type "document" that contains the changes.
You can have multiple "document" with changes that will be applied in the specified sequence.
{
"format": "documentChange",
"error": "",
"data": [{
//First document
"document": {
"id": "firstChange",
"dataUnits": [{
"data": {
"rowLists": [{
"nameXml": "Base",
"rows": [{
"operation": {
"name": "modify"
},
"fields": {
"SectionXml": "Base",
"IdXml": "HeaderLeft",
"ValueXml": "Changed header1 with documentChange"
}
}]
}],
},
"nameXml": "FileInfo",
"nid": ""
}]
}
}, {
//Second document
"document": {
"id": "secondChange",
"dataUnits": [{
"data": {
"rowLists": [{
"rows": [{
"operation": {
"name": "delete",
"sequence": "10"
}
}]
}]
},
"nameXml": "Transactions"
}]
}
}, {
//Third document
"document": {
"id": "secondChange",
"dataUnits": [{
"data": {
"rowLists": [{
"rows": [{ // remove the existing account at line 7
"operation": {
"name": "delete",
"sequence": "7"
}
}, { // add a new account at line 7
"fields": {
"Date": "2025-01-04",
"Description": "Bank Account",
"Account": "1001"
},
"operation": {
"name": "add",
"sequence": "7"
}
}]
}]
},
"nameXml": "Accounts"
}]
}
}, {
//Fourth document
"document": {
"id": "secondChange",
"dataUnits": [{
"data": {
"rowLists": [{
"rows": [{ //add first transaction
"fields": {
"Date": "2025-01-04",
"Description": "Purchase of goods",
"AccountDebit": "4200",
"AccountCredit": "2001",
"Amount": "1300"
},
"operation": {
"name": "add"
}
},
{ // add second transaction, using the account added in the previous document
"fields": {
"Date": "2025-01-05",
"Description": "Sell of goods",
"AccountDebit": "1001",
"AccountCredit": "3000",
"Amount": "1500"
},
"operation": {
"name": "add"
}
}
]
}]
},
"nameXml": "Transactions"
}]
}
}]
}
Convenience class for Document change
The InvoiceApp is an Invoice Dialog Extension that internally use a DocumentChange class that provide a convenient way to create a Document change JSON.
It should be ported to be used to simplify the creation of DocumentChange JSON programmatically.
Basic Examples DocumentChange operations on rows
Example adding a row
The following example shows how to append a row to the Transactions table. If you indicate the sequence, the row will be inserted at the given position. Try this operation
{
"format":"documentChange",
"error":"",
"data":[
{
"document":{
"dataUnits":[
{
"data":{
"rowLists":[
{
"rows":[
{
"fields":{
"Date":"2019-01-04",
"Description":"Invoice 304"
},
"operation":{
"name":"add"
},
"style": {
"fontSize":12,
"bold":"true",
"italic":"false"
}
}
]
}
]
},
"nameXml":"Transactions"
}
]
}
}
]
}
Example modifying a row
The following example shows how to modify the existing row at line 2 in the Transactions table.
{
"format":"documentChange",
"error":"",
"data":[
{
"document":{
"dataUnits":[
{
"data":{
"rowLists":[
{
"rows":[
{
"fields":{
"Description":"Invoice Hello World"
},
"operation":{
"name":"modify",
"sequence":"1"
}
}
]
}
]
},
"nameXml":"Transactions"
}
]
}
}
]
}
Example replacing a row
The following example shows how to replace the existing row at line 2 in the Transactions table.
{
"format":"documentChange",
"error":"",
"data":[
{
"document":{
"dataUnits":[
{
"data":{
"rowLists":[
{
"rows":[
{
"fields":{
"Date":"2020-01-05",
"Description":"Invoice 304",
"Amount":"300.00"
},
"operation":{
"name":"replace",
"sequence":"1"
}
}
]
}
]
},
"nameXml":"Transactions"
}
]
}
}
]
}
Example deleting a row
The following example shows how to delete the existing row at line 2 in the Transactions table.
{
"format":"documentChange",
"error":"",
"data":[
{
"document":{
"dataUnits":[
{
"data":{
"rowLists":[
{
"rows":[
{
"operation": {
"name": "delete",
"sequence": "1"
}
}
]
}
]
},
"nameXml":"Transactions"
}
]
}
}
]
}
Example moving a row
The following example shows how to move the existing row at line 2 to line 5 in the Transactions table.
{
"format":"documentChange",
"error":"",
"data":[
{
"document":{
"dataUnits":[
{
"data":{
"rowLists":[
{
"rows":[
{
"operation":{
"name":"move",
"sequence":"1",
"moveTo":"4"
}
}
]
}
]
},
"nameXml":"Transactions"
}
]
}
}
]
}
Example adding rows to recurring transactions table
The following example shows how to add rows to the table Recurring transactions.
{
"format": "documentChange",
"error": "",
"data": [
{
"document": {
"dataUnits": [
{
"data": {
"rowLists": [
{
"nameXml": "Templates",
"rows": [
{
"fields": {
"Date": "20200705",
"Description": "compleanno Anna",
"Doc": "r1"
},
"operation": {
"name": "add"
}
}
]
}
]
},
"nameXml": "Transactions"
}
]
}
}
]
}
Example adding JSON content in a custom column in the Transactions table
DocumentChange allows you to update a MIME field of type text/json. In this field it is possible to insert several json objects identified by a key.
- The contents of the field must be passed as a string
- Other types of MIME fields (text/html, image/jpg, ...) are currently not supported.
- In Banana you can create a column of type MIME using the menu command: Data - Columns setup, Add new column and choosing Data type Mime
{
"format":"documentChange",
"error":"",
"data": [
{
"document": {
"dataUnits": [
{
"data": {
"rowLists": [
{
"rows": [
{
"fields": {
"Date": "2020-08-07",
"Description":"Writing data to json/text field",
"MyMimeColumn":{
"Object1Key":"{\"amount\":\"100.00\",\"currency\":\"CHF\"}",
"Object2Key":"{\"amount\":\"200.00\",\"currency\":\"EUR\"}"
}
},
"operation": {
"name": "add"
}
}
]
}
]
},
"nameXml": "Transactions"
}
]
},
"fileVersion": "1.0.0"
}
]
}
Example adding attachments (text/plain) to the table Documents
DocumentChange allows you to insert a text in the Attachments Column available in the Documents table. The MIME type is text/plain and cannot be changed.
- The contents of the field must be passed as a string
- Other types of MIME fields (image, HTML text, Markdown code, CSS stylesheet, Javascript code) are currently not supported.
This property has been introduced in BananaPlus 10.1.20
// Creates a JSON DocumentChange which adds a row with an attachment to the Documents table.
//
// @id = ch.banana.example.documentpatchMime
// @api = 1.0
// @pubdate = 2024-04-17
// @doctype = *.*
// @description = Add attachments to Documents Table
// @task = app.command
// @timeout = -1
function exec() {
var jsonContent = {
"billing_info": {
"total_amount_vat_exclusive": "51.00",
"total_amount_vat_exclusive_before_discount": "51.00"
}
};
var jsonChange = {
"format": "documentChange",
"error": "",
"data": [
{
"document": {
"dataUnits": [ {
"nameXml": "Documents",
"data": {
"rowLists": [ {
"rows": [ {
"fields": {
"RowId": "MyDocument 1",
"Description":"Writing data to the attachmnents field",
"Attachments": JSON.stringify(jsonContent, null, 3)
},
"operation": {
"name": "add"
} } ]
} ]
} } ]
} } ]
};
return jsonChange;
}
Examples DocumentChange operations on columns
With the DocumentChange it is also possible to perform operations on columns, in case you want to modify, add or replace a column.
Columns properties
- alignement
- type: text
- values: left|right|center
- description
- type: text
- header1
- type: text
- header2
- type: text
- name
- type: text
- nameXml
- type: text
- width
- type: number
- values: in mm, max value 10000
- definition
- type: object
- values: text, number, amount, date, time, bool, timestamp, timecounter, links,textmultiline, markdown, mime, textencrypted, Default value: text
- decimals
Number of decimals for types amount and number. Default value: 2
- operation
- values: add|delete|modify|move|replace
{
"name": "MyColumn",
"nameXml": "MyColumn",
"description": "This is my column with an amount",
"header1": "MyColumn",
"definition" : {
"type": "amount",
"decimals": "4"
},
"operation": {
"name": "add"
}
}
Example adding a column
The following example shows how to append a column to the Accounts table. If you indicate the sequence, the column will be inserted at the given position. try this operation
{
"format": "documentChange",
"error": "",
"data": [{
"document": {
"dataUnits": [{
"data": {
"viewList": {
"views": [{
"columns": [{
"alignement": "center",
"description": "center column",
"nameXml": "CenteredColumn",
"header1": "My Header 1",
"header2": "My Header 2",
"width": 200,
"operation": {
"name": "add",
"sequence": 0
}
}],
"id": "Base",
"nameXml": "Base",
"nid": 1
}]
}
},
"id": "Accounts",
"nameXml": "Accounts",
"nid": 100
}]
}
}]
}
Example modifying a column
The following example shows how to modify the existing column at line 2 in the Transactions table.
{
"format": "documentChange",
"error": "",
"data": [{
"document": {
"dataUnits": [{
"data": {
"viewList": {
"views": [{
"columns": [{
"header1": "NewDescription XXXX",
"nameXml": "Description",
"operation": {
"name": "modify",
"sequence": "1"
}
}],
"id": "Base",
"nameXml": "Base",
"nid": 1
}]
}
},
"id": "Transactions",
"nameXml": "Transactions",
"nid": 103
}]
}
}]
}
Example replacing a column
The following example shows how to replace the existing column at line 24 in the Transactions table.
{
"format": "documentChange",
"error": "",
"data": [{
"document": {
"dataUnits": [{
"data": {
"viewList": {
"views": [{
"columns": [{
"nameXml": "Amount",
"header1": "AmountAsText",
"definition": {
"type": "text"
},
"operation": {
"name": "replace",
"sequence": "23"
}
}],
"id": "Base",
"nameXml": "Base",
"nid": 1
}]
}
},
"id": "Transactions",
"nameXml": "Transactions",
"nid": 103
}]
}
}]
}
Example deleting a column
The following example shows how to delete the existing column at line 2 in the Accounts table.
{
"format": "documentChange",
"error": "",
"data": [{
"document": {
"dataUnits": [{
"data": {
"viewList": {
"views": [{
"columns": [{
"nameXml": "Description",
"operation": {
"name": "delete"
"sequence": "1"
}
}],
"id": "Base",
"nameXml": "Base",
"nid": 1
}]
}
},
"id": "Accounts",
"nameXml": "Accounts",
"nid": 100
}]
}
}]
}
Example moving a column
The following example shows how to move the existing column to line 2 in the Transactions table. To know the number of a column, double-click on the header of one of them, in the dialog that opens you can see all the available columns, they are represented in ascending order. values start from 0.
{
"format": "documentChange",
"error": "",
"data": [{
"document": {
"dataUnits": [{
"data": {
"viewList": {
"views": [{
"columns": [{
"nameXml": "Description",
"operation": {
"name": "move",
"sequence": "2"
}
}]
}]
}
},
"nameXml": "Transactions"
}]
}
}]
}
Example DocumentChange FileProperties
When changing data to the File Properties (Header, date begin, date end) the change is structured like a change to the table, but using a special table FileInfo.
See: Menu > Tools > File info for the list of elements.
Structure of the DocumentChange:
- You can only use the operation "modify".
- The extension can change only the elements that the user can change.
- The element to be changed
- SectionXml
The name of the section, for example "SectionXml":"Base" - IdXml
The identification, for example "IdXml":"HeaderLeft"
- The value to be changed
- ValueXml
The contents of the field in Xml format, for example "ValueXml":"Changed header1 with documentChange"
Example changing file properties
The following example shows how to change accounting data properties as accounting header.
{
"format":"documentChange",
"error":"",
"data":[
{
"document":{
"dataUnits":[
{
"nameXml":"FileInfo",
"data":{
"rowLists":[
{
"rows":[
{
"fields":{
"SectionXml":"Base",
"IdXml":"HeaderLeft",
"ValueXml":"Changed header1 with documentChange"
},
"operation":{
"name":"modify"
}
},
{
"fields":{
"SectionXml":"Base",
"IdXml":"HeaderRight",
"ValueXml":"Changed header2 with documentChange"
},
"operation":{
"name":"modify"
}
}
]
}
]
}
}
]
}
}
]
}
Generale Examples Document Change API
Complete example creating and running a DocumentChange
The following extension creates a DocumentChange, which adds and changes some rows in the Transactions table.
To try this extension, you can copy and paste the code into a text file and save it in ".js" format.
To install it in Banana you have to click on the Menu Extensions (command Manage extensions...) and then add the file you just created using "Add from file" button.
After this procedure, the file can be run from the Menu Extensions under the new command "Modify ac2 file using documentChange".
// @id = ch.banana.test.create.documentchange.ac2
// @api = 1.0
// @pubdate = 2019-10-09
// @publisher = Banana.ch SA
// @description = Modify ac2 file using documentChange
// @task = app.command
// @doctype = 100.*;110.*;130.*
// @timeout = -1
function exec(inData) {
if (!Banana.document)
return "@Cancel";
var documentChange = {
"format": "documentChange",
"error": "",
"data": []
};
//1. Appends a row to the transaction table
var jsonDoc = transactionRowAppend();
documentChange["data"].push(jsonDoc);
//2. Insert a row to the transaction table at the beginning of the rows
jsonDoc = transactionRowInsert();
documentChange["data"].push(jsonDoc);
//3. Modify all rows in the transaction table
jsonDoc = transactionRowEdit();
documentChange["data"].push(jsonDoc);
// Banana.Ui.showText("json object: " + JSON.stringify(documentChange, null, 3));
return documentChange;
}
function getCurrentDate() {
var d = new Date();
var datestring = d.getFullYear() + ("0" + (d.getMonth() + 1)).slice(-2) + ("0" + d.getDate()).slice(-2);
return Banana.Converter.toInternalDateFormat(datestring, "yyyymmdd");
}
function getCurrentTime() {
var d = new Date();
var timestring = ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2);
return Banana.Converter.toInternalTimeFormat(timestring, "hh:mm");
}
function initDocument() {
var jsonDoc = {};
jsonDoc.document = {};
jsonDoc.document.fileVersion = "1.0.0";
jsonDoc.document.dataUnits = [];
jsonDoc.creator = {};
jsonDoc.creator.executionDate = getCurrentDate();
jsonDoc.creator.executionTime = getCurrentTime();
jsonDoc.creator.name = Banana.script.getParamValue('id');
jsonDoc.creator.version = "1.0";
return jsonDoc;
}
function transactionRowAppend() {
//row operation
var row = {};
row.operation = {};
row.operation.name = "add";
//row fields
row.fields = {};
row.fields["Date"] = getCurrentDate();
row.fields["Description"] = "Executed transactionRowAppend()";
//rows
var rows = [];
rows.push(row);
//table
var dataUnitTransactions = {};
dataUnitTransactions.nameXml = "Transactions";
dataUnitTransactions.data = {};
dataUnitTransactions.data.rowLists = [];
dataUnitTransactions.data.rowLists.push({
"rows": rows
});
//document
var jsonDoc = initDocument();
jsonDoc.document.dataUnits.push(dataUnitTransactions);
return jsonDoc;
}
function transactionRowEdit() {
// Read the table row by row and save some values
var rows = [];
var table = Banana.document.table('Transactions');
for (var i = 0; i < table.rowCount; i++) {
var tRow = table.row(i);
var description = tRow.value('Description');
if (description.length <= 0)
continue;
//row operation
var row = {};
row.operation = {};
row.operation.name = "modify";
var sequence = i.toString();
if (sequence.length <= 0)
sequence = "0";
row.operation.sequence = sequence;
//row fields
row.fields = {};
row.fields["Date"] = getCurrentDate();
row.fields["Description"] = description + " + transactionRowEdit()";
rows.push(row);
}
//table
var dataUnitTransactions = {};
dataUnitTransactions.nameXml = "Transactions";
dataUnitTransactions.data = {};
dataUnitTransactions.data.rowLists = [];
dataUnitTransactions.data.rowLists.push({
"rows": rows
});
//document
var jsonDoc = initDocument();
jsonDoc.document.dataUnits.push(dataUnitTransactions);
return jsonDoc;
}
function transactionRowInsert() {
//row operation
var row = {};
row.operation = {};
row.operation.name = "add";
row.operation.sequence = "0";
//row fields
row.fields = {};
row.fields["Date"] = getCurrentDate();
row.fields["Description"] = "Executed transactionRowInsert()";
//rows
var rows = [];
rows.push(row);
//table
var dataUnitTransactions = {};
dataUnitTransactions.nameXml = "Transactions";
dataUnitTransactions.data = {};
dataUnitTransactions.data.rowLists = [];
dataUnitTransactions.data.rowLists.push({
"rows": rows
});
//document
var jsonDoc = initDocument();
jsonDoc.document.dataUnits.push(dataUnitTransactions);
return jsonDoc;
}
Complete example loading and running an existing DocumentChange
The following code will ask for a DocumentChange file as input, after which it will process the operations present in the document and modify the accounting file accordingly.
To try this extension, you can copy and paste the code into a text file and save it in ".js" format.
To install it in Banana you have to click on the Menu Extensions (command Manage extensions...) and then add the file you just created using "Add from file" button.
After this procedure, the file can be run from the Menu Extensions under the new command "Read document change files (task: app.command)".
// @id = ch.banana.test.read.documentchange
// @api = 1.0
// @pubdate = 2019-12-19
// @publisher = Banana.ch SA
// @description = Read document change files (task: app.command)
// @task = app.command
// @doctype = *
// @docproperties =
// @timeout = -1
function exec(inData) {
if (!Banana.document)
return "@Cancel";
var fileContent = '';
var fileName = Banana.IO.getOpenFileName("Select open file", "", "Json file (*.json);;All files (*)")
if (fileName.length) {
var file = Banana.IO.getLocalFile(fileName)
//file.codecName = "latin1"; // Default is UTF-8
fileContent = file.read();
if (file.errorString) {
Banana.Ui.showInformation("Read error", file.errorString);
return "@Cancel";
}
} else {
Banana.Ui.showInformation("Info", "no file selected");
return "@Cancel";
}
var jsonData = {
"format": "documentChange",
"error": "",
"data": []
};
try {
jsonData = JSON.parse(fileContent);
} catch (e) {
Banana.Ui.showInformation("Info", "error parsing documentChange");
Banana.Ui.showText(fileContent);
return "@Cancel";
}
if (!jsonData)
return "@Cancel";
//Banana.Ui.showText("json object: " + JSON.stringify(jsonData, null, 3));
return jsonData;
}
Invoice Examples Document Change API
Example adding an Invoice
the following example shows how to use document change to create invoices with Document Change in Banana. These rows can only be inserted in the Invoices table using the Estimates and Invoices application. The Invoice JSON object represents the data structure through which a new invoice can be created.
{
"format": "documentChange",
"error": "",
"data": [
{
"document": {
"dataUnits": [
{
"nameXml": "Invoices",
"data": {
"rowLists": [
{
"rows": [
{//Invoice 1
"operation": {
"name": "add"
},
"fields": {
(Invoice JSON Object)
},
{//Invoice 2
"operation": {
"name": "add"
},
"fields": {
(Invoice JSON Object)
}
]
}
]
}
}
]
},
"creator": {
"executionDate": "2021-09-13",
"name": "extension_name.js",
"version": "1.0"
}
}
]
}
Assure that the JSon Invoice Object is valid
It is advisable to check that the JSon Invoice Object is valid. Therefore:
- Create a Json Invoice Object.
- Pass the object to the function Calculate invoice.
- Add the object to the document change
Example Change the Date with the Document Change API
Introduction
This page explains how to update the file properties, accounting dates with Banana Accounting Javascript Extension using DocumentChange API .
Before start, to understand part of the code it's useful to read all the documentation about the DocumentChange API functionalities .
It is very important to have all the dates that match in the accounting document, otherwise the script may not work properly.
This script allows you to change the file dates with the current year. for setting the current year has been created a Date type object, we use his method getFullYear() to recover the year of the current date.
The current date value can be changed in the in the method: initParam();.
In an Accounting file we can find three main places with references to the dates:
- OpeningDate/ClosureDate, which indicate the opening and closing dates of the accounts
- HeaderLeft/HeaderRight, that are the two opposite side headers of a page, where a user could decide to put the dates for example for print a report
- Date, referring to the date field in the table
the internal format is always composed as follows 'YYYYMMDD'.
References
- DocumentChange API
- Script's source: ch.banana.apps.documentchange.dates.js
- Build you first Extension
Function Exec()
The exec() function is the main function, which is called when the extension is executed. This function does the following:
- creates the initial command structure part which is the same for all documents
- calls the methods used to define the rest of the structure and parameters of the documents we want to change
- for every function called, checks that the parameters are not empty
- returns an object containing the whole commands structure
function exec(inData, options) {
var param = initParam();
Banana.console.debug(JSON.stringify(param));
var ischange = false;
var documentChange = { "format": "documentChange", "error": "", "data": [] };
if (param.newaccountingopeningdate.length > 0) {
var jsonDoc = setfileInfo("AccountingDataBase", "OpeningDate", param.newaccountingopeningdate);
documentChange["data"].push(jsonDoc);
ischange = true;
}
if (param.newaccountingclosuredate.length > 0) {
jsonDoc = setfileInfo("AccountingDataBase", "ClosureDate", param.newaccountingclosuredate);
documentChange["data"].push(jsonDoc);
ischange = true;
}
if (param.newaccountingheaderleft.length > 0) {
jsonDoc = setfileInfo("Base", "HeaderLeft", param.newaccountingheaderleft);
documentChange["data"].push(jsonDoc);
ischange = true;
}
if (param.newaccountingheaderright.length > 0) {
jsonDoc = setfileInfo("Base", "HeaderRight", param.newaccountingheaderright);
documentChange["data"].push(jsonDoc);
ischange = true;
}
jsonDoc = setTransactionsDate(param);
if (typeof(jsonDoc) == "object") {
documentChange["data"].push(jsonDoc);
ischange = true;
}
jsonDoc = setBudgetDate(param);
if (typeof(jsonDoc) == "object") {
documentChange["data"].push(jsonDoc);
ischange = true;
}
if (ischange) {
return documentChange;
}
}
Function initParam()
- This method initializes the parameters, which are dates taken from the file informations, and the crurrent date.
- checks if there is a date in the headers taking as reference the opening date of the file, if there is it updates it with the current one
- check that the year of opening and closing have the current year, if not, will update them with the current year
- return an object with al the parameters wee need.
function initParam() {
var param = {};
param.differenceyear = 0;
param.accountingyear = "";
param.newaccountingyear = new Date().getFullYear();
param.newaccountingopeningdate = "";
param.newaccountingclosuredate = "";
param.newaccountingheaderleft = "";
param.newaccountingheaderright = "";
var OpeningDate = Banana.document.info("AccountingDataBase", "OpeningDate");
if (OpeningDate && OpeningDate.length > 4) {
param.accountingyear = OpeningDate.toString().substr(0, 4);
var Headerleft = Banana.document.info("Base", "HeaderLeft");
if (Headerleft && Headerleft.indexOf(param.accountingyear) >= 0) {
Headerleft = Headerleft.replace(param.accountingyear, param.newaccountingyear);
param.newaccountingheaderleft = Headerleft;
}
var Headerright = Banana.document.info("Base", "HeaderRight");
if (Headerright && Headerright.indexOf(param.accountingyear) >= 0) {
Headerright = Headerright.replace(param.accountingyear, param.newaccountingyear);
param.newaccountingheaderright = Headerright;
}
var currentYearint = parseInt(param.newaccountingyear);
var fileYearint = parseInt(param.accountingyear);
param.differenceyear = Banana.SDecimal.subtract(currentYearint, fileYearint);
if (parseInt(param.differenceyear) != 0) {
param.newaccountingopeningdate = param.newaccountingyear.toString() + OpeningDate.toString().substr(4);
param.newaccountingopeningdate = param.newaccountingopeningdate.replace(/-/g, "");
var closureDate = Banana.document.info("AccountingDataBase", "ClosureDate");
if (closureDate && closureDate.length > 4) {
var year = closureDate.toString().substr(0, 4);
var newyear = parseInt(year) + parseInt(param.differenceyear);
param.newaccountingclosuredate = newyear.toString() + closureDate.toString().substr(4);
param.newaccountingclosuredate = param.newaccountingclosuredate.replace(/-/g, "");
}
}
}
return param;
}
Function changeYearInDate()
Calculate the new date for the opening date and the closure date taking as parameters the current opening and closure date and the difference between the current effective date and the current opening date reported in the file information.
conditions:
the opening and the closure date should not be empty.
return the date changed.
function changeYearInDate(differenceyear, OpeningClosureDate) {
if (OpeningClosureDate && OpeningClosureDate.length > 4) {
var Year = OpeningClosureDate.toString().substr(0, 4);
var newyear = Banana.SDecimal.add(parseInt(Year), parseInt(differenceyear));
var changedDate = newyear.toString() + OpeningClosureDate.toString().substr(4);
changedDate = changedDate.replace(/-/g, "");
return changedDate;
}
return "";
}
Function getNewRowDate()
Calculate the new date for the table rows taking as parameters the current date in the table and the difference between the current effective date and the current opening date reported in the file information.
Conditions:
- the current date must be longer than four characters, and should exist
- it must be a difference between the current effective date and the current opening date reported in the file information
Returns the new date.
function getNewRowDate(currentDate, param) {
if (!currentDate || currentDate.length < 4)
return "";
if (param.differenceyear == 0)
return "";
var currentyear = currentDate.substr(0, 4);
var newyear = parseInt(currentyear) + parseInt(param.differenceyear);
var newDate = newyear.toString() + currentDate.substr(4);
return newDate;
}
function setfileInfo()
- this function set the structure of the document wich modify the dates into the files information table
- requires three parameters which represent the identification values of the fields who can containing dates in the file information table
- returns an object with the document structure
function setfileInfo(key1, key2, value) {
//row operation
var row = {};
row.operation = {};
row.operation.name = "modify";
row.fields = {};
row.fields["SectionXml"] = key1;
row.fields["IdXml"] = key2;
row.fields["ValueXml"] = value;
var rows = [];
rows.push(row);
//table
var dataUnitTransactions = {};
dataUnitTransactions.nameXml = "FileInfo";
dataUnitTransactions.data = {};
dataUnitTransactions.data.rowLists = [];
dataUnitTransactions.data.rowLists.push({ "rows": rows });
//document
var jsonDoc = initDocument();
jsonDoc.document.dataUnits.push(dataUnitTransactions);
return jsonDoc;
}
functions setTransactionsDate()/setBudgetDate()
these two functions are very similar, they have the same code and the same document structure, which modifies the rows of the record tables, the only difference is that they are pointing to two different kind of tables:
- transactions
- budget
both call the function getNewRowDate(), wich change the current date founded in the row with the effectvie current one.
Returns an object with the document structure.
setTransactionsDate()
function setTransactionsDate(param) {
var table = Banana.document.table("Transactions");
if (!table) {
return;
}
var rows = [];
for (var i = 0; i < table.rowCount; i++) {
var tRow = table.row(i)
var TransDate = tRow.value('Date');
TransDate = getNewRowDate(TransDate, param);
if (TransDate.length <= 0) {
continue;
}
//row operation
var row = {};
row.operation = {};
row.operation.name = "modify";
row.operation.sequence = i.toString();
row.fields = {};
row.fields["Date"] = TransDate;
rows.push(row);
}
if (rows.length <= 0)
return;
//table
var dataUnitTransactions = {};
dataUnitTransactions.nameXml = "Transactions";
dataUnitTransactions.data = {};
dataUnitTransactions.data.rowLists = [];
dataUnitTransactions.data.rowLists.push({ "rows": rows });
//document
var jsonDoc = initDocument();
jsonDoc.document.dataUnits.push(dataUnitTransactions);
return jsonDoc;
}
setBudgetDate()
function setBudgetDate(param) {
var table = Banana.document.table("Budget");
if (!table) {
return;
}
var rows = [];
for (var i = 0; i < table.rowCount; i++) {
var tRow1 = table.row(i)
var TransDate = tRow1.value('Date');
var TransDateEnd = tRow1.value('DateEnd');
TransDate = getNewRowDate(TransDate, param);
TransDateEnd = getNewRowDate(TransDateEnd, param);
if (TransDate.length <= 0) {
continue;
}
//row operation
var row = {};
row.operation = {};
row.operation.name = "modify";
row.operation.sequence = i.toString();
row.fields = {};
row.fields["Date"] = TransDate;
row.fields["DateEnd"] = TransDateEnd;
rows.push(row);
}
if (rows.length <= 0)
return;
//table
var dataUnitTransactions = {};
dataUnitTransactions.nameXml = "Budget";
dataUnitTransactions.data = {};
dataUnitTransactions.data.rowLists = [];
dataUnitTransactions.data.rowLists.push({ "rows": rows });
//document
var jsonDoc = initDocument();
jsonDoc.document.dataUnits.push(dataUnitTransactions);
return jsonDoc;
}
Changelog
Date BananaPlus BananaPlus Dev API Version Change Notes 2022-03-30 10.1.8 10.0.12.089 1.2.0 New class Banana.Document.Column New method Banana.Document.Table.column New method Banana.Document.Table.viewName New method Banana.Document.Row.style New methods Banana.ReportElement.addHeader1..6 New method Banana.ReportElement.addStructuredText 2022-05-31 10.1.8 10.0.12.151 1.2.1 New method Banana.ReportElement.GetChildren New method Banana.ReportElement.GetParent New method Banana.ReportElement.GetRoot Fixes Banana.ReportElement.addStructuredText 2022-12-02 10.1.8
10.0.13.340 1.2.2 New property Banana.application.qtVersion New property Banana.application.apiVersion Fixes Banana.Document.Table.progressiveNumber for alphanumeric or composite numbers. 2023-02-22 10.1.8 10.1.0.23053 1.2.3 New method Banana.application.getMessages
New method Banana.document.getMessages New property Banana.document.uuid 2023-08-22 n/a 10.1.0.23228 1.2.3 New method Banana.document.addDocInfo 2023-08-25 n/a n/a 1.2.4 Search paths for include scripts via the attribute @includejs or via the method Banana.include has be extended:
1) Relative to the same directory as the file that contains the @include attribute.
2) New: relative to the directories of the currently opened include files, in the reverse order in which they were opened. 2023-09-26 n/a n/a 1.2.5 New method Test.closeDocument
New method Test.setDocument
New method Test.setTableValue
Tutorial Extensions
Embedded Extensions are extensions written in JavaScript and saved directly in the Banana Accounting file. For more information visit:
Embedded extensions examples
The following pages contain code examples for most of the Javascript APIs:
Embedded Extensions examples Tutorial 1
'Hello world' report
Hello World
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialhelloworld
// @description = Tutorial: Hello world
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text
report.addParagraph('Hello World!!!');
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Creating Reports
Add several paragraphs
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialaddseveralparagraphs
// @description = Tutorial: Add several paragraphs
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add several paragraphs with some text
report.addParagraph('This');
report.addParagraph('is');
report.addParagraph('a');
report.addParagraph('text');
report.addParagraph(' '); //Empty paragraph
report.addParagraph('printed');
report.addParagraph('on');
report.addParagraph('several');
report.addParagraph('paragraphs.');
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Add the header
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialheaderstyles
// @description = Tutorial: Add the header with some styles
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add the header
report.getHeader().addClass('header');
report.getHeader().addText('This is the header text aligned to the right with a bottom border', 'header');
//Add some style
var stylesheet = Banana.Report.newStyleSheet();
//Header style
style = stylesheet.addStyle(".header");
style.setAttribute("text-align", "right");
style.setAttribute("border-bottom", "thin solid black");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Add the footer
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialfooterstyles
// @description = Tutorial: Add the footer with some styles
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add the footer with page numbers
report.getFooter().addClass('footer');
report.getFooter().addText('Banana Accounting, v. ' + Banana.document.info('Base', 'ProgramVersion'));
report.getFooter().addText(' - Page' + ' ');
report.getFooter().addFieldPageNr();
//Add some style
var stylesheet = Banana.Report.newStyleSheet();
//Footer style
style = stylesheet.addStyle(".footer");
style.setAttribute("text-align", "right");
style.setAttribute("font-size", "8px");
style.setAttribute("font-family", "Courier New");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Add an image
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialimage
// @description = Tutorial: Add an image
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add an image stored in the document tabel
report.addImage("documents:logo");
//Add a png image passing the content of the image
report.addImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAARqklEQVRogb2ZeVRT1/bHT9+TgiKTIiiCgAMig0wm997MzKKiOHR4WgdAUAhgRQWnIn1Pa21r+161Uu3wfG0d2tfqs1a7bJkHAyGQhJAACSQEUQZFxalWge/vj6AFoVZb+9trfde6f9yz92fvs885dyDkD1i87QTXLRMnLXnDbfLrh6d7f3TSa+aRr718P8+Z6rlv40SX9I3OzqIkm0l2fyTGMzURISPEjhNDd7tNffOIp09hgV9QmyyIgpJFQzVAilkUpIHs3ryZAReOePrk73Bx35vu5DLfnxDb3xPX3cHScXMc68cXhFMOEkKe+z0+nlvrMGHhN14z86RB7BtNNA8GhocGigs1m4GKRaOmXyoWjVoWDQ2bgZbiQk/zYKB5UASx757w9lVmT3LbHGpp6fg0wbdlLsmQ/i8ZcZEe3xFCnn8qcl9CJu+b5nVEw2Z6dRQXdRQHKhYNZb8egCsfIxWLRh2bg0aai0aaix/8ArTZLm5rRYRYPAnDgf0b/qEq3ILEeR650+2J1RPDz7a0jDwvCtdeilwAFZuGchb1EHig1P3VbqS5aKK50FJc1LGZYe9VsmhoKS50FBcHp3l+HWRuPuW3OJYtC32p7nwW1r/kK2FPtBr7RPDzRlotrIl56Xrr4mVQzKJQMwBe2Q+tp3lopLmQBrHvnZ0Z0Hp8hm/tMU8f1SkfP32J/6xb9RQHzQwfWor7cNYejK9lMbjA8HHa108VYWMT9DiWyZOdfasKttzLSmDVhgfYO/0mfAAZIahZvLTrwiuroQgIGgKv66/24ele8liH8Vm+FhZh5oR4EEKcCCHjCSHuzmZmlMDKNm67i9uxQv/AzhaGDw2bGdR2NSwaLQwf53wD6/2eH+39GKRRX3+WqHx/S4hR5D/e7bHwLoQ4nRGE1XQkp0MROBS+ieaiLIDVucjOIcPSBPubNs1sJLXdxe3LBjbTV8fmDFk7Fxg+jnh6l1oR8qvtsWNz5Edfvhd9zdyceDw22GbnSW91pWWiliOEMoiFGhYzCL7QL6jNz3zUvCcBf8TMl45z3K5hMz31FGfITFzk8JHuNOnNXxscM98n6btPF/WNtTZj/WoEJ0I8pXNi2o2Ll5laZ0AADZtB7SzqZ2qk9cu/A/6hxTlO2K2neVAPWOTK/l1KHsS+5W1m6T/cOH9/p3DJ6eVgeY195Vedrxo3PrNtyXLUMALUBLEHBWhheNjo7PIxIeQvfyQBQohNzrTpxQaGN2SHMjJ8ZE9yPTTcoJleE/g6aTLES733/5pjs8PefgXGsHmDtksli0YDxUV5AOuqi9ljpu8pjBo5ekkdi+lTPZKAjuLi+5l+Bu+RIyc9OkbAnbaorW49ju2bU0fIMGeBDSHuRYGsK3U0b0gCRoaHf03x+J4QMvJZJEAIsf3ay1eto7iD1kIdmwMNi7kXZmOzeODN0RFunvvfij6trUyCqiC+j/J1XDDEI9vKil89i+6pfaQqtSwGzQwPseMcdz4jeEIIITsmTf53C8MblEBtf7HiHJyy+28zz8pgZ6tLVrTpqxOhKotFY3ka/rlZcIY8Wsxo27ExahY9ZFo1bAZaNqcvwsp25bNMINZhfJZxmHXQwvCwzWXSvwkhZOlS1rLeG6/hWlMimhWJuKRJgL5yHerOxvUI/Ma8NMhhjM2YxWoW3adiD3ZYR3FQy2bu86xsFz7LBJY6OGwcdiFzeHjTbcqXhJC/fnUs/RRgQNeFAzBUx6NRKkaDJA2tFa8ia7X/UTJwQxFZW89Wsqi+GjYN5QBpKA7qKKY32MbmxWeZQMJ4p6xmDh8K1uB4Rg4Pu1wnHyOE2KgVnzQAt3DnaimaqlejUZqM+vOpuCDLwIdZYaVzfW1+eddwMzPzlwSxbteyGSgHSMVm0MTwsHiM/fpnmcAOV7dPjBw+FI/EM3L4SB/vtN/dw8Hvdnf+T333jbjZlYvGqtVokiWjoUwMoywT3+a8qHOfYOE60KfdCW8/tZbmDus023XyF+R3vkwMY6O+9vFV6hjeoFgqNoNmjgALLcds/Ft8yGr0yfHzrWp0d5yEVvZLAgbpJpQcjWsfa0U8B3nNdHH/2MgR9DvlPFQDzUOB/6wL4wiZ+izoeZbWs2vYnPs1A2Io2Ryo2Vxo2Jz7IgvLVZ9/ueNL9JbgTncRrl78HDp5KvSVSWgoE6OpYhOkJ5KuudqPChzkOGiUVYyGzelTU1wo2JxBMnD4SHNy3v0M+J87MNXztJ7hD4lRR/OQ7+PXGjXDLamp5bih59ZJ3L5yGh2GD9CkWAe9NAl1ZWI0VWSi6lRq9+Txo4YcrDaHPGYUGzlCyB9xXktxoWAxt/jW1pF/hH6Bnf0aLcPrqR2mSPU0D5+6T5FuS39pX1/Pib7blz9F96XP0Nb4NgyKZDRJk1BfJoa+YjMqT6Zec7U3CxwSgBlt80INi3tXQ/NNSVAmydkcNDAC5AeyjNzRtsG/B36ds+viilnUlbpHfD/wr5lF9+308DxdWv6mvPdODq61vo8u4z60N+5Cs3wtGqVi1Jcmw1C5HcXH1rQNWQP99tf1Tq6HWngiKCgOqtkm53K26VrLCFAaSF3Ndp2aHkGI5ZOAv2BnZyOeMHFr+Sz6Rj0jGOTzgZQUF2U+ATdz1sYU/nwnp+fGxSxcad6Fy4Z30K59DYaqNWisEENTnIKW6myczlmqtRtJhjwzPTCHfR5eeaYkuKimuJD3q5riQkPzUcfw8a1vYNWa8S4bY2zsgzImTnSOsbW1DSJkFJfYW71q7zohzmGi37qJLuu/nRlUreUIoGb4JvgB/h6ols3F2SBWp6Ziz5Wfr/0dl5vS0aHbgi7Du2hVr4e+ai105WJoilJxUb4TOVlRpbyB58CjZkOI+wfTZhQ284KhoHmoYnOHSMPw0cARopLN3DnpG6D5yNOn8AMPr7M5Hj4/Hvf2V0hYzI16jgAahj/s+Aeqprio8p+Fih1r7t/sfhtd+tXoaEhCh3Yruoz/hFGRCH1lMhokKVAXpaGtehe2rQ46Sgj562OnfhQhTttcJx+t5whRzxFCTvEgo3io6teD6xqaj3qOADqu6KHqOULU0PxB9w0rmofqIAoSYQQMVbvR3ZmMTm0cWmvjcfXCAXTotkFftRqNFWLUl6airiQdxrLtWCyatPlJ2pcQQswj7camnJwZ1NjIC4aOGwwFI4CM4j+xqujHiOKj0p9G+evxuHp1O7oMsbikiUW7dhu62w6jRRkPfZXY1D7FKWgsz4T8VOJtbxfLp9sN7QmZ/vK4ibuO+gbWKBkhGnnBqOeKUMMIUE0LUEUPBq6m+VAyAqgemywPVUE8lIWHQit7Bd2X4tDZEI+L6gTc6Pgv2rWZaJYnQl+ZgoayVKgLU2GUZuLIG+FqQshTfd17aCMJcQm0tF6W4ux28CNP38qzgezLEhanV0bzIWcEkPcnVM7m9p7xZ3UenxmglVK8niqaD9mjYvNREciD5MO56OqMR1fTalxUr8C11kO4fvEQjIo4GKpN1a8rSUV9aRqai5IhXuzxq6+VT2tj7QiZOdPScnaonf2yhfaOCYvsJ6yJsB27kra2i3I2M6N2T/U8V8MRDYWn+ZAF8FGQIERL8wpcNybiknoFLut34k7XWbTWrkVz9RroZWI0nDct3vrSNEiPLLo3ZbzF7zqHnspEhIx4Z5rXQQ03GJW0AJW08KGktBCyQCEKw3molbyI7rY1aK9fhQ7tJty9XoxO3WY0y+NgqBI/XLy1Ba+iMS8Fe5IDvieEmP+p8N6EPL9ryoycOl4oZIwIFbRwkCpZQpSweZAcj0ZXZwI6G1aio+FV3L1xHl3Ne2BUrIKhWmx6gSlLgbowFXWFG1D91d96/KdYxfyp8FGEmO+c5nVQxQuFjAlGOS38RYwQFZQQZYF8FO6JQPuleFzWLUenbgPudpfjWut+tChXolmejCZZMnQSMTRFaVDlvwpjcTr+vsbvNHl2HxaG2rIxY6zf8/Q9XMMNRQUjgoQWopwWmcSIUEGLIAkUIm9DCJr1K3ClcSWu6LNw72YVrl14Hy3KlTAqkqDvh68vTYUqPxW60q0o+njRdZdxI/jDxX0+lHIKf2sXd/2Bfy7J3LYxKlokmuqcnf10H7CW2kyy+8DL/ysVPxwVnGBIGNEgldMiSAJE+CFBBK3mZXQZYnHjUg7u3Vaiy7jHVPkH8OX98HliaIq3Qv9jKl4Mcc4eNrD7OAtB9alVt291bMLtLjHuXPtX76XG9zvPffvqt7v/sSDzhYX+4W9kz/HYtXXRhGVRlHVq1FTz7Gzv51OjpppHRDhaxsYGjIsMcPfbN93vnJIfDgk3BGWcYJzvVxknGOeZEJwPDMa5ZVzUyhaj+1IG7l7/EXe7S9GhzYRRsaofXgxdeTIaylJRWyCGumgLLkpewxtr/L4nw33MIoSQyY4WYdqyrXd/6vwPWlSJuNnxFnC/EOgrBHpOo+fGERgb97VJirOVZ05uyDt9OPZU7pH4kycOLf/f5x+/fO7w1nnSs8GhlxWiuShhglHCCUEJJ/ShyjihKA0S4OxSCmpZLH66/gXu36pCd9t/0KpOgFERb+r5SlPlG8rSoC4QQ120GZdku/HZ6wKNvRWZ/rjZN0+J5++53/YumipSoK9KwBXjFty+9jnu3c5H790yoCcP6DuDnzoO4IJsM4xVG9GqWQ/VwZdQvWABVC+vRSk/EiVMCEq4oQ9VyoSiOFCIH1Yvgl73IXruSXHr8gm0azP6+z0RhuoUNEqToS1P6e95MdTF29Au34tT70YZPV1Hcp6khR0/fndh8VXtdjTLE9CsiEVrbTwu6zfi9uW9uHfzY1wx7EWjJAN6+Qaoy1OQvz4SJaJ5UIq3oixyEYpoEUo4YabKc0NRQoeiMCgEuevXwWg8gTvXvkCnLgMtylg0K1ajuToJTTIxdBWmg0pTnAJVnhh15/+OdvlenHwnomWK44iQJ4EnhBBiY2Mxef9bL35/VZcNvTQZBnkimmXJ0FfFo/CbefjukzDkn4xG4fEY5C4NhmTOK1C/9ibK5r6AQkqIYl4EinkRKOJFoISJQD4VjLMZC1BfuwntDSloUayCUZGIZnky9LJkNEqToZOYqq4uSIYqfx0aZXvRLtuNT7fza2a4jaSfGP6XJGzs0pPn7rug3NXbpsqEMi8B/z0QhY9283DwHS4OpbHxrYAH2fI01GbtRknEAhRQIhTyI1HIj0ARPwJFdATO8cJwZvd8aGoS0KpeY3okqBKbwCvE0JanoKEsBZoisanqpdtxqeYA9AWbsCPO56S91W/8hfkN+0uoyH/l15/E6k7kROLT9wQ4uIePL1byURARA6V4G2RJ6cjnhyOPE4IC4WzkCyNRKJiNQjoc380Ox7mPlqBekYQWZQr0laYTVVeeAu15U8U1RWKo8sWoLcpAi/w9dCrexY8HF3fOZ8ZtIYSM/iPwD83amkybO9v17Q83cW+cig5BSfgSlC9PQlH0C8hlQpArjESuKAq5oigU8KOQx4nE/16ZjbxvlkNXnYImqQlYez4F9WVpqCtJhbpADFV+CjTFmdDL3ka7/B1UfbPmTsYyz/+6Ooxgngn4APvLionTXssVRPWeF0ajIGw+ckWz8QM3DLmiKPwoikK+cA4KuFE4I4zENxkLUPpDAhqk69BQmgZNSRo0RWlQF6ZBXbgO9SUb0FS+A63Vb6G1fCdKvlh567V4v69mTDSfS/6MhzMns1GBn7GFuh/4s2/mB8/plYRGQxo2H9Lw+SgPi4Y0dD4kYdHIXRGDwv/EoqFqA1qqMmEo3wR9+UYYJBthLM9AS/lmGCXboCvYgtLjq7tytgZX/i3c5Q2HMYQhhJg9c/ABZjbZ3Hqaj41NBGU7Lnaek3N2grvHZ1leAbmHAjmad3wp2eJprkfXLvM9dWBnhOTY3ui6E/sXNZ/+cOGFU/tjjEffnqM9mB1W+Y9U7vcJC70+DJk1LsV9wgg+ecyv1P8Pe86eECsLQlyJ6R+xmRshFlZWxN7CgriPHk1m2I0mPmNGE29zczKFEOLoRMioPxPo/wBFxyrdFyIbZQAAAABJRU5ErkJggg==");
//Add a svg image passing the content of image
report.addImage('data:image/svg;utf8,<svg version="1.2" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="337px" height="82px" viewBox="0 0 337 82" xml:space="preserve"><defs></defs><path fill="#234571" d="M16.737,0c5.755,0,9.592,3.309,9.592,8.151c0,3.453-2.973,6.38-5.803,6.906c3.405,0.191,8.105,3.405,8.105,8.632c0,5.947-4.172,9.881-10.839,9.881H4.651V0H16.737z M16.209,14.1c4.412,0,7.337-2.35,7.337-5.851s-2.925-5.755-7.337-5.755H7.48v11.604L16.209,14.1L16.209,14.1z M17.648,31.078c4.556,0,8.104-2.734,8.104-7.242c0-4.221-3.836-7.29-8.393-7.29H7.48v14.532H17.648z"/><path fill="#234571" d="M59.56,24.076H39.514l-4.844,9.495h-3.069L48.77,0.001h1.535l17.169,33.57h-3.069L59.56,24.076z M58.218,21.438L49.873,4.989l-0.336-0.863l-0.335,0.863l-8.345,16.448L58.218,21.438L58.218,21.438z"/><path fill="#234571" d="M100.178,0v33.568H97.54L76.678,5.801l-0.671-1.007l0.096,1.391v27.387h-2.83V0.001h2.638l20.91,27.672l0.624,1.055l-0.096-1.438V0H100.178z"/><path fill="#234571" d="M132.833,24.076h-20.047l-4.844,9.495h-3.069l17.169-33.57h1.535l17.168,33.57h-3.068L132.833,24.076z M131.492,21.438L123.145,4.99l-0.336-0.863l-0.334,0.863l-8.346,16.448H131.492z"/><path fill="#234571" d="M173.452,0v33.568h-2.638L149.954,5.8l-0.672-1.007l0.096,1.391v27.387h-2.83V0.001h2.64l20.91,27.672l0.623,1.055l-0.097-1.438V0H173.452z"/><path fill="#234571" d="M206.105,24.076h-20.047l-4.844,9.495h-3.068l17.168-33.57h1.535l17.17,33.57h-3.067L206.105,24.076z M204.762,21.438L196.416,4.99l-0.336-0.863l-0.336,0.863L187.4,21.438H204.762z"/><path fill="#234571" d="M26.376,75.723H10.934l-1.966,4.316H0l15.826-33.57h5.659l15.826,33.57h-8.968L26.376,75.723z M22.972,68.193l-3.837-8.486l-0.479-1.344l-0.479,1.344l-3.837,8.486H22.972z"/><path fill="#234571" d="M61.334,56.875c-1.535-1.918-4.412-3.117-7.05-3.117c-5.563,0-9.016,3.98-9.016,9.496c0,5.803,3.789,9.398,9.016,9.398c3.213,0,6.283-1.633,7.673-3.934l8.153,2.109c-2.781,5.945-8.776,9.88-15.826,9.88c-9.64,0-17.409-7.338-17.409-17.457s7.769-17.457,17.409-17.457c6.618,0,12.277,3.55,15.251,8.92L61.334,56.875z"/><path fill="#234571" d="M97.012,56.875c-1.535-1.918-4.412-3.117-7.05-3.117c-5.563,0-9.016,3.98-9.016,9.496c0,5.803,3.789,9.398,9.016,9.398c3.213,0,6.283-1.633,7.673-3.934l8.153,2.109c-2.781,5.945-8.776,9.88-15.826,9.88c-9.64,0-17.409-7.338-17.409-17.457s7.769-17.457,17.409-17.457c6.618,0,12.277,3.55,15.251,8.92L97.012,56.875z"/><path fill="#234571" d="M125.64,45.797c9.642,0,17.457,7.338,17.457,17.457s-7.815,17.457-17.457,17.457c-9.64,0-17.409-7.338-17.409-17.457S116,45.797,125.64,45.797z M125.64,72.749c5.467,0,9.064-3.884,9.064-9.495c0-5.658-3.598-9.496-9.064-9.496c-5.418,0-9.016,3.838-9.016,9.496C116.623,68.865,120.22,72.749,125.64,72.749z"/><path fill="#234571" d="M178.102,46.469v18.655c0,10.069-6.232,15.587-15.104,15.587c-8.922,0-15.106-5.518-15.106-15.587V46.469h8.057v18.943c0,4.796,2.637,7.77,7.051,7.77c4.412,0,7.049-2.974,7.049-7.77V46.469H178.102z"/><path fill="#234571" d="M214.645,46.469v33.57h-7.58l-13.905-17.938l-0.671-1.248l0.097,1.248v17.938h-8.06v-33.57h7.576l13.908,17.696l0.672,1.247l-0.098-1.247V46.469H214.645z"/><path fill="#234571" d="M247.204,46.469v7.529h-10.218v26.041h-8.059v-26.04h-10.068v-7.53H247.204L247.204,46.469z"/><path fill="#234571" d="M251.418,80.04V46.469h8.061v33.57L251.418,80.04L251.418,80.04z"/><path fill="#234571" d="M297.077,46.469v33.57h-7.578L275.59,62.102l-0.67-1.248l0.096,1.248v17.938h-8.057v-33.57h7.576l13.908,17.696l0.672,1.247l-0.098-1.247V46.469H297.077z"/><path fill="#234571" d="M329.008,77.307c-1.965,2.109-5.317,3.404-9.106,3.404c-9.644,0-17.408-7.338-17.408-17.457s7.77-17.457,17.408-17.457c6.52,0,12.229,3.453,15.25,8.92l-8.199,2.158c-1.584-1.918-4.412-3.117-7.051-3.117c-5.562,0-9.021,3.98-9.021,9.496c0,5.896,3.98,9.592,9.496,9.592c5.371,0,7.725-2.781,8.684-5.273v-0.051h-8.823v-6.474h15.682v18.991h-6.906v-2.732H329.008L329.008,77.307z"/></svg>');
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
stylesheet.addStyle("img", "margin-bottom:4em");
Banana.Report.preview(report, stylesheet);
}
Add page break
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialpagebreak
// @description = Tutorial: Page break
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text
report.addParagraph('Hello');
//Add a page break
report.addPageBreak();
//Add an other paragraph
report.addParagraph('World!!!');
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Add attachments
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialattachments
// @description = Tutorial: Attachments
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report attachments');
//Add a paragraph with some text
report.addParagraph('Report with attachments');
//Attach text files created on the fly
//We use the prefix 'data:...' to tell that the string is not an url but is itself the content of the file
report.addAttachment('text file 1.txt', 'data:text/plain;utf8,This is the content of the text file 1.');
report.addAttachment('text file 2.txt', 'data:text/plain;utf8,This is the content of the text file 2.');
report.addAttachment('text file 3.txt', 'data:text/plain;utf8,This is the content of the text file 3.');
//Attach an image stored in the document table
//We use the prefix 'document:...'
report.addAttachment('logo.jpg', 'documents:logo');
//Add an xml element
//We just add the new created Banana.Xml.newDocument
var xmlDocument = Banana.Xml.newDocument("eCH-0217:VATDeclaration");
var rootNode = xmlDocument.addElement("eCH-0217:VATDeclaration");
rootNode.addElement("title").addTextNode("Vat Declaration 2018");
report.addAttachment('vat_declaration.xml', xmlDocument);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Print multiple reports
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialmultiplereports
// @description = Tutorial: Multiple reports
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var docs = [];
var styles = [];
// Report
for (var i = 0; i < 10; i++) {
var report = Banana.Report.newReport("Report title");
report.addParagraph("Hello World #" + i + " !!!", "styleHelloWorld");
report.setTitle("Document " + i);
report.getFooter().addFieldPageNr();
docs.push(report);
// Styles
var stylesheet = Banana.Report.newStyleSheet();
var style = stylesheet.addStyle(".styleHelloWorld");
style.setAttribute("font-size", "24pt");
style.setAttribute("text-align", "center");
style.setAttribute("margin-top", "10mm");
var style2 = stylesheet.addStyle("@page");
style2.setAttribute("size", "landscape");
styles.push(stylesheet);
}
// Print preview of 10 documents together
Banana.Report.preview("Multi documents printing example", docs, styles);
}
Add structured text
// Banana Accounting Extension Javascript
// @api = 1.2.0
// @id = ch.banana.uni.app.tutorialstructuredtext
// @description = Hello world
// @task = app.command
// @doctype = nodocument
// @publisher = Publisher name
// @pubdate = 2022-05-31
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report and the stylesheet
var report = Banana.Report.newReport('Tutorial Banana.ReportElement.addStructuredText');
var stylesheet = Banana.Report.newStyleSheet();
stylesheet.addStyle(".example", "margin-top: 2em; margin-bottom: 0.5em; font-style: italic;");
report.addParagraph("--- Markdown example ---", "example");
let mdText = "# Header 1\n";
mdText += "## Header 2\n";
mdText += "### Header 3\n";
mdText += "Markdown text with **bold** and *italic*. \n";
mdText += "[Markdown link](https://www.banana.ch) \n";
mdText += "* List row 1\n";
mdText += "* List row 2\n";
mdText += "* List row 3\n";
report.addStructuredText(mdText, "md");
report.addParagraph("--- Simple html example ---", "example");
let htmlText = "<h1 style=\"color: purple\">Header 1</h1>\n";
htmlText += "<p style=\"color: blue\">Paragraph</p>\n";
report.addStructuredText(htmlText, "html");
report.addParagraph("--- Full html example ---", "example");
htmlText = "<html>\n";
htmlText += "<head>\n";
htmlText += "<style>\n";
htmlText += "p.green {color: green;}\n";
htmlText += ".red {color: red;}\n";
htmlText += "</style>\n";
htmlText += "</head>\n";
htmlText += "<body>\n";
htmlText += "<h1 class=\"red\">Header 1</h1>\n";
htmlText += "<p class=\"green\">Paragraph</p>\n";
htmlText += "</body>\n";
htmlText += "</html>\n";
report.addStructuredText(htmlText, "html", stylesheet);
report.addParagraph("--- Plain html example ---", "example");
let plainText = "Testo riga 1\n";
plainText += "Testo riga 2\n";
plainText += "Testo riga 3\n";
report.addStructuredText(plainText, "text");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Creating Reports with table object
Create a table with one row
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialtableonerow
// @description = Tutorial: Create a table with one row
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a table
var table = report.addTable('myTable');
//Add a row
tableRow = table.addRow();
tableRow.addCell('Cash');
tableRow.addCell('1200');
//Create style
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Create a table with multiple rows
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialtablemultiplerows
// @description = Tutorial: Create a table with multiple rows
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a table
var table = report.addTable('myTable');
//Add row 1
tableRow = table.addRow();
tableRow.addCell('Cash');
tableRow.addCell('1200');
//Add row 2
tableRow = table.addRow();
tableRow.addCell('Bank 1');
tableRow.addCell('500');
//Add row 3
tableRow = table.addRow();
tableRow.addCell('Bank 2');
tableRow.addCell('2600');
//Print report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Create a table with multiple rows and a header
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialtablewithheader
// @description = Tutorial: Create a table with multiple rows and header
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a table
var table = report.addTable('myTable');
//Create table header
var tableHeader = table.getHeader();
//Add the header of the table
tableRow = tableHeader.addRow();
tableRow.addCell('Description');
tableRow.addCell('Amount');
//Add row 1
tableRow = table.addRow();
tableRow.addCell('Cash');
tableRow.addCell('1200');
//Add row 2
tableRow = table.addRow();
tableRow.addCell('Bank 1');
tableRow.addCell('500');
//Add row 3
tableRow = table.addRow();
tableRow.addCell('Bank 2');
tableRow.addCell('2600');
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Create a table with multiple rows, header and borders
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialtablewithheaderandborders
// @description = Tutorial: Create a table with multiple rows, header and borders
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a table
var table = report.addTable('myTable');
//Create table header
var tableHeader = table.getHeader();
//Add the header of the table
tableRow = tableHeader.addRow();
tableRow.addCell('Description');
tableRow.addCell('Amount');
//Add row 1
tableRow = table.addRow();
tableRow.addCell('Cash');
tableRow.addCell('1200');
//Add row 2
tableRow = table.addRow();
tableRow.addCell('Bank 1');
tableRow.addCell('500');
//Add row 3
tableRow = table.addRow();
tableRow.addCell('Bank 2');
tableRow.addCell('2600');
//Stylesheet
var stylesheet = Banana.Report.newStyleSheet();
//Create style for the table adding borders
var style = stylesheet.addStyle("table");
stylesheet.addStyle("table.myTable td", "border: thin solid black");
//Print report
Banana.Report.preview(report, stylesheet);
}
Create a table with fixed columns widths
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialtablecolumnswidth
// @description = Tutorial: Create a table with fixed columns width
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var report = Banana.Report.newReport("Javascrip Tutorial - Table with fixed column widths");
/* Create the table */
var table = report.addTable("table");
/* Add columns */
var column1 = table.addColumn("col1");
var column2 = table.addColumn("col2");
var column3 = table.addColumn("col3");
var column4 = table.addColumn("col4");
var row;
/* Add a row with cells */
row = table.addRow(); //Add a row
row.addCell("A", "", 1); //add first cell
row.addCell("B", "", 1); //add second cell
row.addCell("C", "", 1); //add third cell
row.addCell("D", "", 1); //add fourth cell
//Add more rows...
/* Print the report */
var stylesheet = createStyleSheet();
Banana.Report.preview(report, stylesheet);
}
function createStyleSheet() {
var stylesheet = Banana.Report.newStyleSheet();
var style = stylesheet.addStyle(".table");
style.setAttribute("width","100%"); //table takes all the page width
stylesheet.addStyle("table.table td", "border: thin solid black");
/* Set column widths */
stylesheet.addStyle(".col1", "width:10%");
stylesheet.addStyle(".col2", "width:55%");
stylesheet.addStyle(".col3", "width:30%");
stylesheet.addStyle(".col4", "width:5%");
return stylesheet;
}
Add multiple paragraphs in one cell
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcellmultipleparagraphs
// @description = Tutorial: Add multiple paragraphs in one cell of the table
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var report = Banana.Report.newReport("Javascrip Tutorial - Add multiple paragraphs in one cell");
/* Create the table */
var table = report.addTable("table");
var row;
/* Add a row */
row = table.addRow();
/* Add first cell with paragraphs*/
var cell1 = row.addCell("", "", 1);
cell1.addParagraph("First paragraph...", "");
cell1.addParagraph("Second paragraph...", "");
cell1.addParagraph(" "); //empty paragraph
cell1.addParagraph("Fourth paragraph...", "");
/* Add second cell without paragraphs */
var cell2 = row.addCell("Cell2...", "", 1);
/* Print the report */
var stylesheet = createStyleSheet();
Banana.Report.preview(report, stylesheet);
}
function createStyleSheet() {
var stylesheet = Banana.Report.newStyleSheet();
style = stylesheet.addStyle(".table");
style.setAttribute("width","100%");
stylesheet.addStyle("table.table td", "border: thin solid black");
return stylesheet;
}
Create a table with fixed columns and cells span
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialtablefixedcolumnscellspan
// @description = Tutorial: Create a table with fixed columns and cells span
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var report = Banana.Report.newReport("Javascrip Tutorial - Simple Table");
/* Create the table */
var table = report.addTable("table");
/* Add columns */
var column1 = table.addColumn("col1");
var column2 = table.addColumn("col2");
var column3 = table.addColumn("col3");
var column4 = table.addColumn("col4");
var row;
/* 1st row */
row = table.addRow();
row.addCell("Row 1, Cell 1: span cell over 4 columns", "", 4); //span cell over 4 columns
/* 2nd row */
row = table.addRow();
row.addCell("Row 2, Cell 1: span cell over 2 columns", "", 2); //span cell over 2 columns
row.addCell("Row 2, Cell 3: span cell over 2 columns", "", 2); //span cell over 2 columns
/* 3rd row */
row = table.addRow();
row.addCell("Row 3, Cell 1", "", 1);
row.addCell("Row 3, Cell 2: span cell over 2 columns", "", 2); //span cell over 2 columns
row.addCell("Row 3, Cell 4", "", 1);
/* 4th row*/
row = table.addRow();
row.addCell("Row 4, Cell 1", "", 1);
row.addCell("Row 4, Cell 2", "", 1);
row.addCell("Row 4, Cell 3", "", 1);
row.addCell("Row 4, Cell 4", "", 1);
/* 5th row */
row = table.addRow();
row.addCell("Row 5, Cell 1: span cell over 3 columns", "", 3); //span cell over 3 columns
row.addCell("Row 5, Cell 4", "", 1);
/* Print the report */
var stylesheet = createStyleSheet();
Banana.Report.preview(report, stylesheet);
}
function createStyleSheet() {
var stylesheet = Banana.Report.newStyleSheet();
var style = stylesheet.addStyle(".table");
style.setAttribute("width","100%"); //table takes all the page width
stylesheet.addStyle("table.table td", "border: thin solid black; padding-top:10px; padding-bottom:10px;");
/* Set columns' width */
stylesheet.addStyle(".col1", "width:25%");
stylesheet.addStyle(".col2", "width:25%");
stylesheet.addStyle(".col3", "width:25%");
stylesheet.addStyle(".col4", "width:25%");
return stylesheet;
}
Add reporting styles
Set page margins
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialstylesheetsetmargins
// @description = Tutorial: Stylesheet set margins
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text using a style
report.addParagraph('Hello world!');
//Add some styles
var stylesheet = Banana.Report.newStyleSheet();
//Create the margin for the page: [top, right, bottom, left]
var pageStyle = stylesheet.addStyle("@page");
pageStyle.setAttribute("margin", "10mm 20mm 10mm 20mm");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Set landscape page
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialstylesheetsetlandscape
// @description = Tutorial: Stylesheet set landscape
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text using a style
report.addParagraph('Hello world!');
//Add some styles
var stylesheet = Banana.Report.newStyleSheet();
//Create the margin for the page
var pageStyle = stylesheet.addStyle("@page");
pageStyle.setAttribute("size", "landscape");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Add bold style to a text
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialstylesheetboldtext
// @description = Tutorial: Stylesheet add bold style to a text
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text using a style
report.addParagraph('Hello world!', 'boldStyle');
//Add some styles
var stylesheet = Banana.Report.newStyleSheet();
//Create the "boldStyle"
style = stylesheet.addStyle(".boldStyle");
style.setAttribute("font-weight", "bold");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Add a font size to a text
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialstylesheetfontsizetext
// @description = Tutorial: Stylesheet add a specific font size to a text
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text using a style
report.addParagraph('Hello world!', 'titleStyle');
//Add some styles
var stylesheet = Banana.Report.newStyleSheet();
//Create the style for the text
style = stylesheet.addStyle(".titleStyle");
style.setAttribute("font-size", "20px");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Add a color to a text
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialstylesheetcolortext
// @description = Tutorial: Stylesheet add a color to a text
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Add a paragraph with some text using a style
report.addParagraph('Hello world!', 'colorStyle');
//Add some styles
var stylesheet = Banana.Report.newStyleSheet();
//Create the style for the text
style = stylesheet.addStyle(".colorStyle");
style.setAttribute("color", "red");
//Print the report
Banana.Report.preview(report, stylesheet);
}
First page/cover example
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcoverpageexample
// @description = Tutorial: First page/cover example
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport("Cover example");
var title = " 'This is the title' ";
var companyName = "Banana.ch SA";
var openingDate = "01.01.2015";
var closufeDate = "31.12.2015";
var year = "2015";
report.addParagraph(title, "heading1 alignCenter");
report.addParagraph(" ");
report.addParagraph(companyName, "heading2 alignCenter");
report.addParagraph(" ");
report.addParagraph(year, "heading3 alignCenter");
report.addParagraph(" ");
report.addParagraph("(" + openingDate + " - " + closufeDate + ")", "heading4 alignCenter");
//Add some styles
var stylesheet = Banana.Report.newStyleSheet();
var pageStyle = stylesheet.addStyle("@page");
pageStyle.setAttribute("margin", "10mm 10mm 10mm 20mm");
stylesheet.addStyle("body", "font-family : Helvetica");
style = stylesheet.addStyle(".heading1");
style.setAttribute("font-size", "22px");
style.setAttribute("font-weight", "bold");
style.setAttribute("border-top", "100mm");
style = stylesheet.addStyle(".heading2");
style.setAttribute("font-size", "18px");
style.setAttribute("font-weight", "bold");
style = stylesheet.addStyle(".heading3");
style.setAttribute("font-size", "14px");
style.setAttribute("font-weight", "bold");
style = stylesheet.addStyle(".heading4");
style.setAttribute("font-size", "10px");
style.setAttribute("font-weight", "bold");
style = stylesheet.addStyle(".alignCenter");
style.setAttribute("text-align", "center");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Format values
Format numbers
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialformatnumbers
// @description = Tutorial: Format numbers
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Convert the value
var convertedAmount1 = Banana.Converter.toLocaleNumberFormat("1200.65");
var convertedAmount2 = Banana.Converter.toLocaleNumberFormat("0");
var convertedAmount3 = Banana.Converter.toLocaleNumberFormat(1234.56);
var convertedAmount4 = Banana.Converter.toLocaleNumberFormat(1);
//Add the converted amount to the report's paragraph
report.addParagraph(convertedAmount1);
report.addParagraph(convertedAmount2);
report.addParagraph(convertedAmount3);
report.addParagraph(convertedAmount4);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Format dates
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialformatdates
// @description = Tutorial: Format dates
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Convert the value: parameter is a string
var date1 = Banana.Converter.toLocaleDateFormat('2015-12-31');
//Convert the value: parameter is a date object
var d = new Date();
var date2 = Banana.Converter.toLocaleDateFormat(d);
//Add the converted amount to the report's paragraph
report.addParagraph(date1);
report.addParagraph(date2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Format transactions journal data
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialformattransactionjournaldata
// @description = Tutorial: Format transactions journal data
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create the table that will be printed on the report
var table = report.addTable("myTable");
//Add column titles to the table report
var tableHeader = table.getHeader();
tableRow = tableHeader.addRow();
tableRow.addCell('Data', 'boldStyle');
tableRow.addCell('Account', 'boldStyle');
tableRow.addCell('Description', 'boldStyle');
tableRow.addCell('Amount', 'boldStyle');
//Create a table with all transactions
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL);
//Read some values of the journal table
for (var i = 0; i < journal.rowCount; i++) {
var tRow = journal.row(i);
//Add the values taken from the rows to the respective cells of the table
//For the dates and the amounts we apply the format functions
tableRow = table.addRow();
tableRow.addCell(Banana.Converter.toLocaleDateFormat(tRow.value('JDate')));
tableRow.addCell(tRow.value('JAccount'));
tableRow.addCell(tRow.value('JAccountDescription'));
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JAmount')), 'alignRight');
}
//Create the styleSheet
var stylesheet = Banana.Report.newStyleSheet();
//Add borders to the table
var style = stylesheet.addStyle("table");
stylesheet.addStyle("table.myTable td", "border: thin solid black");
//Add the right alignment for the amount
style = stylesheet.addStyle(".alignRight");
style.setAttribute("text-align", "right");
//Add the bold style for the header
style = stylesheet.addStyle(".boldStyle");
style.setAttribute("font-weight", "bold");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Numbers operations with SDecimal() functions
Basic mathematical operations (sum, subtract, multiply, divide)
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialbasicmathematicaloperations
// @description = Tutorial: Basic mathematical operations (sum, subtract, multiply, divide)
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Do some mathematical operations and add the results to the report
//Sum
var sum = Banana.SDecimal.add('6.50', '3.50'); // return '10.00'
report.addParagraph(sum);
//Subtract
var sub = Banana.SDecimal.subtract('10', '3'); // return '7'
report.addParagraph(sub);
//Multiply
var mul = Banana.SDecimal.multiply('6', '3'); // return '18'
report.addParagraph(mul);
//Divide
var div = Banana.SDecimal.divide('6', '3'); // return '2'
report.addParagraph(div);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
abs function
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialabsfunction
// @description = Tutorial: abs function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Return the value without the sign
var absValue = Banana.SDecimal.abs('-10');
//Add a paragraph to the report
report.addParagraph(absValue);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Compare two values
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcomparevalues
// @description = Tutorial: Compare two values
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
// Compare the values:
// return 1 if value1 > value2
// return 0 if value1 = value2
// return -1 if value1 < value2
var compareValue = Banana.SDecimal.compare('5', '2');
//Add a paragraph to the report
report.addParagraph(compareValue);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Invert sign of a value
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialinvertsign
// @description = Tutorial: Invert value sign
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Invert the sign:
//if positive return a negative value
//if negative return a positive value
var invertValue = Banana.SDecimal.invert('4');
//Add a paragraph to the report
report.addParagraph(invertValue);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Check the sign of a value
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcheckvaluesign
// @description = Tutorial: Check value sign
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Check the sign of the value:
//return 1 if value > 0
//return 0 if value = 0
//return -1 if value <0
var signValue = Banana.SDecimal.sign('-6');
//Add a paragraph to the report
report.addParagraph(signValue);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Number of decimals and rounding properties
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialdecimalsrounding
// @description = Tutorial: Number of decimals and rounding properties
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Divide without properties
var result1 = Banana.SDecimal.divide('10', '3.25'); //return '3.3333333333333333333333333'
report.addParagraph(result1);
//Divide with number of decimals property
var result2 = Banana.SDecimal.divide('10', '3.25', {
'decimals': 4
});
report.addParagraph(result2);
//Divide with number of decimals and rounding properties
var result3 = Banana.SDecimal.divide('10', '3.25', {
'decimals': 2,
'mode': Banana.SDecimal.HALF_UP
});
report.addParagraph(result3);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
User interface functions
Dialog information
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialinformationdialog
// @description = Tutorial: Information dialog
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Open a dialog window with an information
Banana.Ui.showInformation('Title', 'This is the information message!');
}
Dialog question
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialquestiondialog
// @description = Tutorial: Question dialog
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create a report
var report = Banana.Report.newReport("Report title");
//Open a dialog window with a question
var question = Banana.Ui.showQuestion('Question title', 'Print the report?');
//If 'true' do something...
if (question) {
//...for example add some text to the paragraph
report.addParagraph('The answer was YES!');
//...then print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
}
Dialog show text
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialshowtextdialog
// @description = Tutorial: Show text dialog
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Open a dialog window showing the text.
//In this case we want to show the table Accounts as html file
Banana.Ui.showText(Banana.document.table('Accounts').toHtml(['Account', 'Group', 'Description', 'Balance'], true));
}
Dialog input text
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialinputtextdialog
// @description = Tutorial: Input text dialog
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create a report
var report = Banana.Report.newReport("Report title");
//Open a dialog window asking the user to insert some text
//The text inserted is saved into a variable
var textInsertedByUser = Banana.Ui.getText('This is a dialog window', 'Insert some text', '');
//Add to the paragraph the text inserted by the user
report.addParagraph(textInsertedByUser);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Dialog item selection
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialitemselectiondialog
// @description = Tutorial: Item selection dialog
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Open a dialog window asking to select an item from the list
//The selected item is then saved into a variable
var itemSelected = Banana.Ui.getItem('Input', 'Choose a value', ['Item ONE', 'Item TWO', 'Item THREE', 'Item FOUR', 'Item FIVE'], 2, false);
//Add the selected item to the paragraph
report.addParagraph(itemSelected);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Dialog period selection
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialperiodselectiondialog
// @description = Tutorial: Period selection dialog
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create a report
var report = Banana.Report.newReport("Report title");
//Open a dialog windows to choose a period
var date = Banana.Ui.getPeriod('Period selection', '2015-01-01', '2015-12-31');
//Add the date information to the report
report.addParagraph(date.startDate);
report.addParagraph(date.endDate);
report.addParagraph(date.hasSelection);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Dialog multiple items selection
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialmultipleitemsselectiondialog
// @description = Tutorial: Multiple items selection dialog
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Open a dialog window asking to select an item from the list
//The selected item is then saved into a variable
var itemsSelected = Banana.Ui.getItems(
'Input',
'Choose one or more values',
['Item ONE', 'Item TWO', 'Item THREE', 'Item FOUR', 'Item FIVE'],
['Item ONE', 'Item THREE']
);
if (!itemsSelected) {
// User pressed cancel
return;
}
//Add the selected item to the paragraph
report.addParagraph("Selected items:");
if (itemsSelected.length > 0) {
for (var i = 0; i < itemsSelected.length; ++i) {
report.addParagraph("- " + itemsSelected[i]);
}
} else {
report.addParagraph("No item selected");
}
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Message functions
Show messages
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialshowmessages
// @description = Tutorial: Show messages
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
Banana.document.clearMessages();
//Step 1 - table access
var transactionTable = Banana.document.table('Transactions');
//Step 2 - loop on each row of the table
for (var i = 0; i < transactionTable.rowCount; i++) {
var tRow = transactionTable.row(i);
//Check the length of the description
if (tRow.value('Description').length > 20 && tRow.value('Description').length < 30) {
Banana.document.addMessage("Warning: row " + tRow.rowNr + ", description's length is " + tRow.value('Description').length + "!");
} else if (tRow.value('Description').length >= 30) {
Banana.document.addMessage("Error: row " + tRow.rowNr + ", description's length is " + tRow.value('Description').length + "!");
}
}
}
Show messages linked to table Transaction
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialshowmessageslinkedtotable
// @description = Tutorial: Show messages linked to table Transactions
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
Banana.document.clearMessages();
//Step 1 - table access
var transactionTable = Banana.document.table('Transactions');
//Step 2 - loop on each row of the table
for (var i = 0; i < transactionTable.rowCount; i++) {
var tRow = transactionTable.row(i);
//Check the length of the description
if (tRow.value('Description').length > 20 && tRow.value('Description').length < 30) {
tRow.addMessage("Warning: description's length is " + tRow.value('Description').length + "!");
} else if (tRow.value('Description').length >= 30) {
tRow.addMessage("Error: description's length is " + tRow.value('Description').length + "!");
}
}
}
Clear all messages
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialclearmessages
// @description = Tutorial: Clear all messages
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
Banana.document.clearMessages();
}
Save settings
Save settings
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialsavesettings
// @description = Tutorial: Save settings
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Readscript settings
var readText = Banana.document.scriptReadSettings();
//If there is a saved setting we can use it
if (readText) {
//Use the JSON.parse() to convert a JSON text into a JavaScript object
var object = JSON.parse(readText);
//Add a paragraph with the saved and parsed text
report.addParagraph('Previously saved value: ' + object);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
// If it doesn't exists a saved setting yet (which it happens the very first time the script is executed),
// it is necessary to create and save it
//For example using an dialog window to insert some text
var text = Banana.Ui.getText('Save settings example', 'Insert some text', '');
//Convert a JavaScript value into a JSON string using the JSON.stringify() function
var textToSave = JSON.stringify(text);
//Save script settings
var savedText = Banana.document.scriptSaveSettings(textToSave);
}
Retrieving informations from "File and account properties..."
Retrieve basic accounting informations
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialretrievebasicaccountinginformation
// @description = Tutorial: Retrieve basic accounting information
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create report
var report = Banana.Report.newReport('Report title');
//Get some value of the accounting file
var fileName = Banana.document.info("Base", "FileName");
var decimalsAmounts = Banana.document.info("Base", "DecimalsAmounts");
var headerLeft = Banana.document.info("Base", "HeaderLeft");
var headerRight = Banana.document.info("Base", "HeaderRight");
var basicCurrency = Banana.document.info("AccountingDataBase", "BasicCurrency");
//For openingDate and closureDate
var startDate = Banana.document.info('AccountingDataBase', 'OpeningDate');
var endDate = Banana.document.info('AccountingDataBase', 'ClosureDate');
//For file accounting type
var fileType = Banana.document.info("Base", "FileType");
var fileGroup = Banana.document.info("Base", "FileTypeGroup");
var fileNumber = Banana.document.info("Base", "FileTypeNumber");
//Add the informations to the report
report.addParagraph(fileName);
report.addParagraph(decimalsAmounts);
report.addParagraph(headerLeft);
report.addParagraph(headerRight);
report.addParagraph(basicCurrency);
report.addParagraph(startDate);
report.addParagraph(endDate);
report.addParagraph(fileType);
report.addParagraph(fileGroup);
report.addParagraph(fileNumber);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retrieve address informations
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialretrieveaddressinformation
// @description = Tutorial: Retrieve address information
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create report
var report = Banana.Report.newReport('Report title');
//Save informations
var company = Banana.document.info('AccountingDataBase', 'Company');
var courtesy = Banana.document.info('AccountingDataBase', 'Courtesy');
var name = Banana.document.info('AccountingDataBase', 'Name');
var familyName = Banana.document.info('AccountingDataBase', 'FamilyName');
var address1 = Banana.document.info('AccountingDataBase', 'Address1');
var address2 = Banana.document.info('AccountingDataBase', 'Address2');
var zip = Banana.document.info('AccountingDataBase', 'Zip');
var city = Banana.document.info('AccountingDataBase', 'City');
var state = Banana.document.info('AccountingDataBase', 'State');
var country = Banana.document.info('AccountingDataBase', 'Country');
var web = Banana.document.info('AccountingDataBase', 'Web');
var email = Banana.document.info('AccountingDataBase', 'Email');
var phone = Banana.document.info('AccountingDataBase', 'Phone');
var mobile = Banana.document.info('AccountingDataBase', 'Mobile');
var fax = Banana.document.info('AccountingDataBase', 'Fax');
var fiscalNumber = Banana.document.info('AccountingDataBase', 'FiscalNumber');
var vatNumber = Banana.document.info('AccountingDataBase', 'VatNumber');
//Add the informations to the report
report.addParagraph(company);
report.addParagraph(courtesy);
report.addParagraph(name);
report.addParagraph(familyName);
report.addParagraph(address1);
report.addParagraph(address2);
report.addParagraph(zip);
report.addParagraph(city);
report.addParagraph(state);
report.addParagraph(country);
report.addParagraph(web);
report.addParagraph(email);
report.addParagraph(phone);
report.addParagraph(mobile);
report.addParagraph(fax);
report.addParagraph(fiscalNumber);
report.addParagraph(vatNumber);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retrieving data from Banana tables
Retrieve rows table values using findRowByValue() function
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialretrieverowstablevaluesusingfindrowbyvalue
// @description = Tutorial: Retrieve rows table values using findRowByValue() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create report
var report = Banana.Report.newReport("Report title");
//Save the row extracted from the table
var rowToExtract = Banana.document.table('Accounts').findRowByValue('Account', '1000');
//Add the Account, Description and Balance informations to the report
report.addParagraph(rowToExtract.value('Account'));
report.addParagraph(rowToExtract.value('Description'));
report.addParagraph(rowToExtract.value('Balance'));
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retrieve specific rows table values
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialretrievespecificrowstablevalues
// @description = Tutorial: Retrieve specific rows table values
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create report
var report = Banana.Report.newReport("Report title");
// Step 1 - table access: specify the name of the table ("Accounts", "Transactions", "VatCodes", ...)
var accountsTable = Banana.document.table("Accounts");
//Step 2 - row selection: it is important to note that the rows of the Banana table start counting from 0,
//so keep in mind to specify one number less than the desired one
//1st row = 0
//2nd row = 1
//3rd row = 2
//4th row = 3
//...
var row3 = accountsTable.row(2); // We want the third row
// Step 3 - select all the desired columns
var account = row3.value("Account");
var description = row3.value("Description");
var balance = row3.value("Balance");
//Add the informations to the report
report.addParagraph(account);
report.addParagraph(description);
report.addParagraph(balance);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retrieve rows table values
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialretrieverowstablevalues
// @description = Tutorial: Retrieve rows table values
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create a report
var report = Banana.Report.newReport('Report title');
//Step 1 - table access
var accountsTable = Banana.document.table('Accounts');
//Step 2 - loop on each row of the table, instead of specifying a single row
for (var rowNumber = 0; rowNumber < accountsTable.rowCount; rowNumber++) {
var tRow = accountsTable.row(rowNumber);
//Step 3 - select the desired columns
var account = tRow.value('Account');
var description = tRow.value('Description');
var balance = tRow.value('Balance');
//Add the informations to the report
report.addParagraph(account + ', ' + description + ', ' + balance);
}
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retrieve rows table with account number
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialretretrieverowstablewithaccountnumber
// @description = Tutorial: Retrieve rows table with account number
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create a report
var report = Banana.Report.newReport('Report title');
//Step 1 - table access
var accountsTable = Banana.document.table('Accounts');
//Step 2 - loop on each row of the table, instead of specifying a single row
for (var rowNumber = 0; rowNumber < accountsTable.rowCount; rowNumber++) {
var tRow = accountsTable.row(rowNumber);
//If the row has an account number we save the values and print them
if (tRow.value('Account')) {
//Step 3 - select the desired columns
var account = tRow.value('Account');
var description = tRow.value('Description');
var balance = tRow.value('Balance');
//Add the informations to the report
report.addParagraph(account + ', ' + description + ', ' + balance);
}
}
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Print all table rows in a table format
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialretprintrowstablewithaccountnumberintableformat
// @description = Tutorial: Print rows table with account number in table format
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create a report
var report = Banana.Report.newReport('Report title');
//Create the table that will be printed on the report
var table = report.addTable("myTable");
//Add column titles to the table report
var tableHeader = table.getHeader();
tableRow = tableHeader.addRow();
tableRow.addCell("Account");
tableRow.addCell("Description");
tableRow.addCell("Balance");
//Step 1 - table access
var accountsTable = Banana.document.table('Accounts');
//Step 2 - loop on each row of the table, instead of specifying a single row
for (var rowNumber = 0; rowNumber < accountsTable.rowCount; rowNumber++) {
var tRow = accountsTable.row(rowNumber);
//If the row has an account number we save the values and print them
if (tRow.value('Account')) {
//Step 3 - select the desired columns
var account = tRow.value('Account');
var description = tRow.value('Description');
var balance = tRow.value('Balance');
//Add the values taken from the rows to the respective cells of the table
tableRow = table.addRow();
tableRow.addCell(account);
tableRow.addCell(description);
tableRow.addCell(balance);
}
}
//Create the styleSheet to
var stylesheet = Banana.Report.newStyleSheet();
//Create a table style adding the border
var style = stylesheet.addStyle("table");
stylesheet.addStyle("table.myTable td", "border: thin solid black");
//Print the report
Banana.Report.preview(report, stylesheet);
}
Find all rows that match a condition using findRows
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialfindrows
// @description = Tutorial: Retrieve all rows table that match a condition using findRows
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var tableAccounts = Banana.document.table('Accounts');
var rows = tableAccounts.findRows(accountStartsWith25XX);
var accounts = [];
for(var i = 0; i < rows.length; i++) {
accounts.push(rows[i].value('Account'));
}
Banana.Ui.showInformation('Info', 'Accounts that start with 25XX: ' + accounts.join(';'));
}
function accountStartsWith25XX(rowObj,rowNr,table) {
// Return true if account start with '25XX'
return rowObj.value('Account').startsWith('25');
}
Retrieve all rows that match a condition using extractRows
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialextractrows
// @description = Tutorial: Retrieve all rows table that match a condition using extractRows
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var tableAccounts = Banana.document.table('Accounts');
tableAccounts.extractRows(accountStartsWith25XX, 'Accounts that start with 25XX');
}
function accountStartsWith25XX(rowObj,rowNr,table) {
// Return true if account start with '25XX'
return rowObj.value('Account').startsWith('25');
}
Retriveing data with currentBalance() function
Amount of opening for all transactions for an account
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentbalancesingleaccount
// @description = Tutorial: Retrieve amount of an account using currentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take opening sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.currentBalance('1000', '', '').opening;
//Take opening sum for a specific period
var amount2 = Banana.document.currentBalance('1000', '2015-01-05', '2015-02-07').opening;
//Add a paragraph with the amounts just calculated
report.addParagraph(Banana.document.accountDescription('1000'));
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Amount of opening for all transactions for multiple accounts
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentbalancemultipleaccounts
// @description = Tutorial: Retrieve amount of multiple accounts using currentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take opening sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.currentBalance('1000|1010|1011', '', '').opening;
//Take opening sum for a specific period
var amount2 = Banana.document.currentBalance('1000|1010|1011', '2015-01-05', '2015-02-07').opening;
//Add a paragraph with the amounts just calculated
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Amount of opening for all transactions for a single group
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentbalancesinglegroup
// @description = Tutorial: Retrieve amount of single group using currentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take opening sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.currentBalance('Gr=100', '', '').opening;
//Take opening sum for a specific period
var amount2 = Banana.document.currentBalance('Gr=100', '2015-01-05', '2015-02-07').opening;
//Add a paragraph with the amounts just calculated
report.addParagraph(Banana.document.accountDescription('Gr=100'));
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Amount of opening for all transactions for multiple groups
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentbalancemultiplegroups
// @description = Tutorial: Retrieve amount of multiple groups using currentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take opening sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.currentBalance('Gr=100|110|120', '', '').opening;
//Take opening sum for a specific period
var amount2 = Banana.document.currentBalance('Gr=100|110|120', '2015-01-05', '2015-02-07').opening;
//Add a paragraph with the amounts just calculated
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Amount of opening for all transactions for a BClass
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentbalancesinglebclass
// @description = Tutorial: Retrieve amount of a single BClass using currentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take opening sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.currentBalance('BClass=1', '', '').opening;
//Take opening sum for a specific period
var amount2 = Banana.document.currentBalance('BClass=1', '2015-01-05', '2015-02-07').opening;
//Add a paragraph with the amounts just calculated
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Amount of opening for all transactions for multiple BClass values
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentbalancemultiplebclass
// @description = Tutorial: Retrieve amount of multiple BClass using currentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take opening sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.currentBalance('BClass=1|2', '', '').opening;
//Take opening sum for a specific period
var amount2 = Banana.document.currentBalance('BClass=1|2', '2015-01-05', '2015-02-07').opening;
//Add a paragraph with the amounts just calculated
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retriveing data with vatCurrentBalance() function
Sum the Vat amounts for the specified vat code
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialvatcurrentbalancesinglevatcode
// @description = Tutorial: Sum the VAT amounts for single VAT code using vatCurrentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take the vatAmount sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.vatCurrentBalance('S10', '', '').vatAmount;
//Take the vatAmount sum for a specific period
var amount2 = Banana.document.vatCurrentBalance('S10', '2015-01-01', '2015-01-06').vatAmount;
//Add a paragraph with the amounts just calculated
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Sum the Vat amounts for multiple vat codes
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialvatcurrentbalancemultiplevatcodes
// @description = Tutorial: Sum the VAT amounts for multiple VAT codes using vatCurrentBalance() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Take the vatAmount sum for a non-specific period: period taken from Banana
var amount1 = Banana.document.vatCurrentBalance('S10|P10', '', '').vatAmount;
//Take the vatAmount sum for a specific period
var amount2 = Banana.document.vatCurrentBalance('S10|P10', '2015-02-01', '2015-02-28').vatAmount;
//Add a paragraph with the amounts just calculated
report.addParagraph(amount1);
report.addParagraph(amount2);
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retriveing data with currentCard() function
For a given account without specifying the period
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentcardnoperiod
// @description = Tutorial: Use currentCard() function for a given account
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a table with all the transactions of the given account
var transTab = Banana.document.currentCard('1010', '', '');
//For each row of the table we save the values
for (var i = 0; i < transTab.rowCount; i++) {
var tRow = transTab.row(i);
var date = tRow.value('JDate');
var account = tRow.value('JAccount');
var description = tRow.value("JDescription");
var debit = tRow.value('JDebitAmount');
var credit = tRow.value('JCreditAmount');
var balance = tRow.value('JBalance');
//Add a paragraph with the values just calculated
report.addParagraph(date + ', ' + account + ', ' + description + ', ' + debit + ', ' + credit + ', ' + balance);
}
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
For a given account and period
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialcurrentcardwithperiod
// @description = Tutorial: Use currentCard() function for a given account and period
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a table with all transactions for the given account and period
var transTab = Banana.document.currentCard('1010', '2015-01-03', '2015-02-07');
//For each row of the table we save the values
for (var i = 0; i < transTab.rowCount; i++) {
var tRow = transTab.row(i);
var date = tRow.value('JDate');
var account = tRow.value('JAccount');
var description = tRow.value("JDescription");
var debit = tRow.value('JDebitAmount');
var credit = tRow.value('JCreditAmount');
var balance = tRow.value('JBalance');
//Add a paragraph with the values just calculated
report.addParagraph(date + ', ' + account + ', ' + description + ', ' + debit + ', ' + credit + ', ' + balance);
}
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Retriveing data with journal() function
Get all transaction for normal accounts
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialjournal
// @description = Tutorial: Retrieve all transactions for normal accounts using the journal() function
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Create a table with all transactions
var journal = Banana.document.journal(Banana.document.ORIGINTYPE_CURRENT, Banana.document.ACCOUNTTYPE_NORMAL);
//Read the table and save some values
for (var i = 0; i < journal.rowCount; i++) {
var tRow = journal.row(i);
var date = tRow.value('JDate');
var account = tRow.value('JAccount');
var accDescription = tRow.value('JAccountDescription');
var description = tRow.value('JDescription');
var vatCode = tRow.value('JVatCodeWithoutSign');
var vatDescription = tRow.value('JVatCodeDescription');
var amount = tRow.value('JAmount');
//Add to the paragraph the values just saved
report.addParagraph(date + ', ' + account + ', ' + accDescription + ', ' + description + ', ' + vatCode + ', ' + vatDescription + ', ' + amount);
}
//Print the report
var stylesheet = Banana.Report.newStyleSheet();
Banana.Report.preview(report, stylesheet);
}
Reading and writing xml files
Reading an xml file
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialreadxmlfile
// @description = Tutorial: Read an XML file
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
var xml = '<Library updated="2018-09-03">' + // To simplify,
'<Book>' + // the variable
'<Title>Paths of colours</Title>' + // xml contains
'<Author>Rosa Indaco</Author>' + // the xml string
'</Book>' +
'<Book>' +
'<Title>Accounting exercises</Title>' +
'<Author>Su Zhang</Author>' +
'</Book>' +
'</Library>';
var bookList = ""; // Create string for the output
var xmlFile = Banana.Xml.parse(xml); // Create XML Parse object
var xmlRoot = xmlFile.firstChildElement('Library'); // Find the first tag "Library" in the XML
var updateDate = xmlRoot.attribute('updated'); // Take attribute assigned to the tag
bookList += "Books in the library on " + updateDate + "\n\n"; // Append to the output string
var bookNode = xmlRoot.firstChildElement('Book'); // Take the first Book
while (bookNode) { // As long as there are books, repeat
var title = bookNode.firstChildElement('Title').text; // Find the first tag "Title" in the XML
var authorNode = bookNode.firstChildElement('Author'); // Find the first tag "Author" in the XML
var author = authorNode ? authorNode.text : 'unknow'; // Check whether there is a tag "Author"
bookList += title + " - " + author + "\n"; // Append to the output string
bookNode = bookNode.nextSiblingElement('Book'); // Go to the next book
}
Banana.Ui.showText("List of books present in the xml file", bookList); // Output the results
Writing an xml file
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialwritexmlfile
// @description = Tutorial: Write an XML file
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
var xmlDocument = Banana.Xml.newDocument("Library"); // Create XML file
xmlDocument.addComment("This is the generated xml file"); // Add comment to the file
var rootNode = xmlDocument.addElement("Library"); // Set root tag "Library"
rootNode.setAttribute("updated", "2018-09-03"); // Set attribute to the tag "Library"
var bookNode = rootNode.addElement("Book"); // Create tag "Book" child of "Library"
bookNode.addElement("Title").addTextNode("Paths of colours"); // Create tag "Title" child of "Book"
bookNode.addElement("Author").addTextNode("Rosa Indaco"); // Create tag "Author" child of "Book"
var bookNode = rootNode.addElement("Book"); // Create tag "Book" child of "Library"
bookNode.addElement("Title").addTextNode("Accounting exercises"); // Create tag "Title" child of "Book"
bookNode.addElement("Author").addTextNode("Su Zhang"); // Create tag "Author" child of "Book"
var xmlString = Banana.Xml.save(xmlDocument); // Create output
// Show the xml file
Banana.Ui.showText("Xml file", xmlString); // Generate output
}
Validate an xml file via xsd
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialxmlvalidation
// @description = Tutorial: Validate an XML file via XSD
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
// The xml file
var xml = '<Library updated="2018-09-03"> \
<Book> \
<Title>Paths of colours</Title> \
<Author>Rosa Indaco</Author> \
</Book> \
<Book> \
<Title>Accounting exercises</Title> \
<Author>Su Zhang</Author> \
</Book> \
</Library>';
// Parse the xml
var xmlFile = Banana.Xml.parse(xml);
// Validate the xml
var valid = Banana.Xml.validate(xmlFile, 'documents:xsd');
if (valid) {
Banana.Ui.showInformation('Validation result', 'The xml is valid');
} else {
Banana.Ui.showInformation('Validation result', 'The xml is not valid: ' + Banana.Xml.errorString);
}
}
Filter for xml file
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialgeneralxmlFile
// @description = Tutorial: General functions on XML files
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2020-03-27
// @inputdatasource = none
// @timeout = -1
function exec(){
const xml = '<solarSystem updated="2020-03-27">' +
'<Planet>' +
'<name>Sun</name>' +
'<sizeOrder>1</sizeOrder>' +
'</Planet>' +
'<Planet>' +
'<name>Earth</name>' +
'<sizeOrder>6</sizeOrder>' +
'<satellite>Moon</satellite>' +
'</Planet>' +
'<Planet>' +
'<name>Jupiter</name>' +
'<sizeOrder>2</sizeOrder>' +
'<satellite>Callisto</satellite>' +
'</Planet>' +
'<Planet>' +
'<name>Saturn</name>' +
'<sizeOrder>3</sizeOrder>' +
'<satellite>Cronus</satellite>' +
'</Planet>' +
'<Planet>' +
'<name>Mars</name>' +
'<sizeOrder>8</sizeOrder>' +
'<satellite>Phobos</satellite>' +
'</Planet>' +
'<Planet>' +
'<name>Neptune</name>' +
'<sizeOrder>5</sizeOrder>' +
'<satellite>Triton</satellite>' +
'</Planet>' +
'<Planet>' +
'<name>Mercury</name>' +
'<sizeOrder>9</sizeOrder>' +
'</Planet>' +
'<Planet>' +
'<name>Venus</name>' +
'<sizeOrder>7</sizeOrder>' +
'</Planet>' +
'<Planet>' +
'<name>Uranus</name>' +
'<sizeOrder>4</sizeOrder>' +
'<satellite>Ariel</satellite>' +
'</Planet>' +
'</solarSystem>';
var outputString = "";
var xmlFile = Banana.Xml.parse(xml);
var xmlRoot = xmlFile.firstChildElement('solarSystem');
var updateDate = xmlRoot.attribute('updated');
outputString += "Planets in the solar System with satellites updated on " + updateDate + "\n\n";
var planet = xmlRoot.firstChildElement('Planet');
while (planet) {
if (planet.hasChildElements('satellite')) {
var planetName = planet.firstChildElement('name').text;
var planetSatellite = planet.firstChildElement('satellite').text;
outputString += "name: " + planetName + ", satellite: " + planetSatellite + "\n";
}
planet = planet.nextSiblingElement('Planet');
}
Banana.Ui.showText("Planets in the XML with satellites", outputString);
}
Export Transaction table to xml file
// Banana Accounting Extension Javascript
// @id = ch.banana.apps.export
// @api = 1.0
// @pubdate = 2016-04-08
// @doctype = *.*
// @description = Export into an xml file (.xml)
// @task = export.file
// @exportfiletype = xml
// @timeout = -1
function exec() {
var xmlDocument = Banana.Xml.newDocument("Transactions");
xmlDocument.addComment("This is the generated xml file");
var rootNode = xmlDocument.addElement("transactions");
var tableTransactions = Banana.document.table('Transactions');
if (!tableTransactions) {
return;
}
for (i=0;i<tableTransactions.rowCount;i++) {
if (tableTransactions.row(i).value('Amount')) {
var transactionNode = rootNode.addElement("transaction");
transactionNode.addElement("date").addTextNode(tableTransactions.row(i).value('Date'));
transactionNode.addElement("description").addTextNode(tableTransactions.row(i).value('Description'));
transactionNode.addElement("amount").addTextNode(tableTransactions.row(i).value('Amount'));
}
}
var xmlString = Banana.Xml.save(xmlDocument);
Banana.Ui.showText("Xml file", xmlString);
return xmlString;
}
Import Transactions from xml file
// Banana Accounting Extension Javascript
// @api = 1.0
// @pubdate = 2020-04-02
// @id = ch.banana.uni.app.tutorialretrieverowstablevalues
// @description = Import transactions
// @task = import.transactions
// @outputformat = transactions.simple
// @doctype = *
// @inputdatasource = openfiledialog
// @inputencoding = latin1
// @inputfilefilter = Text files (*.xml);;All files (*.*)
// @publisher = Banana.ch SA
// @timeout = -1
function exec(inputFile) {
var CSV_String = "Date" + '","' + "Description" + '","' + "Income" + '","' + "Expenses" + '\n';
var xmlFile = Banana.Xml.parse(inputFile);
var xmlRoot = xmlFile.firstChildElement('transactions');
var transactionNode = xmlRoot.firstChildElement('transaction');
while (transactionNode) {
var date = transactionNode.firstChildElement('date').text;
var description = transactionNode.firstChildElement('description').text;
var income = transactionNode.firstChildElement('income').text;
var expenses = transactionNode.firstChildElement('expenses').text;
CSV_String += ('"' + date + '","' + description + '","' + income + '","' + expenses + '"' + '\n');
transactionNode = transactionNode.nextSiblingElement('transaction');
}
Banana.console.debug(CSV_String);
var csvFile = Banana.Converter.csvToArray(CSV_String, ',', '"');
var tsvFile = Banana.Converter.arrayToTsv(csvFile);
return tsvFile;
}
Debugging
Ouput messages to the debug panel
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialdebugmessages
// @description = Tutorial: Output messages to the debug panel
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
Banana.console.log("An info message");
Banana.console.debug("A debug message");
Banana.console.warn("A warning message"); // Since Banana 9.0.4 use Banana.console.warning
Banana.console.critical("A critical message");
}
Progress bar and timeout
Script timeout
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialscripttimeout
// @description = Tutorial: Progress bar
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-12-06
// @inputdatasource = none
// @timeout = 2000
function exec() {
while(true) {
}
}
Progess bar
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialprogressbar
// @description = Tutorial: Progress bar
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-12-06
// @inputdatasource = none
// @timeout = 20000
function exec() {
var nr = 100000000;
var progressBar = Banana.application.progressBar;
progressBar.start(nr);
for (var i = 0; i < nr; ++i) {
if (!progressBar.step(1)) {
break; // Operation canceled by the user
}
}
}
User interface
QTableWidget interaction
// Banana Accounting Extension Javascript
/**
* This example shows the use of a QTableWidget
* The user interface is defined in file "ch.banana.tutorial.tablewidget.ui"
* This example is also found in the tutorial file "embedded_javascript_tutorial1.ac2"
*/
// @id = ch.banana.exmaple.tablewidget
// @version = 1.0
// @date = 2019-12-06
// @publisher = Banana.ch SA
// @description = Tutorial QTableWidget
// @task = app.command
// @inputdatasource = none
// @timeout = -1
// @doctype = nodocument
var param = {};
/** Dialog's functions declaration */
var dialog = Banana.Ui.createUi("documents:740.ui");
var table = dialog.findChild("tableWidget");
var buttonBox = dialog.findChild("buttonBox");
var statusLabel = dialog.findChild("statusLabel");
/** Main function */
function exec(inData) {
//Check the version of Banana
var requiredVersion = "9.1.0.0";
if (!Banana.compareVersion || Banana.compareVersion(Banana.application.version, requiredVersion) < 0) {
Banana.Ui.showInformation("You need Banana 9.1.0.0 or newer to run this example");
return;
}
// Connect button box signals
buttonBox.accepted.connect(function() {dialog.close();});
buttonBox.rejected.connect(function() {dialog.close();});
// Set the table read
// table.setEditTriggers(0); // see flags QAbstractItemView::EditTriggers
// Set columns
table.setColumnCount(4);
table.setHorizontalHeaderLabels(["A", "B", "C", "D"])
table.setColumnWidth(1, 200);
// Set rows
table.setRowCount(5);
// Set cell text
table.item(1,0).text = "hello";
// Set cell colors
var item2 = table.item(1,1);
item2.text = "colors";
item2.background = "red";
item2.foreground = "white";
// Set cell checkable
var item3 = table.item(1,2);
item3.flags = 0x33; // See flags Qt::ItemFlags
item3.text = "check-it";
item3.checkState = 0; // See flags Qt::CheckState
// Set current cell
// table.setCurrentCell(1,0);
// Connect table's signals after the table is populated
table.cellClicked.connect(updateStatusBar);
table.cellChanged.connect(updateStatusBar);
// Show dialog
Banana.application.progressBar.pause();
dialog.exec();
Banana.application.progressBar.resume();
// Get table size
Banana.console.log("Table size: " + table.rowCount + ", " + table.columnCount);
// Get current position
Banana.console.log("Current position: " + table.currentRow + ", " + table.currentColumn);
// Get current text
var curItem = table.currentItem();
Banana.console.log("Current text: " + curItem.text);
// Get item check state
Banana.console.log("Item check state: " + (item3.checkState === 2 ? "checked" : "unchecked"));
}
// Update status bar with useful info about the current cell
function updateStatusBar() {
var curItem = table.currentItem();
if (curItem) {
var msg = "Cell " + (table.currentRow + 1) + "," + (table.currentColumn + 1) + " clicked. ";
if (curItem.text.length > 0)
msg += "Text: '" + curItem.text + "'. ";
if (curItem.checkState === 2)
msg += "Checked: true.";
statusLabel.text = msg;
} else {
statusLabel.text = "";
}
}
- User interface for QTableWidget interaction
// Banana Accounting Extension Javascript
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>411</height>
</rect>
</property>
<property name="windowTitle">
<string>QTableWidget Tutorial</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableWidget" name="tableWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>tableWidget</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
Find dialog
// Banana Accounting Extension Javascript
/**
* This example search a text in all the tables of the document,
* and show the matches in the messages pane.
*/
// @id = ch.banana.scripts.find
// @version = 1.3
// @date = 2019-12-06
// @publisher = Banana.ch SA
// @description = Find in whole accounting
// @description.it = Cerca in tutta la contabilità
// @description.de = Suchen in der gesamten Buchhaltung
// @description.fr = Chercher dans toute la comptabilité
// @task = app.command
// @inputdatasource = none
// @timeout = -1
/**
* param values are loaded from Banana.document, edited through dialog and saved to Banana.document
* This array object is like a map (associative array) i.e. "key":"value", see initParam()
* Examples of keys: searchText, wholeText, ...
*/
var param = {};
/** Dialog's functions declaration */
var dialog = Banana.Ui.createUi("documents:742.ui"); // ch.banana.scripts.find.ui
/** Dialog Objects declaration */
var findNextButton = dialog.findChild('findNextButton');
var helpButton = dialog.findChild('helpButton');
var closeButton = dialog.findChild('closeButton');
var searchTextLineEdit = dialog.findChild('searchTextLineEdit');
var matchCaseCheckBox = dialog.findChild('matchCaseCheckBox');
var wholeTextCheckBox = dialog.findChild('wholeTextCheckBox');
dialog.checkdata = function () {
var valid = true;
if (searchTextLineEdit.text.length <= 0) {
Banana.Ui.showInformation("Error", "Search text can't be empty");
valid = false;
}
if (valid) {
dialog.accept();
}
};
dialog.showHelp = function () {
Banana.Ui.showHelp("ch.banana.script.find");
};
dialog.closeDialog = function () {
dialog.close();
};
/** Dialog's events declaration */
findNextButton.clicked.connect(dialog, dialog.checkdata);
helpButton.clicked.connect(dialog, dialog.showHelp);
closeButton.clicked.connect(dialog, dialog.closeDialog);
/** Main function */
function exec(inData) {
//calls dialog
// var rtnDialog = true;
var rtnDialog = dialogExec();
//search text in the whole accounting
if (rtnDialog && Banana.document) {
Banana.document.clearMessages();
searchInTables();
}
}
/** Show the dialog and set the parameters */
function dialogExec() {
// Read saved script settings
initParam();
if (Banana.document) {
var data = Banana.document.getScriptSettings();
if (data.length > 0) {
param = JSON.parse(data);
}
}
// Text at cursor position
var cursor = Banana.document.cursor;
var columnName = cursor.tableName === 'Documents' && cursor.columnName == 'Attachments' ? 'Description' : cursor.columnName;
param["searchText"] = Banana.document.value(cursor.tableName,cursor.rowNr,columnName);
searchTextLineEdit.text = param["searchText"];
// Set dialog parameters
if (param["matchCase"] == "true")
matchCaseCheckBox.checked = true;
else
matchCaseCheckBox.checked = false;
if (param["wholeText"] == "true")
wholeTextCheckBox.checked = true;
else
wholeTextCheckBox.checked = false;
Banana.application.progressBar.pause();
var dlgResult = dialog.exec();
Banana.application.progressBar.resume();
if (dlgResult !== 1)
return false;
// Read dialog parameters
param["searchText"] = searchTextLineEdit.text;
if (matchCaseCheckBox.checked)
param["matchCase"] = "true";
else
param["matchCase"] = "false";
if (wholeTextCheckBox.checked)
param["wholeText"] = "true";
else
param["wholeText"] = "false";
// Save script settings
var paramString = JSON.stringify(param);
var value = Banana.document.setScriptSettings(paramString);
return true;
}
/** Initialize dialog values with default values */
function initParam() {
param = {
"searchText": "",
"matchCase": "false",
"wholeText": "false"
};
}
/** Search a text in the accounting's tables */
function searchInTables() {
var searchText = param["searchText"];
if (param["matchCase"] === "false")
searchText = searchText.toLowerCase();
var tables = Banana.document.tableNames;
// Tables
for (var t=0; t < tables.length; t++) {
var table = Banana.document.table(tables[t]);
var columns = table.columnNames;
// Rows
for (var r=0; r < table.rowCount; r++) {
// Columns
for (var c=0; c < columns.length; c++) {
var textFound = false;
var text = table.value(r, columns[c]);
if (param["matchCase"] === "false")
text = text.toLowerCase();
// Find text
if (param["wholeText"] === "true") {
if (text === searchText)
textFound = true;
} else {
if (text.indexOf(searchText) >= 0)
textFound = true;
}
// Show message
if (textFound) {
table.addMessage("Text \"" + param["searchText"] +
"\" found in \"" + table.value(r, columns[c]) + "\"", r, columns[c]);
}
}
}
}
}
- User interface for Find dialog
// Banana Accounting Extension Javascript
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgFind</class>
<widget class="QDialog" name="DlgFind">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>193</height>
</rect>
</property>
<property name="windowTitle">
<string>Find</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>40</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="searchTextLabel">
<property name="text">
<string>Search &text</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="searchTextLineEdit"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Options</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="matchCaseCheckBox">
<property name="text">
<string>&Match case</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="wholeTextCheckBox">
<property name="text">
<string>&Whole text</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="findNextButton">
<property name="text">
<string>&Find</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="helpButton">
<property name="text">
<string>Help</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>matchCaseCheckBox</tabstop>
<tabstop>findNextButton</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
Export
Export tutorial1 javascript codes
// Banana Accounting Extension Javascript
// @id = ch.banana.apps.exportjavascriptcodestutorial1.js
// @api = 1.0
// @publisher = Banana.ch SA
// @description = Tutorial: Export javascript codes of the Tutorial 1 examples
// @task = export.file
// @doctype = *.*
// @docproperties =
// @timeout = -1
// @exportfiletype = js
//Main function
function exec() {
//Check if we are on an opened document
if (!Banana.document) {
return;
}
//Take the table Documents
var documents = Banana.document.table('Documents');
//We check if the table Documents exists, then we can take all the codes
//If the table Documents doesn't exists, then we stop the script execution
if (!documents) {
return;
} else {
//We use this variable to save all the codes
var jsCode = '';
jsCode += '// Copyright [2018] [Banana.ch SA - Lugano Switzerland]' + '\n';
jsCode += '// ' + '\n';
jsCode += '// Licensed under the Apache License, Version 2.0 (the "License");' + '\n';
jsCode += '// you may not use this file except in compliance with the License.' + '\n';
jsCode += '// You may obtain a copy of the License at' + '\n';
jsCode += '// ' + '\n';
jsCode += '// http://www.apache.org/licenses/LICENSE-2.0' + '\n';
jsCode += '// ' + '\n';
jsCode += '// Unless required by applicable law or agreed to in writing, software' + '\n';
jsCode += '// distributed under the License is distributed on an "AS IS" BASIS,' + '\n';
jsCode += '// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.' + '\n';
jsCode += '// See the License for the specific language governing permissions and' + '\n';
jsCode += '// limitations under the License.' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n';
//Function call to get all the tutorial's codes
jsCode = getJavascriptCode(jsCode, documents);
}
return jsCode;
}
//Function that, for each tutorial's example, gets the javascript code and save it into the jsCode variable.
function getJavascriptCode(jsCode, documents) {
//Read row by row the table Documents
var len = documents.rowCount;
for (var i = 0; i < len; i++) {
//Create a variable for the row
var tRow = documents.row(i);
//We get some values
var fName = Banana.document.info("Base", "FileName").replace(/^.*[\\\/]/, ''); //the file name (without path)
var id = tRow.value("RowId"); //the id of the example
var description = tRow.value("Description"); //the description of the example
var attachments = tRow.value("Attachments"); //the javascript code of the example
//We consider only the rows that contain an id, a description and an attachment
if (id && description && attachments) {
//At the beginning of each code, we insert some information
jsCode += "/** " + '\n';
jsCode += " File: " + fName + '\n';
jsCode += " Id: " + id + '\n';
jsCode += " Description: " + description + '\n';
jsCode += "*/" + '\n';
//we add the code of the attachments
jsCode += attachments;
//At the end of each code, we insert some new lines
jsCode += '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n';
}
}
//Finally we return the variable containing all the codes of all the examples
return jsCode;
}
Export tutorial1 javascript codes to HTML
// Banana Accounting Extension Javascript
// @id = ch.banana.apps.exporthtmljavascriptcodestutorial1.js
// @api = 1.0
// @publisher = Banana.ch SA
// @description = Tutorial: Export javascript codes of the Tutorial 1 examples in HTML
// @task = export.file
// @doctype = *.*
// @docproperties =
// @timeout = -1
// @exportfiletype = html
//Main function
function exec() {
//Check if we are on an opened document
if (!Banana.document) {
return;
}
//Take the table Documents
var documents = Banana.document.table('Documents');
//We check if the table Documents exists, then we can take all the codes
//If the table Documents doesn't exists, then we stop the script execution
if (!documents) {
return;
} else {
//We use this variable to save all the codes
var jsCode = '';
//Function call to get all the tutorial's codes
jsCode = getJavascriptCode(jsCode, documents);
}
return jsCode;
}
//Function that, for each tutorial's example, gets the javascript code and save it into the jsCode variable.
function getJavascriptCode(jsCode, documents) {
//Read row by row the table Documents
var len = documents.rowCount;
for (var i = 0; i < len; i++) {
//Create a variable for the row
var tRow = documents.row(i);
//We get some values
var fName = Banana.document.info("Base", "FileName").replace(/^.*[\\\/]/, ''); //the file name (without path)
var section = tRow.value("Section"); // the section column used to define the title type
var id = tRow.value("RowId"); //the id of the example
var description = tRow.value("Description"); //the description of the example
var attachments = tRow.value("Attachments"); //the javascript code of the example
attachments = attachments.replace(/</g,'<'); // replace the < symbol
attachments = attachments.replace(/>/g,'>'); // replace the > symbol
//For tilte h2 we conside only rows with section h2
if (section && section === "h2") {
jsCode += '<h2>' + description + '</h2>\n';
}
//For js codes we consider only rows with section h3, id, description and attachment
else if (section && section === "h3" && id && description && attachments) {
jsCode += '<h3>' + description + '</h3>\n';
jsCode += '<pre><code class="language-javascript">\n';
jsCode += '// Banana Accounting Extension Javascript' + '\n';
jsCode += attachments;
jsCode += '\n';
jsCode += '</code></pre>\n';
}
}
//Finally we return the variable containing all the codes of all the examples
return jsCode;
}
Embedded Extensions examples Tutorial 2 (Reports)
Complete examples
Account statement - account and period choice
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialaccountstatement
// @description = Tutorial: Return an account statement for the given account and period
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Function call to add the footer to the report
addFooter(report);
//Function call to take a list of all the account numbers
var accountList = getAccountsList();
//Open a dialog window asking to select an item from the list. The selected item is then saved into a variable
var accountNumber = Banana.Ui.getItem('Account selection', 'Select an account', accountList, 0, false);
//Open a dialog windows taskint the user to choose a period
//Return an object with the attributes 'startDate', 'endDate' and 'hasSelection' or undefined if the user clicked cancel
var date = Banana.Ui.getPeriod('Period selection', '2015-01-01', '2015-12-31');
//Check if user has clicked cancel, then use the default startDate/endDate (whole year)
if (date) {
var openingDate = date.startDate;
var closureDate = date.endDate;
}
//--------------//
// 1. TITLE //
//--------------//
//Take the description of the given account and add it to the paragraph
var accountDescription = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('Description');
report.addParagraph("Account statement" + " - " + accountNumber + " " + accountDescription, "styleTitle styleBottomBorder");
report.addParagraph(" ");
//--------------//
// 2. TABLE //
//--------------//
//Create a table object with all transactions for the given account and period
var transTab = Banana.document.currentCard(accountNumber, openingDate, closureDate);
//Create the table that will be printed on the report
var table = report.addTable("myTable");
//Add column titles to the table report
var tableHeader = table.getHeader();
tableRow = tableHeader.addRow();
tableRow.addCell("Date", "styleTableHeader");
tableRow.addCell("Description", "styleTableHeader");
tableRow.addCell("Contra Account", "styleTableHeader");
tableRow.addCell("Debit amount", "styleTableHeader");
tableRow.addCell("Credit amount", "styleTableHeader");
tableRow.addCell("Balance", "styleTableHeader");
//Add the values taken from each row of the table (except the last one) to the respective cells of the table
for (var i = 0; i < transTab.rowCount - 1; i++) {
var tRow = transTab.row(i);
tableRow = table.addRow();
tableRow.addCell(Banana.Converter.toLocaleDateFormat(tRow.value('JDate')));
tableRow.addCell(tRow.value("JDescription"));
tableRow.addCell(tRow.value("JContraAccount"), "styleAccount");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JDebitAmountAccountCurrency')), "styleAmount");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JCreditAmountAccountCurrency')), "styleAmount");
if (Banana.SDecimal.sign(tRow.value('JBalanceAccountCurrency')) >= 0) {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleAmount");
} else {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleBalance styleAmount");
}
}
//We add last row (totals) separately because we want to apply a special style only to this row
for (var i = transTab.rowCount - 1; i < transTab.rowCount; i++) {
var tRow = transTab.row(i);
tableRow = table.addRow();
tableRow.addCell(Banana.Converter.toLocaleDateFormat(tRow.value('JDate')), "styleTotal");
tableRow.addCell(tRow.value("JDescription"), "styleTotal");
tableRow.addCell(tRow.value("JContraAccount"), "styleAccount styleTotal");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JDebitAmountAccountCurrency')), "styleAmount styleTotal");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JCreditAmountAccountCurrency')), "styleAmount styleTotal");
if (Banana.SDecimal.sign(tRow.value('JBalanceAccountCurrency')) >= 0) {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleAmount styleTotal");
} else {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleBalance styleAmount styleTotal");
}
}
//Functin call to create all the styles
var stylesheet = createStyleSheet();
//Print the report
Banana.Report.preview(report, stylesheet);
}
//This function adds a Footer to the report
function addFooter(report) {
report.getFooter().addClass(".img");
report.getFooter().addImage("documents:logo");
}
//This function take from Banana table 'Accounts' all the account numbers and create a list
function getAccountsList() {
var arrList = [];
for (var i = 0; i < Banana.document.table('Accounts').rowCount; i++) {
var tRow = Banana.document.table('Accounts').row(i);
if (tRow.value("Account")) {
arrList.push(tRow.value("Account"));
}
}
return arrList;
}
//The main purpose of this function is to create styles for the report print
function createStyleSheet() {
var stylesheet = Banana.Report.newStyleSheet();
//Page style
var pageStyle = stylesheet.addStyle("@page");
pageStyle.setAttribute("margin", "20m 15mm 15mm 25mm");
//Footer style
style = stylesheet.addStyle(".img");
style.setAttribute("width", "50%");
style.setAttribute("height", "auto");
style.setAttribute("text-align", "center");
//Title style
style = stylesheet.addStyle(".styleTitle");
style.setAttribute("font-size", "14pt");
style.setAttribute("font-weight", "bold");
//Bottom border
style = stylesheet.addStyle(".styleBottomBorder");
style.setAttribute("border-bottom", "1px solid black");
//Create a table style adding the border
style = stylesheet.addStyle("table");
style.setAttribute("width", "100%");
stylesheet.addStyle("table.myTable td", "border: thin solid black");
//Style for the table titles
style = stylesheet.addStyle(".styleTableHeader");
style.setAttribute("font-weight", "bold");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("background-color", "#ffd100");
style.setAttribute("color", "#1b365d");
//Style for account numbers
style = stylesheet.addStyle(".styleAccount");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("text-align", "center");
//Style for amounts
style = stylesheet.addStyle(".styleAmount");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("text-align", "right");
//Style for balances
style = stylesheet.addStyle(".styleBalance");
style.setAttribute("color", "red");
//Style for the total of the table
style = stylesheet.addStyle(".styleTotal");
style.setAttribute("font-weight", "bold");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("background-color", "#b7c3e0");
style.setAttribute("border-bottom", "1px double black");
return stylesheet;
}
Account statement - more accounts print (without accounts/period choice)
// Banana Accounting Extension Javascript
// @api = 1.0
// @id = ch.banana.uni.app.tutorialaccountstatements
// @description = Tutorial: Return a multiple accounts statements
// @task = app.command
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2019-01-25
// @inputdatasource = none
// @timeout = -1
function exec() {
//Create the report
var report = Banana.Report.newReport('Report title');
//Function call to add the footer to the report
addFooter(report);
//First function call to create the page of the report
createReport(report, '1010', '2015-01-01', '2015-12-31');
//Add a page break after the first page
report.addPageBreak();
//Second function call to create the second page of the report
createReport(report, '1011', '2015-01-01', '2015-12-31');
//Functin call to create all the styles
var stylesheet = createStyleSheet();
//Print the report
Banana.Report.preview(report, stylesheet);
}
//The purpose of this function is to create a report using the given accounts number and period
function createReport(report, accountNumber, openingDate, closureDate) {
//--------------//
// 1. ADDRESS //
//--------------//
//Read from the table 'Address' some informations and save them
var namePrefix = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('NamePrefix');
var firstName = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('FirstName');
var familyName = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('FamilyName');
var organisationName = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('OrganisationName');
var address = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('Street');
var countryCode = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('CountryCode');
var postalCode = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('PostalCode');
var locality = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('Locality');
var telephone = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('PhoneMain');
var email = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('EmailWork');
//Add a section to the paragraph for the address
var sectionAddress = report.addSection("styleAddress");
//Check if there are the desired address informations, then add them to the paragraph
if (organisationName) {
sectionAddress.addParagraph(organisationName);
}
if (namePrefix) {
sectionAddress.addParagraph(namePrefix);
}
if (firstName && familyName) {
sectionAddress.addParagraph(firstName + ' ' + familyName);
}
if (address) {
sectionAddress.addParagraph(address);
}
if (countryCode && postalCode && locality) {
sectionAddress.addParagraph(countryCode + ' - ' + postalCode + ' ' + locality);
}
if (telephone) {
sectionAddress.addParagraph('Tel: ' + telephone);
}
if (email) {
sectionAddress.addParagraph('Email: ' + email);
}
//--------------//
// 2. TITLE //
//--------------//
//Take the description of the given account and add it to the paragraph
var accountDescription = Banana.document.table('Accounts').findRowByValue('Account', accountNumber).value('Description');
report.addParagraph(" ", "styleParagraph");
report.addParagraph("Account statement" + " - " + accountNumber + " " + accountDescription, "styleTitle styleBottomBorder");
report.addParagraph(" ");
//--------------//
// 3. TABLE //
//--------------//
//Create a table object with all transactions for the given account and period
var transTab = Banana.document.currentCard(accountNumber, openingDate, closureDate);
//Create the table that will be printed on the report
var table = report.addTable("myTable");
//Add column titles to the table report
var tableHeader = table.getHeader();
tableRow = tableHeader.addRow();
tableRow.addCell("Date", "styleTableHeader");
tableRow.addCell("Description", "styleTableHeader");
tableRow.addCell("Contra Account", "styleTableHeader");
tableRow.addCell("Debit amount", "styleTableHeader");
tableRow.addCell("Credit amount", "styleTableHeader");
tableRow.addCell("Balance", "styleTableHeader");
//Add the values taken from each row of the table (except the last one) to the respective cells of the table
for (var i = 0; i < transTab.rowCount - 1; i++) {
var tRow = transTab.row(i);
tableRow = table.addRow();
tableRow.addCell(Banana.Converter.toLocaleDateFormat(tRow.value('JDate')));
tableRow.addCell(tRow.value("JDescription"));
tableRow.addCell(tRow.value("JContraAccount"), "styleAccount");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JDebitAmountAccountCurrency')), "styleAmount");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JCreditAmountAccountCurrency')), "styleAmount");
if (Banana.SDecimal.sign(tRow.value('JBalanceAccountCurrency')) >= 0) {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleAmount");
} else {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleBalance styleAmount");
}
}
//We add last row (totals) separately because we want to apply a special style only to this row
for (var i = transTab.rowCount - 1; i < transTab.rowCount; i++) {
var tRow = transTab.row(i);
tableRow = table.addRow();
tableRow.addCell(Banana.Converter.toLocaleDateFormat(tRow.value('JDate')), "styleTotal");
tableRow.addCell(tRow.value("JDescription"), "styleTotal");
tableRow.addCell(tRow.value("JContraAccount"), "styleAccount styleTotal");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JDebitAmountAccountCurrency')), "styleAmount styleTotal");
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JCreditAmountAccountCurrency')), "styleAmount styleTotal");
if (Banana.SDecimal.sign(tRow.value('JBalanceAccountCurrency')) >= 0) {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleAmount styleTotal");
} else {
tableRow.addCell(Banana.Converter.toLocaleNumberFormat(tRow.value('JBalanceAccountCurrency')), "styleBalance styleAmount styleTotal");
}
}
}
//This function adds a Footer to the report
function addFooter(report) {
report.getFooter().addClass(".img");
report.getFooter().addImage("documents:logo");
}
//The main purpose of this function is to create styles for the report print
function createStyleSheet() {
var stylesheet = Banana.Report.newStyleSheet();
//Page style
var pageStyle = stylesheet.addStyle("@page");
pageStyle.setAttribute("margin", "20m 15mm 15mm 25mm");
//Footer style
style = stylesheet.addStyle(".img");
style.setAttribute("width", "50%");
style.setAttribute("height", "auto");
style.setAttribute("text-align", "center");
//Title style
style = stylesheet.addStyle(".styleTitle");
style.setAttribute("font-size", "14pt");
style.setAttribute("font-weight", "bold");
//Bottom border
style = stylesheet.addStyle(".styleBottomBorder");
style.setAttribute("border-bottom", "1px solid black");
//Create a table style adding the border
style = stylesheet.addStyle("table");
style.setAttribute("width", "100%");
stylesheet.addStyle("table.myTable td", "border: thin solid black");
//Style for the table titles
style = stylesheet.addStyle(".styleTableHeader");
style.setAttribute("font-weight", "bold");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("background-color", "#ffd100");
style.setAttribute("color", "#1b365d");
//Style for account numbers
style = stylesheet.addStyle(".styleAccount");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("text-align", "center");
//Style for amounts
style = stylesheet.addStyle(".styleAmount");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("text-align", "right");
//Style for balances
style = stylesheet.addStyle(".styleBalance");
style.setAttribute("color", "red");
//Style for the total of the table
style = stylesheet.addStyle(".styleTotal");
style.setAttribute("font-weight", "bold");
style.setAttribute("padding-bottom", "5px");
style.setAttribute("background-color", "#b7c3e0");
style.setAttribute("border-bottom", "1px double black");
style = stylesheet.addStyle(".styleAddress");
style.setAttribute("position", "absolute");
style.setAttribute("left", "0mm");
style.setAttribute("top", "0mm");
style.setAttribute("width", "80mm");
style.setAttribute("height", "30mm");
style.setAttribute("overflow-shrink-max", "0.6");
style.setAttribute("overflow", "shrink");
//Add a space between the date and the title
style = stylesheet.addStyle(".styleParagraph");
style.setAttribute("margin", "112px");
return stylesheet;
}
Export
Export a value from Banana into a text file (.txt)
// Banana Accounting Extension Javascript
// @id = ch.banana.apps.export
// @api = 1.0
// @doctype = *.*
// @description = Tutorial: Export a value from Banana into a text file (*.txt)
// @task = export.file
// @exportfiletype = txt
// @timeout = -1
// It is possible to export data only into external files.
// In this example we take an account balance and we export it into a txt file.
// A dialog window asks the user to insert the file name and choose where to save it.
function exec() {
//Take the balance (opening + debit-credit) for the given account and period
var exportResult = Banana.document.currentBalance('1000', '2015-01-05', '2015-02-07').balance;
//Specifies a value to be returned that will be exported into the txt file
return exportResult;
}
Export Tutorial2 javascript codes
// Banana Accounting Extension Javascript
// @id = ch.banana.apps.exportjavascriptcodestutorial2.js
// @api = 1.0
// @publisher = Banana.ch SA
// @description = Tutorial: Export javascript codes of the tutorial 2 examples
// @task = export.file
// @doctype = *.*
// @docproperties =
// @timeout = -1
// @exportfiletype = js
//Main function
function exec() {
//Check if we are on an opened document
if (!Banana.document) {
return;
}
//Take the table Documents
var documents = Banana.document.table('Documents');
//We check if the table Documents exists, then we can take all the codes
//If the table Documents doesn't exists, then we stop the script execution
if (!documents) {
return;
} else {
//We use this variable to save all the codes
var jsCode = '';
jsCode += '// Copyright [2018] [Banana.ch SA - Lugano Switzerland]' + '\n';
jsCode += '// ' + '\n';
jsCode += '// Licensed under the Apache License, Version 2.0 (the "License");' + '\n';
jsCode += '// you may not use this file except in compliance with the License.' + '\n';
jsCode += '// You may obtain a copy of the License at' + '\n';
jsCode += '// ' + '\n';
jsCode += '// http://www.apache.org/licenses/LICENSE-2.0' + '\n';
jsCode += '// ' + '\n';
jsCode += '// Unless required by applicable law or agreed to in writing, software' + '\n';
jsCode += '// distributed under the License is distributed on an "AS IS" BASIS,' + '\n';
jsCode += '// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.' + '\n';
jsCode += '// See the License for the specific language governing permissions and' + '\n';
jsCode += '// limitations under the License.' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n';
//Function call to get all the tutorial's codes
jsCode = getJavascriptCode(jsCode, documents);
}
return jsCode;
}
//Function that, for each tutorial's example, gets the javascript code and save it into the jsCode variable.
function getJavascriptCode(jsCode, documents) {
//Read row by row the table Documents
var len = documents.rowCount;
for (var i = 0; i < len; i++) {
//Create a variable for the row
var tRow = documents.row(i);
//We get some values
var fName = Banana.document.info("Base", "FileName").replace(/^.*[\\\/]/, ''); //the file name (without path)
var id = tRow.value("RowId"); //the id of the example
var description = tRow.value("Description"); //the description of the example
var attachments = tRow.value("Attachments"); //the javascript code of the example
//We consider only the rows that contain an id, a description and an attachment
if (id && description && attachments) {
//At the beginning of each code, we insert some information
jsCode += "/** " + '\n';
jsCode += " File: " + fName + '\n';
jsCode += " Id: " + id + '\n';
jsCode += " Description: " + description + '\n';
jsCode += "*/" + '\n';
//we add the code of the attachments
jsCode += attachments;
//At the end of each code, we insert some new lines
jsCode += '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n';
}
}
//Finally we return the variable containing all the codes of all the examples
return jsCode;
}
Export Tutorial2 javascript codes to HTML
// Banana Accounting Extension Javascript
// @id = ch.banana.apps.exporthtmljavascriptcodestutorial2.js
// @api = 1.0
// @publisher = Banana.ch SA
// @description = Tutorial: Export javascript codes of the Tutorial 2 examples in HTML
// @task = export.file
// @doctype = *.*
// @docproperties =
// @timeout = -1
// @exportfiletype = html
//Main function
function exec() {
//Check if we are on an opened document
if (!Banana.document) {
return;
}
//Take the table Documents
var documents = Banana.document.table('Documents');
//We check if the table Documents exists, then we can take all the codes
//If the table Documents doesn't exists, then we stop the script execution
if (!documents) {
return;
} else {
//We use this variable to save all the codes
var jsCode = '';
//Function call to get all the tutorial's codes
jsCode = getJavascriptCode(jsCode, documents);
}
return jsCode;
}
//Function that, for each tutorial's example, gets the javascript code and save it into the jsCode variable.
function getJavascriptCode(jsCode, documents) {
//Read row by row the table Documents
var len = documents.rowCount;
for (var i = 0; i < len; i++) {
//Create a variable for the row
var tRow = documents.row(i);
//We get some values
var fName = Banana.document.info("Base", "FileName").replace(/^.*[\\\/]/, ''); //the file name (without path)
var section = tRow.value("Section"); // the section column used to define the title type
var id = tRow.value("RowId"); //the id of the example
var description = tRow.value("Description"); //the description of the example
var attachments = tRow.value("Attachments"); //the javascript code of the example
attachments = attachments.replace(/</g,'<'); // replace the < symbol
attachments = attachments.replace(/>/g,'>'); // replace the > symbol
//For tilte h2 we conside only rows with section h2
if (section && section === "h2") {
jsCode += '<h2>' + description + '</h2>\n';
}
//For js codes we consider only rows with section h3, id, description and attachment
else if (section && section === "h3" && id && description && attachments) {
jsCode += '<h3>' + description + '</h3>\n';
jsCode += '<pre><code class="language-javascript">\n';
jsCode += '// Banana Accounting Extension Javascript' + '\n';
jsCode += attachments;
jsCode += '\n';
jsCode += '</code></pre>\n';
}
}
//Finally we return the variable containing all the codes of all the examples
return jsCode;
}
Embedded Extensions examples Tutorial 3 Import CSV
On this page we show some examples of transactions import extensions.
Each example consists of:
- The complete JavaScript code of the import extension.
- The .CSV files in different formats with the transactions data to be imported.
Some examples contains anonymized data, the description text has no meanings. - The output in .TSV format (Tabulator Separated Values) of the import extension, which contains the transformed csv data in the “transactions.simple” format used to import the transactions in Banana Accounting.
Import transactions example 1
Migros Bank (Switzerland) import transactions with multiple csv formats
// Banana Accounting Extension Javascript
// @id = ch.banana.switzerland.import.migrosbank.tutorial
// @api = 1.0
// @pubdate = 2023-10-10
// @publisher = Banana.ch SA
// @description = Migros Bank - Import account statement .csv (Banana+ Advanced)
// @description.en = Migros Bank - Import account statement .csv (Banana+ Advanced)
// @description.de = Migros Bank - Bewegungen importieren .csv (Banana+ Advanced)
// @description.fr = Migros Bank - Importer mouvements .csv (Banana+ Advanced)
// @description.it = Migros Bank - Importa movimenti .csv (Banana+ Advanced)
// @doctype = *
// @docproperties =
// @task = import.transactions
// @outputformat = transactions.simple
// @inputdatasource = openfiledialog
// @timeout = -1
// @inputencoding = latin1
// @inputfilefilter = Text files (*.txt *.csv);;All files (*.*)
// @inputfilefilter.de = Text (*.txt *.csv);;Alle Dateien (*.*)
// @inputfilefilter.fr = Texte (*.txt *.csv);;Tous (*.*)
// @inputfilefilter.it = Testo (*.txt *.csv);;Tutti i files (*.*)
/**
* Parse the data and return the data to be imported as a tab separated file.
*/
function exec(string, isTest) {
var importUtilities = new ImportUtilities(Banana.document);
if (isTest !== true && !importUtilities.verifyBananaAdvancedVersion())
return "";
var fieldSeparator = findSeparator(string);
var transactions = Banana.Converter.csvToArray(string, fieldSeparator, '"');
// Format 1
var format1 = new MBFormat1();
if (format1.match(transactions)) {
transactions = format1.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
importUtilities.getUnknownFormatError();
return "";
}
/**
* Migros Bank Format 1 A):
* Kontoauszug bis: 04.09.2023 ;;;
* ;;;
* Kontonummer: 543.278.22;;;
* Bezeichnung: Privat;;;
* Saldo: CHF 38547.7;;;
* ;;;
* Ramer E. & Ramer-Zahner D.;;;
* In den Steinreben 6C;;;
* 4153 Reinach BL;;;
* ;;;
* ;;;
* Datum;Buchungstext;Betrag;Valuta
* 04.09.23;Zahlungseingang;1838.00;04.09.23
* 04.09.23;Zahlungs;-204.45;04.09.23
*
* Migros Bank Format 1 B), valutare in futuro se fare un formato differente per conti privati,
* per ora cambia solo la data e le intestazioni:
* Moristra rerva eo:;2023-09-13
* Moristra rerva lant:;2023-10-10
* ;
* Sciercipsidea:;Rerva haragine
* ;
* ;
* ;
* Data;Testo di registrazione;Importo;Valuta
* 15.09.2023;Frunt stantuisu me quaesecerinum XXX/UT/PUS, Dis Frangunattis 47h, 1782 Raraequone;-105.45;15.09.2023
* 15.09.2023;DIDUNT Humquit-Costripe EO, Dis Volluvis 1, 7888 Prescrente;-230.95;15.09.2023
* 19.09.2023;CLAVIANTO AUFERVA EO, DIS MINENT 8, 6686 COLUMEA;-150.80;19.09.2023
*/
var MBFormat1 = class MBFormat1 {
constructor() {
this.colDate = 0;
this.colDescr = 1;
this.colAmount = 2;
this.colDateValuta = 3;
this.colCount = 4;
this.decimalSeparator = ".";
this.dateFormat = "dd.mm.yy";
}
/** Return true if the transactions match this format */
match(transactions) {
if (transactions.length === 0)
return false;
for (var i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
/* array should have all columns */
if (transaction.length == this.colCount)
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate] &&
transaction[this.colDate].match(/^(0[1-9]|[12][0-9]|3[01])[-.](0[1-9]|1[0-2])[-.]\d{2}$/)) {
formatMatched = true;
} else if (formatMatched && transaction[this.colDate] &&
transaction[this.colDate].match(/^(0[1-9]|[12][0-9]|3[01])[-.](0[1-9]|1[0-2])[-.]\d{4}$/)) {
this.dateFormat = "dd.mm.yyyy";
formatMatched = true;
}
else {
formatMatched = false;
}
if (formatMatched && transaction[this.colDateValuta] &&
transaction[this.colDateValuta].match(/\b\d{2}[.-]\d{2}[.-](?:\d{2}|\d{4})\b/g)) {
formatMatched = true;
}
else {
formatMatched = false;
}
if (formatMatched) {
return true;
}
}
return false;
}
/** Convert the transaction to the format to be imported */
convert(rows) {
var transactionsToImport = [];
for (var i = 0; i < rows.length; i++) {
let transaction = rows[i];
if (transaction.length == this.colCount &&
transaction[this.colDate].match(/^(0[1-9]|[12][0-9]|3[01])[-.](0[1-9]|1[0-2])[-.](\d{4}|\d{2})$/)) {
transactionsToImport.push(this.mapTransaction(rows[i]));
}
}
// Sort rows by date
if (this.dateFormat !== "dd.mm.yyyy") // transactions in the format B are already provided in the correct order.
transactionsToImport = transactionsToImport.reverse();
// Add header and return
var header = [["Date", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
/** Return the transaction converted in the import format */
mapTransaction(transaction) {
var mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(transaction[this.colDate], this.dateFormat));
mappedLine.push(""); // Doc is empty for now
mappedLine.push(transaction[this.colDescr]);
var amount = transaction[this.colAmount];
if (amount.length > 0) {
//check decimal separator, if is comma, we replace it.
if (amount.indexOf(",") >= 0)
amount = amount.replace(',', '.');
if (amount[0] === "-") {
amount = amount.replace(/-/g, ''); //remove minus sign
mappedLine.push("");
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount, "."));
} else {
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount, "."));
mappedLine.push("");
}
}
return mappedLine;
}
}
/**
* The function findSeparator is used to find the field separator.
*/
function findSeparator(string) {
var commaCount = 0;
var semicolonCount = 0;
var tabCount = 0;
for (var i = 0; i < 1000 && i < string.length; i++) {
var c = string[i];
if (c === ',')
commaCount++;
else if (c === ';')
semicolonCount++;
else if (c === '\t')
tabCount++;
}
if (tabCount > commaCount && tabCount > semicolonCount) {
return '\t';
}
else if (semicolonCount > commaCount) {
return ';';
}
return ',';
}
/*
* class ImportUtilities
* Contains methods that can be shared by extensions for importing bank data
*/
var ImportUtilities = class ImportUtilities {
constructor(banDocument) {
this.banDocument = banDocument;
if (this.banDocument === undefined)
this.banDocument = Banana.document;
}
//The purpose of this function is to convert all the data into a format supported by Banana
convertToBananaFormat(intermediaryData) {
var columnTitles = [];
//Create titles only for fields not starting with "_"
for (var name in intermediaryData[0]) {
if (name.substring(0, 1) !== "_") {
columnTitles.push(name);
}
}
//Function call Banana.Converter.objectArrayToCsv() to create a CSV with new data just converted
var convertedCsv = Banana.Converter.objectArrayToCsv(columnTitles, intermediaryData, "\t");
return convertedCsv;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertCsvToIntermediaryData(inData, convertionParam) {
var form = [];
var intermediaryData = [];
//Add the header if present
if (convertionParam.header) {
inData = convertionParam.header + inData;
}
//Read the CSV file and create an array with the data
var csvFile = Banana.Converter.csvToArray(inData, convertionParam.separator, convertionParam.textDelim);
//Variables used to save the columns titles and the rows values
var columns = this.getHeaderData(csvFile, convertionParam.headerLineStart); //array
var rows = this.getRowData(csvFile, convertionParam.dataLineStart); //array of array
//Load the form with data taken from the array. Create objects
this.loadForm(form, columns, rows);
//Create the new CSV file with converted data
var convertedRow;
//For each row of the form, we call the rowConverter() function and we save the converted data
for (var i = 0; i < form.length; i++) {
convertedRow = convertionParam.rowConverter(form[i]);
intermediaryData.push(convertedRow);
}
//Return the converted CSV data into the Banana document table
return intermediaryData;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertHtmlToIntermediaryData(inData, convertionParam) {
var form = [];
var intermediaryData = [];
//Read the HTML file and create an array with the data
var htmlFile = [];
var htmlRows = inData.match(/<tr[^>]*>.*?<\/tr>/gi);
for (var rowNr = 0; rowNr < htmlRows.length; rowNr++) {
var htmlRow = [];
var htmlFields = htmlRows[rowNr].match(/<t(h|d)[^>]*>.*?<\/t(h|d)>/gi);
for (var fieldNr = 0; fieldNr < htmlFields.length; fieldNr++) {
var htmlFieldRe = />(.*)</g.exec(htmlFields[fieldNr]);
htmlRow.push(htmlFieldRe.length > 1 ? htmlFieldRe[1] : "");
}
htmlFile.push(htmlRow);
}
//Variables used to save the columns titles and the rows values
var columns = this.getHeaderData(htmlFile, convertionParam.headerLineStart); //array
var rows = this.getRowData(htmlFile, convertionParam.dataLineStart); //array of array
//Convert header names
for (var i = 0; i < columns.length; i++) {
var convertedHeader = columns[i];
convertedHeader = convertedHeader.toLowerCase();
convertedHeader = convertedHeader.replace(" ", "_");
var indexOfHeader = columns.indexOf(convertedHeader);
if (indexOfHeader >= 0 && indexOfHeader < i) { // Header alreay exist
//Avoid headers with same name adding an incremental index
var newIndex = 2;
while (columns.indexOf(convertedHeader + newIndex.toString()) !== -1 && newIndex < 99)
newIndex++;
convertedHeader = convertedHeader + newIndex.toString()
}
columns[i] = convertedHeader;
}
// Banana.console.log(JSON.stringify(columns, null, " "));
//Load the form with data taken from the array. Create objects
this.loadForm(form, columns, rows);
//Create the new CSV file with converted data
var convertedRow;
//For each row of the form, we call the rowConverter() function and we save the converted data
for (var i = 0; i < form.length; i++) {
convertedRow = convertionParam.rowConverter(form[i]);
intermediaryData.push(convertedRow);
}
//Return the converted CSV data into the Banana document table
return intermediaryData;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertToIntermediaryData(inData, convertionParam) {
if (convertionParam.format === "html") {
return this.convertHtmlToIntermediaryData(inData, convertionParam);
} else {
return this.convertCsvToIntermediaryData(inData, convertionParam);
}
}
//The purpose of this function is to return all the titles of the columns
getHeaderData(csvFile, startLineNumber) {
if (!startLineNumber) {
startLineNumber = 0;
}
var headerData = csvFile[startLineNumber];
for (var i = 0; i < headerData.length; i++) {
headerData[i] = headerData[i].trim();
if (!headerData[i]) {
headerData[i] = i;
}
//Avoid duplicate headers
var headerPos = headerData.indexOf(headerData[i]);
if (headerPos >= 0 && headerPos < i) { // Header already exist
var postfixIndex = 2;
while (headerData.indexOf(headerData[i] + postfixIndex.toString()) !== -1 && postfixIndex <= 99)
postfixIndex++; // Append an incremental index
headerData[i] = headerData[i] + postfixIndex.toString()
}
}
return headerData;
}
getLang() {
var lang = 'en';
if (this.banDocument)
lang = this.banDocument.locale;
else if (Banana.application.locale)
lang = Banana.application.locale;
if (lang.length > 2)
lang = lang.substr(0, 2);
return lang;
}
//The purpose of this function is to return all the data of the rows
getRowData(csvFile, startLineNumber) {
if (!startLineNumber) {
startLineNumber = 1;
}
var rowData = [];
for (var i = startLineNumber; i < csvFile.length; i++) {
rowData.push(csvFile[i]);
}
return rowData;
}
//The purpose of this function is to load all the data (titles of the columns and rows) and create a list of objects.
//Each object represents a row of the csv file
loadForm(form, columns, rows) {
for (var j = 0; j < rows.length; j++) {
var obj = {};
for (var i = 0; i < columns.length; i++) {
obj[columns[i]] = rows[j][i];
}
form.push(obj);
}
}
// The purpose of this function is to sort the data
sortData(intermediaryData, convertionParam) {
if (convertionParam.sortColums && convertionParam.sortColums.length) {
intermediaryData.sort(
function (row1, row2) {
for (var i = 0; i < convertionParam.sortColums.length; i++) {
var columnName = convertionParam.sortColums[i];
if (row1[columnName] > row2[columnName])
return 1;
else if (row1[columnName] < row2[columnName])
return -1;
}
return 0;
});
if (convertionParam.sortDescending)
intermediaryData.reverse();
}
return intermediaryData;
}
verifyBananaPlusVersion() {
if (!this.banDocument)
return false;
var BAN_VERSION_MIN = "10.0";
// supported Version
if (Banana.compareVersion && Banana.compareVersion(Banana.application.version, BAN_VERSION_MIN) >= 0) {
return true;
}
// not supported version
var lang = this.getLang();
var msg = "This extension requires Banana Accounting+";
this.banDocument.addMessage(msg, "ID_ERR_LICENSE_NOTVALID");
return false;
}
//Check if the version of Banana Accounting is compatible with this class
verifyBananaAdvancedVersion() {
if (!this.banDocument)
return false;
if (!Banana.application.license || Banana.application.license.licenseType !== "advanced") {
var lang = this.getLang();
var msg = "This extension requires Banana Accounting+ Advanced";
this.banDocument.addMessage(msg, "ID_ERR_LICENSE_NOTVALID");
return false;
}
return true;
}
getErrorMessage(errorId, lang) {
if (!lang)
lang = 'en';
switch (errorId) {
case "ID_ERR_FORMAT_UNKNOWN":
if (lang == 'it')
return "Formato del file *.csv non riconosciuto";
else if (lang == 'fr')
return "Format de fichier *.csv non reconnu";
else if (lang == 'de')
return "Unerkanntes *.csv-Dateiformat";
else
return "Unrecognised *.csv file format";
}
return '';
}
getLang() {
var lang = 'en';
if (Banana.application.locale)
lang = Banana.application.locale;
if (lang.length > 2)
lang = lang.substring(0, 2);
return lang;
}
getUnknownFormatError(){
let errId = "ID_ERR_FORMAT_UNKNOWN"; //error
let lang = this.getLang();
let msg = this.getErrorMessage(errId, lang);
Banana.document.addMessage(msg, errId);
}
}
Input data - csv_migrosbank_example_format1_20230906.csv
Input text passed to the exec() function.
Alevenequis xxx: 78.71.5440 ;;;
;;;
Ausplecutum: 457.211.73;;;
Agnuluviant: Neriam;;;
Oprit: BOX 54060.3;;;
;;;
Agile G. & Agile-Tumere L.;;;
Ut lum Ascungilis 1Q;;;
4153 Reinach BL;;;
;;;
;;;
Datum;Buchungstext;Betrag;Valuta
04.09.23;Partuducartudie;1838.00;04.09.23
Output data - csv_migrosbank_example_format1_20230906.tsv
Output text returned by the exec() function.
Date\tDoc\tDescription\tIncome\tExpenses
2023-09-04\t\tPartuducartudie\t1838.00\t
Input data - csv_migrosbank_example_format1_20230908.csv
Input text passed to the exec() function.
Officulo patem crem: 42.35.6581 ;;;
;;;
Office eo patem: 133.273.44;;;
Tabilliquaest: Patem plucinto;;;
Widum: SUB 30221.84;;;
;;;
Amniuntum-Reles Addunnes;;;
Flone H. Nolvo 13 O;;;
10090 Villarbasse TO;;;
;;;
;;;
Data;Testo di registrazione;Importo;Valuta
06.09.23;Anispus rentemple;975.00;06.09.23
04.09.23;Rentemple;-204.45;04.09.23
01.09.23;Anispus rentemple;2300.00;01.09.23
01.09.23;Anispus rentemple;2400.00;01.09.23
31.08.23;Anispus rentemple;2610.00;31.08.23
30.08.23;Rentemple;-166.00;30.08.23
29.08.23;Rentemple;-161.55;29.08.23
29.08.23;Anispus rentemple;140.00;29.08.23
28.08.23;Anispus rentemple;2640.00;28.08.23
18.08.23;Anispus rentemple;2190.00;18.08.23
10.08.23;Vicum eo eviore patem usa 84.60.6581 vi 80.60.6581;-3.00;10.08.23
10.08.23;Raepribulle multubiti morpus usa 84.60.6581 vi 80.60.6581 triente 67010185;-5.00;10.08.23
08.08.23;Rentemple;-216.50;08.08.23
07.08.23;Anispus rentemple;975.00;07.08.23
04.08.23;Anispus rentemple;2500.00;04.08.23
03.08.23;Anispus rentemple;2300.00;03.08.23
31.07.23;Anispus rentemple;2610.00;31.07.23
31.07.23;Anispus rentemple;2540.00;31.07.23
28.07.23;Anispus rentemple;140.00;28.07.23
28.07.23;Anispus rentemple;2640.00;28.07.23
25.07.23;Rentemple;-371.75;25.07.23
24.07.23;Rentemple;-708.25;24.07.23
20.07.23;Anispus rentemple;2190.00;20.07.23
18.07.23;Rentemple;-51.76;18.07.23
Output data - csv_migrosbank_example_format1_20230908.tsv
Output text returned by the exec() function.
Date\tDoc\tDescription\tIncome\tExpenses
2023-07-18\t\tRentemple\t\t51.76
2023-07-20\t\tAnispus rentemple\t2190.00\t
2023-07-24\t\tRentemple\t\t708.25
2023-07-25\t\tRentemple\t\t371.75
2023-07-28\t\tAnispus rentemple\t2640.00\t
2023-07-28\t\tAnispus rentemple\t140.00\t
2023-07-31\t\tAnispus rentemple\t2540.00\t
2023-07-31\t\tAnispus rentemple\t2610.00\t
2023-08-03\t\tAnispus rentemple\t2300.00\t
2023-08-04\t\tAnispus rentemple\t2500.00\t
2023-08-07\t\tAnispus rentemple\t975.00\t
2023-08-08\t\tRentemple\t\t216.50
2023-08-10\t\tRaepribulle multubiti morpus usa 84.60.6581 vi 80.60.6581 triente 67010185\t\t5.00
2023-08-10\t\tVicum eo eviore patem usa 84.60.6581 vi 80.60.6581\t\t3.00
2023-08-18\t\tAnispus rentemple\t2190.00\t
2023-08-28\t\tAnispus rentemple\t2640.00\t
2023-08-29\t\tAnispus rentemple\t140.00\t
2023-08-29\t\tRentemple\t\t161.55
2023-08-30\t\tRentemple\t\t166.00
2023-08-31\t\tAnispus rentemple\t2610.00\t
2023-09-01\t\tAnispus rentemple\t2400.00\t
2023-09-01\t\tAnispus rentemple\t2300.00\t
2023-09-04\t\tRentemple\t\t204.45
2023-09-06\t\tAnispus rentemple\t975.00\t
Input data - csv_migrosbank_example_format1_20231010.csv
Input text passed to the exec() function.
Moristra rerva eo:;2023-09-13
Moristra rerva lant:;2023-10-10
;
Sciercipsidea:;Rerva haragine
;
;
;
Data;Testo di registrazione;Importo;Valuta
15.09.2023;Frunt stantuisu me quaesecerinum XXX/UT/PUS, Dis Frangunattis 47h, 1782 Raraequone;-105.45;15.09.2023
15.09.2023;DIDUNT Humquit-Costripe EO, Dis Volluvis 1, 7888 Prescrente;-230.95;15.09.2023
19.09.2023;CLAVIANTO AUFERVA EO, DIS MINENT 8, 6686 COLUMEA;-150.80;19.09.2023
20.09.2023;Quibula Mindum Eaniertus Habit, Dis cat Brende 28, 1880 Reline, QL3478184100087423875;2190.00;20.09.2023
22.09.2023;CONDUONE PAVIONENT, DIS CAT BRENDE 48, 1880 RELINE, AG04803336078414G776D;6534.85;22.09.2023
28.09.2023;CURICA MITATE, DIS FERBO MEN 87 UT 1880 RELINE, EC143102680158501757U;2640.00;28.09.2023
29.09.2023;Perrede Deceripam, Insunt Pulus 60, 8533 Inatu Serneripe, HK3780577203472652012;140.00;29.09.2023
29.09.2023;Eorore Quam, Dis cat Brende 28, UT-1880 Reline, NW8367667075683018488;2610.00;29.09.2023
29.09.2023;Ludicita Lumilla, Dis Ferbo Men 87, 1880 Reline, JX6823625561033213063;2400.00;29.09.2023
03.10.2023;Biberi Tere, Dis cat Brende 28, 1880 Reline, YD8147137112546525622;2300.00;03.10.2023
06.10.2023;Aufere Adecro in commensectum, Horint Coluva-Exerent 56, 8367 Ireèex, WG0071635058848171552;975.00;06.10.2023
09.10.2023;Nanno Spirit Ripere, Dis cat Brende 28, 1880 Reline, XA1816106073487284374;2500.00;09.10.2023
10.10.2023;Mendisistra sustudabo difico nos 44.60.3252 at 18.60.3252 sideano 23418626;-5.00;10.10.2023
10.10.2023;Humea me punium rerva nos 44.60.3252 at 18.60.3252;-3.00;10.10.2023
Output data - csv_migrosbank_example_format1_20231010.tsv
Output text returned by the exec() function.
Date\tDoc\tDescription\tIncome\tExpenses
2023-09-15\t\tFrunt stantuisu me quaesecerinum XXX/UT/PUS, Dis Frangunattis 47h, 1782 Raraequone\t\t105.45
2023-09-15\t\tDIDUNT Humquit-Costripe EO, Dis Volluvis 1, 7888 Prescrente\t\t230.95
2023-09-19\t\tCLAVIANTO AUFERVA EO, DIS MINENT 8, 6686 COLUMEA\t\t150.80
2023-09-20\t\tQuibula Mindum Eaniertus Habit, Dis cat Brende 28, 1880 Reline, QL3478184100087423875\t2190.00\t
2023-09-22\t\tCONDUONE PAVIONENT, DIS CAT BRENDE 48, 1880 RELINE, AG04803336078414G776D\t6534.85\t
2023-09-28\t\tCURICA MITATE, DIS FERBO MEN 87 UT 1880 RELINE, EC143102680158501757U\t2640.00\t
2023-09-29\t\tPerrede Deceripam, Insunt Pulus 60, 8533 Inatu Serneripe, HK3780577203472652012\t140.00\t
2023-09-29\t\tEorore Quam, Dis cat Brende 28, UT-1880 Reline, NW8367667075683018488\t2610.00\t
2023-09-29\t\tLudicita Lumilla, Dis Ferbo Men 87, 1880 Reline, JX6823625561033213063\t2400.00\t
2023-10-03\t\tBiberi Tere, Dis cat Brende 28, 1880 Reline, YD8147137112546525622\t2300.00\t
2023-10-06\t\tAufere Adecro in commensectum, Horint Coluva-Exerent 56, 8367 Ireèex, WG0071635058848171552\t975.00\t
2023-10-09\t\tNanno Spirit Ripere, Dis cat Brende 28, 1880 Reline, XA1816106073487284374\t2500.00\t
2023-10-10\t\tMendisistra sustudabo difico nos 44.60.3252 at 18.60.3252 sideano 23418626\t\t5.00
2023-10-10\t\tHumea me punium rerva nos 44.60.3252 at 18.60.3252\t\t3.00
Import transactions example 2
Postfinance (Switzerland) import transactions with multiple csv formats
// Banana Accounting Extension Javascript
// @id = ch.banana.switzerland.import.postfinance.tutorial
// @api = 1.0
// @pubdate = 2023-09-29
// @publisher = Banana.ch SA
// @description = Postfinance - Import account statement .csv (Banana+ Advanced)
// @description.de = Postfinance - Bewegungen importieren .csv (Banana+ Advanced)
// @description.en = Postfinance - Import account statement .csv (Banana+ Advanced)
// @description.fr = Postfinance - Importer mouvements .csv (Banana+ Advanced)
// @description.it = Postfinance - Importa movimenti .csv (Banana+ Advanced)
// @doctype = *
// @docproperties =
// @task = import.transactions
// @outputformat = transactions.simple
// @inputdatasource = openfiledialog
// @inputencoding = latin1
// @inputfilefilter = Text files (*.txt *.csv);;All files (*.*)
// @inputfilefilter.de = Text (*.txt *.csv);;Alle Dateien (*.*)
// @inputfilefilter.fr = Texte (*.txt *.csv);;Tous (*.*)
// @inputfilefilter.it = Testo (*.txt *.csv);;Tutti i files (*.*)
/**
* Parse the data and return the data to be imported as a tab separated file.
*/
function exec(inData, isTest) {
if (!inData) return "";
var importUtilities = new ImportUtilities(Banana.document);
if (isTest !== true && !importUtilities.verifyBananaAdvancedVersion())
return "";
if (inData.indexOf("<html") >= 0) {
var formatHtml1 = new PFHtmlFormat1();
var rows = formatHtml1.convert(inData);
var csv = Banana.Converter.objectArrayToCsv(
["Date", "DateValue", "Description", "Income", "Expenses"],
rows);
return csv;
} else {
var fieldSeparator = findSeparator(inData);
let inDataCleared = clearText(inData);
var transactions = Banana.Converter.csvToArray(inDataCleared, fieldSeparator);
// Format SBU 1
var formatSBU1 = new PFCSVFormatSBU1();
if (formatSBU1.match(transactions)) {
transactions = formatSBU1.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Credit Card format 1
var format1_CreditCard = new PFCSVFormat1_CreditCard();
if (format1_CreditCard.match(transactions)) {
transactions = format1_CreditCard.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 1
var format1 = new PFCSVFormat1();
if (format1.match(transactions)) {
transactions = format1.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 2
var format2 = new PFCSVFormat2();
if (format2.match(transactions)) {
transactions = format2.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 3
var format3 = new PFCSVFormat3();
if (format3.match(transactions)) {
transactions = format3.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 4
var format4 = new PFCSVFormat4();
if (format4.match(transactions)) {
transactions = format4.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 5
var format5 = new PFCSVFormat5();
if (format5.match(transactions)) {
transactions = format5.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 6, works with translated column headers.
var format6 = new PFCSVFormat6();
// getFormattedData () works with specifics headers and to translate them.
let transactionsData = format6.getFormattedData(transactions, importUtilities);
if (format6.match(transactionsData)) {
let convTransactions = format6.convert(transactionsData);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(convTransactions);
}
}
importUtilities.getUnknownFormatError();
return "";
}
/**
* Pulisce il testo dai doppi a capo, con la versione 6 del formato csv, per qualche motivo quando il file .csv
* viene aperto su windows vengono aggiunti degli a capo aggiuntivi (uno o più).
* Ogni riga dovrebbe contenere un "\r\n" non di più, anche quelle vuote.
*/
function clearText(text) {
// Sostituisce tutte le occorrenze multiple di "\r\r\n" con un singolo "\r\n"
return text.replace(/\r\r\n/g, "\r\n");
}
/**
* PFCSV Format 6, since february 2024.
* Date de début:;26.02.2022;;;;;
* Date de fin:;26.02.2024;;;;;
* Catégorie:;Tous;;;;;
* Compte:;CH00000000000000000000;;;;;
* Monnaie:;CHF;;;;;
* ;;;;;;
* Date;Type de transaction;Texte de notification;Crédit en CHF;Débit en CHF;Label;Catégorie
* ;;;;;;
* 26.02.2024;Enregistrement comptable;Descr;;-100;;Dépenses autres
* 26.02.2024;Enregistrement comptable;Descr;;-15;;Dépenses autres
* ;;;;;;
* Disclaimer:;;;;;;
* Le contenu du document a été généré à partir des paramètres de filtrage des clientes et des clients. PostFinance n’est pas responsable du contenu et de son exhaustivité.;;;;;;
*/
function PFCSVFormat6() {
this.getFormattedData = function (transactions, importUtilities) {
let headerLineStart = this.getHeaderLineStart(transactions);
let dataLineStart = headerLineStart == 6 ? 8 : 7;
// We do a copy as the getHeaderData modifies the content and we need to keep the original version clean.
var transactionsCopy = transactions.map(function (arr) {
return arr.slice();
});
if (transactionsCopy.length < dataLineStart)
return [];
let columns = importUtilities.getHeaderData(transactionsCopy, headerLineStart); //array
let rows = importUtilities.getRowData(transactionsCopy, dataLineStart); //array of array
let form = [];
/** We convert the original headers into a custom format to be able to work with the same
* format regardless of original's headers language or the position of the header column.
* We need to translate all the .csv fields as the loadForm() method expects the header and
* the rows to have the same length.
* */
let convertedColumns = [];
convertedColumns = this.convertHeaderDe(columns, convertedColumns);
if (convertedColumns.length > 0) {
importUtilities.loadForm(form, convertedColumns, rows);
return form;
}
// Convert headers from italian.
convertedColumns = this.convertHeaderIt(columns, convertedColumns);
if (convertedColumns.length > 0) {
importUtilities.loadForm(form, convertedColumns, rows);
return form;
}
// Convert headers from french.
convertedColumns = this.convertHeaderFr(columns, convertedColumns);
if (convertedColumns.length > 0) {
importUtilities.loadForm(form, convertedColumns, rows);
return form;
}
// Convert headers from english.
convertedColumns = this.convertHeaderEn(columns, convertedColumns);
if (convertedColumns.length > 0) {
importUtilities.loadForm(form, convertedColumns, rows);
return form;
}
return [];
}
/**
* With this format, if user does not explicitly set the End Date of the movements
* when is exporting, then the header and data start at a different row, then we have
* to figure out if the end date is present or not.
*/
this.getHeaderLineStart = function (transactions) {
let endDate = transactions[1][1];
if (endDate.match(/^\d{2}.\d{2}.\d{4}$/))
return 6; // the Header is on row 6.
else
return 5; // the Header is on row 5.
}
this.convertHeaderDe = function (columns) {
let convertedColumns = [];
for (var i = 0; i < columns.length; i++) {
switch (columns[i]) {
case "Datum":
convertedColumns[i] = "Date";
break;
case "Bewegungstyp":
convertedColumns[i] = "Type";
break;
case "Avisierungstext":
convertedColumns[i] = "Description";
break;
case "Gutschrift in CHF":
case "Gutschrift in EUR":
case "Gutschrift in USD":
convertedColumns[i] = "Income";
break;
case "Lastschrift in CHF":
case "Lastschrift in EUR":
case "Lastschrift in USD":
convertedColumns[i] = "Expenses";
break;
case "Label":
convertedColumns[i] = "Label";
break;
case "Kategorie":
convertedColumns[i] = "Category";
break;
default:
break;
}
}
if (convertedColumns.indexOf("Date") < 0
|| convertedColumns.indexOf("Description") < 0
|| convertedColumns.indexOf("Income") < 0
|| convertedColumns.indexOf("Expenses") < 0) {
return [];
}
return convertedColumns;
}
this.convertHeaderIt = function (columns, convertedColumns) {
for (var i = 0; i < columns.length; i++) {
switch (columns[i]) {
case "Data":
convertedColumns[i] = "Date";
break;
case "Tipo di movimento":
convertedColumns[i] = "Type";
break;
case "Testo di avviso":
convertedColumns[i] = "Description";
break;
case "Accredito in CHF":
case "Accredito in EUR":
case "Accredito in USD":
convertedColumns[i] = "Income";
break;
case "Addebito in CHF":
case "Addebito in EUR":
case "Addebito in USD":
convertedColumns[i] = "Expenses";
break;
case "Tag":
convertedColumns[i] = "Label";
break;
case "Categoria":
convertedColumns[i] = "Category";
break;
default:
break;
}
}
if (convertedColumns.indexOf("Date") < 0
|| convertedColumns.indexOf("Description") < 0
|| convertedColumns.indexOf("Income") < 0
|| convertedColumns.indexOf("Expenses") < 0) {
return [];
}
return convertedColumns;
}
this.convertHeaderFr = function (columns, convertedColumns) {
for (var i = 0; i < columns.length; i++) {
switch (columns[i]) {
case "Date":
convertedColumns[i] = "Date";
break;
case "Type de transaction":
convertedColumns[i] = "Type";
break;
case "Texte de notification":
convertedColumns[i] = "Description";
break;
case "Crédit en CHF":
case "Crédit en EUR":
case "Crédit en USD":
convertedColumns[i] = "Income";
break;
case "Débit en CHF":
case "Débit en EUR":
case "Débit en USD":
convertedColumns[i] = "Expenses";
break;
case "Label":
convertedColumns[i] = "Label";
break;
case "Catégorie":
convertedColumns[i] = "Category";
break;
default:
break;
}
}
if (convertedColumns.indexOf("Date") < 0
|| convertedColumns.indexOf("Description") < 0
|| convertedColumns.indexOf("Income") < 0
|| convertedColumns.indexOf("Expenses") < 0) {
return [];
}
return convertedColumns;
}
this.convertHeaderEn = function (columns, convertedColumns) {
for (var i = 0; i < columns.length; i++) {
switch (columns[i]) {
case "Date":
convertedColumns[i] = "Date";
break;
case "Type of transaction":
convertedColumns[i] = "Type";
break;
case "Notification text":
convertedColumns[i] = "Description";
break;
case "Credit in CHF":
case "Credit in EUR":
case "Credit in USD":
convertedColumns[i] = "Income";
break;
case "Debit in CHF":
case "Debit in EUR":
case "Debit in USD":
convertedColumns[i] = "Expenses";
break;
case "Tag":
convertedColumns[i] = "Label";
break;
case "Category":
convertedColumns[i] = "Category";
break;
default:
break;
}
}
if (convertedColumns.indexOf("Date") < 0
|| convertedColumns.indexOf("Description") < 0
|| convertedColumns.indexOf("Income") < 0
|| convertedColumns.indexOf("Expenses") < 0) {
return [];
}
return convertedColumns;
}
/** Return true if the transactions match this format */
this.match = function (transactionsData) {
if (transactionsData.length === 0)
return false;
for (var i = 0; i < transactionsData.length; i++) {
var transaction = transactionsData[i];
var formatMatched = true;
if (formatMatched && transaction["Date"] && transaction["Date"].length >= 10 &&
transaction["Date"].match(/^\d{2}.\d{2}.\d{4}$/))
formatMatched = true;
else
formatMatched = false;
if (formatMatched)
return true;
}
return false;
}
this.convert = function (transactionsData) {
var transactionsToImport = [];
for (var i = 0; i < transactionsData.length; i++) {
if (transactionsData[i]["Date"] && transactionsData[i]["Date"].length >= 10 &&
transactionsData[i]["Date"].match(/^\d{2}.\d{2}.\d{4}$/)) {
transactionsToImport.push(this.mapTransaction(transactionsData[i]));
}
}
// Sort rows by date
transactionsToImport = transactionsToImport.reverse();
// Add header and return
var header = [["Date", "DateValue", "Doc", "ExternalReference", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
this.mapTransaction = function (transaction) {
let mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(transaction["Date"], "dd.mm.yyyy"));
mappedLine.push(Banana.Converter.toInternalDateFormat("", "dd.mm.yyyy"));
mappedLine.push("");
mappedLine.push("");
let trDescription = transaction["Description"] + ", " + transaction["Type"];
mappedLine.push(trDescription);
mappedLine.push(Banana.Converter.toInternalNumberFormat(transaction["Income"], '.'));
let expAmount = transaction["Expenses"].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(expAmount, '.'));
return mappedLine;
}
}
/**
* Credit Card format 1
* Kartenkonto:;0000 1234 5467 7654
* Karte:;XXXX XXXX XXXX 1111 PostFinance Visa Business Card
* Datum;Buchungsdetails;Gutschrift in CHF;Lastschrift in CHF
* 2023-08-24;"Tankstelle Marche Brugg BE";;-94.70
* 2023-08-21;"Tankstelle Marche Brugg BE";;-114.05
* 2023-08-10;"6131 STORNO JAHRESPREIS";80.00;
**/
function PFCSVFormat1_CreditCard() {
this.colDate = 0;
this.colDescr = 1;
this.colCredit = 2;
this.colDebit = 3;
this.dateFormat = 'dd-mm-yyyy';
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0)
return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
if (transaction.length === this.colDebit + 1)
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\-)[0-9]{2}(\-)[0-9]{4}/g)) {
formatMatched = true;
} else if (formatMatched && transaction[this.colDate].match(/[0-9]{4}(\-)[0-9]{2}(\-)[0-9]{2}/g)) {
formatMatched = true;
this.dateFormat = 'yyyy-mm-dd';
} else {
formatMatched = false;
}
if (formatMatched)
return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < (this.colAmount + 1))
continue;
if (transaction[this.colDate] && transaction[this.colDate].match(/[0-9]{2,4}(\-)[0-9]{2}(\-)[0-9]{2,4}/g)
&& transaction[this.colDate].length == 10)
transactionsToImport.push(this.mapTransaction(transaction));
}
// Sort rows by date (just invert)
transactionsToImport = transactionsToImport.reverse();
// Add header and return
var header = [["Date", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
this.mapTransaction = function (element) {
var mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate], this.dateFormat));
mappedLine.push(""); // Doc is empty for now
var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces
mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));
var amount = element[this.colCredit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount));
amount = element[this.colDebit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount));
return mappedLine;
}
}
/**
* PFCSV Format 5
* Example: pfcsv.#20230901
**/
function PFCSVFormat5() {
this.colDate = 0;
this.colMovType = 1;
this.colDescr = 2;
this.colCredit = 3;
this.colDebit = 4;
this.dateFormat = 'dd.mm.yyyy';
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0)
return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
if (transaction.length === this.colDebit + 1)
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\.)[0-9]{2}(\.)[0-9]{2}/g)) {
formatMatched = true;
} else {
formatMatched = false;
}
if (formatMatched)
return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < (this.colAmount + 1))
continue;
if (transaction[this.colDate] && transaction[this.colDate].match(/[0-9]{2}(\.)[0-9]{2}(\.)[0-9]{4}/g) && transaction[this.colDate].length == 10)
transactionsToImport.push(this.mapTransaction(transaction));
}
// Sort rows by date (just invert)
transactionsToImport = transactionsToImport.reverse();
// Add header and return
var header = [["Date", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
this.mapTransaction = function (element) {
var mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate], this.dateFormat));
mappedLine.push(""); // Doc is empty for now
var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces
mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));
mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colCredit], '.'));
amountDebit = element[this.colDebit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amountDebit, '.'));
return mappedLine;
}
}
/**
* PFCSV Format 4
* Example: pfcsv.#20230509
* Fœnum porto natio:;0000 8003 3386 9363
* Natio:;LIAM LIAM LIAM 5526 PecuLeverba Aturaequat Cocet Voluna
* Tuundit nostinsan:;06.04.2022 - 05.05.2022
* Data;Denominazione;Accredito in CHF;Addebito in CHF;Importo in CHF
* 2022-05-04;"ARTION *PRATIUNDICO 52163467544 XXX";;52.00;
* 2022-05-04;"1.7% SUPPL. CHF ALL'ESTERO";;0.88;
* 2022-05-04;"ARTION *EXPECT CUNT 1324126664 NOS";;21.93;
* 2022-05-03;"ARTION *EXPECT CUNT 1324126664 NOS";;11.11;
* 2022-05-03;"ARTION *MENTIO SET 1324126664 STO";;15.00;
* 2022-05-03;"1.7% SUPPL. CHF ALL'ESTERO";;0.26;
* 2022-05-02;"PATTINDE NATHOC FŒNUM NATIO";300.00;;
* 2022-05-01;"ARATIMOTE PATUBIT MODO CONDE MONCH NIS 0.56 Effect 8.1480 ost 37.77.6604 TER 0.62 8.52% de todivispect cor pasus fertumquobsemo TER 0.77";;8.44;
**/
function PFCSVFormat4() {
this.colDate = 0;
this.colDescr = 1;
this.colCredit = 2;
this.colDebit = 3;
this.colAmount = 4;
this.dateFormat = 'dd-mm-yyyy';
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0)
return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
if (transaction.length === this.colAmount + 1)
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\-)[0-9]{2}(\-)[0-9]{4}/g)) {
formatMatched = true;
} else if (formatMatched && transaction[this.colDate].match(/[0-9]{4}(\-)[0-9]{2}(\-)[0-9]{2}/g)) {
formatMatched = true;
this.dateFormat = 'yyyy-mm-dd';
} else {
formatMatched = false;
}
if (formatMatched)
return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < (this.colAmount + 1))
continue;
if (transaction[this.colDate].match(/[0-9]{2,4}(\-)[0-9]{2}(\-)[0-9]{2,4}/g) && transaction[this.colDate].length == 10)
transactionsToImport.push(this.mapTransaction(transaction));
}
// Sort rows by date (just invert)
transactionsToImport = transactionsToImport.reverse();
// Add header and return
var header = [["Date", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
this.mapTransaction = function (element) {
var mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate], this.dateFormat));
mappedLine.push(""); // Doc is empty for now
var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces
mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));
var amount = element[this.colCredit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount));
amount = element[this.colDebit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount));
return mappedLine;
}
}
/**
* PF Html Format 1
* Html table with the followings colums:
* 0:Details; 1:Date; 2:Description; 3:Income; 4:Expenses; 5:DateValue; 6:Balance;
**/
function PFHtmlFormat1() {
/** This function defines the convertion of the single html table rows to Banana fields.
This is the only function to be adapted to the desired format. */
this.htmlRowToObject = function (htmlString) {
// Extract html fields (tags td)
var htmlTableFields = htmlString.match(/<td[^>]*>[\s\S]*?<\/td>/g); //[\s\S]*? match all chars non gready
if (!htmlTableFields)
return null;
// Verify fields count
if (htmlTableFields.length < 6)
return null;
// Verify if date field match
var date = this.htmlText(htmlTableFields[1]);
if (!date.match(/[0-9.]{8}/))
return null;
// Convert row
var rowObject = {};
rowObject.Date = Banana.Converter.toInternalDateFormat(this.htmlText(htmlTableFields[1]));
rowObject.Description = Banana.Converter.stringToCamelCase(this.htmlText(htmlTableFields[2]));
rowObject.ContraAccount = "";
rowObject.Income = Banana.Converter.toInternalNumberFormat(this.htmlText(htmlTableFields[3]));
rowObject.Expenses = Banana.Converter.toInternalNumberFormat(this.htmlText(htmlTableFields[4]));
rowObject.DateValue = Banana.Converter.toInternalDateFormat(this.htmlText(htmlTableFields[5]));
rowObject._Balance = Banana.Converter.toInternalNumberFormat(this.htmlText(htmlTableFields[6]));
return rowObject;
}
/** This function extract from the html the data to be imported in Banana Accounting.
It use the function htmlRowToObject to convert the single data rows. */
this.convert = function (htmlString) {
var rows = [];
var htmlTables = htmlString.match(/<tbody[^>]*>[\s\S]*?<\/tbody>/g); //[\s\S]*? match all chars non gready
if (htmlTables) {
for (var t = 0; t < htmlTables.length; t++) {
var htmlTableRows = htmlTables[t].match(/<tr[^>]*>[\s\S]*?<\/tr>/g); //[\s\S]*? match all chars non gready
if (htmlTableRows) {
for (var r = 0; r < htmlTableRows.length; r++) {
var row = this.htmlRowToObject(htmlTableRows[r]);
if (row) {
rows.push(row);
}
}
}
}
}
return rows;
}
/** This function extract the text inside an html element */
this.htmlText = function (htmlString) {
// Read text from html string
// The text is found between each ">...<" sequence
var retText = "";
var htmlTexts = htmlString.match(/>[^<]+</g);
if (htmlTexts) {
for (var i = 0; i < htmlTexts.length; i++) {
var htmlSubText = htmlTexts[i];
if (htmlSubText.length > 2)
retText = retText + htmlSubText.substr(1, htmlSubText.length - 2);
}
}
// Remove line feeds
retText = retText.replace(/^[ \n\r]+/, ""); // at the beginning
retText = retText.replace(/[ \n\r]+$/, ""); // at the end
retText = retText.replace(/ *[\n\r]+ */g, ", "); // in the middle
return retText;
}
}
/**
* PFCSV Format 3
* Example: pfcsv.#20101031
* BookingDate;BookingText;Details;ValutaDate;DebitAmount;CreditAmount;Balance
* 31.10.2010;FÜR DAS ONLINE-SET SEPTEMBER XXXX;;31.10.2010;;0.00;5831.73
* 29.10.2010;E-FINANCE XXX;1;29.10.2010;-45.00;;5831.73
* 29.10.2010;E-FINANCE XXX;1;29.10.2010;-131.55;;
* Example: pfcsv.#20131231
* Buchung;Buchungstext;Details;Valuta;Belastung;Gutschrift;Saldo;Kategorie;Familienmitglied;Kommentar
* "31.12.2013";"ZINSABSCHLUSS 010113 - 311213";"";"31.12.2013";"-0.15";"";"2549.30";"";"";""
* "24.12.2013";"KAUF/DIENSTLEISTUNG
* VOM 23.12.2013
* KARTEN NR. 82770597
* CUCINA PERO AG
* WƒDENSWIL";"1";"23.12.2013";"-124.00";"";"2549.45";"";"";""
**/
function PFCSVFormat3() {
this.colDate = 0;
this.colDescr = 1;
this.colDateValuta = 3;
this.colDebit = 4;
this.colCredit = 5;
this.colBalance = 6;
this.colComment = 9;
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0)
return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
if (transaction.length === (this.colBalance + 1) ||
transaction.length === (this.colComment + 1))
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate].match(/[0-9]{2,4}(\.|-)[0-9]{2}(\.|-)[0-9]{2,4}/g) &&
transaction[this.colDate].length === 10)
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDateValuta].match(/[0-9]{2,4}(\.|-)[0-9]{2}(\.|-)[0-9]{2,4}/g) &&
transaction[this.colDateValuta].length === 10)
formatMatched = true;
else
formatMatched = false;
if (formatMatched)
return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < (this.colBalance + 1))
continue;
if (transaction[this.colDate].match(/[0-9]{2,4}(\.|-)[0-9]{2}(\.|-)[0-9]{2,4}/g) && transaction[this.colDate].length == 10 &&
transaction[this.colDateValuta].match(/[0-9]{2,4}(\.|-)[0-9]{2}(\.|-)[0-9]{2,4}/g) && transaction[this.colDateValuta].length == 10)
transactionsToImport.push(this.mapTransaction(transaction));
}
// Sort rows by date (just invert)
transactionsToImport = transactionsToImport.reverse();
// Add header and return
var header = [["Date", "DateValue", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
this.mapTransaction = function (element) {
var mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate], 'dd-mm-yyyy'));
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDateValuta], 'dd-mm-yyyy'));
mappedLine.push(""); // Doc is empty for now
var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces
mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));
var amount = element[this.colCredit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount));
amount = element[this.colDebit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount));
return mappedLine;
}
}
/**
* PFCSV Format 2
* Example: pfcsv.#private20090401
* Example: pfcsv.#private20090401
* Data Testo d'avviso Accredito Addebito Data della valuta Saldo
* 20090401 /t ACQUISTO/SERVIZIO DEL XX.XX.XXXX CARTA N. XXX /t99.9 /t20090331 /t /t
* 20090331 /t ORDINE DEBIT DIRECT NUMERO CLIENTE XXX /t85.9 /t20090331 /t7881.35 /t
* 20090330 /t ACQUISTO/SERVIZIO DEL XX.XX.XXXX CARTA N. XXX /t43 /t20090328 /t7967.25 /t
*
*
**/
function PFCSVFormat2() {
this.colDate = 0;
this.colDescr = 1;
this.colCredit = 2;
this.colDebit = 3;
this.colDateValuta = 4;
this.colBalance = 5;
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0)
return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
if (transaction.length === (this.colBalance + 2))
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate].match(/[0-9]{6}/g)
&& transaction[this.colDate].length === 8)
formatMatched = true;
if (formatMatched && transaction[this.colDateValuta].match(/[0-9]{6}/g) &&
transaction[this.colDateValuta].length == 8)
formatMatched = true;
else
formatMatched = false;
if (formatMatched)
return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < (this.colBalance + 1))
continue;
if (transaction[this.colDate].match(/[0-9]+/g) && transaction[this.colDate].length == 8 &&
transaction[this.colDateValuta].match(/[0-9]+/g) && transaction[this.colDateValuta].length == 8)
transactionsToImport.push(this.mapTransaction(transaction));
}
// Sort rows by date (just invert)
transactionsToImport = transactionsToImport.reverse();
// Add header and return
var header = [["Date", "DateValue", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
this.mapTransaction = function (element) {
var mappedLine = [];
mappedLine.push(element[this.colDate]);
mappedLine.push(element[this.colDateValuta]);
mappedLine.push(""); // Doc is empty for now
var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ' '); //remove white spaces
mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));
mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colCredit]));
mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colDebit]));
return mappedLine;
}
}
/**
* PFCSV Format 1
* Example: pfcsv.#20030903-B
* Example: pfcsv.#20121101-B
* Example: pfcsv.#20160707
* Data;Descrizione della transazione;Accreditamento;Debito;Valuta;Saldo
* 31.08.2003;Saldo;;;;50078.40
* 01.09.2003;"YELLOWNET SAMMELAUFTRAG NR. X,YELLOWNET NUMMER XXXXXX";;-28.60;01.09.2003;50049.80
* 01.09.2003;"AUFTRAG DEBIT DIRECT,AUFTRAGSNUMMER X,KUNDENNUMMER XXXX";26.80;;01.09.2003;50076.60
**/
function PFCSVFormat1() {
this.colDate = 0;
this.colDescr = 1;
this.colCredit = 2;
this.colDebit = 3;
this.colDateValuta = 4;
this.colBalance = 5;
this.dateFormat = 'dd-mm-yyyy';
this.decimalSeparator = '.';
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0)
return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
if (transaction.length === (this.colBalance + 1) || transaction.length === (this.colBalance + 2))
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\.)[0-9]{2}(\.)[0-9]{2}/g)) {
this.dateFormat = 'dd.mm.yy';
formatMatched = true;
} else if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\.|-)[0-9]{2}(\.|-)[0-9]{4}/g)) {
formatMatched = true;
} else if (formatMatched && transaction[this.colDate].match(/[0-9]{4}(\.|-)[0-9]{2}(\.|-)[0-9]{2}/g)) {
formatMatched = true;
this.dateFormat = 'yyyy-mm-dd';
} else {
formatMatched = false;
}
if (formatMatched && transaction[this.colDateValuta].match(/[0-9]{2,4}(\.|-)[0-9]{2}(\.|-)[0-9]{2,4}/g))
formatMatched = true;
else
formatMatched = false;
if (formatMatched)
return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < (this.colBalance + 1))
continue;
if (transaction[this.colDate].match(/[0-9\.]{3}/g) && transaction[this.colDateValuta].match(/[0-9\.]{3}/g))
transactionsToImport.push(this.mapTransaction(transaction));
}
// Sort rows by date
transactionsToImport = this.sort(transactionsToImport);
// Add header and return
var header = [["Date", "DateValue", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
/** Sort transactions by date */
this.sort = function (transactions) {
if (transactions.length <= 0)
return transactions;
var i = 0;
var previousDate = transactions[0][this.colDate];
while (i < transactions.length) {
var date = transactions[i][this.colDate];
if (previousDate.length > 0 && previousDate > date)
return transactions.reverse();
else if (previousDate.length > 0 && previousDate < date)
return transactions;
i++;
}
return transactions;
}
this.mapTransaction = function (element) {
var mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate], this.dateFormat));
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDateValuta], this.dateFormat));
mappedLine.push(""); // Doc is empty for now
var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces
mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));
var amount = element[this.colCredit].replace(/\+/g, ''); //remove plus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount, this.decimalSeparator));
amount = element[this.colDebit].replace(/-/g, ''); //remove minus sign
mappedLine.push(Banana.Converter.toInternalNumberFormat(amount, this.decimalSeparator));
return mappedLine;
}
}
/**
* The function findSeparator is used to find the field separator.
*/
function findSeparator(string) {
var commaCount = 0;
var semicolonCount = 0;
var tabCount = 0;
for (var i = 0; i < 1000 && i < string.length; i++) {
var c = string[i];
if (c === ',')
commaCount++;
else if (c === ';')
semicolonCount++;
else if (c === '\t')
tabCount++;
}
if (tabCount > commaCount && tabCount > semicolonCount) {
return '\t';
}
else if (semicolonCount > commaCount) {
return ';';
}
return ',';
}
/**
* PFCSV Smart Business Format 1
* Example: pfcsv.#20180220-SBU
* "client_name";"paid_date";"paid_amount"
* "Schaub Thomas";"21.02.2018";"100.00"
* "Prins Carla";"20.02.2018";"150.00"
* "Mario Wlotzka";"15.02.2018";"960.00"
**/
function PFCSVFormatSBU1() {
this.colDate = 1;
this.colDescr = 0;
this.colCredit = 2;
this.dateFormat = 'dd.mm.yyyy';
this.decimalSeparator = '.';
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0)
return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
if (transaction.length === (this.colCredit + 1))
formatMatched = true;
else
formatMatched = false;
if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\.|-)[0-9]{2}(\.|-)[0-9]{4}/g)) {
formatMatched = true;
} else {
formatMatched = false;
}
if (formatMatched)
return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
var transactionsToImport = [];
// Filter and map rows
for (var i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < this.colCredit)
continue;
if (transaction[this.colDate].match(/[0-9\.]{3}/g))
transactionsToImport.push(this.mapTransaction(transaction));
}
// Sort rows by date
transactionsToImport = this.sort(transactionsToImport);
// Add header and return
var header = [["Date", "DateValue", "Doc", "Description", "Income", "Expenses"]];
return header.concat(transactionsToImport);
}
/** Sort transactions by date */
this.sort = function (transactions) {
if (transactions.length <= 0)
return transactions;
var i = 0;
var previousDate = transactions[0][this.colDate];
while (i < transactions.length) {
var date = transactions[i][this.colDate];
if (previousDate.length > 0 && previousDate > date)
return transactions.reverse();
else if (previousDate.length > 0 && previousDate < date)
return transactions;
i++;
}
return transactions;
}
this.mapTransaction = function (element) {
var mappedLine = [];
mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate], this.dateFormat));
mappedLine.push("");
mappedLine.push("");
mappedLine.push(element[this.colDescr]);
mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colCredit], this.decimalSeparator));
mappedLine.push("");
return mappedLine;
}
}
/**
* The function findSeparator is used to find the field separator.
*/
function findSeparator(string) {
var commaCount = 0;
var semicolonCount = 0;
var tabCount = 0;
for (var i = 0; i < 1000 && i < string.length; i++) {
var c = string[i];
if (c === ',')
commaCount++;
else if (c === ';')
semicolonCount++;
else if (c === '\t')
tabCount++;
}
if (tabCount > commaCount && tabCount > semicolonCount) {
return '\t';
}
else if (semicolonCount > commaCount) {
return ';';
}
return ',';
}
/*
* class ImportUtilities
* Contains methods that can be shared by extensions for importing bank data
*/
var ImportUtilities = class ImportUtilities {
constructor(banDocument) {
this.banDocument = banDocument;
if (this.banDocument === undefined)
this.banDocument = Banana.document;
}
//The purpose of this function is to convert all the data into a format supported by Banana
convertToBananaFormat(intermediaryData) {
var columnTitles = [];
//Create titles only for fields not starting with "_"
for (var name in intermediaryData[0]) {
if (name.substring(0, 1) !== "_") {
columnTitles.push(name);
}
}
//Function call Banana.Converter.objectArrayToCsv() to create a CSV with new data just converted
var convertedCsv = Banana.Converter.objectArrayToCsv(columnTitles, intermediaryData, "\t");
return convertedCsv;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertCsvToIntermediaryData(inData, convertionParam) {
var form = [];
var intermediaryData = [];
//Add the header if present
if (convertionParam.header) {
inData = convertionParam.header + inData;
}
//Read the CSV file and create an array with the data
var csvFile = Banana.Converter.csvToArray(inData, convertionParam.separator, convertionParam.textDelim);
//Variables used to save the columns titles and the rows values
var columns = this.getHeaderData(csvFile, convertionParam.headerLineStart); //array
var rows = this.getRowData(csvFile, convertionParam.dataLineStart); //array of array
//Load the form with data taken from the array. Create objects
this.loadForm(form, columns, rows);
//Create the new CSV file with converted data
var convertedRow;
//For each row of the form, we call the rowConverter() function and we save the converted data
for (var i = 0; i < form.length; i++) {
convertedRow = convertionParam.rowConverter(form[i]);
intermediaryData.push(convertedRow);
}
//Return the converted CSV data into the Banana document table
return intermediaryData;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertHtmlToIntermediaryData(inData, convertionParam) {
var form = [];
var intermediaryData = [];
//Read the HTML file and create an array with the data
var htmlFile = [];
var htmlRows = inData.match(/<tr[^>]*>.*?<\/tr>/gi);
for (var rowNr = 0; rowNr < htmlRows.length; rowNr++) {
var htmlRow = [];
var htmlFields = htmlRows[rowNr].match(/<t(h|d)[^>]*>.*?<\/t(h|d)>/gi);
for (var fieldNr = 0; fieldNr < htmlFields.length; fieldNr++) {
var htmlFieldRe = />(.*)</g.exec(htmlFields[fieldNr]);
htmlRow.push(htmlFieldRe.length > 1 ? htmlFieldRe[1] : "");
}
htmlFile.push(htmlRow);
}
//Variables used to save the columns titles and the rows values
var columns = this.getHeaderData(htmlFile, convertionParam.headerLineStart); //array
var rows = this.getRowData(htmlFile, convertionParam.dataLineStart); //array of array
//Convert header names
for (var i = 0; i < columns.length; i++) {
var convertedHeader = columns[i];
convertedHeader = convertedHeader.toLowerCase();
convertedHeader = convertedHeader.replace(" ", "_");
var indexOfHeader = columns.indexOf(convertedHeader);
if (indexOfHeader >= 0 && indexOfHeader < i) { // Header alreay exist
//Avoid headers with same name adding an incremental index
var newIndex = 2;
while (columns.indexOf(convertedHeader + newIndex.toString()) !== -1 && newIndex < 99)
newIndex++;
convertedHeader = convertedHeader + newIndex.toString()
}
columns[i] = convertedHeader;
}
// Banana.console.log(JSON.stringify(columns, null, " "));
//Load the form with data taken from the array. Create objects
this.loadForm(form, columns, rows);
//Create the new CSV file with converted data
var convertedRow;
//For each row of the form, we call the rowConverter() function and we save the converted data
for (var i = 0; i < form.length; i++) {
convertedRow = convertionParam.rowConverter(form[i]);
intermediaryData.push(convertedRow);
}
//Return the converted CSV data into the Banana document table
return intermediaryData;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertToIntermediaryData(inData, convertionParam) {
if (convertionParam.format === "html") {
return this.convertHtmlToIntermediaryData(inData, convertionParam);
} else {
return this.convertCsvToIntermediaryData(inData, convertionParam);
}
}
//The purpose of this function is to return all the titles of the columns
getHeaderData(csvFile, startLineNumber) {
if (!startLineNumber) {
startLineNumber = 0;
}
var headerData = csvFile[startLineNumber];
for (var i = 0; i < headerData.length; i++) {
headerData[i] = headerData[i].trim();
if (!headerData[i]) {
headerData[i] = i;
}
//Avoid duplicate headers
var headerPos = headerData.indexOf(headerData[i]);
if (headerPos >= 0 && headerPos < i) { // Header already exist
var postfixIndex = 2;
while (headerData.indexOf(headerData[i] + postfixIndex.toString()) !== -1 && postfixIndex <= 99)
postfixIndex++; // Append an incremental index
headerData[i] = headerData[i] + postfixIndex.toString()
}
}
return headerData;
}
getLang() {
var lang = 'en';
if (this.banDocument)
lang = this.banDocument.locale;
else if (Banana.application.locale)
lang = Banana.application.locale;
if (lang.length > 2)
lang = lang.substr(0, 2);
return lang;
}
//The purpose of this function is to return all the data of the rows
getRowData(csvFile, startLineNumber) {
if (!startLineNumber) {
startLineNumber = 1;
}
var rowData = [];
for (var i = startLineNumber; i < csvFile.length; i++) {
rowData.push(csvFile[i]);
}
return rowData;
}
//The purpose of this function is to load all the data (titles of the columns and rows) and create a list of objects.
//Each object represents a row of the csv file
loadForm(form, columns, rows) {
for (var j = 0; j < rows.length; j++) {
var obj = {};
for (var i = 0; i < columns.length; i++) {
obj[columns[i]] = rows[j][i];
}
form.push(obj);
}
}
// The purpose of this function is to sort the data
sortData(intermediaryData, convertionParam) {
if (convertionParam.sortColums && convertionParam.sortColums.length) {
intermediaryData.sort(
function (row1, row2) {
for (var i = 0; i < convertionParam.sortColums.length; i++) {
var columnName = convertionParam.sortColums[i];
if (row1[columnName] > row2[columnName])
return 1;
else if (row1[columnName] < row2[columnName])
return -1;
}
return 0;
});
if (convertionParam.sortDescending)
intermediaryData.reverse();
}
return intermediaryData;
}
verifyBananaPlusVersion() {
if (!this.banDocument)
return false;
var BAN_VERSION_MIN = "10.0";
// supported Version
if (Banana.compareVersion && Banana.compareVersion(Banana.application.version, BAN_VERSION_MIN) >= 0) {
return true;
}
// not supported version
var lang = this.getLang();
var msg = "This extension requires Banana Accounting+";
this.banDocument.addMessage(msg, "ID_ERR_LICENSE_NOTVALID");
return false;
}
//Check if the version of Banana Accounting is compatible with this class
verifyBananaAdvancedVersion() {
if (!this.banDocument)
return false;
if (!Banana.application.license || Banana.application.license.licenseType !== "advanced") {
var lang = this.getLang();
var msg = "This extension requires Banana Accounting+ Advanced";
this.banDocument.addMessage(msg, "ID_ERR_LICENSE_NOTVALID");
return false;
}
return true;
}
getErrorMessage(errorId, lang) {
if (!lang)
lang = 'en';
switch (errorId) {
case "ID_ERR_FORMAT_UNKNOWN":
if (lang == 'it')
return "Formato del file *.csv non riconosciuto";
else if (lang == 'fr')
return "Format de fichier *.csv non reconnu";
else if (lang == 'de')
return "Unerkanntes *.csv-Dateiformat";
else
return "Unrecognised *.csv file format";
}
return '';
}
getLang() {
var lang = 'en';
if (Banana.application.locale)
lang = Banana.application.locale;
if (lang.length > 2)
lang = lang.substring(0, 2);
return lang;
}
getUnknownFormatError(){
let errId = "ID_ERR_FORMAT_UNKNOWN"; //error
let lang = this.getLang();
let msg = this.getErrorMessage(errId, lang);
Banana.document.addMessage(msg, errId);
}
}
Input data - csv_postfinance_example_format1_CreditCard_20230929.csv
Input text passed to the exec() function.
Kartenkonto:;0000 1234 5467 7654
Karte:;XXXX XXXX XXXX 1111 PostFinance Visa Business Card
Datum;Buchungsdetails;Gutschrift in CHF;Lastschrift in CHF
2023-08-24;"Tankstelle";;-94.70
2023-08-21;"Tankstelle";;-114.05
2023-08-10;"6131 STORNO JAHRESPREIS";80.00;
Disclaimer:
Der Dokumentinhalt wurde durch Filtereinstellungen der Kund:innen generiert. PostFinance ist für den Inhalt und die Vollständigkeit nicht verantwortlich.
Output data - csv_postfinance_example_format1_CreditCard_20230929.tsv
Output text returned by the exec() function.
Date\tDoc\tDescription\tIncome\tExpenses
2023-08-10\t\t6131 Storno Jahrespreis\t80.00\t
2023-08-21\t\tTankstelle\t\t114.05
2023-08-24\t\tTankstelle\t\t94.70
Input data - csv_postfinance_example_format2_20090401.csv
Input text passed to the exec() function.
Data Testo d'avviso Accredito Addebito Data della valuta Saldo
20090401 ACQUISTO/SERVIZIO DES 31.03.2009 UNDAE W. 47655099 AURSENTATREPE-8250 LENSIT C. A LENSIT 71.8 66667620
20090331 ORDINE PERIS NAVITI HORTIS PERUCUM 109631 PRIETE NABO ARITATIS OS HORTIS EO VOCTENENDIT: 000000000001107565001543539 PARTERIT EVENT PRINNAM DES 26.03.2009 W. REPEM UNDAE 1107 5650 0154 3539 85.9 20090331 7881.35
20090330 ACQUISTO/SERVIZIO DES 28.03.2009 UNDAE W. 47655099 ACUTION ASTO RODO POST 30 11025450 1423.50
20090330 ACQUISTO/SERVIZIO DES 28.03.2009 UNDAE W. 47655099 ACUTION ASTO RODO POST 47 11025450
20090330 ACQUISTO/SERVIZIO DES 29.03.2009 UNDAE W. 47655099 DICITIMPTIONSI EST POST 81 78665580
20090330 ACQUISTO/SERVIZIO DES 27.03.2009 UNDAE W. 47655099 MARTURRIUNGI EO VOLANEREM ANT LENSIT 58 55580477
20090326 OPERAZIONE VENT CHRARDUCI ALIUNDI DES 25.03.2009 UNDAE W. 47655099 UNCELUM ALIUNDI REPERTUS 556.5 28683443 5582.50
20090325 GIRATA EX RET MODEST 8465 DITIUNIS: /SECT SECTIA ET: WNQGR7Q513MBKEVW ACINSA OS OS NOSSUS ET: 79777957 090325CH81880950 IUSUPARTERIPUS: 690505731 4570.25 20090325 8388.85
20090322 OPERAZIONE VENT CHRARDUCI ALIUNDI DES 21.03.2009 UNDAE W. 47655099 UNCELUM ALIUNDI REPERTUS 1606.8 13330272 8568.5
20090319 PRELIEVO DE HABERUNT DES 19.03.2009 UNDAE W. 47655099 ANTINDIS: PUTULO PUTULO 636 68200818 2224.0
20090316 OPERAZIONE VENT CHRARDUCI ALIUNDI DES 13.03.2009 UNDAE W. 47655099 UNCELUM ALIUNDI REPERTUS 8233 86784617 8577.0
20090316 ACQUISTO/SERVIZIO DES 14.03.2009 UNDAE W. 47655099 IURRIDICUM PUPILODEANTE ET DIO QUA VOCARURA 32 68227047
20090316 ACQUISTO/SERVIZIO DES 12.03.2009 UNDAE W. 47655099 SOMULTUSA OS PLUCET 30 60283240
20090316 ACQUISTO/SERVIZIO DES 14.03.2009 UNDAE W. 47655099 FRUCEM B. VOCARURA B. VOCARURA 22 68227047
20090311 OPERAZIONE VENT CHRARDUCI ALIUNDI DES 10.03.2009 UNDAE W. 47655099 UNCELUM ALIUNDI REPERTUS 4018 23204372 35808.0
20090309 ACQUISTO/SERVIZIO DES 07.03.2009 UNDAE W. 47655099 PLEX-8801 B. VOCARURA QUA VOCARURA 50.34 17246434 83387.0
20090309 ACQUISTO/SERVIZIO DES 07.03.2009 UNDAE W. 47655099 FRUCEM B. VOCARURA B. VOCARURA 31.34 17246434
20090309 ACQUISTO/SERVIZIO DES 07.03.2009 UNDAE W. 47655099 AURSENTATREPE-7652 QUA VENTABO QUA VOCARURA 318 17246434
20090309 ACQUISTO/SERVIZIO DES 05.03.2009 UNDAE W. 47655099 SERE-NUNT, COCTUUNT-POSTERTE PUTULO PHRATUS 52.00 52 20090305
20090306 PRELIEVO DE HABERUNT DES 06.03.2009 UNDAE W. 47655099 ANTINDIS: LENSIT CUNGUA OBABO LENSIT 472 32032225 83803.1
20090306 ACQUISTO/SERVIZIO DES 05.03.2009 UNDAE W. 47655099 FRUCEM FORGENS FORGENS 7.1 24280353
20090304 ACQUISTO/SERVIZIO DES 03.03.2009 UNDAE W. 47655099 POSTO BONCH BONCH 50.50 84402074 84572.7
20090303 ORDINE PERIS NAVITI HORTIS PERUCUM 109631 PRIETE NABO ARITATIS OS HORTIS EO VOCTENENDIT: 000000000001107565001543539 PARTERIT EVENT PRINNAM DES 26.02.2009 W. REPEM UNDAE 1107 5650 0154 3539 92.4 20090303 16062.65
Output data - csv_postfinance_example_format2_20090401.tsv
Output text returned by the exec() function.
Date\tDateValue\tDoc\tDescription\tIncome\tExpenses
20090303\t20090303\t\tOrdine Peris Naviti Hortis Perucum 109631 Priete Nabo Aritatis Os Hortis Eo Voctenendit: 000000000001107565001543539 Parterit Event Prinnam Des 26.02.2009 W. Repem Undae 1107 5650 0154 3539\t\t92.4
20090304\t84402074\t\tAcquisto/servizio Des 03.03.2009 Undae W. 47655099 Posto Bonch Bonch\t\t50.50
20090306\t24280353\t\tAcquisto/servizio Des 05.03.2009 Undae W. 47655099 Frucem Forgens Forgens\t\t7.1
20090306\t32032225\t\tPrelievo De Haberunt Des 06.03.2009 Undae W. 47655099 Antindis: Lensit Cungua Obabo Lensit\t\t472
20090309\t20090305\t\tAcquisto/servizio Des 05.03.2009 Undae W. 47655099 Sere-Nunt, Coctuunt-Posterte Putulo Phratus 52.00\t\t52
20090309\t17246434\t\tAcquisto/servizio Des 07.03.2009 Undae W. 47655099 Aursentatrepe-7652 Qua Ventabo Qua Vocarura\t\t318
20090309\t17246434\t\tAcquisto/servizio Des 07.03.2009 Undae W. 47655099 Frucem B. Vocarura B. Vocarura\t\t31.34
20090309\t17246434\t\tAcquisto/servizio Des 07.03.2009 Undae W. 47655099 Plex-8801 B. Vocarura Qua Vocarura\t\t50.34
20090311\t23204372\t\tOperazione Vent Chrarduci Aliundi Des 10.03.2009 Undae W. 47655099 Uncelum Aliundi Repertus\t\t4018
20090316\t68227047\t\tAcquisto/servizio Des 14.03.2009 Undae W. 47655099 Frucem B. Vocarura B. Vocarura\t\t22
20090316\t60283240\t\tAcquisto/servizio Des 12.03.2009 Undae W. 47655099 Somultusa Os Plucet\t\t30
20090316\t68227047\t\tAcquisto/servizio Des 14.03.2009 Undae W. 47655099 Iurridicum Pupilodeante Et Dio Qua Vocarura\t\t32
20090316\t86784617\t\tOperazione Vent Chrarduci Aliundi Des 13.03.2009 Undae W. 47655099 Uncelum Aliundi Repertus\t\t8233
20090319\t68200818\t\tPrelievo De Haberunt Des 19.03.2009 Undae W. 47655099 Antindis: Putulo Putulo\t\t636
20090322\t13330272\t\tOperazione Vent Chrarduci Aliundi Des 21.03.2009 Undae W. 47655099 Uncelum Aliundi Repertus\t\t1606.8
20090325\t20090325\t\tGirata Ex Ret Modest 8465 Ditiunis: /sect Sectia Et: WNQGR7Q513MBKEVW Acinsa Os Os Nossus Et: 79777957 090325CH81880950 Iusuparteripus: 690505731\t4570.25\t
20090326\t28683443\t\tOperazione Vent Chrarduci Aliundi Des 25.03.2009 Undae W. 47655099 Uncelum Aliundi Repertus\t\t556.5
20090330\t55580477\t\tAcquisto/servizio Des 27.03.2009 Undae W. 47655099 Marturriungi Eo Volanerem Ant Lensit\t\t58
20090330\t78665580\t\tAcquisto/servizio Des 29.03.2009 Undae W. 47655099 Dicitimptionsi Est Post\t\t81
20090330\t11025450\t\tAcquisto/servizio Des 28.03.2009 Undae W. 47655099 Acution Asto Rodo Post\t\t47
20090330\t11025450\t\tAcquisto/servizio Des 28.03.2009 Undae W. 47655099 Acution Asto Rodo Post\t\t30
20090331\t20090331\t\tOrdine Peris Naviti Hortis Perucum 109631 Priete Nabo Aritatis Os Hortis Eo Voctenendit: 000000000001107565001543539 Parterit Event Prinnam Des 26.03.2009 W. Repem Undae 1107 5650 0154 3539\t\t85.9
20090401\t66667620\t\tAcquisto/servizio Des 31.03.2009 Undae W. 47655099 Aursentatrepe-8250 Lensit C. A Lensit\t\t71.8
Input data - csv_postfinance_example_format3_20101031.csv
Input text passed to the exec() function.
BookingDate;BookingText;Details;ValutaDate;DebitAmount;CreditAmount;Balance
31.10.2010;HS IGE HYACTA-XXX ANDUXEMUM 4682 - VIVIVIOFIG DEAGNA INE PAM 3555.77;;31.10.2010;;0.00;5831.73
29.10.2010;W-GANGUNT 75-13080-1 - MAGNUNANS;2;29.10.2010;-45.00;;5831.73
29.10.2010;W-GANGUNT 75-88716-7 - DIUSQUAM OSTO;2;29.10.2010;-131.55;;
29.10.2010;W-GANGUNT 75-73547-1 - MULTIUNT DE. TABICUSTIO VI;2;29.10.2010;-110.00;;
29.10.2010;W-GANGUNT 75-87515-1 - LIQUIT-PONTARE;2;29.10.2010;-119.65;;
29.10.2010;W-GANGUNT 75-88560-5 - MULTIUNT DE. TABICUSTIO VI;2;29.10.2010;-140.00;;
29.10.2010;W-GANGUNT 75-87515-1 - LIQUIT-PONTARE;2;29.10.2010;-249.30;;
29.10.2010;W-GANGUNT 75-28743-1 - MATE - TRUNT UT;2;29.10.2010;-122.85;;
29.10.2010;W-GANGUNT 75-45521-6 - SUBSTO BY;2;29.10.2010;-115.50;;
29.10.2010;W-GANGUNT 75-36815-7 - VERANEST;2;29.10.2010;-300.00;;
29.10.2010;W-GANGUNT 75-2055-5 - DE.SOLONE EXACTIANAVIT UT;2;29.10.2010;-1400.00;;
25.10.2010;SOLO DEM RIDEO 28-2-2 - TEM UT;2;25.10.2010;;110.00;8565.58
19.10.2010;REGERUMERI - XXX INE. RIDEO XXX 10.63.4682;2;19.10.2010;;500.00;8455.58
13.10.2010;OVUM/SEDIVISCATIRIS - XXX 36.63.4682;2;11.10.2010;-39.95;;7955.58
06.10.2010;SOLO DEM RIDEO 28-2-2 - TEM UT;2;06.10.2010;;392.00;7995.53
06.10.2010;REGERUMERI - XXX INE. RIDEO XXX 30.63.4682;2;06.10.2010;;900.00;
04.10.2010;OVUM/SEDIVISCATIRIS - XXX 25.63.4682;2;02.10.2010;-30.15;;6703.53
30.09.2010;HS IGE HYACTA-XXX LODUCI 4682 - VIVIVIOFIG HABULAC INE PAM 3555.77;;30.09.2010;-3.00;;6733.68
30.09.2010;W-GANGUNT 75-27675-7 - TESTANES (PROXITA) UT, AGNA;2;30.09.2010;-36.25;;
30.09.2010;W-GANGUNT 75-34663-7 - SENIURA ASTIURUNGOBTIS UT;2;30.09.2010;-58.85;;
30.09.2010;W-GANGUNT 75-88560-5 - MULTIUNT DE. TABICUSTIO VI;2;30.09.2010;-140.00;;
30.09.2010;W-GANGUNT 75-7670-4 - PRIATE CHABIT;2;30.09.2010;-141.50;;
30.09.2010;W-GANGUNT 75-87515-1 - LIQUIT-PONTARE;2;30.09.2010;-203.95;;
30.09.2010;W-GANGUNT 75-87515-1 - LIQUIT-PONTARE;2;30.09.2010;-249.30;;
30.09.2010;W-GANGUNT 75-36815-7 - VERANEST;2;30.09.2010;-300.00;;
30.09.2010;W-GANGUNT 75-2055-5 - DE.SOLONE EXACTIANAVIT UT;2;30.09.2010;-1400.00;;
30.09.2010;SOLO DEM HYACTA-RAL 700 - HUMELUMENTEM:;2;30.09.2010;;400.00;
28.09.2010;REGERUMERI XXX INE. RIDEO - XXX 51.28.4682;2;28.09.2010;;600.00;8866.53
28.09.2010;OVUM/SEDIVISCATIRIS - XXX 58.28.4682;2;24.09.2010;-49.00;;
27.09.2010;W-GANGUNT 24315 - PENDIRESTIFFICTRANSOLUNIUS DIO;2;27.09.2010;-282.60;;8315.53
20.09.2010;REGERUMERI XXX INE. RIDEO - XXX 58.28.4682;2;20.09.2010;;500.00;8598.13
17.09.2010;REGERUMERI XXX INE. RIDEO - XXX 75.28.4682;2;17.09.2010;;700.00;8098.13
14.09.2010;OVUM/SEDIVISCATIRIS - XXX 63.28.4682;2;10.09.2010;-44.95;;7398.13
03.09.2010;REGERUMERI XXX INE. RIDEO - XXX 63.28.4682;2;03.09.2010;;1200.00;7443.08
02.09.2010;OVUM/SEDIVISCATIRIS - XXX 28.28.4682;2;31.08.2010;-42.75;;6243.08
01.09.2010;REGERUMERI XXX INE. RIDEO - XXX 75.28.4682;2;01.09.2010;;800.00;6285.83
Output data - csv_postfinance_example_format3_20101031.tsv
Output text returned by the exec() function.
Date\tDateValue\tDoc\tDescription\tIncome\tExpenses
2010-09-01\t2010-09-01\t\tRegerumeri Xxx Ine. Rideo - Xxx 75.28.4682\t800.00\t
2010-09-02\t2010-08-31\t\tOvum/sediviscatiris - Xxx 28.28.4682\t\t42.75
2010-09-03\t2010-09-03\t\tRegerumeri Xxx Ine. Rideo - Xxx 63.28.4682\t1200.00\t
2010-09-14\t2010-09-10\t\tOvum/sediviscatiris - Xxx 63.28.4682\t\t44.95
2010-09-17\t2010-09-17\t\tRegerumeri Xxx Ine. Rideo - Xxx 75.28.4682\t700.00\t
2010-09-20\t2010-09-20\t\tRegerumeri Xxx Ine. Rideo - Xxx 58.28.4682\t500.00\t
2010-09-27\t2010-09-27\t\tW-Gangunt 24315 - Pendirestiffictransolunius Dio\t\t282.60
2010-09-28\t2010-09-24\t\tOvum/sediviscatiris - Xxx 58.28.4682\t\t49.00
2010-09-28\t2010-09-28\t\tRegerumeri Xxx Ine. Rideo - Xxx 51.28.4682\t600.00\t
2010-09-30\t2010-09-30\t\tSolo Dem Hyacta-Ral 700 - Humelumentem:\t400.00\t
2010-09-30\t2010-09-30\t\tW-Gangunt 75-2055-5 - De.Solone Exactianavit Ut\t\t1400.00
2010-09-30\t2010-09-30\t\tW-Gangunt 75-36815-7 - Veranest\t\t300.00
2010-09-30\t2010-09-30\t\tW-Gangunt 75-87515-1 - Liquit-Pontare\t\t249.30
2010-09-30\t2010-09-30\t\tW-Gangunt 75-87515-1 - Liquit-Pontare\t\t203.95
2010-09-30\t2010-09-30\t\tW-Gangunt 75-7670-4 - Priate Chabit\t\t141.50
2010-09-30\t2010-09-30\t\tW-Gangunt 75-88560-5 - Multiunt De. Tabicustio Vi\t\t140.00
2010-09-30\t2010-09-30\t\tW-Gangunt 75-34663-7 - Seniura Astiurungobtis Ut\t\t58.85
2010-09-30\t2010-09-30\t\tW-Gangunt 75-27675-7 - Testanes (Proxita) Ut, Agna\t\t36.25
2010-09-30\t2010-09-30\t\tH�s Ige Hyacta-Xxx Loduci 4682 - Vivivio�fig Habulac Ine Pam 3555.77\t\t3.00
2010-10-04\t2010-10-02\t\tOvum/sediviscatiris - Xxx 25.63.4682\t\t30.15
2010-10-06\t2010-10-06\t\tRegerumeri - Xxx Ine. Rideo Xxx 30.63.4682\t900.00\t
2010-10-06\t2010-10-06\t\tSolo Dem Rideo 28-2-2 - Tem Ut\t392.00\t
2010-10-13\t2010-10-11\t\tOvum/sediviscatiris - Xxx 36.63.4682\t\t39.95
2010-10-19\t2010-10-19\t\tRegerumeri - Xxx Ine. Rideo Xxx 10.63.4682\t500.00\t
2010-10-25\t2010-10-25\t\tSolo Dem Rideo 28-2-2 - Tem Ut\t110.00\t
2010-10-29\t2010-10-29\t\tW-Gangunt 75-2055-5 - De.Solone Exactianavit Ut\t\t1400.00
2010-10-29\t2010-10-29\t\tW-Gangunt 75-36815-7 - Veranest\t\t300.00
2010-10-29\t2010-10-29\t\tW-Gangunt 75-45521-6 - Substo By\t\t115.50
2010-10-29\t2010-10-29\t\tW-Gangunt 75-28743-1 - Mate - Trunt Ut\t\t122.85
2010-10-29\t2010-10-29\t\tW-Gangunt 75-87515-1 - Liquit-Pontare\t\t249.30
2010-10-29\t2010-10-29\t\tW-Gangunt 75-88560-5 - Multiunt De. Tabicustio Vi\t\t140.00
2010-10-29\t2010-10-29\t\tW-Gangunt 75-87515-1 - Liquit-Pontare\t\t119.65
2010-10-29\t2010-10-29\t\tW-Gangunt 75-73547-1 - Multiunt De. Tabicustio Vi\t\t110.00
2010-10-29\t2010-10-29\t\tW-Gangunt 75-88716-7 - Diusquam Osto\t\t131.55
2010-10-29\t2010-10-29\t\tW-Gangunt 75-13080-1 - Magnunans\t\t45.00
2010-10-31\t2010-10-31\t\tH�s Ige Hyacta-Xxx Anduxemum 4682 - Vivivio�fig De�agna Ine Pam 3555.77\t0.00\t
Import transactions example 3
Ubs (Switzerland) import transactions with multiple csv formats
// Banana Accounting Extension Javascript
// @id = ch.banana.switzerland.import.ubs.tutorial
// @api = 1.0
// @pubdate = 2024-06-24
// @publisher = Banana.ch SA
// @description = UBS - Import account statement .csv (Banana+ Advanced)
// @description.en = UBS - Import account statement .csv (Banana+ Advanced)
// @description.de = UBS - Bewegungen importieren .csv (Banana+ Advanced)
// @description.fr = UBS - Importer mouvements .csv (Banana+ Advanced)
// @description.it = UBS - Importa movimenti .csv (Banana+ Advanced)
// @doctype = *
// @docproperties =
// @task = import.transactions
// @outputformat = transactions.simple
// @inputdatasource = openfiledialog
// @inputencoding = latin1
// @inputfilefilter = Text files (*.txt *.csv);;All files (*.*)
// @inputfilefilter.de = Text (*.txt *.csv);;Alle Dateien (*.*)
// @inputfilefilter.fr = Texte (*.txt *.csv);;Tous (*.*)
// @inputfilefilter.it = Testo (*.txt *.csv);;Tutti i files (*.*)
// @timeout = -1
/*
* class ImportUtilities
* Contains methods that can be shared by extensions for importing bank data
*/
var ImportUtilities = class ImportUtilities {
constructor(banDocument) {
this.banDocument = banDocument;
if (this.banDocument === undefined)
this.banDocument = Banana.document;
}
//The purpose of this function is to convert all the data into a format supported by Banana
convertToBananaFormat(intermediaryData) {
var columnTitles = [];
//Create titles only for fields not starting with "_"
for (var name in intermediaryData[0]) {
if (name.substring(0, 1) !== "_") {
columnTitles.push(name);
}
}
//Function call Banana.Converter.objectArrayToCsv() to create a CSV with new data just converted
var convertedCsv = Banana.Converter.objectArrayToCsv(columnTitles, intermediaryData, "\t");
return convertedCsv;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertCsvToIntermediaryData(inData, convertionParam) {
var form = [];
var intermediaryData = [];
//Add the header if present
if (convertionParam.header) {
inData = convertionParam.header + inData;
}
//Read the CSV file and create an array with the data
var csvFile = Banana.Converter.csvToArray(inData, convertionParam.separator, convertionParam.textDelim);
//Variables used to save the columns titles and the rows values
var columns = this.getHeaderData(csvFile, convertionParam.headerLineStart); //array
var rows = this.getRowData(csvFile, convertionParam.dataLineStart); //array of array
//Load the form with data taken from the array. Create objects
this.loadForm(form, columns, rows);
//Create the new CSV file with converted data
var convertedRow;
//For each row of the form, we call the rowConverter() function and we save the converted data
for (var i = 0; i < form.length; i++) {
convertedRow = convertionParam.rowConverter(form[i]);
intermediaryData.push(convertedRow);
}
//Return the converted CSV data into the Banana document table
return intermediaryData;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertHtmlToIntermediaryData(inData, convertionParam) {
var form = [];
var intermediaryData = [];
//Read the HTML file and create an array with the data
var htmlFile = [];
var htmlRows = inData.match(/<tr[^>]*>.*?<\/tr>/gi);
for (var rowNr = 0; rowNr < htmlRows.length; rowNr++) {
var htmlRow = [];
var htmlFields = htmlRows[rowNr].match(/<t(h|d)[^>]*>.*?<\/t(h|d)>/gi);
for (var fieldNr = 0; fieldNr < htmlFields.length; fieldNr++) {
var htmlFieldRe = />(.*)</g.exec(htmlFields[fieldNr]);
htmlRow.push(htmlFieldRe.length > 1 ? htmlFieldRe[1] : "");
}
htmlFile.push(htmlRow);
}
//Variables used to save the columns titles and the rows values
var columns = this.getHeaderData(htmlFile, convertionParam.headerLineStart); //array
var rows = this.getRowData(htmlFile, convertionParam.dataLineStart); //array of array
//Convert header names
for (var i = 0; i < columns.length; i++) {
var convertedHeader = columns[i];
convertedHeader = convertedHeader.toLowerCase();
convertedHeader = convertedHeader.replace(" ", "_");
var indexOfHeader = columns.indexOf(convertedHeader);
if (indexOfHeader >= 0 && indexOfHeader < i) { // Header alreay exist
//Avoid headers with same name adding an incremental index
var newIndex = 2;
while (columns.indexOf(convertedHeader + newIndex.toString()) !== -1 && newIndex < 99)
newIndex++;
convertedHeader = convertedHeader + newIndex.toString()
}
columns[i] = convertedHeader;
}
// Banana.console.log(JSON.stringify(columns, null, " "));
//Load the form with data taken from the array. Create objects
this.loadForm(form, columns, rows);
//Create the new CSV file with converted data
var convertedRow;
//For each row of the form, we call the rowConverter() function and we save the converted data
for (var i = 0; i < form.length; i++) {
convertedRow = convertionParam.rowConverter(form[i]);
intermediaryData.push(convertedRow);
}
//Return the converted CSV data into the Banana document table
return intermediaryData;
}
// Convert to an array of objects where each object property is the banana columnNameXml
convertToIntermediaryData(inData, convertionParam) {
if (convertionParam.format === "html") {
return this.convertHtmlToIntermediaryData(inData, convertionParam);
} else {
return this.convertCsvToIntermediaryData(inData, convertionParam);
}
}
//The purpose of this function is to return all the titles of the columns
getHeaderData(csvFile, startLineNumber) {
if (!startLineNumber) {
startLineNumber = 0;
}
var headerData = csvFile[startLineNumber];
for (var i = 0; i < headerData.length; i++) {
headerData[i] = headerData[i].trim();
if (!headerData[i]) {
headerData[i] = i;
}
//Avoid duplicate headers
var headerPos = headerData.indexOf(headerData[i]);
if (headerPos >= 0 && headerPos < i) { // Header already exist
var postfixIndex = 2;
while (headerData.indexOf(headerData[i] + postfixIndex.toString()) !== -1 && postfixIndex <= 99)
postfixIndex++; // Append an incremental index
headerData[i] = headerData[i] + postfixIndex.toString()
}
}
return headerData;
}
getLang() {
var lang = 'en';
if (this.banDocument)
lang = this.banDocument.locale;
else if (Banana.application.locale)
lang = Banana.application.locale;
if (lang.length > 2)
lang = lang.substr(0, 2);
return lang;
}
//The purpose of this function is to return all the data of the rows
getRowData(csvFile, startLineNumber) {
if (!startLineNumber) {
startLineNumber = 1;
}
var rowData = [];
for (var i = startLineNumber; i < csvFile.length; i++) {
rowData.push(csvFile[i]);
}
return rowData;
}
//The purpose of this function is to load all the data (titles of the columns and rows) and create a list of objects.
//Each object represents a row of the csv file
loadForm(form, columns, rows) {
for (var j = 0; j < rows.length; j++) {
var obj = {};
for (var i = 0; i < columns.length; i++) {
obj[columns[i]] = rows[j][i];
}
form.push(obj);
}
}
// The purpose of this function is to sort the data
sortData(intermediaryData, convertionParam) {
if (convertionParam.sortColums && convertionParam.sortColums.length) {
intermediaryData.sort(
function (row1, row2) {
for (var i = 0; i < convertionParam.sortColums.length; i++) {
var columnName = convertionParam.sortColums[i];
if (row1[columnName] > row2[columnName])
return 1;
else if (row1[columnName] < row2[columnName])
return -1;
}
return 0;
});
if (convertionParam.sortDescending)
intermediaryData.reverse();
}
return intermediaryData;
}
verifyBananaPlusVersion() {
if (!this.banDocument)
return false;
var BAN_VERSION_MIN = "10.0";
// supported Version
if (Banana.compareVersion && Banana.compareVersion(Banana.application.version, BAN_VERSION_MIN) >= 0) {
return true;
}
// not supported version
var lang = this.getLang();
var msg = "This extension requires Banana Accounting+";
this.banDocument.addMessage(msg, "ID_ERR_LICENSE_NOTVALID");
return false;
}
//Check if the version of Banana Accounting is compatible with this class
verifyBananaAdvancedVersion() {
if (!this.banDocument)
return false;
if (!Banana.application.license || Banana.application.license.licenseType !== "advanced") {
var lang = this.getLang();
var msg = "This extension requires Banana Accounting+ Advanced";
this.banDocument.addMessage(msg, "ID_ERR_LICENSE_NOTVALID");
return false;
}
return true;
}
getErrorMessage(errorId, lang) {
if (!lang)
lang = 'en';
switch (errorId) {
case "ID_ERR_FORMAT_UNKNOWN":
if (lang == 'it')
return "Formato del file *.csv non riconosciuto";
else if (lang == 'fr')
return "Format de fichier *.csv non reconnu";
else if (lang == 'de')
return "Unerkanntes *.csv-Dateiformat";
else
return "Unrecognised *.csv file format";
}
return '';
}
getLang() {
var lang = 'en';
if (Banana.application.locale)
lang = Banana.application.locale;
if (lang.length > 2)
lang = lang.substring(0, 2);
return lang;
}
getUnknownFormatError(){
let errId = "ID_ERR_FORMAT_UNKNOWN"; //error
let lang = this.getLang();
let msg = this.getErrorMessage(errId, lang);
Banana.document.addMessage(msg, errId);
}
}
/**
* Parse the data and return the data to be imported as a tab separated file.
*/
function exec(inData, isTest) {
if (!inData) return "";
/** in the new version of format 3 (June 2024) we could have the situation where descriptions have
* trhee pairs of quotes: """description text""". This situation cause problems
* when the API Banana.Converter.csvToArray() read the content, the text is ignored. This happen
* when the text description contains a semicolon ';'.
* For the time being, we 'clean' the text of these quotes pairs by replacing them with normal quotes pairs.
* */
inData = inData.replace(/"""/g, '"');
var importUtilities = new ImportUtilities(Banana.document);
if (isTest !== true && !importUtilities.verifyBananaAdvancedVersion())
return "";
convertionParam = defineConversionParam(inData);
//Add the header if present
if (convertionParam.header) {
inData = convertionParam.header + inData;
}
let transactions = Banana.Converter.csvToArray(
inData,
convertionParam.separator,
convertionParam.textDelim
);
// Format Credit Card
var formatCc1Ubs = new UBSFormatCc1();
if (formatCc1Ubs.match(transactions)) {
transactions = formatCc1Ubs.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 1
var format1Ubs = new UBSFormat1();
if (format1Ubs.match(transactions)) {
transactions = format1Ubs.convert(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 2
var format2Ubs = new UBSFormat2();
if (format2Ubs.match(transactions)) {
transactions = format2Ubs.convert(transactions, convertionParam);
transactions = format2Ubs.postProcessIntermediaryData(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
// Format 3
var format3Ubs = new UBSFormat3();
if (format3Ubs.match(transactions)) {
transactions = format3Ubs.convert(transactions, convertionParam);
transactions = format3Ubs.postProcessIntermediaryData(transactions);
Banana.console.log(Banana.Converter.arrayToTsv(transactions));
return Banana.Converter.arrayToTsv(transactions);
}
importUtilities.getUnknownFormatError();
return "";
}
/**
* UBS Format 1
*
* Valuation date;Banking relationship;Portfolio;Product;IBAN;Ccy.;Date from;Date to;Description;Trade date;Booking date;Value date;Description 1;Description 2;Description 3;Transaction no.;Exchange rate in the original amount in settlement currency;Individual amount;Debit;Credit;Balance
* 07.07.17;0240 00254061;;0240 00254061.01C;CH62 0024 4240 2340 6101 C;CHF;01.02.17;30.06.17;UBS Business Current Account;30.06.17;30.06.17;30.06.17;e-banking Order;BWS - CHENEVAL, BWS GERMANLINGUA, DE DE DE 80331 MUECHEN, INVOICE : M25252, STD: ALICE CHENEVAL;;ZD81181TI0690091;;;3'416.82;;206'149.34
* 07.07.17;0240 00254061;;0240 00254061.01C;CH62 0024 4240 2340 6101 C;CHF;01.02.17;30.06.17;UBS Business Current Account;30.06.17;30.06.17;30.06.17;Amount paid;;;ZD81181TI0690091;1.113334;3069;;;
*/
function UBSFormat1() {
// Index of columns in csv file
this.colCount = 21;
this.colCurrency = 5;
this.colDate = 10;
this.colDateValuta = 11;
this.colDescr1 = 12;
this.colDescr2 = 13;
this.colDescr3 = 14;
this.colDescr4 = 15;
this.colExchRate = -5;
this.colDetails = -4;
this.colDebit = -3;
this.colCredit = -2;
this.colBalance = -1;
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0) return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
/* array should have all columns */
if (transaction.length >= this.colCount) formatMatched = true;
else formatMatched = false;
if (formatMatched &&
transaction[this.colDate] &&
transaction[this.colDate].match(/^[0-9]+\.[0-9]+\.[0-9]+$/))
formatMatched = true;
else formatMatched = false;
if (
formatMatched &&
transaction[this.colDateValuta] &&
transaction[this.colDateValuta].match(/^[0-9]+\.[0-9]+\.[0-9]+$/)
)
formatMatched = true;
else formatMatched = false;
if (formatMatched) return true;
}
return false;
};
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
this.colCount =
transactions.length > 1 ? transactions[0].length : this.colCount;
transactions = this.convertTransactions(transactions);
if (transactions.length > 1) {
//Sort by date
if (transactions[0][0] > transactions[transactions.length - 1][0]) {
//Sort transactions
transactions = transactions.reverse();
}
}
var header = [
[
"Date",
"DateValue",
"Doc",
"ExternalReference",
"Description",
"Income",
"Expenses",
"IsDetail",
],
];
return header.concat(transactions);
};
/** Convert the transaction to the format to be imported */
this.convertTransactions = function (transactions) {
var transactionsToImport = [];
/** Complete, filter and map rows */
var lastCompleteTransaction = null;
for (var i = 0; i < transactions.length; i++) {
var mappedTransaction = [];
var transaction = transactions[i];
if (transaction.length <= this.colDate ||
!transaction[this.colDate].match(/[0-9\.]+/g))
continue;
if (transaction.length >= this.colCount + this.colBalance &&
(transaction[this.colCount + this.colDebit] && (transaction[this.colCount + this.colDebit].length > 0) ||
(transaction[this.colCount + this.colCredit] && transaction[this.colCount + this.colCredit].length > 0) ||
(transaction[this.colCount + this.colBalance] && transaction[this.colCount + this.colBalance].length > 0))) {
// Is a complete row
if (lastCompleteTransaction) {
mappedTransaction = this.mapTransaction(lastCompleteTransaction);
mappedTransaction.push("");
transactionsToImport.push(mappedTransaction);
lastCompleteTransaction = null;
}
lastCompleteTransaction = transaction;
} else if (transaction.length >= this.colCount + this.colDetails &&
transaction[this.colCount + this.colDetails].length > 0) {
// Is a detail row
if (transaction[this.colCount + this.colExchRate].match(/[0-9]+\.[0-9]+/g)) {
// Is a multicurrency detail row
if (lastCompleteTransaction) {
mappedTransaction = this.mapTransaction(lastCompleteTransaction);
mappedTransaction.push("");
transactionsToImport.push(mappedTransaction);
lastCompleteTransaction = null;
}
} else {
// Is a normal detail row
if (transaction[this.colDescr1] === "Cashpayment charges deducted by post" &&
lastCompleteTransaction && lastCompleteTransaction[this.colDescr1] === "Incomings UBS BESR Quick") {
// Post charges are contabilised at the end of the period, skip this row
if (lastCompleteTransaction !== null) {
mappedTransaction = this.mapTransaction(lastCompleteTransaction);
mappedTransaction.push("");
transactionsToImport.push(mappedTransaction);
lastCompleteTransaction = null;
}
} else {
if (lastCompleteTransaction !== null) {
mappedTransaction = this.mapTransaction(lastCompleteTransaction);
mappedTransaction.push("S");
transactionsToImport.push(mappedTransaction);
lastCompleteTransaction = null;
}
mappedTransaction = this.mapDetailTransaction(transaction);
mappedTransaction.push("D");
transactionsToImport.push(mappedTransaction);
}
}
}
}
if (lastCompleteTransaction !== null) {
transactionsToImport.push(this.mapTransaction(lastCompleteTransaction));
}
return transactionsToImport;
};
this.mapTransaction = function (element) {
var mappedLine = [];
if (
element[this.colDate] === null ||
element[this.colDescr1] === null ||
element[this.colDescr2] === null ||
element[this.colDescr3] === null ||
element[this.colDescr4] === null ||
element[element.length + this.colCredit] === null ||
element[element.length + this.colDebit] === null
) {
mappedLine.push("");
mappedLine.push("");
mappedLine.push("Error importing data");
mappedLine.push("");
mappedLine.push("");
return mappedLine;
}
mappedLine.push(
Banana.Converter.toInternalDateFormat(element[this.colDate], "dd.mm.yyyy")
);
mappedLine.push(
Banana.Converter.toInternalDateFormat(
element[this.colDateValuta],
"dd.mm.yyyy"
)
);
mappedLine.push("");
mappedLine.push(element[this.colDescr4]); //transaction number.
mappedLine.push(this.mapDescription(element));
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[element.length + this.colCredit],
"."
)
);
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[element.length + this.colDebit],
"."
)
);
return mappedLine;
};
this.mapDetailTransaction = function (element) {
var mappedLine = [];
if (
element[this.colDate] === null ||
element[this.colDescr1] === null ||
element[this.colDescr2] === null ||
element[this.colDescr3] === null ||
element[this.colDescr4] === null ||
element[element.length + this.colCredit] === null ||
element[element.length + this.colDebit] === null
) {
mappedLine.push("");
mappedLine.push("");
mappedLine.push("");
mappedLine.push("Error importing data");
mappedLine.push("");
mappedLine.push("");
return mappedLine;
}
mappedLine.push(
Banana.Converter.toInternalDateFormat(element[this.colDate], "dd.mm.yyyy")
);
mappedLine.push(
Banana.Converter.toInternalDateFormat(
element[this.colDateValuta],
"dd.mm.yyyy"
)
);
mappedLine.push("");
mappedLine.push(element[this.colDescr4]);
mappedLine.push(this.mapDescription(element));
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[this.colCount + this.colDetails].replace(",", ""),
"."
)
);
mappedLine.push("");
return mappedLine;
};
/**
* Return the descrition for the requested line.
*/
this.mapDescription = function (line) {
var descr = line[this.colDescr1];
if (line[this.colDescr2].length) descr += ", " + line[this.colDescr2];
if (line[this.colDescr3].length) descr += ", " + line[this.colDescr3];
descr = Banana.Converter.stringToCamelCase(descr);
descr = descr.replace(/"/g, '\\"');
return '"' + descr + '"';
};
}
/**
* UBS Format 2
*
* This new format (09.2022) use the import utilities class.
* This format has no detail rows.
*
* Numero di conto:;0234 00103914.40;
* IBAN:;CH29 0023 4234 1039 1440 G;
* Dal:;2022-09-15;
* Al:;2022-09-19;
* Saldo iniziale:;1719.34;
* Saldo finale:;631.07;
* Valutazione in:;CHF;
* Numero di transazioni in questo periodo:;13;
*
* Data dell'operazione;Ora dell'operazione;Data di registrazione;Data di valuta;Moneta;Importo della transazione;Addebito/Accredito;Saldo;N. di transazione;Descrizione1;Descrizione2;Descrizione3;Note a piè di pagina;
* 2022-09-19;;2022-09-19;2022-09-19;CHF;-150.00;Addebito;600;123456TI1234567;"Versamento";"Ordine di pagamento via e-banking";;;
* 2022-09-19;;2022-09-19;2022-09-19;CHF;-92.00;Addebito;692;2345678TI2345678;"Versamento";"Ordine di pagamento via e-banking";;;
* 2022-09-19;;2022-09-19;2022-09-19;CHF;-10.00;Addebito;702;3456789TI3456789;"Versamento";"Ordine di pagamento via e-banking";;;
* 2022-09-19;;2022-09-19;2022-09-19;CHF;-40.00;Addebito;742;4567890TI4567890;"Versamento";"Ordine di pagamento via e-banking";;;
*
*/
var UBSFormat2 = class UBSFormat2 extends ImportUtilities {
// Index of columns in csv file
constructor(banDocument) {
super(banDocument);
this.colCount = 12;
this.colDateOperation = 0;
this.colDateValuta = 3;
this.colAmount = 5;
this.colOpType = 6;
this.colTransNr = 8;
this.colDescr1 = 9;
this.colDescr2 = 10;
this.colDescr3 = 11;
//Index of columns in import format.
this.newColDate = 0;
this.newColDescription = 2;
this.newColExpenses = 4;
}
/** Return true if the transactions match this format */
match(transactions) {
if (transactions.length === 0) return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
/* array should have all columns */
if (transaction.length >= this.colCount) formatMatched = true;
else formatMatched = false;
if (
formatMatched &&
transaction[this.colDateOperation] &&
transaction[this.colDateOperation].match(/^[0-9]+\-[0-9]+\-[0-9]+$/)
)
formatMatched = true;
else formatMatched = false;
if (
formatMatched &&
transaction[this.colDateValuta] &&
transaction[this.colDateValuta].match(/^[0-9]+\-[0-9]+\-[0-9]+$/)
)
if (
formatMatched &&
transaction[this.colOpType] &&
transaction[this.colOpType].match(/[a-zA-Z]/)
)
formatMatched = true;
else formatMatched = false;
if (formatMatched) return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
convert(transactions, convertionParam) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < this.colCount + 1) continue;
if (
transaction[this.colDateOperation].match(/[0-9\.]+/g) &&
transaction[this.colDateOperation].length === 10
)
transactionsToImport.push(this.mapTransaction(transaction));
}
/**
* Sort rows by date
* SPECIFY THE COLUMN TO USE FOR SORTING
* If sortColums is empty the data are not sorted
* */
convertionParam.sortColums = [0, 2]; //0 = "Date" field position, 2 = "Description" field position.
convertionParam.sortDescending = false;
transactionsToImport = sort(transactionsToImport, convertionParam);
// Add header and return
var header = [
[
"Date",
"DateValue",
"Description",
"ExternalReference",
"Expenses",
"Income",
],
];
return header.concat(transactionsToImport);
}
mapTransaction(element) {
var mappedLine = [];
let dateText = "";
let dateValueText = "";
dateText = element[this.colDateOperation].substring(0, 10);
dateValueText = element[this.colDateValuta].substring(0, 10);
mappedLine.push(
Banana.Converter.toInternalDateFormat(dateText, "yyyy-mm-dd")
);
mappedLine.push(
Banana.Converter.toInternalDateFormat(dateValueText, "yyyy-mm-dd")
);
// wrap descr to bypass TipoFileImporta::IndovinaSeparatore problem
mappedLine.push(
element[this.colDescr1] +
" " +
element[this.colDescr2] +
" " +
element[this.colDescr3]
);
mappedLine.push(element[this.colTransNr]);
if (element[this.colAmount].indexOf("-") == -1) {
mappedLine.push("");
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[this.colAmount],
this.decimalSeparator
)
);
} else {
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[this.colAmount],
this.decimalSeparator
)
);
mappedLine.push("");
}
return mappedLine;
}
//The purpose of this function is to let the user specify how to convert the categories
postProcessIntermediaryData(transactions) {
let processesData = [];
if (transactions.length < 1) return processesData;
processesData = transactions;
/** INSERT HERE THE LIST OF ACCOUNTS NAME AND THE CONVERSION NUMBER
* If the content of "Account" is the same of the text
* it will be replaced by the account number given */
//Accounts conversion
var accounts = {
//...
};
/** INSERT HERE THE LIST OF CATEGORIES NAME AND THE CONVERSION NUMBER
* If the content of "ContraAccount" is the same of the text
* it will be replaced by the account number given */
//Categories conversion
var categories = {
//...
};
//Apply the conversions
for (var i = 1; i < processesData.length; i++) {
var convertedData = processesData[i];
//Invert values
if (convertedData[this.newColExpenses]) {
convertedData[this.newColExpenses] = Banana.SDecimal.invert(
convertedData[this.newColExpenses]
);
}
}
return processesData;
}
};
/**
* UBS Format 3
*
* This new format (08.11.2022) use the import utilities class.
* This format has no detail rows.
*
* Numero di conto:;0234 00103914.40;
* IBAN:;CH29 0023 4234 1039 1440 G;
* Dal:;2022-09-15;
* Al:;2022-09-19;
* Saldo iniziale:;1719.34;
* Saldo finale:;631.07;
* Valutazione in:;CHF;
* Numero di transazioni in questo periodo:;13;
*
* Data dell'operazione;Ora dell'operazione;Data di registrazione;Data di valuta;Moneta;Debit amount;Credit amount;Individual amount;Saldo;N. di transazione;Descrizione1;Descrizione2;Descrizione3;Note a piè di pagina;
* 2022-11-07;;2022-11-07;2022-11-07;TEM;-99.80;;;2215.89;1770311TO2672955;"Meniunis (Suractae) VI,Maxi Habyssidedertis 6, 3542 Aerna";"Cepate in consolest tam g-possica";"Decilausa vi. NUS: 35 47463 30382 81016 85544 75378, Experi in consolest: 2213 / Osit: 37.57.84 - 62.57.84 / Mendimus audio at: 75.64.4848, Sologit vi. CAPH: JA18 6457 3522 2051 7571 2, Suisi: B-Possica TEM Suractae, Offereganga vi. 6068584LN1841647";;
* 2022-11-07;;2022-11-07;2022-11-07;TEM;-52.10;;;2315.69;1670311TO2672937;"Meniunis (Suractae) VI,Maxi Habyssidedertis 6, 3542 Aerna";"Cepate in consolest tam g-possica";"Decilausa vi. NUS: 35 47463 30382 27465 62135 38521, Experi in consolest: 2213 / Osit: 37.80.84 - 16.80.84 / Mendimus audio at: 81.57.4848, Sologit vi. CAPH: JA18 6457 3522 2051 7571 2, Suisi: B-Possica TEM Suractae, Offereganga vi. 7510665VI0356053";;
* 2022-11-07;17:10:46;;2022-11-07;TEM;-4.35;;;2367.79;9999311BN1710030;"CERA SEPTEMPTO,SEPTEMPTO";"18264075-0 07/24, Pagamento carta di debito";"Offereganga vi. 7740420TJ8353344";;
* 2022-11-07;07:55:57;;2022-11-07;TEM;-2.70;;;2372.14;9999311BN0755924;"CERA SEPTEMPTO,SEPTEMPTO";"18264075-0 07/24, Pagamento carta di debito";"Offereganga vi. 3275420YO4320201";;
* 2022-11-07;17:21:52;;2022-11-07;TEM;-2.30;;;2374.84;9999311BN1721198;"POR SALL. SED. MANTUMN PARATE,PARATE";"18264075-0 07/24, Pagamento carta di debito";"Offereganga vi. 7518748DV2785407";;
* 2022-11-06;15:31:05;2022-11-07;2022-11-06;TEM;-6.80;;;2377.14;9930811BN5353554;"Parescro Tratiantro VI,6010 Recto";"18264075-0 07/24, Pagamento carta di debito";"Offereganga vi. 8740610YF3026752";;
*
*/
var UBSFormat3 = class UBSFormat3 extends ImportUtilities {
// Index of columns in *.csv file
constructor(banDocument) {
super(banDocument);
//original file columns
this.colCount = 13;
this.colDateOperation = 0;
this.colDateValuta = 3;
this.colDebitAmt = 5;
this.colCreditAmt = 6;
this.colTransNr = 9;
this.colDescr1 = 10;
this.colDescr2 = 11;
this.colDescr3 = 12;
this.decimalSeparator = ".";
//Index of columns in import format.
this.newColDate = 0;
this.newColDescription = 2;
this.newColExpenses = 4;
}
/** Return true if the transactions match this format */
match(transactions) {
if (transactions.length === 0) return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
/* array should have all columns */
if (transaction.length >= this.colCount) formatMatched = true;
else formatMatched = false;
if (
formatMatched &&
transaction[this.colDateOperation] &&
transaction[this.colDateOperation].match(/^[0-9]+\-[0-9]+\-[0-9]+$/)
)
formatMatched = true;
else formatMatched = false;
if (
formatMatched &&
transaction[this.colDateValuta] &&
transaction[this.colDateValuta].match(/^[0-9]+\-[0-9]+\-[0-9]+$/)
)
formatMatched = true;
else formatMatched = false;
if (
(formatMatched && transaction[this.colDebitAmt]) ||
transaction[this.colCreditAmt]
)
formatMatched = true;
else formatMatched = false;
if (formatMatched) return true;
}
return false;
}
/** Convert the transaction to the format to be imported */
convert(transactions, convertionParam) {
var transactionsToImport = [];
// Filter and map rows
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
if (transaction.length < this.colCount + 1) continue;
if (
transaction[this.colDateOperation].match(/[0-9\.]+/g) &&
transaction[this.colDateOperation].length === 10
)
transactionsToImport.push(this.mapTransaction(transaction));
}
/**
* Sort rows by date
* SPECIFY THE COLUMN TO USE FOR SORTING
* If sortColums is empty the data are not sorted
* */
convertionParam.sortColums = [this.newColDate, this.newColDescription]; //0 = "Date" field position, 2 = "Description" field position.
convertionParam.sortDescending = false;
transactionsToImport = sort(transactionsToImport, convertionParam);
// Add header and return
var header = [
[
"Date",
"DateValue",
"Description",
"ExternalReference",
"Expenses",
"Income",
],
];
return header.concat(transactionsToImport);
}
mapTransaction(element) {
var mappedLine = [];
let dateText = "";
let dateValueText = "";
dateText = element[this.colDateOperation].substring(0, 10);
dateValueText = element[this.colDateValuta].substring(0, 10);
mappedLine.push(
Banana.Converter.toInternalDateFormat(dateText, "yyyy-mm-dd")
);
mappedLine.push(
Banana.Converter.toInternalDateFormat(dateValueText, "yyyy-mm-dd")
);
// wrap descr to bypass TipoFileImporta::IndovinaSeparatore problem
mappedLine.push(element[this.colDescr1] + " " + element[this.colDescr2]);
mappedLine.push(element[this.colTransNr]);
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[this.colDebitAmt],
this.decimalSeparator
)
);
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[this.colCreditAmt],
this.decimalSeparator
)
);
return mappedLine;
}
//The purpose of this function is to let the user specify how to convert the categories
postProcessIntermediaryData(transactions) {
let processesData = [];
if (transactions.length < 1) return processesData;
processesData = transactions;
/** INSERT HERE THE LIST OF ACCOUNTS NAME AND THE CONVERSION NUMBER
* If the content of "Account" is the same of the text
* it will be replaced by the account number given */
//Accounts conversion
var accounts = {
//...
};
/** INSERT HERE THE LIST OF CATEGORIES NAME AND THE CONVERSION NUMBER
* If the content of "ContraAccount" is the same of the text
* it will be replaced by the account number given */
//Categories conversion
var categories = {
//...
};
//Apply the conversions
for (var i = 1; i < processesData.length; i++) {
var convertedData = processesData[i];
//Invert values
if (convertedData[this.newColExpenses]) {
convertedData[this.newColExpenses] = Banana.SDecimal.invert(
convertedData[this.newColExpenses]
);
}
}
return processesData;
}
};
/**
* UBS Credit Card Format 1
*
* sep=;
* Numéro de compte;Numéro de carte;Titulaire de compte/carte;Date d'achat;Texte comptable;Secteur;Montant;Monnaie originale;Cours;Monnaie;Débit;Crédit;Ecriture
* ZZZZ ZZZZ ZZZZ;;SIMON JEAN;19.10.2017;Report de solde;;;;;CHF;;0.00;
* ZZZZ ZZZZ ZZZZ;XXXX XXXX XXXX XXXX;JEAN SIMON;16.11.2017;Cafe de Paris Geneve CHE;Restaurants, Bar;119.40;CHF;;;;;
* ZZZZ ZZZZ ZZZZ;XXXX XXXX XXXX XXXX;JEAN SIMON;13.11.2017;www.banana.ch LUGANO CHE;Magasin d ordinateurs;189.00;CHF;;CHF;189.00;;15.11.2017
*/
function UBSFormatCc1() {
// Index of columns in csv file
this.colCount = 13;
this.colCardNo = 2;
this.colDateDoc = 3;
this.colDescr = 4;
this.colCurrency = -4;
this.colDebit = -3;
this.colCredit = -2;
this.colDate = -1;
/** Return true if the transactions match this format */
this.match = function (transactions) {
if (transactions.length === 0) return false;
for (i = 0; i < transactions.length; i++) {
var transaction = transactions[i];
var formatMatched = false;
/* array should have all columns */
if (transaction.length >= this.colCount) formatMatched = true;
else formatMatched = false;
if (
formatMatched &&
transaction[this.colCount + this.colDate] &&
transaction[this.colCount + this.colDate].match(
/^[0-9]+\.[0-9]+\.[0-9]+$/
)
)
formatMatched = true;
else formatMatched = false;
if (formatMatched) return true;
}
return false;
};
/** Convert the transaction to the format to be imported */
this.convert = function (transactions) {
this.colCount =
transactions.length > 1 ? transactions[0].length : this.colCount;
transactions = this.convertTransactions(transactions);
if (transactions.length > 1) {
//Sort by date
if (transactions[0][0] > transactions[transactions.length - 1][0]) {
//Sort transactions
transactions = transactions.reverse();
}
}
var header = [
["Date", "DateDocument", "Doc", "Description", "Income", "Expenses"],
];
return header.concat(transactions);
};
/** Convert the transaction to the format to be imported */
this.convertTransactions = function (transactions) {
var transactionsToImport = [];
/** Complete, filter and map rows */
var lastCompleteTransaction = null;
for (
var i = 0; i < transactions.length; i++ // First row contains the header
) {
var transaction = transactions[i];
if (
transaction.length <= this.colCount + this.colDate ||
!transaction[transaction.length + this.colDate].match(
/^[0-9]+\.[0-9]+\.[0-9]+$/
)
)
continue;
var mappedTransaction = this.mapTransaction(transaction);
transactionsToImport.push(mappedTransaction);
}
return transactionsToImport;
};
this.mapTransaction = function (element) {
var mappedLine = [];
if (
element[element.length + this.colDate] === null ||
element[this.colDescr] === null ||
element[element.length + this.colCredit] === null ||
element[element.length + this.colDebit] === null
) {
mappedLine.push("");
mappedLine.push("");
mappedLine.push("Error importing data");
mappedLine.push("");
mappedLine.push("");
return mappedLine;
}
var descr;
mappedLine.push(
Banana.Converter.toInternalDateFormat(
element[element.length + this.colDate],
"dd.mm.yyyy"
)
);
mappedLine.push("");
mappedLine.push("");
mappedLine.push(this.convertDescription(element[this.colDescr]));
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[element.length + this.colCredit],
"."
)
);
mappedLine.push(
Banana.Converter.toInternalNumberFormat(
element[element.length + this.colDebit],
"."
)
);
return mappedLine;
};
this.convertDescription = function (text) {
var convertedDescr = text.replace(/ +/g, " ");
convertedDescr = convertedDescr.replace(/"/g, '\\"');
return '"' + convertedDescr + '"'; // Banana.Converter.stringToCamelCase(convertedDescr);
};
}
function defineConversionParam(inData) {
var csvData = Banana.Converter.csvToArray(inData);
var header = String(csvData[0]);
var convertionParam = {};
/** SPECIFY THE SEPARATOR AND THE TEXT DELIMITER USED IN THE CSV FILE */
convertionParam.format = "csv"; // available formats are "csv", "html"
//get text delimiter
convertionParam.textDelim = '"';
// get separator
convertionParam.separator = findSeparator(inData);
return convertionParam;
}
/** Sort transactions by date and description */
function sort(transactions, convertionParam) {
if (
transactions.length <= 0 ||
!convertionParam.sortColums ||
convertionParam.sortColums.length <= 0
)
return transactions;
transactions.sort(function (row1, row2) {
for (var i = 0; i < convertionParam.sortColums.length; i++) {
var columnIndex = convertionParam.sortColums[i];
if (row1[columnIndex] > row2[columnIndex]) return 1;
else if (row1[columnIndex] < row2[columnIndex]) return -1;
}
return 0;
});
if (convertionParam.sortDescending) transactions.reverse();
return transactions;
}
function findSeparator(string) {
var commaCount = 0;
var semicolonCount = 0;
var tabCount = 0;
for (var i = 0; i < 1000 && i < string.length; i++) {
var c = string[i];
if (c === ',')
commaCount++;
else if (c === ';')
semicolonCount++;
else if (c === '\t')
tabCount++;
}
if (tabCount > commaCount && tabCount > semicolonCount) {
return '\t';
}
else if (semicolonCount > commaCount) {
return ';';
}
return ',';
}
Input data - csv_ubs_example_format1_20230905_03.csv
Input text passed to the exec() function.
Valuation date,Banking relationship,Portfolio,Product,IBAN,Ccy.,Date from,Date to,Description,Trade date,Booking date,Value date,Description 1,Description 2,Description 3,Transaction no.,Exchange rate in the original amount in settlement currency,Individual amount,Debit,Credit,Balance
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.08.2023,31.08.2023,31.08.2023,Secitque dedra,4-12.2023 BVG monthly pa,"ingit, GROBAE COLO, AN DUONE 1017, 600457761231762504643213385, 1561140RG4305540",9930743LK8430013,,,557.50,,4'371.73
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.08.2023,31.08.2023,31.08.2023,R-Audideo diambile,,,9930743LK8430013,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.08.2023,31.08.2023,31.08.2023,Viscus lis at minitudunto congerate parto,,,9930743LK8430013,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.08.2023,31.08.2023,31.08.2023,Coniunt secitque ellura,,,9930743LP7352170,,,1'469.95,,4'929.23
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.08.2023,31.08.2023,31.08.2023,DORPUPRA VOLOCULUVIT,,,9930743LP7352170,,-1327.500000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.08.2023,31.08.2023,31.08.2023,PLEGENT COR INE,AN SECIBURIA (ALIQUID) 4045,,9930743LP7352170,,-75.000000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.08.2023,31.08.2023,31.08.2023,DITA PATUMERE DE,,,9930743LP7352170,,-67.450000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,30.08.2023,30.08.2023,30.08.2023,d-audideo Volury,OPUGAVIT XXX,"8820 WAEDENSWIL, AAPARTMENT RENTAL FEE SEP 23, Credit / debit advice",9702242TO3295927,,,,3'700.00,6'399.18
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,25.08.2023,25.08.2023,25.08.2023,Creta d-audideo Dedra,TUM,"AN FICA 66 8840, 404800036845402515030151356",5730237TI4790761,,,165.00,,2'699.18
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,25.08.2023,25.08.2023,25.08.2023,R-Audideo diambile,,,5730237TI4790761,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,25.08.2023,25.08.2023,25.08.2023,Viscus lis at minitudunto congerate parto,,,5730237TI4790761,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,24.08.2023,24.08.2023,24.08.2023,Creta d-audideo Dedra,RES,"AN VIT 3534, 803023367811405547285483243",2530236TI4589949,,,1'674.15,,2'864.18
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,24.08.2023,24.08.2023,24.08.2023,R-Audideo diambile,,,2530236TI4589949,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,24.08.2023,24.08.2023,24.08.2023,Viscus lis at minitudunto congerate parto,,,2530236TI4589949,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,21.08.2023,21.08.2023,21.08.2023,Creta d-audideo Dedra,VOLONCENDE FRUM ET,"AN REGRUMEA 5037, 246531233028703100220735546",5530233TI3956784,,,705.30,,4'538.33
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,21.08.2023,21.08.2023,21.08.2023,R-Audideo diambile,,,5530233TI3956784,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,21.08.2023,21.08.2023,21.08.2023,Viscus lis at minitudunto congerate parto,,,5530233TI3956784,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,02.08.2023,02.08.2023,02.08.2023,d-audideo Dedra,"VOLUNDO MANGUN, FLUVIDENT 8,","6318 WALCHWIL, CH, COMPENSATION FROM KSG",9930212TI9569993,,,5'000.00,,5'243.63
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,02.08.2023,02.08.2023,02.08.2023,R-Audideo diambile,,,9930212TI9569993,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,02.08.2023,02.08.2023,02.08.2023,Viscus lis at minitudunto congerate parto,,,9930212TI9569993,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Coniunt secitque ellura,,,9930712LP4015960,,,1'469.95,,10'243.63
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,DORPUPRA VOLOCULUVIT,,,9930712LP4015960,,-1327.500000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,PLEGENT COR INE,AN SECIBURIA (ALIQUID) 4045,,9930712LP4015960,,-75.000000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,DITA PATUMERE DE,,,9930712LP4015960,,-67.450000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Secitque dedra,4-12.2023 BVG MONTHLY PA,"INGIT, GROBAE COLO, AN DUONE 1017, 600457761231762504643213385",9930712LK6453313,,,557.50,,11'713.58
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,R-Audideo diambile,,,9930712LK6453313,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Viscus lis at minitudunto congerate parto,,,9930712LK6453313,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Cebitom at perange alurem,,,BJ31418NJ8204828,,,0.00,,12'271.08
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,01.07.2023 - 31.07.2023,,,BJ31418NJ8204828,,,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Centuide PER-mantumn,,,BJ31418NJ8204828,,-0.200000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Viscus lis at minitudunto congerate parto,,,BJ31418NJ8204828,,0.200000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,R-Audideo diambile,,,BJ31418NJ8204828,,-0.300000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Viscus lis at minitudunto congerate parto,,,BJ31418NJ8204828,,0.300000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Secitque dedra diambile,,,BJ31418NJ8204828,,-0.900000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,Viscus lis at minitudunto congerate parto,,,BJ31418NJ8204828,,0.900000000,,,
30.08.2023,1111 11111111,,1111 11111111.01X,VN16 6883 8648 7677 1877 A,LAM,31.07.2023,31.08.2023,QUI Patumere Cognumn Funtali,31.07.2023,31.07.2023,31.07.2023,d-audideo Volury,OPUGAVIT XXX,"8820 WAEDENSWIL, AAPARTMENT RENTAL FEE AUG 23, Credit / debit advice",9902211TO9260785,,,,3'700.00,12'271.08
,,,,,,,,,,,,,,,,,,,,
Flassus cebitom,Quonent cebitom,,,,,,,,,,,,,,,,,,,
1111.123333,34545.000000007,,,,,,,,,,,,,,,,,,,
Output data - csv_ubs_example_format1_20230905_03.tsv
Output text returned by the exec() function.
Date\tDateValue\tDoc\tExternalReference\tDescription\tIncome\tExpenses\tIsDetail
2023-07-31\t2023-07-31\t\t9902211TO9260785\t\"D-Audideo Volury, Opugavit Xxx, 8820 Waedenswil, Aapartment Rental Fee Aug 23, Credit / Debit Advice\"\t3700.00\t
2023-07-31\t2023-07-31\t\tBJ31418NJ8204828\t\"Viscus Lis At Minitudunto Congerate Parto\"\t0.900000000\t\tD
2023-07-31\t2023-07-31\t\tBJ31418NJ8204828\t\"Secitque Dedra Diambile\"\t-0.900000000\t\tD
2023-07-31\t2023-07-31\t\tBJ31418NJ8204828\t\"Viscus Lis At Minitudunto Congerate Parto\"\t0.300000000\t\tD
2023-07-31\t2023-07-31\t\tBJ31418NJ8204828\t\"R-Audideo Diambile\"\t-0.300000000\t\tD
2023-07-31\t2023-07-31\t\tBJ31418NJ8204828\t\"Viscus Lis At Minitudunto Congerate Parto\"\t0.200000000\t\tD
2023-07-31\t2023-07-31\t\tBJ31418NJ8204828\t\"Centuide Per-Mantumn\"\t-0.200000000\t\tD
2023-07-31\t2023-07-31\t\tBJ31418NJ8204828\t\"Cebitom At Perange Alurem\"\t\t0.00\tS
2023-07-31\t2023-07-31\t\t9930712LK6453313\t\"Secitque Dedra, 4-12.2023 Bvg Monthly Pa, Ingit, Grobae Colo, An Duone 1017, 600457761231762504643213385\"\t\t557.50\t
2023-07-31\t2023-07-31\t\t9930712LP4015960\t\"Dita Patumere De\"\t-67.450000000\t\tD
2023-07-31\t2023-07-31\t\t9930712LP4015960\t\"Plegent Cor Ine, An Seciburia (Aliquid) 4045\"\t-75.000000000\t\tD
2023-07-31\t2023-07-31\t\t9930712LP4015960\t\"Dorpupra Voloculuvit\"\t-1327.500000000\t\tD
2023-07-31\t2023-07-31\t\t9930712LP4015960\t\"Coniunt Secitque Ellura\"\t\t1469.95\tS
2023-08-02\t2023-08-02\t\t9930212TI9569993\t\"D-Audideo Dedra, Volundo Mangun, Fluvident 8,, 6318 Walchwil, Ch, Compensation From Ksg\"\t\t5000.00\t
2023-08-21\t2023-08-21\t\t5530233TI3956784\t\"Creta D-Audideo Dedra, Voloncende Frum Et, An Regrumea 5037, 246531233028703100220735546\"\t\t705.30\t
2023-08-24\t2023-08-24\t\t2530236TI4589949\t\"Creta D-Audideo Dedra, Res, An Vit 3534, 803023367811405547285483243\"\t\t1674.15\t
2023-08-25\t2023-08-25\t\t5730237TI4790761\t\"Creta D-Audideo Dedra, Tum, An Fica 66 8840, 404800036845402515030151356\"\t\t165.00\t
2023-08-30\t2023-08-30\t\t9702242TO3295927\t\"D-Audideo Volury, Opugavit Xxx, 8820 Waedenswil, Aapartment Rental Fee Sep 23, Credit / Debit Advice\"\t3700.00\t\t
2023-08-31\t2023-08-31\t\t9930743LP7352170\t\"Dita Patumere De\"\t-67.450000000\t\tD
2023-08-31\t2023-08-31\t\t9930743LP7352170\t\"Plegent Cor Ine, An Seciburia (Aliquid) 4045\"\t-75.000000000\t\tD
2023-08-31\t2023-08-31\t\t9930743LP7352170\t\"Dorpupra Voloculuvit\"\t-1327.500000000\t\tD
2023-08-31\t2023-08-31\t\t9930743LP7352170\t\"Coniunt Secitque Ellura\"\t\t1469.95\tS
2023-08-31\t2023-08-31\t\t9930743LK8430013\t\"Secitque Dedra, 4-12.2023 Bvg Monthly Pa, Ingit, Grobae Colo, An Duone 1017, 600457761231762504643213385, 1561140RG4305540\"\t\t557.50\t
Input data - csv_ubs_example_format2_de_20220928.csv
Input text passed to the exec() function.
Kontonummer:;12345678910;
IBAN:;CH12345678910;
Von:;2022-09-26;
Bis:;2022-09-28;
Anfangssaldo:;1000.00;
Schlusssaldo:;1441.21;
Bewertet in:;CHF;
Anzahl Transaktionen in diesem Zeitraum:;10;
Abschlussdatum;Abschlusszeit;Buchungsdatum;Valutadatum;Währung;Transaktionsbetrag;Belastung/Gutschrift;Saldo;Transaktions-Nr.;Beschreibung1;Beschreibung2;Beschreibung3;Fussnoten;
2022-09-28;16:08:11;;2022-09-28;CHF;100.00;Gutschrift;1100.00;12345678910;"Gutschrift";"Einzahlung Bancomat";;;
2022-09-28;12:48:24;;2022-09-28;CHF;-20.00;Belastung;1000.00;12345678910;"FILIALE";"123456-0 07/24, Bezug Bancomat";;;
2022-09-27;13:32:48;2022-09-29;2022-09-27;CHF;-5.35;Belastung;1005.35;12345678910;"Lidl Viganello";"123456-0 07/24, Zahlung Debitkarte";;;
2022-09-27;16:39:42;2022-09-28;2022-09-27;CHF;-2.30;Belastung;1007.85;12345678910;"TPL Piaz. Mol. Billett L";"123456-0 07/24, Zahlung Debitkarte";;;
2022-09-26;;2022-09-26;2022-09-26;CHF;-135.00;Belastung;1142.85;12345678910;"Zahlung ";"Zahlung e-banking-Vergutungsauftrag";;;
2022-09-26;;2022-09-26;2022-09-26;CHF;-38.01;Belastung;1180.86;12345678910;"Zahlung ";"e-banking-Vergutungsauftrag";;;
2022-09-26;;2022-09-26;2022-09-26;CHF;-35.00;Belastung;1215.86;12345678910;"Zahlung";"Zahlung";;;
2022-09-26;;2022-09-26;2022-09-26;CHF;-31.75;Belastung;1306.21;12345678910;"Zahlung ";"e-banking-Vergutungsauftrag";;;
2022-09-26;;2022-09-26;2022-09-26;CHF;-58.60;Belastung;1364.81;12345678910;"Sunrise UPC Sagl";"e-banking-Vergutungsauftrag";;;
2022-09-26;;2022-09-26;2022-09-26;CHF;-76.40;Belastung;1441.21;12345678910;"Salt Mobile SA";"e-banking-Vergutungsauftrag";;;
Output data - csv_ubs_example_format2_de_20220928.tsv
Output text returned by the exec() function.
Date\tDateValue\tDescription\tExternalReference\tExpenses\tIncome
2022-09-26\t2022-09-26\tSalt Mobile SA e-banking-Vergutungsauftrag \t12345678910\t76.40\t
2022-09-26\t2022-09-26\tSunrise UPC Sagl e-banking-Vergutungsauftrag \t12345678910\t58.60\t
2022-09-26\t2022-09-26\tZahlung Zahlung e-banking-Vergutungsauftrag \t12345678910\t135.00\t
2022-09-26\t2022-09-26\tZahlung e-banking-Vergutungsauftrag \t12345678910\t31.75\t
2022-09-26\t2022-09-26\tZahlung e-banking-Vergutungsauftrag \t12345678910\t38.01\t
2022-09-26\t2022-09-26\tZahlung Zahlung \t12345678910\t35.00\t
2022-09-27\t2022-09-27\tLidl Viganello 123456-0 07/24, Zahlung Debitkarte \t12345678910\t5.35\t
2022-09-27\t2022-09-27\tTPL Piaz. Mol. Billett L 123456-0 07/24, Zahlung Debitkarte \t12345678910\t2.30\t
2022-09-28\t2022-09-28\tFILIALE 123456-0 07/24, Bezug Bancomat \t12345678910\t20.00\t
2022-09-28\t2022-09-28\tGutschrift Einzahlung Bancomat \t12345678910\t\t100.00
Input data - csv_ubs_example_format3_it_triplequotes_20240621.csv
Input text passed to the exec() function.
Numero di conto:;0000 00000800.00;;;;;;;;;;;;;
IBAN:;CH00 0000 0000 0000 0000 N;;;;;;;;;;;;;
Dal:;;;;;;;;;;;;;;
Al:;;;;;;;;;;;;;;
Saldo iniziale:;1117.58;;;;;;;;;;;;;
Saldo finale:;22.97;;;;;;;;;;;;;
Valutazione in:;CHF;;;;;;;;;;;;;
Numero di transazioni in questo periodo:;6;;;;;;;;;;;;;
Data dell'operazione;Ora dell'operazione;Data di registrazione;Data di valuta;Moneta;Addebito;Accredito;Importo singolo;Saldo;N. di transazione;Descrizione1;Descrizione2;Descrizione3;Note a piè di pagina;
2024-06-19;12:48:15;;2024-06-19;CHF;-20.00;;;22.97;11111111;"""FILIALE;VIGANELLO""";"""11111111-0 07/24; Prelevamento Bancomat""";No di transazioni: 111111;;
2024-06-19;;2024-06-19;2024-06-19;CHF;-450.00;;;42.97;11111112;"""Descrizione1""";"""Descrizione2; Descrizione2""";"""Descrizione3""";;
2024-06-17;17:19:57;2024-06-19;2024-06-17;CHF;-15.40;;;492.97;11111113;"""Descrizione1;6962 Viganello""";"""11111111-0 07/24; Pagamento carta di debito""";No di transazioni: 11111112334;;
2024-06-17;17:31:13;2024-06-18;2024-06-17;CHF;-5.20;;;508.37;11111114;"""Descrizione1;6900 Lugano""";"""11111111-0 07/24; Pagamento carta di debito""";No di transazioni: 11234534553;;
2024-06-18;;2024-06-18;2024-06-18;CHF;;200.00;;513.57;11111115;"""Descrizione1;6900 Lugano""";Accredito;No di transazioni: 12678345643;;
2024-05-31;17:23:44;2024-06-03;2024-05-31;CHF;-20.00;;;1117.58;11111116;BR Lugano;"""111111111-0 07/24; Prelevamento Bancomat""";"""Spese: Prelevamento di contanti al Bancomat di banche terze/Postomat in Svizzera; No di transazioni: 1268923683""";;
Output data - csv_ubs_example_format3_it_triplequotes_20240621.tsv
Output text returned by the exec() function.
Date\tDateValue\tDescription\tExternalReference\tExpenses\tIncome
2024-05-31\t2024-05-31\tBR Lugano 111111111-0 07/24; Prelevamento Bancomat\t11111116\t20.00\t
2024-06-17\t2024-06-17\tDescrizione1;6900 Lugano 11111111-0 07/24; Pagamento carta di debito\t11111114\t5.20\t
2024-06-17\t2024-06-17\tDescrizione1;6962 Viganello 11111111-0 07/24; Pagamento carta di debito\t11111113\t15.40\t
2024-06-18\t2024-06-18\tDescrizione1;6900 Lugano Accredito\t11111115\t\t200.00
2024-06-19\t2024-06-19\tDescrizione1 Descrizione2; Descrizione2\t11111112\t450.00\t
2024-06-19\t2024-06-19\tFILIALE;VIGANELLO 11111111-0 07/24; Prelevamento Bancomat\t11111111\t20.00\t
Export
Export Tutorial3 javascript codes, csv and tsv to HTML
// Banana Accounting Extension Javascript
// @id = ch.banana.apps.exporthtmljavascriptcodestutorial3.js
// @api = 1.0
// @publisher = Banana.ch SA
// @description = Tutorial: Export javascript codes, csv and tsv of the Tutorial 3 examples in HTML
// @task = export.file
// @doctype = *.*
// @docproperties =
// @timeout = -1
// @exportfiletype = html
// @visibility = never
//Main function
function exec() {
//Check if we are on an opened document
if (!Banana.document) {
return;
}
//Take the table Documents
var documents = Banana.document.table('Documents');
//We check if the table Documents exists, then we can take all the codes
//If the table Documents doesn't exists, then we stop the script execution
if (!documents) {
return;
} else {
//Variable to save the html text
var htmlText = '';
htmlText += '<p>On this page we show some examples of transactions import extensions.</p>\n';
htmlText += '<p>Each example consists of:</p>\n';
htmlText += '<ul>\n';
htmlText += '<li>The complete <strong>JavaScript code of the import extension</strong>.</li>\n';
htmlText += '<li>The <strong>.CSV</strong> files in different formats with the transactions data to be imported.<br>Some examples contains <strong>anonymized data</strong>, the description text has no meanings. </li>\n';
htmlText += '<li>The output in <strong>.TSV</strong> format (Tabulator Separated Values) of the import extension, which contains the transformed csv data in the “transactions.simple” format used to import the transactions in Banana Accounting.</li>\n';
htmlText += '</ul>\n';
//Get all the tutorial javascript codes
htmlText = getJavascriptCode(htmlText, documents);
}
return htmlText;
}
//Function that gets the javascript code of each tutorial example and save it into the htmlText.
function getJavascriptCode(htmlText, documents) {
//Read row by row the table Documents
var len = documents.rowCount;
for (var i = 0; i < len; i++) {
//Create a variable for the row
var tRow = documents.row(i);
//We get some values
var fName = Banana.document.info("Base", "FileName").replace(/^.*[\\\/]/, ''); //the file name (without path)
var section = tRow.value("Section"); // the section column used to define the title type
var id = tRow.value("RowId"); //the id of the example
var description = tRow.value("Description"); //the description of the example
var attachments = tRow.value("Attachments"); //the javascript code of the example
attachments = attachments.replace(/</g,'<'); // replace the < symbol
attachments = attachments.replace(/>/g,'>'); // replace the > symbol
//For tilte h2 we consider only rows with section h2
if (section && section === "h2") {
htmlText += '<h2>' + description + '</h2>\n';
}
//For js codes we consider only rows with section h3, id, description and attachment
else if (section && section === "h3" && id && description && attachments) {
htmlText += '<h3>' + description + '</h3>\n';
htmlText += '<pre><code class="language-javascript">\n';
htmlText += '// Banana Accounting Extension Javascript' + '\n';
htmlText += attachments;
htmlText += '\n';
htmlText += '</code></pre>\n';
htmlText += getCsvAndTsv(id, documents); // adds csv and tsv
}
}
//Returns the html text which contains titles, javascript codes and csv examples
return htmlText;
}
//Function that gets the Csv with the bank movements and the Tsv (tabulator separated values).
//The Tsv contains the Csv data after being processed by the import extension.
//The Tsv has a specific format used by Banana Accounting to import transactions.
function getCsvAndTsv(jsCodeId, documents) {
//Variable to save the csv and tsv (tabulator separated values)
var text = '';
//Remove '.js' from the jsCodeId string, we use the id number to get the tsv
jsCodeId = jsCodeId.replace(/\.js$/, "");
//Read row by row the table Documents
var len = documents.rowCount;
for (var i = 0; i < len; i++) {
//Create a variable for the row
var tRow = documents.row(i);
//We get some values
var section = tRow.value("Section"); // the section column used to define the title type
var id = tRow.value("RowId"); //the id of the example
var description = tRow.value("Description"); //the description of the example
var attachments = tRow.value("Attachments"); //the csv/tsv text of the example
//For the csv/tsv text we consider only rows with section h4, id that starts with the same id of the import extension, description and attachment
if (section === "h4" && id.startsWith(jsCodeId) && description && attachments) {
var strtype = '';
var strIntro = '';
if (id.indexOf(".csv") > -1) {
strtype = "Input data - ";
strIntro ="Input text passed to the exec() function.";
} else if (id.indexOf(".tsv") > -1) {
strtype = "Output data - ";
strIntro ="Output text returned by the exec() function.";
}
text += '<h4>' + strtype + description + '</h4>\n';
text += '<p>'+ strIntro + '</p>\n';
text += '<pre><code class="language-plaintext">\n';
text += attachments;
text += '\n';
text += '</code></pre>\n';
}
}
return text;
}
Working with XML
Introduction
This page contains some code examples of how to read, write and more in general how to work with XML files in Banana.
All the code reported above as example can be found in the following file: embedded_javascript_tutorial1.ac2
XML object
XML files are used to save a large amount of data in an organized way.
Using the Banana APIs is possible to retrieve data from XML files and also create new XML files.
Read XML
In order to read an XML string we have to follow the following steps:
- Create the XML parse object
- Take the root of the XML
- Find the data we want to retrieve from the file using firstChildElement([text]).
- Iterate all over the file as long as we always have something from step 3.
Read XML Code Sample: Simple XML
var xml = '<Library updated="2018-09-03">' + // To simplify,
'<Book>' + // the variable
'<Title>Paths of colours</Title>' + // xml contains
'<Author>Rosa Indaco</Author>' + // the xml string
'</Book>' +
'<Book>' +
'<Title>Accounting exercises</Title>' +
'<Author>Su Zhang</Author>' +
'</Book>' +
'</Library>';
var bookList = ""; // Create string for the output
var xmlFile = Banana.Xml.parse(xml); // Create XML Parse object
var xmlRoot = xmlFile.firstChildElement('Library'); // Find the first tag "Library" in the XML
var updateDate = xmlRoot.attribute('updated'); // Take attribute assigned to the tag
bookList += "Books in the library on " + updateDate + "\n\n"; // Append to the output string
var bookNode = xmlRoot.firstChildElement('Book'); // Take the first Book
while (bookNode) { // As long as there are books, repeat
var title = bookNode.firstChildElement('Title').text; // Find the first tag "Title" in the XML
var authorNode = bookNode.firstChildElement('Author'); // Find the first tag "Author" in the XML
var author = authorNode ? authorNode.text : 'unknow'; // Check whether there is a tag "Author"
bookList += title + " - " + author + "\n"; // Append to the output string
bookNode = bookNode.nextSiblingElement('Book'); // Go to the next book
}
Banana.Ui.showText("List of books present in the xml file", bookList); // Output the results
Output:

Write XML
In order to write and create an XML file we have to follow the following steps:
- Create the XML document object.
- Create a root tag for the document using newDocument([text]).
- Add new tag using addElement([text]).
- Add text for the tag with addTextNode([text]).
Write XML Code Sample: Simple XML
var xmlDocument = Banana.Xml.newDocument("Library"); // Create XML file
xmlDocument.addComment("This is the generated xml file"); // Add comment to the file
var rootNode = xmlDocument.addElement("Library"); // Set root tag "Library"
rootNode.setAttribute("updated", "2018-09-03"); // Set attribute to the tag "Library"
var bookNode = rootNode.addElement("Book"); // Create tag "Book" child of "Library"
bookNode.addElement("Title").addTextNode("Paths of colours"); // Create tag "Title" child of "Book"
bookNode.addElement("Author").addTextNode("Rosa Indaco"); // Create tag "Author" child of "Book"
var bookNode = rootNode.addElement("Book"); // Create tag "Book" child of "Library"
bookNode.addElement("Title").addTextNode("Accounting exercises"); // Create tag "Title" child of "Book"
bookNode.addElement("Author").addTextNode("Su Zhang"); // Create tag "Author" child of "Book"
var xmlString = Banana.Xml.save(xmlDocument); // Create output
Banana.Ui.showText("Xml file", xmlString); // Generate output
Output:

Validate
Is possible to validate if a file is in fact an XML which contains tag with the validate() function.
var xmlFile = Banana.Xml.parse(xml); // Create the XML file
var valid = Banana.Xml.validate(xmlFile, 'documents:xsd'); // Validate the XML
if (valid) {
Banana.Ui.showInformation('Validation result', 'The xml is valid');
} else {
Banana.Ui.showInformation('Validation result', 'The xml is not valid: ' + Banana.Xml.errorString);
}
Output:

General examples with XML
In this section we are going to provide some examples of how to use API functions for XML files, here below there is the XML file used for the first example:
<solarSystem updated="2020-03-27">
<Planet>
<name>Sun</name>
<sizeOrder>1</sizeOrder>
</Planet>
<Planet>
<name>Earth</name>
<sizeOrder>6</sizeOrder>
<satellite>Moon</satellite>
</Planet>
<Planet>
<name>Jupiter</name>
<sizeOrder>2</sizeOrder>
<satellite>Callisto</satellite>
</Planet>
<Planet>
<name>Saturn</name>
<sizeOrder>3</sizeOrder>
<satellite>Cronus</satellite>
</Planet>
<Planet>
<name>Mars</name>
<sizeOrder>8</sizeOrder>
<satellite>Phobos</satellite>
</Planet>
<Planet>
<name>Neptune</name>
<sizeOrder>5</sizeOrder>
<satellite>Triton</satellite>
</Planet>
<Planet>
<name>Mercury</name>
<sizeOrder>9</sizeOrder>
</Planet>
<Planet>
<name>Venus</name>
<sizeOrder>7</sizeOrder>
</Planet>
<Planet>
<name>Uranus</name>
<sizeOrder>4</sizeOrder>
<satellite>Ariel</satellite>
</Planet>
</solarSystem>
Check if a tag has a specific Child tag
the following is a code example of how to return and print only planets with a satellite, the other will be excluded, therefore will be used the function hasChildElements([text]).
var outputString = "";
var xmlFile = Banana.Xml.parse(xml);
var xmlRoot = xmlFile.firstChildElement('solarSystem');
var updateDate = xmlRoot.attribute('updated');
outputString += "Planets in the solar System with satellites updated on " + updateDate + "\n\n";
var planet = xmlRoot.firstChildElement('Planet'); // Take the first tag "Planet"
while (planet) { // As long as we have planets
if (planet.hasChildElements('satellite')) { // Check if the planet has tag "satellite"
var planetName = planet.firstChildElement('name').text; // Save the planetName
var planetSatellite = planet.firstChildElement('satellite').text; // Save the satelliteName
outputString += "name: "+planetName+", satellite: "+planetSatellite+"\n";
}
planet = planet.nextSiblingElement('Planet'); // Move to the next planet
}
Banana.Ui.showText("Planets in the XML with satellites", outputString); // Show the output
Output:

Export Transactions in XML format
Here there is an example of how to take various fields from the table Transactions in one of our .ac2 files and then print them in an xml files.
Naturally it is possible to change various parameter as for example the table we want to take the data. But also the number and type of fields we want to print in our file, in order to do so we have to follow the following steps:
- Decide which table we want to retrieve informations.
- Remember to handle the error for which the file doesn't have the desired table.
- Loop through the entire table taking only the desired fields.
- Decide the indentation for the file by appending to the strings special characters like '\t' (tab) or '\n' (new line).
// @id = ch.banana.apps.export
// @api = 1.0
// @pubdate = 2016-04-08
// @doctype = *.*
// @description = Export into an xml file (.xml)
// @task = export.file
// @exportfiletype = xml
// @timeout = -1
function exec() {
var xmlDocument = Banana.Xml.newDocument("Transactions");
xmlDocument.addComment("This is the generated xml file");
var rootNode = xmlDocument.addElement("transactions");
var tableTransactions = Banana.document.table('Transactions');
if (!tableTransactions) {
return;
}
for (i=0;i<tabletransactions.rowcount;i++) {
if (tableTransactions.row(i).value('Amount')) {
var transactionNode = rootNode.addElement("transaction");
transactionNode.addElement("date").addTextNode(tableTransactions.row(i).value('Date'));
transactionNode.addElement("description").addTextNode(tableTransactions.row(i).value('Description'));
transactionNode.addElement("amount").addTextNode(tableTransactions.row(i).value('Amount'));
}
}
var xmlString = Banana.Xml.save(xmlDocument);
Banana.Ui.showText("Xml file", xmlString);
return xmlString;
The code above and his explanation are available also here.
Import transactions from XML
The following is an example of how to add new transactions to a .ac2 file in Banana, below is possible to see the XML file used as example:
<transactions>
<transaction>
<date>2020-01-01</date>
<description>Red car sale</description>
<income>10000.50</income>
<expenses></expenses>
</transaction>
<transaction>
<date>2020-03-15</date>
<description>ATM withdrawal</description>
<income></income>
<expenses>600.00</expenses>
</transaction>
<transaction>
<date>2020-02-14</date>
<description>Bought silver ring</description>
<income></income>
<expenses>2000.00</expenses>
</transaction>
<transaction>
<date>2020-04-01</date>
<description>Yellow rubber duck sale</description>
<income>4200.00</income>
<expenses></expenses>
</transaction>
</transactions>
We can eventually modify the XML file above by adding new fields for our transactions and obviously add new transactions to the file, but in order to transfer data from the file into Banana we have to follow these instructions:
- We are going to transfer the data from XML to CSV and then from CSV to TSV which are Tab separated files.
- Create the CSV string we are going to append data from our file.
- As we did before in the Read XML example we have to iterate through the XML file we take in input and then append the values of the tags into our CSV string, this time we have to remember to format the string by adding special character like '\n' (new line), ',' (comma), ''' (apostrophe) or '"' (quotation mark).
- once this process is complete and we have our CSV String ready we have to convert it into an Array using csvToArray(string, [, separator, textdelim]) function and once again convert the resulting array into a TSV using arrayToTSV(table, [, defaultChar]) and return the TSV.
// @api = 1.0
// @pubdate = 2020-04-02
// @id = ch.banana.uni.app.tutorialretrieverowstablevalues
// @description = Import transactions
// @task = import.transactions
// @outputformat = transactions.simple
// @doctype = *
// @inputdatasource = openfiledialog
// @inputencoding = latin1
// @inputfilefilter = Text files (*.xml);;All files (*.*)
// @publisher = Banana.ch SA
// @timeout = -1
function exec(inputFile) {
var CSV_String = "Date" + '","' + "Description" + '","' + "Income" + '","' + "Expenses" + '\n';
var xmlFile = Banana.Xml.parse(inputFile);
var xmlRoot = xmlFile.firstChildElement('transactions');
var transactionNode = xmlRoot.firstChildElement('transaction');
while (transactionNode) {
var date = transactionNode.firstChildElement('date').text;
var description = transactionNode.firstChildElement('description').text;
var income = transactionNode.firstChildElement('income').text;
var expenses = transactionNode.firstChildElement('expenses').text;
CSV_String += ('"' + date + '","' + description + '","' + income + '","' + expenses + '"' + '\n');
transactionNode = transactionNode.nextSiblingElement('transaction');
}
var csvFile = Banana.Converter.csvToArray(CSV_String, ',', '"');
var tsvFile = Banana.Converter.arrayToTsv(csvFile);
return tsvFile;
}
FAQ
Can I call an external program within a Extension?
For the moment, for security reason we do not allow Extensions to works directly on file and call external programs.
Can I create QML (QtQuick) apps?
With QML application have extensive access to the computer.
Fot the moment, for security reason we do not allow Extensions to use QML.
How can I get the start and end date of the accounting?
var openingDate = Banana.document.info("AccountingDataBase","OpeningDate");
var closureDate = Banana.document.info("AccountingDataBase","ClosureDate");
Note: the keywords "AccountingsDataBase", "OpeningDate" and "ClosureDate" correspond to the values in the columns "Section Xml" and ID Xml" of the table "Info file". See command "Info table" under the menu "Tools".
Can I save and recall in a script the values entered by the user?
Yes, use the functions Banana.Document.scriptSaveSettings and Banana.Document.scriptReadSettings.
Settings are saved and restored in the current accounting file under the script id, if you change the id your settings will not be retrieved.
// Initialise parameter
param = {
"searchText": "",
"matchCase": "false",
"wholeText": "false"
};
// Read script settings
var data = Banana.document.getScriptSettings();
if (data.length > 0) {
param = JSON.parse(data);
}
...
// Save script settings
var paramString = JSON.stringify(param);
var value = Banana.document.setScriptSettings(paramString);
Accented letters are displayed wrong
Save the script file in UTF-8.
The wait cursor is not going away when a custom dialog is open
When you open a custom dialog you have to pause the progress bar.
Banana.application.progressBar.pause();
var result = dialog.exec();
Banana.application.progressBar.resume();
Can I protect the app?
If you don't want to someone easily change the js file, you can package it in a rcc file.
Users request for the development of a customized extension
Banana.ch has a specific area of assistance, consulting and development.
On request and upon availability we can provide the following services:
- Development of specific Banana Extensions for different needs (import, export, printing, controls)
- Integration of the Banana Accounting software with other company solutions
- Implementation of the use of Microsoft Office technologies (Excel, Word, Outlook, Access add-ons) in combination with Banana Accounting
- Development of special charts of accounts for specific needs or nations
- Integration and creation of specific solutions.
For these services:
- We are happy to supply a quote (please contact us by email at info@banana.ch)
- User's license and Terms & conditions are applicable
- Unless otherwise agreed, the developments are carried out and made available according to the Apache License 2.0 (see wikipedia's explanations)
The application can be modified, made public without restrictions, and the developers assume no responsibility for the developments, and for the application's compliance to the requirements.
- Technical details of the technology used can be found in our documentation.
- If not specified otherwise, it is assumed that our services are based on the use of Banana Accounting Plus.
Banana Accounting Extensions GPTs
The GPTs of Banana Accounting are created using ChatGPT, and are intended for creating extensions that run in Banana Accounting Plus.
Table of contents
Use the generated extensions
We summarize here how you can execute code as and Embedded extension, see Creation of an Embedded Extension saved in the accounting file (alternatively, you can also create the extension as a File Based Extension).
- Copy the code generated by the ChatGPT.
- Create a new line in the Documents table.
- In the column Attachments click on the Modification icon and select Javascript code.
- You will see a text editor.
- Clear the proposed code.
- Paste the copied code.
- Save.
- Run the code by clicking on the Execution icon in the Attachments column.

Banana Accounting Extensions Maker GPT
The GPT is only experimental: it might be subject to changes and improvements.
This GPT was created using ChatGPT, and is intended for creating extensions or asking questions about extension development. The GPT uses documentation updated as of 27.01.2025.
Requirements
To use this GPT, you must have a ChatGPT Plus subscription. Without it, you can try the service for free for up to ten requests. After that, you’ll need to either upgrade to ChatGPT Plus or wait some hours before making additional requests.
How it works
- Open the Banana GPT from this link:
- In the Message field at the bottom, enter a sentence describing what you want. Generally, more specific requests will yield better results.
- GPT will process your request and returns the javascript code.
- Generated code should always be checked.

Example reports
Report with "hello world"
Enter the following text into the GPT chat:
- Create an extension that prints a report wit the text "Hello world".
Print example:

Report with accounts list and balances
Enter the following text into the GPT chat:
- I am working on a double-entry accounting system with VAT.
- Create an extension that prints a report.
- As title of the report print "Accounts report".
- As subtitle of the report print the current date.
- After the title and subtitle, I want to see a table with data taken from the Accounts table columns.
- First row is the header of the table, use the column names as text.
- First column print the Account; align the text on the left.
- Second column print the Description; align the text in the middle.
- Third column print the Balance; align right.
- Print negative amounts in red.
- Include only rows with an Account and a BClass 1 or 2 or 3 or 4.
- At the end of the table add a row for the total of the balances.
Print example:

Report with accounts list and balances with styles
Enter the following text into the GPT chat:
- I am working on a double-entry accounting system with VAT.
- Create an extension that prints a report.
- As title of the report print "Accounts report".
- As subtitle of the report print the current date.
- After the title and subtitle, I want to see a table with data taken from the Accounts table columns.
- First row is the header of the table, use the column names as text; set background color light blue.
- First column print the Account; align the text on the left.
- Second column print the Description; align the text in the middle.
- Third column print the Balance; align right.
- Print negative amounts in red.
- Include only rows with an Account and a BClass 1 or 2 or 3 or 4.
- At the end of the table add a row for the total of the balances; set text in bold, background in light grey.
- Add borders to table and cells.
- Table must fill the full width of the page.
- Use the Times New Roman font for all texts.
- Use font size 20 for title.
- Use font size 16 for subtitle.
- Use font size 10 for table.
Print example:

Banana Accounting Journal Transactions GPT
The GPT is only experimental: it might be subject to changes and improvements.
This GPT was created using ChatGPT and is designed to generate extensions for creating reports with current and budget transactions extracted from the Journal of the accounting file. The GPT uses documentation updated as of 19.02.2025.
Requirements
To use this GPT, you must have a ChatGPT Plus subscription. Without it, you can try the service for free for up to ten requests. After that, you’ll need to either upgrade to ChatGPT Plus or wait some hours before making additional requests.
How it works
- Open the Banana GPT from this link:
- In the Message field at the bottom, enter a sentence describing what you want. Generally, more specific requests will yield better results.
- GPT will process your request and returns the javascript code.
- Generated code should always be checked.

Example reports
Report with Journal current and budget transactions
Enter the following text into the GPT chat:
- I am working on a double-entry accounting system with VAT.
- Create an extension that generates a report.
- Enter the text "Current transactions".
- Then show a table with the current transactions.
- On a new page write the text "Budget Transactions".
- Then show a table with budget transactions.
Print example:

Report with Journal current transactions with styles
Enter the following text into the GPT chat:
- I am working on a double-entry accounting system with VAT.
- Create an extension that prints a report.
- As the title of the report, print "Journal Transactions".
- After the title, display a table with transactions taken from the Journal.
- The first row is the table header; use the column names as text and set the background color to light blue.
- Column 1: Print the origin row number or the transaction, aligned to the left.
- Column 2: Print the date, aligned to the left.
- Column 3: Print the account, aligned to the left.
- Column 4: Print the contra account, aligned to the left.
- Column 5: Print the transaction description, aligned to the left.
- Column 6: Print the account description, aligned to the left.
- Column 7: Print the transaction amount, aligned to the right.
- The table must fill the full width of the page.
- Add black borders to the table and cells.
- Use Helvetica as the font for all text.
- Set the font size to 20 for the title.
- Set the font size to 16 for the subtitle.
- Set the font size to 10 for the table.
Print example:

Banana Accounting CSV Importer GPT
The GPT is only experimental: it might be subject to changes and improvements.
This GPT was created using ChatGPT and is designed to generate extensions for importing transactions from CSV files into Banana Accounting Plus. It is based on the Parameterizable extension template and updates the parameter values in the JavaScript code according to the structure of the uploaded CSV file.
Requirements
To use this GPT, you must have a ChatGPT Plus subscription. Without it, you can try the service for free for up to ten requests. After that, you’ll need to either upgrade to ChatGPT Plus or wait some hours before making additional requests.
How it works
- Open the Banana GPT from this link:
- In the Message field at the bottom, enter the CSV file containing the transactions you want to import. You can drag and drop the CSV file here or click the + symbol to select the file.
- GPT will:
- Analyze the CSV file.
- Extract the necessary parameters.
- Column separator character.
- Text delimiter character for strings.
- Decimal separator character used for amounts.
- Line number where the column headers start.
- Line number where the data starts.
- Column name for the transaction date.
- Date format.
- Column name for the transaction description.
- Column name for the income amount.
- Column name for the expense/outcome amount.
- Column name for the external reference of the transaction.
- Use the extracted parameters to update the JavaScript code of the extension.
- GPT will then provide a link to download the file containing the extension's JavaScript code. The generated code should always be reviewed.
- Download the file, open it with a text editor, and copy all the code.

Banana Accounting Extensions GPT Documentation
The GPT is only experimental: it might be subject to changes and improvements.
This GPT was created using ChatGPT, and is intended for creating extensions or asking questions about extension development. The GPT uses documentation updated as of 07.03.2025. The GPT relies only on the documentation.
Requirements
To use this GPT, you must have a ChatGPT Plus subscription. Without it, you can try the service for free for up to ten requests. After that, you’ll need to either upgrade to ChatGPT Plus or wait some hours before making additional requests.
How it works
- Open the Banana GPT from this link:
- In the Message field at the bottom, enter a sentence describing what you want. Generally, more specific requests will yield better results.
- GPT will process your request and returns the javascript code.
- Generated code should always be checked.
Example reports
Report with "hello world"
Enter the following text into the GPT chat:
- Create an extension that prints a report wit the text "Hello world".
Print example:

Report with accounts list and balances
Enter the following text into the GPT chat:
- I am working on a double-entry accounting system with VAT.
- Create an extension that prints a report.
- As title of the report print "Accounts report".
- As subtitle of the report print the current date.
- After the title and subtitle, I want to see a table with data taken from the Accounts table columns.
- First row is the header of the table, use the column names as text.
- First column print the Account; align the text on the left.
- Second column print the Description; align the text in the middle.
- Third column print the Balance; align right.
- Print negative amounts in red.
- Include only rows with an Account and a BClass 1 or 2 or 3 or 4.
- At the end of the table add a row for the total of the balances.
Print example:

Report with accounts list and balances with styles
Enter the following text into the GPT chat:
- I am working on a double-entry accounting system with VAT.
- Create an extension that prints a report.
- As title of the report print "Accounts report".
- As subtitle of the report print the current date.
- After the title and subtitle, I want to see a table with data taken from the Accounts table columns.
- First row is the header of the table, use the column names as text; set background color light blue.
- First column print the Account; align the text on the left.
- Second column print the Description; align the text in the middle.
- Third column print the Balance; align right.
- Print negative amounts in red.
- Include only rows with an Account and a BClass 1 or 2 or 3 or 4.
- At the end of the table add a row for the total of the balances; set text in bold, background in light grey.
- Add borders to table and cells.
- Table must fill the full width of the page.
- Use the Times New Roman font for all texts.
- Use font size 20 for title.
- Use font size 16 for subtitle.
- Use font size 10 for table.
Print example:

Command line
Banana can be started by giving a series of command (for a list of command and examples file see below).
Example: open a file
banana90.exe c:\temp\example.ac2
Rule for command line command
- The arguments need to be preceded by a minus “-” sign. If an argument is missing of the “-” sign, it is interpreted as the name of the file to open.
- Include the whole argument within the delimiter “…” if the text include whitespace.
- Running import as command in the command line save the accounting file on exit
If a command fail, than a return code different than 0 is returned, and the error is inserted in the log file (only if the option –log_file was used).
Examples
Example: open a file:
banana90.exe c:\temp\example.ac2
Export to xml file
banana90.exe -cmd=export "-cmd_file=c:\temp\my example.ac2" "-cmd_p1=c:\temp\myexample.xml" -cmd_p2=xml -period_begin=2006-01-01 –period_end=2005-03-30
Example: import transactions (use the file name with the proper directory name)
Use also a log so that you know the error
banana90.exe -cmd=import -cmd_file="company.ac2" -cmd_table=Transactions -cmd_p1=import_mov.txt -cmd_exit=1 -log_file=log.txt
For detail information regarding the import of transaction see the page "Importing in txt format".
Available Command
The argument “–cmd=…” specifies the command to be executed. The other arguments specify the option for this command.
The command can be used as a command line or a DDE request.
Argument Description cmd= The command to execute
- file_open (cmd_p1=noshow)
- file_close (cmd_file)
- file_save (cmd_file)
- file_saveas (cmd_file, cmd_p1)
- file_show (cmd_file)
- get_tableinfo (cmd_file , cmd_table)
- get_getcell (cmd_file , cmd_table, cmd_column, cmd_row)
- get_getline (cmd_file , cmd_table, cmd_column, cmd_row)
- get_lasterror
- set_language(cmd_p1)
- calc_all (cmd_file)
- calc_simple (cmd_file)
- deleterows (…) *)
- export (…)
- fileinfo (…)
- import (…) *)
- version.
Program return the version number and terminate.
1) Running import in the command line save the file on exit;
*) If you use the commands “deleterows” and “import” directly from a command line the file is automatically saved on exit
List of arguments
Command Argument Description From command line cmd_exit=1 The program should exit and terminate
Note if you use the command import= then the file that has been opened is automatically saved when the program terminate. nonetwork Turn off all connections to the network (i.e. to check for updates, integrated web-server, ...) For all commands cmd_file= the file to use or open cmd_pw= password to open the file cmd_names= A - Field name in XML
a - Field name in original language (default on)
log_file= set the log file name for writing messages (if no file name no log) deletelines cmd_p1= start of line to delete (number) cmd_p2= how many lines to delete (if not present = 1) cmd_table= The name of table set_language cmd_p1= The two letter ISO639 language code (de, fr, en, it) file_open cmd_p1= noshow – do not show the file file_saveas cmd_p1= file name of saved file get_tableinfo cmd_table= The name of the table to get info get_getcell cmd_table= The name of the table cmd_row= The number of the row, or an expression like “Account=1000:3” (In this ex. the third row where the field Account is equal to 1000 is used) cmd_column= The name of the column cmd_op= A – Format value (default on) get_getline cmd_table= The name of the table cmd_row= The number of the row, or an expression like “Account=1000:3” (In this ex. the third row where the field Account is equal to 1000 is used) cmd_op= A – Format value (default on) export export_use_param Instead of the default parameters use the last saved parameters (set with the dialog) and then applies the specified options with the other arguments cmd_p1= file name of the export file cmd_p2= Type: html, excel, xml cmd_table= The name of table to export (only the table is exported) export_include= Options:
Upper case(A) = on; Lower Case(a) = off
A - Recheck accounting (default on)
B - Include statistics table (default on)
C - Include transaction table (default on)
D - Include account table (default on)
E - Include category table (default on)
F - Include total table (default on)
G - Include Exchange rate table (default on)
H - Inclue Vat code table and vat report (default on)
I - Include Period Accounts (default on)
L - Include Period VAT (default on)
M - Create periods for the whole year (default off)
N – Create accounts card
export_include_ma= number of months for accounts period, for option I, (default 1)
-1 for daily export_include_mv= number of months VAT period, for option L (default 3) export_include_mm= max numbers of periods (default 36) export_op_html= Options for html
A - Use style sheet
B - Use predefined style sheet (default on)
C - Include style shett within html file (default on)
D - Export visible fields only (default on)
E - Table with borders (default on)
F - Columns with headers (default on)
G - Preserve page breaks within the table (default on)
export_op_excel= Options for Excel export
A - Define cell name (default on)
B - Define table name (default on)
C - Use Xml names (default on)
D - Protect tables (default on)
export_op_xml= Upper case(A) = on; Lower Case(a) = off
A – Visible field only (default off)
B – Include view list (default off)
period_all period All period_begin= Begin date (yyyy-mm-dd) period_end= period End date (yyyy-mm-dd) vat_use_param= Instead of the default parameters use the last saved parameters (set with the dialog) and then applies the options specified with vat_op vat_op= A - Include transactions
B - Include total account
C - Include total codes
D - Include total percentage
E - Use own group schema
F - Only code specified
G - Only group specified
vat_sort= sort field vat_text= single code or groups (to use with –vat_op F and G) fileinfo cmd_op= A – Recalculate all (default off) import cmd_p1= File name of the file to import. Data have to be separated by tabulator, and the first row has to contain the name of the fields. cmd_p2= Insert al line number (0=Append to end) cmd_op= A - Complete imported raws cmd_table= The name of table where to insert the data
(Accounts, Transactions, …).
Integrated Web Server
Banana Accounting has an integrated web server that allow to access the accounting data through a browser or another software through a RESTful API, that can be accessed through with an http protocol.
This feature is only available with the Advanced plan.
Excel, Word, Access and other software have the ability to integrate documents and data made available through the internet protocol.
The web server can't be used to write to the accounting file, and Banana Accounting+ can't connect to external URLs.
Starting the web server
The web server enables you to access the accounting data through http.
The web server is started from the Program Options dialog under the Tools menu.
RestAPI Navigator
Once the web server is started you can navigate to the server by typing the address "http://localhost:8081/" in your browser.
Once you connect to the server will open a RestAPI navigator, that allows you to navigate the files opened in Banana Accounting Files and their content.
- See the list of all open file.
- See the list of
- Tables
- Columns
- Available commands
- Access the content in different format
The URL you see on the browser is the one you will use in the RestApi.
Settings
The settings of the file server, like the listening port number and others, are stored in the httpconfig.ini file.
The location of the file is the following:
- Windows: "C:/Users/{user_name}/AppData/Local/Banana.ch/BananaPlus/10.0/httpconfig.ini"
- Mac: "/Users/{user_name}/Library/Application Support/Banana.ch/BananaPlus/10.0/httpconfig.ini"
- Linux: "/home/{user_name}/.local/share/data/Banana.ch/BananaPlus/10.0/httpconfig.ini"
In case the file is not found as indicated above, you can follow the steps below to find and access it:
- Click on menu Tools > Program Options.
- Select the tab Advanced.
- Click on System info button under Develop section.
- Select the entry Web Server > Settings file path.
- Click on Open path button to open the directory where the httpconfig.ini file is located.
- Open the file httpconfig.ini with any text editor to edit the file.
To apply the changes made in the httpconfig.ini file it's required to save the file, close and reopen Banana Accounting Plus.

Certificates
The web server uses Banana certificates.
If you want to use your own certificates, you need to save the certificates (.key and .pem files) in the Ssl directory of Banana application (saving certificate files in a different directory doesn't work because Banana always checks for the files inside the Ssl directory). Then you need to change the names of sslCertFile and sslKeyFile parameters in the httpconfig.ini file.
Windows example:
[Https]
sslKeyFile=C:/Users/username/AppData/Local/Programs/BananaPlus/Ssl/banana.localhost.key
sslCertFile=C:/Users/username/AppData/Local/Programs/BananaPlus/Ssl/banana.localhost.pem
macOS example:
[Https]
sslCertFile=/Applications/BananaPlus.app/Contents/Resources/Ssl/banana.localhost.pem
sslKeyFile=/Applications/BananaPlus.app/Contents/Resources/Ssl/banana.localhost.key
Security
To limit access to the web server, it is possible to set an access token in the settings parameter Banana/accessToken.
[Banana]
accessControlAllowOrigin=https://www.banana.ch
accessToken=b8nmr1a
In this case the caller have to send the request with the same accessToken set in the http header "X-Banana-Access-Token" or in the query parameter "acstkn". If the token doesn't match the server will answer with a 401 unauthorised.
http://localhost:8081/v2?acstkn=b8nmr1a
The settings parameter Banana/accessControlAllowOrigin=https://www.banana.ch is needed to allow the Banana Excel Addin to access the web server. You can set it to '*' if you want to allow the access from other Addins too.
Since Banana 9.1.0
API
The latest version of Banana Accounting Plus (version 10.1.7 or more recent) support both versions V1 and V2.
Previous versions of Banana Accounting support only the V1 version. The version V1 is no longer developed.
- API Version V2
This is the currently developed version. It is supported by Banana Accounting Plus (version 10.1.7 or more recent).
This version is fully compatible with V1 version (what worked with V1 also works with V2). - API Version V1 (outdated)
This is the legacy version, supported by Banana9 and BananaPlus. It is no longer developed.
Data formats
Date
Date values are in ISO 8601 format 'YYYY-MM-DD'.
Decimal
Decimal values have a '.' (dot) as decimal separator and doesn't have a group separator. For example: '12345.67'.
Decimal values are rounded according to the accounting settings.
Text
Text values can contain any character supported by UTF-8.
Time
Time values are in ISO 8601 format 'HH:MM:SS'. The formats 'HH:MM' and 'HH:MM:SS.ZZZ are also accepted.
Setup of the Banana Web Server (Windows)
The guide below walk you through the setup of the Banana Web Server for Windows.
1. Start Banana Accounting web server
- Open Banana Accounting Plus.
- Click on menu Tools > Program Options.
- Select the tab General.
- Check the options Start Web Server.
In Windows you must use the http://localhost:8081, not the SSL.
2. Edit the Banana Web Server configuration file (httpconfig.ini)
- Click on menu Tools > Program Options.
- Select the tab Advanced.
- Click on System info button

- Select the entry Web Server > Settings file path
- Click on Open path... button

- Right click > Open with > Notepad.
Open the file httpconfig.ini- In the file look for the following properties and edit as indicated:
- accessControlAllowOrigin
Modify the value of property accessControlAllowOrigin to "*" (accessControlAllowOrigin=* ) - accessToken
Modify the value of property accessToken with a password of your choice (e.g. "accessToken=MyPasswordX" )
It is used to have more security when using the Banana Web Server. For more information visit Web Server Security.

- Save and close the file.
- Restart Banana Accounting Plus.
3. Excel, enable localhost connection
Excel uses the Microsoft Edge browser for web services. So if you want to retrieve data in Excel you have to give the command that allows Edge to connect through the localhost.
In technical terms you have to add a local loopback exemption to the Microsoft Edge Web Viewer.
For more information see Microsoft documentation "localhost", Add-ins and Edge.
To enable the localhost connection:
- In the search box enter cmd.

- On the right side select Run as administrator.

- Confirm with Yes.

- Copy (CTRL+C) and paste (CTRL+V) the following command:
CheckNetIsolation LoopbackExempt -a -n="microsoft.win32webviewhost_cw5n1h2txyewy"
- Press enter to run the command.

- Close the command prompt.
Remove LoopbackExempt
To see if loopback is active use the command:
- CheckNetIsolation LoopbackExempt -s
If you no longer want to use the add-in, you can remove the setting with the following command:
- CheckNetIsolation LoopbackExempt -d -n="microsoft.win32webviewhost_cw5n1h2txyewy"
Setup of the Banana Web Server (macOS)
The guide below walk you through the setup of the Banana Web Server for macOS.
1. Start Banana Accounting Plus web servers
- Open Banana Accounting Plus.
- Click on menu Tools > Program Options.
- Select the tab General.
- Check the options Start Web Server and Start Web Server with ssl.
In macOS you must use the SSL https://127.0.0.1:8089, not the localhost.

2. Edit the BananaPlus web server configuration file (httpconfig.ini)
- Click on menu Tools > Program Options.
- Select the tab Advanced.
- Click on System info button

- Select the entry Web Server > Settings file path
- Click on Open path... button

- Open the file httpconfig.ini
Right click > Open with > Other... > select TextEdit. - In the file look for the following properties and edit as indicated:
- accessControlAllowOrigin
Modify the value of property accessControlAllowOrigin to "*" (accessControlAllowOrigin=* ) - accessToken
Modify the value of property accessToken with a password of your choice (e.g. "accessToken=MyPasswordX" )
It is used to have more security when using the Banana Web Server. For more information visit Web Server Security.

- Save and close the file.
- Restart Banana Accounting Plus.
3. Enable banana.localhost certificate
- Open Safari and insert the url https://127.0.0.1:8089
- When the dialog appears, insert your system password and click on Always allow button.

- Open macOS Keychain Access application (Applications > Utilities) and search for the banana.localhost certificate.

- Double click on the banana.localhost certificate, expand the "Trust" section and for "Secure Socket Layer (SSL)" select "Always Trust".
Close the dialog and enter your system password to confirm the changes.

- Close and reopen the macOS Keychain Access application, the banana.localhost certificare appears now with a blue plus icon.

- Close the macOS Keychain Access application.
API Version V2 Get Data
To access the Banana Accounting API, you must type the following address into your browser (replace "b8nmr1a" with your password):
- http://localhost:8081/v2?acstkn=b8nmr1a
- https://127.0.0.1:8089/v2?acstkn=b8nmr1a (when using the web server with SSL, for example on macOS)
Home page
/v2
Show the home page of the web server and enable you to navigate the content of the accounting files.
Application
/v2/application[/{value_name}]
Return a JSON object with some information about the running application like 'version', 'serial', etc.
Examples:
/v2/application
Returns:
{
"isdevchannel": false,
"isexperimental": false,
"name": "BananaPlus",
"osdetails": "Macintosh; Intel Mac OS X 14_5_0; en_CH",
"osname": "macOS-14.5",
"qtversion": "6.5.4",
"serial": "100118-240131",
"version": "10.1.18.24031"
}
/v2/application/serial
Returns: "100118-240131"
Version
Return a string with the application's version.
Examples:
/v2/application/version
Returns: "10.1.18.24031"
appver
It is possible to check the required minimum version with the http header "X-Banana-Accept-App-Version" or the query parameter "appver". The http header or the query parameter will contain the required minimum application's version. If the minimum version is not satisfied the server will answer with a http status 406 "Not acceptable", otherwise the result as usual.
/v2/docs&appver=10.1
Returns: ["accounting.ac2", "accounting_2.ac2", ...]
/v2/docs&appver=10.1.6.23135
Returns: ["accounting.ac2", "accounting_2.ac2", ...]
/v2/docs&appver=99.9.9.991231
Returns: 406 "Not acceptable"
/v2/?appver=10.1.24
/v2/doc/xxx.ac2/balance/1020/amount?appver=10.1.24
If the minimum version 10.1.24 is satisfied, returns the current amount of the 1020 account
otherwise returns "406 Not acceptable"
Note: With Excel Script / Excel Add-ins use the query param "appver" and not the http header "X-Banana-Accept-App-Version". This because Excel Script / Excel Add-ins add an Http OPTIONS call if you set an header, and this is not currently supported in Banana Accounting Plus.
Documents
/v2/docs
Return the list of opened documents as json array.
Examples:
/v2/docs
Returns: ["accounting.ac2","accounting previous year.ac2", ...]
Document name
/v2/doc/{doc_name}
Return the list of available http requests for the file doc_name as html page.
To access the previous years files just postfix doc_name with '_p1', '_p2', etc.
Deprecated: To access the previous year file just postfix doc_name with '_previous'.
Examples:
/v2/doc/accounting.ac2
/v2/doc/accounting.ac2_p1
/v2/doc/accounting.ac2_p2
Tables
/v2/doc/{doc_name}/tablenames
Return the list of tables in document doc_name as json array.
Examples:
/v2/doc/accounting.ac2/tablenames
Returns: ["Accounting","Transactions", ...]
Table name
/v2/doc/{doc_name}/table/{table_name}
Return the content of table table_name in document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/table/Accounts
/v2/doc/accounting.ac2/table/Accounts?view=Base
/v2/doc/accounting.ac2/table/Accounts?columns=Account,Group,Description,Balance
/v2/doc/accounting.ac2/table/Accounts?format=json
Table number rows
/v2/doc/{doc_name}/table/{table_name}/rowcount
Return the number of rows in the table table_name as text.
Columns
/v2/doc/{doc_name}/table/{table_name}/columnnames
Return the list of columns as json array.
Cell value (row,column)
/v2/doc/{doc_name}/table/{table_name}/row/{row_nr}/column/{col_name}
Return the value of cell at row row_nr and column col_name as text.
The part row_nr can be a row number starting from 1 or an expression like 'Account=1000' (In this ex. the first row where the field Account is equal to 1000 is used)
The part col_name is the xml name of the requested column.
Examples:
/v2/doc/accounting.ac2/table/Accounts/row/2/column/Description
/v2/doc/accounting.ac2/table/Accounts/row/Account=1000/column/Balance
Rows list
/v2/doc/{doc_name}/table/{table_name}/rowlistnames
Return the names of row lists present in the table table_name as json array.
Examples:
/v2/doc/accounting.ac2/table/Transactions/rowlistnames
Returns: ["Data","Examples", "Archives", ...]
Row list name
/v2/doc/{doc_name}/table/{table_name}/rowlist/{rowlist_name}
Return the content of the row list rowlist_name in table_name of document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/table/Transactions/rowlist/Examples
/v2/doc/accounting.ac2/table/Transactions/rowlist/Examples?view=Base
/v2/doc/accounting.ac2/table/Accounts?columns=Account,Group,Description,Balance
/v2/doc/accounting.ac2/table/Accounts?format=json
Rowlist number rows
/v2/doc/{doc_name}/table/{table_name}/rowlist/{rowlist_name}/rowcount
Return the number of rows in the row list rowlist_name of table table_name as text.
Cell value (rowlist,row,column)
/v2/doc/{doc_name}/table/{table_name}/rowlist/{rowlist_name}/row/{row_nr}/column/{col_name}
Return the value of cell in row list rowlist_name at row row_nr and column col_name as text.
The part row_nr can be a row number starting from 1 or an expression like 'Account=1000' (In this ex. the first row where the field Account is equal to 1000 is used)
The part col_name is the xml name of the requested column.
Examples:
/v2/doc/accounting.ac2/table/Accounts/row/2/column/Description
/v2/doc/accounting.ac2/table/Accounts/row/Account=1000/column/Balance
Accounts list
/v2/doc/{doc_name}/accounts
Return the list of accounts as json array.
Examples:
/v2/doc/accounting.ac2/accounts
Returns: [{"id":"1000","descr":"1000 Cash"}, {"id":"1010","descr":"1000 Post"}, ...]
Description (account or group)
/v2/doc/{doc_name}/accountdescription/{account_id|Gr=group_id}[/{col_name}]
Return the description of the requested account or group as text.
The part col_name is optional, it is the xml name of the requested column. Default is the column 'Description'.
Examples:
/v2/doc/accounting.ac2/accountdescription/1000
/v2/doc/accounting.ac2/accountdescription/Gr=1
/v2/doc/accounting.ac2/accountdescription/1000/Curreny
Groups list
/v2/doc/{doc_name}/groups
Return the list of groups as json array.
Examples:
/v2/doc/accounting.ac2/groups
Returns: [{"id":"100","descr":"100 Current Assets"}, ...]
Segments list
/v2/doc/{doc_name}/segments
Return the list of segments as json array.
Examples:
/v2/doc/accounting.ac2/segments
Returns: [{"id":":lugano","descr":"Lugano"}, ...]
Vat codes list
/v2/doc/{doc_name}/vatcodes
Return the list of vatcodes as json array.
Examples:
/v2/doc/accounting.ac2/vatcodes
Returns: [{"id":"V80","descr":"V80 Sales and services 8.0%"}, ...]
Vat code description
/v2/doc/{doc_name}/vatdescription/{vat_code}[/{col_name}]
Return the description of the requested vat code as text.
The part col_name is optional, it is the xml name of the requested column. Default is the column 'Description'.
Examples:
/v2/doc/accounting.ac2/vatdescription/V80
/v2/doc/accounting.ac2/vatdescription/V80/Gr1
Current balance
/v2/doc/{doc_name}/balance/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the current balance of the requested account, group or bclass as text.
To access the balances of the previous year file just postfix doc_name with '_p1', '_p2', ... .
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/balance/1000/opening
/v2/doc/accounting.ac2_p1/balance/1000/opening
/v2/doc/accounting.ac2/balance/1000|1010|1020|1030/opening
/v2/doc/accounting.ac2/balance/Gr=6/totalcurrency?period=Q1
/v2/doc/accounting.ac2/balance/Gr=6/totalcurrency?frequency=M
/v2/doc/accounting.ac2/balance/Gr=6/totalcurrency?period=M1&frequency=D
/v2/doc/accounting.ac2/balance/BClass=1/balance
Budget balance
/v2/doc/{doc_name}/budget/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the budget of the requested account, group or bclass as text.
To access the budget balances of the previous year file just postfix doc_name with '_p1', '_p2', ... .
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/budget/1000/opening
/v2/doc/accounting.ac2_p1/budget/1000/opening
/v2/doc/accounting.ac2/budget/1000|1010|1020|1030/opening
/v2/doc/accounting.ac2/budget/Gr=6/totalcurrency?period=Q1
/v2/doc/accounting.ac2/budget/Gr=6/totalcurrency?frequency=M
/v2/doc/accounting.ac2/budget/BClass=1/balance
Interest
/v2/doc/{doc_name}/interest/{account_id|Gr=group_id|BClass=class_id}
Return the calculated interest on the specified account.
Parameters:
rate The interest rate in percentage (ie.: '5', '3.25'). The decimal separator must be a dot '.'. If positive it calculate the interest fo the debit amounts. If negative it calcaulate the interest on the credits amounts.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/interest/1000?rate=2.5
/v2/doc/accounting.ac2/interest/1000?rate=-8.0
/v2/doc/accounting.ac2/interest/1000?rate=-8.0&period=Q1
/v2/doc/accounting.ac2/interest/1000?rate=-8.0&frequency=Q
Budget interest
/v2/doc/{doc_name}/budgetinterest/{account_id|Gr=group_id|BClass=class_id}
Return the calculated interest on the specified account for the budget transactions.
Parameters:
rate The interest rate in percentage (ie.: '5', '3.25'). The decimal separator must be a dot '.'. If positive it calculate the interest fo the debit amounts. If negative it calcaulate the interest on the credits amounts.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/budgetinterest/1000?rate=2.5
/v2/doc/accounting.ac2/budgetinterest/1000?rate=-8.0
/v2/doc/accounting.ac2/budgetinterest/1000?rate=-8.0&period=Q1
/v2/doc/accounting.ac2/budgetinterest/1000?rate=-8.0&frequency=Q
Projection
/v2/doc/{doc_name}/projection/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the projection of the requested account, group or bclass as text.
To access the budget balances of the previous year file just postfix doc_name with '_p1', '_p2', ... .
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
projectionstart This parameter is mandatory and define the start date of the projection.
It can contain a period abbreviation like 'Q1' (start at beginnig of) or a date like '2014-07-01'.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1', a start and end date like '2014-01-01/2014-03-31' or a list of periods separated by a coma like 'S1,S2,ALL'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/projection/1000/opening?projectionstart=S1
/v2/doc/accounting.ac2/projection/1000/opening?projectionstart=2014-07-01
/v2/doc/accounting.ac2_p1/projection/1000/opening?projectionstart=S1
/v2/doc/accounting.ac2_p1/projection/1000/opening?projectionstart=S1&frequency=M
Account card
/v2/doc/{doc_name}/accountcard/{account_id}
Return the account card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/accountcard/1000
/v2/doc/accounting.ac2/accountcard/1000?period=Q1
/v2/doc/accounting.ac2/accountcard/1000?period=2014-01-01/2014-03-31
/v2/doc/accounting.ac2/accountcard/1000?filter=row.value("Description").contain("xyz")
/v2/doc/accounting.ac2/accountcard/1000?format=json
Budget account card
/v2/doc/{doc_name}/budgetcard/{account_id}
Return the budget card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Introduced in 7.0.7.0
Examples:
/v2/doc/accounting.ac2/budgetcard/1000
/v2/doc/accounting.ac2/budgetcard/1000?period=Q1
/v2/doc/accounting.ac2/budgetcard/1000?period=2014-01-01/2014-03-31
/v2/doc/accounting.ac2/budgetcard/1000?format=json
Projection account card
/v2/doc/{doc_name}/projectioncard/{account_id}
Return the projection card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
projectionstart This parameter is mandatory and define the start date of the projection.
It can contain a period abbreviation like 'Q1' (start at beginnig of) or a date like '2014-07-01'.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Introduced in 7.0.7.0
Examples:
/v2/doc/accounting.ac2/projectioncard/1000
/v2/doc/accounting.ac2/projectioncard/1000?period=Q1
/v2/doc/accounting.ac2/projectioncard/1000?period=2014-01-01/2014-03-31
/v2/doc/accounting.ac2/projectioncard/1000?format=json
Current Vat balance
/v2/doc/{doc_name}/vatbalance/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the current balance of the requested vat code as text.
The last part of the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/vatbalance/V80/balance
Budget Vat balance
/v2/doc/{doc_name}/vatbudget/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the budget of the requested vat code as text.
The last part or the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/vatbudget/V80/balance
Vat code account card
/v2/doc/{doc_name}/vatcard/{vat_code}
Return the account card of the vat code vat_code as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/vatcard/V80
/v2/doc/accounting.ac2/vatcard/V0|V25|V80
/v2/doc/accounting.ac2/vatcard/V80?period=Q1
/v2/doc/accounting.ac2/vatcard/V80?period=2014-01-01/2014-03-31
/v2/doc/accounting.ac2/vatcard/V80?filter=row.value("Description").contain("xyz")
/v2/doc/accounting.ac2/vatcard/V80?format=json
Vat code projection
/v2/doc/{doc_name}/vatprojection/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the projection of the requested vat code as text.
The last part or the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
projectionstart This parameter is mandatory and define the start date of the projection.
It can contain a period abbreviation like 'Q1' (start at beginnig of) or a date like '2014-07-01'.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v2/doc/accounting.ac2/vatprojection/V80?startdate=2016-18-31
/v2/doc/accounting.ac2/vatprojection/V80/balance?startdate=Q3
Accounting report
/v2/doc/{doc_name}/accreport
Return the accounting report for the document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
subdivision Define the period subdivision for the request .A period subdivision is defined by one of the following charachters:
- M for monthly subdivision
- Q for quarter sudbivision
- S for semester subdivision
- Y for year subdivision
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/accreport
/v2/doc/accounting.ac2/accreport?period=Q1
/v2/doc/accounting.ac2/accreport?subdivision=Q
/v2/doc/accounting.ac2/accreport?format=json
Vat report
/v2/doc/{doc_name}/vatreport
Return the vat report for the document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/vatreport
/v2/doc/accounting.ac2/vatreport?period=Q3
/v2/doc/accounting.ac2/vatreport?format=json
Journal
/v2/doc/{doc_name}/journal
Return the journal for the document doc_name as html.
Parameters:
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/journal
/v2/doc/accounting.ac2/journal?format=json
Start period date
doc/{doc_name}/startperiod
Return the start date in the form of 'YYYY-MM-DD'.
Parameters:
period Define the period for the request.
It can contain a period abbreviation like '1Q' or be empry. If period is not present or empty the accounting start date is returned.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
See also endPeriod.
Introduced in 7.0.7.0
Examples:
/v2/doc/accounting.ac2/startperiod
/v2/doc/accounting.ac2/startPeriod?period=3Q
End period date
doc/{doc_name}/endPeriod
Return the end date in the form of 'YYYY-MM-DD'.
Parameters:
period Define the period for the request.
It can contain a period abbreviation like '1Q' or be empry. If period is not present or empty the accounting end date is returned.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
See also startPeriod.
Introduced in 7.0.7.0
Examples:
/v2/doc/accounting.ac2/endPeriod
/v2/doc/accounting.ac2/endperiod?period=3Q
Info table
/v2/doc/{doc_name}/info
Return the info table as html.
Parameters:
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'.
Examples:
/v2/doc/accounting.ac2/info
/v2/doc/accounting.ac2/info?format=json
Info value
/v2/doc/{doc_name}/info/{info_section_name}/{info_id_name}
Return the info value section:id as text.
Examples:
/v2/doc/accounting.ac2/info/AccountingDataBase/BasicCurrency
Document info
/v2/doc/{doc_name}/infos
Return the infos of document doc_name as json object.
Examples:
/v2/doc/accounting.ac2/infos
Returns: [{"section":"Base", "id":"FileInfo", "value":""},{"section":"Base", "id":"Date", "value":"2014-05-13"}, ...]
Messages
/v2/doc/{doc_name}/messages
Return the list of message as a json array
Parameters:
recheck If set to 'yes' a 'Recheck accounting' is executed.
Messages number
/v2/doc/{doc_name}/messages/count
Return the number of error messages in the accounting file.
Parameters:
recheck If set to 'yes' a 'Recheck accounting' is executed.
WWW app
/v2/doc/{doc_name}/apps/{app_name}
Return the www app app_name as a html page. Www apps are a showcase of the powerfull capability of the http api.
A www app is just a html page stored under '{program_folder}/WWW' that is returned by this request. Currently banana accounting has the app "Charts" that permit to display charts of accounts, and the app "Dashboard" that show an overview of the accounting.
/v2/doc/accounting.ac2/apps/charts
/v2/doc/accounting.ac2/apps/dashboard
Javascript file
/v2/doc/{doc_name}/[*/]bananaapiv2.js
Return a javascript file tha define an object oriented interface to access the webserver. With this interface the http requests are hidden behind the object's methods and properties. Methods and properties follow the schema of the BananaApps API. All the request are synchronous.
/v2/doc/accounting.ac2/bananaapiv2.js
/v2/doc/accounting.ac2/charts/bananaapiv2.js // note: only the name is checked and not the path
App data
/v2/appdata/{data_id}
The request appdata permit to save and restore parameters.
GET /v2/appdata/chart_xyz // return the data chart_xyz
PUT /v2/appdata/chart_xyz // save some data, the data are sent as body of the request
DELETE /v2/appdata/chart_xyz // delete the data chart_xyz
App data form
/v2/appdataform
The request return a form that permit to create, modify or delete app data.
File name
/v2/files/{file_name}
The request return the file file_name stored in the folder user data.
Windows: "C:/Users/{user_name}/AppData/Local/Banana.ch/BananaPlus/10.0/httpconfig.ini"
Mac: "/Users/{user_name}/Library/Application Support/Banana.ch/BananaPlus/10.0/httpconfig.ini"
Linux: "/home/{user_name}/.local/share/data/Banana.ch/BananaPlus/10.0/httpconfig.ini"
Help page
/v2/help
Show the help page (this page) of the web server.
Execute javascript
/v2/script?scriptfile=path_to_script
Execute the script scriptfile.
Parameters:
scriptfile Define the path of the script to be executed.The path can be an absolute path or a path relative to the user's document directory.
ac2file Define the name of an opened document to be passed to the script. It is optional.
indata Contains text data to be passed to the script. It is optional.
Examples:
/v2/script?scriptfile=getresults.js
/v2/script?scriptfile=getresults.js&ac2file=accounting.ac2
Web server settings
/v2/settings
Show the settings of the web server.
API Version V2 (Send Data)
Create a new file (POST method)
This method allows to programmatically create a new accounting file and apply a Document change element.
This method is similar to using a command File > Create New file.
- Create a complete new file.
- Create a new file using an existing file that is sent within the body.
- Plus you can specify a JSon Document change with data (Transactions,Accounts) to add or remove from the file.
You can use this method for experimenting with sending data to the Banana Accounting Engine. Currently it does not provide a mechanism to check that the data that has been send is correct.
Once the file is created is displayed within a Window in Banana Accounting and you can than:
- Manually apply any command like:
- See that the JSon Document Change give the necessary result.
- Verify that the data is correct using the Action > Recalculate command.
- Print a Balance Sheet and other reports.
- Adding or deleting data.
- Save the file to a disk.
- Close the file when finished.
- Use the other Rest API to retrieve information programmatically.
Examples:
/v2/doc?show
/v2/doc?show&acstkn=1234
POST method
Contrary to other request, this one send also data using a a POST request method that:
This use the https method POST with following parameters:
- method: POST
- headers: {'Content-Type': 'application/json'}
- body: JSon
Return value:
- Currently the method does not verify that the data is correct.
Programming information:
- The following examples use TypeScript both with Deno or Excel.
- You can use any programming language to create a JSon and sent the Post request to the Banana integrated webserver.
// example of using fetch
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(httpBody)
}
Body is a Json structure that can contains the following data
- fileType: JSon structure with the File Type to be created
- accountingType
An object containing the Filetype
See Info Section of the Banana.Document method. - ac2
A base64 encoded data containing a full ac2 file. - title
A string with the name of the file to be displayed
- data: the JSon Document change that will be applied to the file.
Example of a request that create a full new file
// Body of the request using a fileType
const httpBody = {
fileType: {
accountingType: {
FileTypeGroup: 100, // double entry accounting
FileTypeNumber: 100, // double entry
decimals: 2 // number of decimals
}
},
data: jsonData, // Json encoded doc change file
}
Example of a request that send an existing file
// Body of the request using an existing file
const httpBody = {
fileType: {
ac2: ac2Base64, // base 64 encoded ac2 file
title: "Company Example"
},
data: jsonData, // Json encoded doc change file
}
Example for creating a new file
This example use using Typescript for Microsoft Excel Office Scripts:
async function createAc2(jsonData: JSON) {
// Web server url
let _LOCALHOST = "http://localhost:8081"; // for macOS use "https://127.0.0.1:8089";
// Web server password
let _PASSWORD = "MyPasswordX";
// Request to Banana web server
let url = _LOCALHOST + "/v2/doc?show&acstkn=" + _PASSWORD;
// Accounting type parameters
let fileTypeGroup = 100; // Double entry accounting
let fileTypeNumber = 100; // without VAT
let fileDecimals = 2;
try {
// Body of the request
const httpBody = {
fileType: {
accountingType: {
docGroup: fileTypeGroup,
docApp: fileTypeNumber,
decimals: fileDecimals
}
},
data: jsonData,
}
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(httpBody)
});
} catch (error) {
console.log(error);
}
}
jsonData is the structured JSON containing the accounting data.
For more information you can find the complete code example to run in Excel Office Scripts is available on the:
Example using an existing AC2 file
This example use Typescript for deno.
// bananaClient.createAc2('./src/Resources/double_entry_with_vat.ac2', docChangeObj);
FINANCIAL_PLAN_SHOW_URL = http://localhost:8081/v2/doc?show&acstkn=1234
/**
Create a the file in Banana and Show it in Banana
* @param accType The path to the ac2 file to use as a base.
* @param docChange The document change that add accounts, transactions or budgets.
* @returns
*/
public async createAc2(ac2FileName: string, docChange: DocumentChange): Promise<boolean> {
try {
// Body of the request
const data = Deno.readFileSync(ac2FileName);
const ac2Base64 = encode(data);
const httpBody = {
fileType: {
ac2: ac2Base64,
title: "Fiancial Forecast"
},
data: docChange.toJson()
}
// Request to Banana server
const httpClientTest = new HttpClient();
await httpClientTest.postData(BananaClient.FINANCIAL_PLAN_SHOW_URL, JSON.stringify(httpBody), 'application/json');
return true;
} catch (error) {
const err = String(error);
if(err.includes("error 10061")){
console.log("Errore di connessione con BananaPlus, verificare che l'applicazione sia attiva!");
console.log("Dettaglio errore: " + err);
}
return false;
}
}
Retrieving data programmatically
Once you have created a new file, you can retrieve data programmatically with the RestAPI, in this way:
- Manually use the command Save As and give a name of the file.
- Use the RestAPI with using the file name you have saved.
- Once you are done, close the file manually.
Modify and existing file programmatically
Currently the API does not allow to modify and existing file.
If you need to modify and existing file you need to proceed this way:
- Use the API to create a new file, by sending:
- The content of the existing file
- The JSon DocumentChange with the necessary changes.
- Manually use the Save As command to overwrite the existing file.
API Version V1 (outdated)
Home page
/v1
Show the home page of the web server and enable you to navigate the content of the accounting files.
Application
/v1/application[/{value_name}]
Return a JSON object with some information about the running application like 'version', 'serial', ... (since Banana 9.0.7).
Examples:
/v1/application
Returns:
{
"isbeta": false,
"isexperimental": false,
"name": "BananaPlus",
"osdetails": "Macintosh; Intel Mac OS X 13_4; it_CH",
"osname": "macOS Ventura (13.4)",
"qtversion": "6.4.3",
"serial": "100106-230515",
"version": "10.1.6.23135"
}
/v1/application/serial
Returns: "100106-230515"
Version
Return a string with the application's version (since Banana 10.1.6.23135).
Examples:
/v1/application/version
Returns: "10.1.6.23135"
Documents
/v1/docs
Return the list of opened documents as json array.
Examples:
/v1/docs
Returns: ["accounting.ac2","accounting previous year.ac2", ...]
Document name
/v1/doc/{doc_name}
Return the list of available http requests for the file doc_name as html page.
To access the previous years files just postfix doc_name with '_p1', '_p2', ... (since Banana 9.0.6).
Deprecated: To access the previous year file just postfix doc_name with '_previous'.
Examples:
/v1/doc/accounting.ac2
/v1/doc/accounting.ac2_p1
/v1/doc/accounting.ac2_p2
Tables
/v1/doc/{doc_name}/tablenames
Return the list of tables in document doc_name as json array.
Examples:
/v1/doc/accounting.ac2/tablenames
Returns: ["Accounting","Transactions", ...]
Table name
/v1/doc/{doc_name}/table/{table_name}
Return the content of table table_name in document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/table/Accounts
/v1/doc/accounting.ac2/table/Accounts?view=Base
/v1/doc/accounting.ac2/table/Accounts?columns=Account,Group,Description,Balance
/v1/doc/accounting.ac2/table/Accounts?format=json
Table number rows
/v1/doc/{doc_name}/table/{table_name}/rowcount
Return the number of rows in the table table_name as text.
Columns
/v1/doc/{doc_name}/table/{table_name}/columnnames
Return the list of columns as json array.
Cell value (row,column)
/v1/doc/{doc_name}/table/{table_name}/row/{row_nr}/column/{col_name}
Return the value of cell at row row_nr and column col_name as text.
The part row_nr can be a row number starting from 1 or an expression like 'Account=1000' (In this ex. the first row where the field Account is equal to 1000 is used)
The part col_name is the xml name of the requested column.
Examples:
/v1/doc/accounting.ac2/table/Accounts/row/2/column/Description
/v1/doc/accounting.ac2/table/Accounts/row/Account=1000/column/Balance
Rows list
/v1/doc/{doc_name}/table/{table_name}/rowlistnames
Return the names of row lists present in the table table_name as json array.
Examples:
/v1/doc/accounting.ac2/table/Transactions/rowlistnames
Returns: ["Data","Examples", "Archives", ...]
Row list name
/v1/doc/{doc_name}/table/{table_name}/rowlist/{rowlist_name}
Return the content of the row list rowlist_name in table_name of document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/table/Transactions/rowlist/Examples
/v1/doc/accounting.ac2/table/Transactions/rowlist/Examples?view=Base
/v1/doc/accounting.ac2/table/Accounts?columns=Account,Group,Description,Balance
/v1/doc/accounting.ac2/table/Accounts?format=json
Rowlist number rows
/v1/doc/{doc_name}/table/{table_name}/rowlist/{rowlist_name}/rowcount
Return the number of rows in the row list rowlist_name of table table_name as text.
Cell value (rowlist,row,column)
/v1/doc/{doc_name}/table/{table_name}/rowlist/{rowlist_name}/row/{row_nr}/column/{col_name}
Return the value of cell in row list rowlist_name at row row_nr and column col_name as text.
The part row_nr can be a row number starting from 1 or an expression like 'Account=1000' (In this ex. the first row where the field Account is equal to 1000 is used)
The part col_name is the xml name of the requested column.
Examples:
/v1/doc/accounting.ac2/table/Accounts/row/2/column/Description
/v1/doc/accounting.ac2/table/Accounts/row/Account=1000/column/Balance
Accounts list
/v1/doc/{doc_name}/accounts
Return the list of accounts as json array.
Examples:
/v1/doc/accounting.ac2/accounts
Returns: [{"id":"1000","descr":"1000 Cash"}, {"id":"1010","descr":"1000 Post"}, ...]
Description (account or group)
/v1/doc/{doc_name}/accountdescription/{account_id|Gr=group_id}[/{col_name}]
Return the description of the requested account or group as text.
The part col_name is optional, it is the xml name of the requested column. Default is the column 'Description'.
Examples:
/v1/doc/accounting.ac2/accountdescription/1000
/v1/doc/accounting.ac2/accountdescription/Gr=1
/v1/doc/accounting.ac2/accountdescription/1000/Curreny
Groups list
/v1/doc/{doc_name}/groups
Return the list of groups as json array.
Examples:
/v1/doc/accounting.ac2/groups
Returns: [{"id":"100","descr":"100 Current Assets"}, ...]
Segments list
/v1/doc/{doc_name}/segments
Return the list of segments as json array.
Examples:
/v1/doc/accounting.ac2/segments
Returns: [{"id":":lugano","descr":"Lugano"}, ...]
Vat codes list
/v1/doc/{doc_name}/vatcodes
Return the list of vatcodes as json array.
Examples:
/v1/doc/accounting.ac2/vatcodes
Returns: [{"id":"V80","descr":"V80 Sales and services 8.0%"}, ...]
Vat code description
/v1/doc/{doc_name}/vatdescription/{vat_code}[/{col_name}]
Return the description of the requested vat code as text.
The part col_name is optional, it is the xml name of the requested column. Default is the column 'Description'.
Examples:
/v1/doc/accounting.ac2/vatdescription/V80
/v1/doc/accounting.ac2/vatdescription/V80/Gr1
Current balance
/v1/doc/{doc_name}/balance/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the current balance of the requested account, group or bclass as text.
To access the balances of the previous year file just postfix doc_name with '_p1', '_p2', ... .
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/balance/1000/opening
/v1/doc/accounting.ac2_p1/balance/1000/opening
/v1/doc/accounting.ac2/balance/1000|1010|1020|1030/opening
/v1/doc/accounting.ac2/balance/Gr=6/totalcurrency?period=Q1
/v1/doc/accounting.ac2/balance/Gr=6/totalcurrency?frequency=M
/v1/doc/accounting.ac2/balance/Gr=6/totalcurrency?period=M1&frequency=D
/v1/doc/accounting.ac2/balance/BClass=1/balance
Budget balance
/v1/doc/{doc_name}/budget/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the budget of the requested account, group or bclass as text.
To access the budget balances of the previous year file just postfix doc_name with '_p1', '_p2', ... .
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/budget/1000/opening
/v1/doc/accounting.ac2_p1/budget/1000/opening
/v1/doc/accounting.ac2/budget/1000|1010|1020|1030/opening
/v1/doc/accounting.ac2/budget/Gr=6/totalcurrency?period=Q1
/v1/doc/accounting.ac2/budget/Gr=6/totalcurrency?frequency=M
/v1/doc/accounting.ac2/budget/BClass=1/balance
Interest
/v1/doc/{doc_name}/interest/{account_id|Gr=group_id|BClass=class_id}
Return the calculated interest on the specified account.
Parameters:
rate The interest rate in percentage (ie.: '5', '3.25'). The decimal separator must be a dot '.'. If positive it calculate the interest fo the debit amounts. If negative it calcaulate the interest on the credits amounts.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/interest/1000?rate=2.5
/v1/doc/accounting.ac2/interest/1000?rate=-8.0
/v1/doc/accounting.ac2/interest/1000?rate=-8.0&period=Q1
/v1/doc/accounting.ac2/interest/1000?rate=-8.0&frequency=Q
Budget interest
/v1/doc/{doc_name}/budgetinterest/{account_id|Gr=group_id|BClass=class_id}
Return the calculated interest on the specified account for the budget transactions.
Parameters:
rate The interest rate in percentage (ie.: '5', '3.25'). The decimal separator must be a dot '.'. If positive it calculate the interest fo the debit amounts. If negative it calcaulate the interest on the credits amounts.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/budgetinterest/1000?rate=2.5
/v1/doc/accounting.ac2/budgetinterest/1000?rate=-8.0
/v1/doc/accounting.ac2/budgetinterest/1000?rate=-8.0&period=Q1
/v1/doc/accounting.ac2/budgetinterest/1000?rate=-8.0&frequency=Q
Projection
/v1/doc/{doc_name}/projection/{account_id|Gr=group_id|BClass=class_id}/{opening|credit|debit|total|balance|openingcurrency|...}
Return the projection of the requested account, group or bclass as text.
To access the budget balances of the previous year file just postfix doc_name with '_p1', '_p2', ... .
The last part or the url can be one of the followings strings:
- opening
- credit
- debit
- total
- balance
- openingcurrency
- ceditcurrency
- debitcurrency
- totalcurrency
- balancecurrency
- rowcount
Parameters:
projectionstart This parameter is mandatory and define the start date of the projection.
It can contain a period abbreviation like 'Q1' (start at beginnig of) or a date like '2014-07-01'.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1', a start and end date like '2014-01-01/2014-03-31' or a list of periods separated by a coma like 'S1,S2,ALL'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/projection/1000/opening?projectionstart=S1
/v1/doc/accounting.ac2/projection/1000/opening?projectionstart=2014-07-01
/v1/doc/accounting.ac2_p1/projection/1000/opening?projectionstart=S1
/v1/doc/accounting.ac2_p1/projection/1000/opening?projectionstart=S1&frequency=M
Account card
/v1/doc/{doc_name}/accountcard/{account_id}
Return the account card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/accountcard/1000
/v1/doc/accounting.ac2/accountcard/1000?period=Q1
/v1/doc/accounting.ac2/accountcard/1000?period=2014-01-01/2014-03-31
/v1/doc/accounting.ac2/accountcard/1000?filter=row.value("Description").contain("xyz")
/v1/doc/accounting.ac2/accountcard/1000?format=json
Budget account card
/v1/doc/{doc_name}/budgetcard/{account_id}
Return the budget card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Introduced in 7.0.7.0
Examples:
/v1/doc/accounting.ac2/budgetcard/1000
/v1/doc/accounting.ac2/budgetcard/1000?period=Q1
/v1/doc/accounting.ac2/budgetcard/1000?period=2014-01-01/2014-03-31
/v1/doc/accounting.ac2/budgetcard/1000?format=json
Projection account card
/v1/doc/{doc_name}/projectioncard/{account_id}
Return the projection card of account account_id as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
projectionstart This parameter is mandatory and define the start date of the projection.
It can contain a period abbreviation like 'Q1' (start at beginnig of) or a date like '2014-07-01'.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Introduced in 7.0.7.0
Examples:
/v1/doc/accounting.ac2/projectioncard/1000
/v1/doc/accounting.ac2/projectioncard/1000?period=Q1
/v1/doc/accounting.ac2/projectioncard/1000?period=2014-01-01/2014-03-31
/v1/doc/accounting.ac2/projectioncard/1000?format=json
Current Vat balance
/v1/doc/{doc_name}/vatbalance/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the current balance of the requested vat code as text.
The last part of the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/vatbalance/V80/balance
Budget Vat balance
/v1/doc/{doc_name}/vatbudget/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the budget of the requested vat code as text.
The last part or the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/vatbudget/V80/balance
Vat code account card
/v1/doc/{doc_name}/vatcard/{vat_code}
Return the account card of the vat code vat_code as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/vatcard/V80
/v1/doc/accounting.ac2/vatcard/V0|V25|V80
/v1/doc/accounting.ac2/vatcard/V80?period=Q1
/v1/doc/accounting.ac2/vatcard/V80?period=2014-01-01/2014-03-31
/v1/doc/accounting.ac2/vatcard/V80?filter=row.value("Description").contain("xyz")
/v1/doc/accounting.ac2/vatcard/V80?format=json
Vat code projection
/v1/doc/{doc_name}/vatprojection/{vat_code|Gr=vat_group}/{taxable|amount|notdeductible|posted}
Return the projection of the requested vat code as text.
The last part or the url can be one of the followings strings:
- taxable
- amount
- notdeductible
- posted
- rowcount
Parameters:
projectionstart This parameter is mandatory and define the start date of the projection.
It can contain a period abbreviation like 'Q1' (start at beginnig of) or a date like '2014-07-01'.
period Define the start and end date for the request.
It can contain a period abbreviation like 'Q1' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
frequency Define the frequency for the request.
The amounts are calculated at the given frequency and returned as an array.
Frequency abbreviation contains one of the following charachters:
- D for daily
- W for weekly
- M for monthly
- Q for quarterly
- S for semesterly
- Y for yearly
filter Contains a javascript expression used to filter the transactions. The object available to the expression are "row", "rowNr", and "table".
For example: filter=row.value("Date")==="2014-01-15"
Examples:
/v1/doc/accounting.ac2/vatprojection/V80?startdate=2016-18-31
/v1/doc/accounting.ac2/vatprojection/V80/balance?startdate=Q3
Accounting report
/v1/doc/{doc_name}/accreport
Return the accounting report for the document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
subdivision Define the period subdivision for the request .A period subdivision is defined by one of the following charachters:
- M for monthly subdivision
- Q for quarter sudbivision
- S for semester subdivision
- Y for year subdivision
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/accreport
/v1/doc/accounting.ac2/accreport?period=Q1
/v1/doc/accounting.ac2/accreport?subdivision=Q
/v1/doc/accounting.ac2/accreport?format=json
Vat report
/v1/doc/{doc_name}/vatreport
Return the vat report for the document doc_name as html.
Parameters:
view Contains the the xml name of the view to be returned.
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
period Define the start and end date for the request.
It can contain a period abbreviation like '1Q' or a start and end date like '2014-01-01/2014-03-31'.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/vatreport
/v1/doc/accounting.ac2/vatreport?period=Q3
/v1/doc/accounting.ac2/vatreport?format=json
Journal
/v1/doc/{doc_name}/journal
Return the journal for the document doc_name as html.
Parameters:
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/journal
/v1/doc/accounting.ac2/journal?format=json
Start period date
doc/{doc_name}/startperiod
Return the start date in the form of 'YYYY-MM-DD'.
Parameters:
period Define the period for the request.
It can contain a period abbreviation like '1Q' or be empry. If period is not present or empty the accounting start date is returned.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
See also endPeriod.
Introduced in 7.0.7.0
Examples:
/v1/doc/accounting.ac2/startperiod
/v1/doc/accounting.ac2/startPeriod?period=3Q
End period date
doc/{doc_name}/endPeriod
Return the end date in the form of 'YYYY-MM-DD'.
Parameters:
period Define the period for the request.
It can contain a period abbreviation like '1Q' or be empry. If period is not present or empty the accounting end date is returned.
A period abbreviation is defined by a number followed by one of the following charachters:
- M for months
- Q for quarters
- S for semesters
- Y for years
See also startPeriod.
Introduced in 7.0.7.0
Examples:
/v1/doc/accounting.ac2/endPeriod
/v1/doc/accounting.ac2/endperiod?period=3Q
Info table
/v1/doc/{doc_name}/info
Return the info table as html.
Parameters:
columns Contains the xml names of the columns to be returned.
navigation If set to true the html page navigation is showed, else only the data are showed.
format Contains the format to be returned. Supported formats are 'html' or 'json'. Default is 'html'. Since Banana 9.0.5.
Examples:
/v1/doc/accounting.ac2/info
/v1/doc/accounting.ac2/info?format=json
Info value
/v1/doc/{doc_name}/info/{info_section_name}/{info_id_name}
Return the info value section:id as text.
Examples:
/v1/doc/accounting.ac2/info/AccountingDataBase/BasicCurrency
Document info
/v1/doc/{doc_name}/infos
Return the infos of document doc_name as json object.
Examples:
/v1/doc/accounting.ac2/infos
Returns: [{"section":"Base", "id":"FileInfo", "value":""},{"section":"Base", "id":"Date", "value":"2014-05-13"}, ...]
Messages
/v1/doc/{doc_name}/messages
Return the list of message as a json array
Parameters:
recheck If set to 'yes' a 'Recheck accounting' is executed.
Messages number
/v1/doc/{doc_name}/messages/count
Return the number of error messages in the accounting file.
Parameters:
recheck If set to 'yes' a 'Recheck accounting' is executed.
WWW app
/v1/doc/{doc_name}/apps/{app_name}
Return the www app app_name as a html page. Www apps are a showcase of the powerfull capability of the http api.
A www app is just a html page stored under '{program_folder}/WWW' that is returned by this request. Currently banana accounting has the app "Charts" that permit to display charts of accounts, and the app "Dashboard" that show an overview of the accounting.
/v1/doc/accounting.ac2/apps/charts
/v1/doc/accounting.ac2/apps/dashboard
Javascript file
/v1/doc/{doc_name}/[*/]bananaapiv1.js
Return a javascript file tha define an object oriented interface to access the webserver. With this interface the http requests are hidden behind the object's methods and properties. Methods and properties follow the schema of the BananaApps API. All the request are synchronous.
/v1/doc/accounting.ac2/bananaapiv1.js
/v1/doc/accounting.ac2/charts/bananaapiv1.js // note: only the name is checked and not the path
App data
/v1/appdata/{data_id}
The request appdata permit to save and restore parameters.
GET /v1/appdata/chart_xyz // return the data chart_xyz
PUT /v1/appdata/chart_xyz // save some data, the data are sent as body of the request
DELETE /v1/appdata/chart_xyz // delete the data chart_xyz
App data form
/v1/appdataform
The request return a form that permit to create, modify or delete app data.
File name
/v1/files/{file_name}
The request return the file file_name stored in the folder user data.
Windows: "C:/Users/{user_name}/AppData/Local/Banana.ch/Banana/8.0/httpconfig.ini"
Mac: "/Users/{user_name}/Library/Application Support/Banana.ch/Banana/8.0/httpconfig.ini"
Linux: "/home/{user_name}/.local/share/data/Banana.ch/Banana/8.0/httpconfig.ini"
Help page
/v1/help
Show the help page (this page) of the web server.
Execute javascript
/v1/script?scriptfile=path_to_script
Execute the script scriptfile.
Parameters:
scriptfile Define the path of the script to be executed.The path can be an absolute path or a path relative to the user's document directory.
ac2file Define the name of an opened document to be passed to the script. It is optional.
indata Contains text data to be passed to the script. It is optional.
Examples:
/v1/script?scriptfile=getresults.js
/v1/script?scriptfile=getresults.js&ac2file=accounting.ac2
Web server settings
/v1/settings
Show the settings of the web server.
Developer info for importing data in Banana Accounting
Banana Accounting is a an accounting software that run on the client computer and it is not a cloud solution and there is not an internet service that is used to add data to the accounting.
When integrating data there are two choices:
- The user must give a command to import the data.
- You can automate the task by running Banana with a command line parameters for import.
Import the file in Banana Accounting
You can import in Banana Accounting by using one of the predefined formats or by using an Import extension.
- Import Bank Statements Transactions.
This is the most recurring case of importing. See Import Transactions from E-banking. - Use the Menu Actions->Import in Accounting and Automation
Use for importing to the Tables Transactions, Accounts and Vat Code.
It a more specific import with autocomplete and other useful tasks. - Use also the command Data->Import rows,
This is a general version that import directly to any Table the data as it is in the import file.
Complete and modify imported transactions
After any data is imported in the accounting file the user can add more information, modify the existing one or also undo the import.
That makes very easy to test import but also to automate tasks. You don't have to define all possible cases. The user can take care of exceptions and changes.
Create an export file from your application
This is the most current use case, where your application directly create and export file that can be easily imported in Banana Accounting.
By providing a Banana Accounting export file, your application can be appealing to a great number of Banana Accounting users. You can focus on enhancing you application and don't need to dedicate time to develop an accounting application.
- Payroll and Salary
End of month's summary data is exported as double entry transactions.
See: Import Double-entry transactions in CSV format. - Accounting data from another accounting software is integrated in Banana Accounting.
See: Import Double-entry transactions in CSV format. - Export selling data from an Online Web shop.
- Customer information is exported as an accounts data and imported into the Accounts table.
See: Import Accounts. - Invoice information or payments are exported as transactions and imported into the Transactions table.
See: Import Double-entry transactions in CSV format.
- Export Cash book data (Income and Expenses)
See: Import Income & Expenses transactions in CSV format. - You can create an export file for any table an then use the command
Data->Import Rows
Create an Import Extensions for converting from other formats
Most software have the choice to export data in a predefined format and don't give you the chance to create an export format specific to Banana Accounting. By creating an Import Extension the imported file will be converted to the Banana Accounting format during the Import Accounting process.
This is a best solution when you are using a standard software solution and you need to integrate data in Banana Accounting or in case the customer need a customized solution, for example for automating some aspects.
For this case you can:
Use free version for test purpose
For the development and testing the import you can download the Banana Accounting software version available on our web site. You can use all functionalities and save up to 70 transactions. This version is normally sufficient for the development and testing process.
In case you are an independent software developer and need full functionalities we can provide a time-limited full license.
Request must come with a link to the developer web site.
Cloud integration
Banana Accounting is a client solution that runs on the user computer. The accounting file is saved on the client computer.
There is not an API that allow to integrate data from other cloud services.
If you need to integrate data from a cloud solution:
- Export the data in a local file.
- Import the data in Banana Accounting as explained above.
Community
If you are a software developer that provide solutions that integrate or extend Banana Accounting we invite you to also look at the benefits available with our Community.
Import "Text file with columns header"
The Banana import format is of type "Text file with column headers".
- Fields and column name separator is to be tab separated "\t"
- Each line (after a "\n") is a new record
- Character code preferably UTF8 or else the local one.
- The first line contains the columns header name
- You can use any column name existing on the table
- Names are case sensitive and must correspond to the Banana NameXml (English) of the column. You can find the NameXml of a column by clicking on the header of the column and moving under Settings, like in the example:

- Starting from line 2 it contains the data to be imported
- The format for the Date fields is yyyy-mm-dd
- The decimal separator is the decimal point "."
- Amount should not have any thousand separator
File format example:
Date Doc Description AccountDebit AccountCredit Amount
2023-10-12 1 Description 01 1020 2800 2000.00
2023-10-19 2 Description 02 6580 1000 300.00
2023-10-12 3 Description 03 1000 2800 3240.00
2023-10-19 4 Description 04 6570 1020 700.00
Import Accounts
For creating new accounts, customers, suppliers, cost centers. See Chart of accounts documentation for the list of columns available.
Menu Actions->Import into accounting->Accounts
The type of file to be used is a "TXT with headers.
- You can use any column name existing on the table
- Account.
The account number.
- Description
A brief text, organization or customer name
- BClass
Required (1,2,3,4).
- Gr1
Obligatory. It is also used to order the data when it is imported.
- Address fields.
- Fields header in the first line of the file.
Fields names are case sensitive and must correspond to the NameXml (English) that you find in the Setting Tab of the Columns setup.
- Fields header and field data must use the tab character as separator "\t"
- Each line (after a "\n") is a new record
- The format for the Date fields is yyyy-mm-dd
- Character code preferably UTF8 or else the local one.
When importing the user can choose to import only the new lines.
Import Double-entry transactions in CSV format
For what is concerning the specifics of the import of Double-entry see the explanations for Import Double-entry accounting transactions.
Menu Actions → Import into accounting
The type of file to be used is a "Text file with column headers".
File format and Main columns for import
For a double entry accounting files.
- You can use any column that is available in the Transactions table
(See: Transactions Table double entry) and you can see in the Column Setup list of columns. - Main columns for double entry accounting
- Date of the transaction (2014-12-31).
- Description a brief text.
- AccountDebit the account number of the customer or the general account for customers.
- AccountCredit the account number of the revenue account.
- Amount the amount of the accounting currency.
- VatCode the vat code that should be used.
- AmountCurrency if multi-currency the amount of the invoice in original currency and currency of the AccountDebit.
- Fields header in the first line of the file.
Fields names are case sensitive and must correspond to the NameXml (English) that you find in the Setting Tab of the Columns setup. - Fields header and field data must use the tab character as separator "\t"
- Each line (after a "\n") is a new record
- The format for the Date fields is yyyy-mm-dd
- Character code preferably UTF8 or else the local one.
Example file Double-entry format
In the example the values are written in an excel document.

Options
- Import using clipboard data will use the content of the clipboard instead of the file
- Autocomplete values: Some fields of the transactions are automatically completed (see "Importing transactions for multi-currency Double-entry accounting").
- Unicode (utf-8) The content of the file is in Unicode utf-8 (it supports any character set).
Importing other transaction's columns
You can import any other field that is defined in the Transactions table.
There are other values that we suggest to import if available:
- DateDocument the date of the original document (for example the date of the invoice).
- DocInvoice the invoice number.
- DocOriginal the document number for example the invoice number.
- DocLink the address of the file that links to a scanned document (pdf, jpg, ..).
You can use a relative path name to the accounting file. - DateExpiration due date of the invoice.
- ExternalReference an information that help to identify the transactions as unique.
It will be used in future implementation of Banana (in conjunction with the date) to warn a user that the transaction has already been imported.
This should be an external Reference generated by the software that creates the transactions to be imported.
We suggest to use a name of the program and a number that is unique for the accounting period.
For example "invoice-2013-00001.001" with year, invoice number and a progressive number that is relative to the invoice in case it will be necessary to have more transaction lines for the same invoice.
Importing transactions for multicurrency Double-entry accounting
By importing multicurrency data there can be rounding or calculation differences due to different development tools used. To avoid such differences you should provide only certain fields and while importing the program will calculate the field values that are missing (with the option "Autocomplete values") .
- If you provide only "AmountCurrency" the program will use the default exchange rate and will calculate the "Amount".
- In order to avoid error provide always the "ExchangeCurrency"
- If you provide the "AmountCurrency" and the "ExchangeRate" and the "Amount" are 0 or not present the program will calculate the exchange rate based on the column "Amount" and "AmountCurrency".
Importing Invoice data
The data of your invoice software can be imported in Banana.
There are two ways to do so:
- Let your invoice software generate a file for Banana as indicated in the "Import Double-entry transactions in txt format".
- Use the data of the export format of your existing invoicing software .
In order to import this data from a proprietary format into Banana you need to create a Javascript Banana Extension that translates the data into a format acceptable for Banana.
The script program takes as input the content of a file and creates an output that is a tab separated text file with columns headers.
See also repository on Github.
Invoices on multiple rows
Most invoices have different items that need to be registered in different revenue accounts or that have different VAT percentages.
In this case, for each invoice you need to have many import rows.
Date, DateDocument, DocInvoice have always the same values.
- The first row you have the
- AccountDebit the customer account number
- AccountCredit is void.
- Amount the total amount of the invoice. The amount due from the Customer.
- VatCode is void
- For each item with a different revenue account or Vat percentage you should have an additional row
- AccountDebit is void
- AccountCredit the revenue account for this item
- Amount the total amount to be registered on this account.
If you have a VatCode it could be convenient to use the amount without VAT. - VatCode the VatCode that applies to this item.
If the Amount is Net of VAT you should define a VAT Code that is calculated on the net Value.
Group transactions by invoice number
If the imported data contains the "DocInvoice" columns, when Banana displays you a second DialogBox, you can choose to have Banana group the transactions by DocInvoice.
In this case Banana automatically creates, if necessary, a transaction for rounding differences.
Use Cost center instead for customer account
If you want to keep track of the invoices registered but do not want them to be recorded on individual accounts you can use the Cost center (CC3). See also Client/Suppliers register.
Import Income & Expenses transactions in CSV format
This file format is used to export transactions data from an account statement or bank statement with the amounts in plus or minus.
For more information and the data structure of the see "transactions.simple" see the :
Use in Import into accounting
You can import the file by using:
- Menu Actions->Import into accounting
- Import to Transaction table
- The type of file to be used is a "Income & Expenses transactions".
Options
- Import using clipboard data will use the content of the clipboard instead of the file
- Autocomplete values: Some fields of the transactions are automatically completed (see "Importing transactions for multicurrency Double-entry accounting").
Once the import is done, the contra account will have to be entered manually. - Unicode (utf-8) The content of the file is in Unicode utf-8 (it supports any character set).
Exporting data
Banana Accounting can export in different formats:
It is also possible to create Banana Apps that export the data in specific formats:
Banana software is also trying to improve the data interchange with a new JCSV file format that bring toghether the simplicity of CSV and the advanced data interchange capabilities of Json.
JsonCSV file format
JsonCSV (Json Comma Separated Value) is plain text file format for tabular data. It unites the advantages of JSon and the CSV format and make importing and exporting data more reliable.
JsonCSV for tabular data
JsonCSV (Json Comma Separated Value) is plain text file format for tabular data. It is realiable to read and with support for multiple tables.
JsonCSV is CSV for the internet age, it brings together the advantages of JSon and the CSV format (Comma Separated Value)
- Reliable for reading and writing (JSon based data format and can use the JSon parser and writer).
- Easy for human reading (maintains the characteristics of CSV)
- It allows mixing data and metadata (header, column info, descriptions, formats etc.).
- Multiple tables can fit in the same file.
This is the JsonCSV file in the simplest form. An header row, followed by the data rows.
Each line is written in a JSon data format.
{"comment":"Example of JsonCSV format"}
{"column-names":["Section","Group","Account","Description","Boolean","BClass","Gr","Opening","Balance"]}
["","","1000","Cash on hand",true,"1","10",100,1290.3]
["","","1020","Bank account",false,"1","10",0,10]
["","","2000","Suppliers or Creditors",false,"2","20",-50,-50]
["","28","","Equity",false,"","2",-250,-1450.3]
There are 3 type of rows:
- Metadata rows, within {} brackets, in the form of a valid JSon Object in compact form, followed by end of line.
In the above example the "column-names". - Data rows, within [] brackets (JSon Array), followed by end of line.
This is the CSV data, but formatted as a valid JSon Array.
The data contains the value in the same sequence as the columns headers. - Other rows, that are ignored.
JsonCSV with data and metadata
JsonSCV allows to embed in the same file the data and metadata, like table and column name, description, format and attributes, in a very simple form, without requiring a schema file.
- JsonCSV is a better format for archiving tabular data.
- JsonCSV simplify the exchange of data .
The advantages of JsonSCV comes from the possibility to embed any metadata in JSon.
- Encoding specification.
- File information.
- Table information. It is therefore possible to include more tables in the same file.
- Columns sequence.
- Field information.
- Unlimited expansion. Any metadata information, specific to the application or the data row, can be embedded.
- It is also possible to insert any other text. All information not within {} or [] is ignored.
JsonCSV references
The JsonCSV is based on the accepted standards.
See the reference documentation:
- JSon data format (wikipedia Json,, www.json.org).
- The W3C CSV on the Web Working Group specifications for the columns metadata.
- The W3C CSVW Namespace Vocabulary Terms for the terms used.
- The Dublin Core Metadata Element (for elements like dc:description, dc:title, dc:creator).
- The ISO date format 8601 for the date and time format.
JsonCSV format specification
See example below.
- Use the UTF8 format
- JsonCSV file is composed of text lines terminated by the "\n", LF:Line Feed, U+000A.
- The "\r\n" should be supported in reading, but the "\r" alone is not considered as line breaking.
- When writing the \r should be omitted.
- The LF, Line Feed character should be used only at the end of the line and not within the data or metadata line.
- In the data or metadata line, replace the LF char with the LS:Line Separator, U+2028 or any appropriate character you prefer.
- Metadata lines
- They need to be valid Json Objects (JSon document), in compact format (No space and no end of line).
Meta data line start "{" and end with the "}" brackets. - Metadata lines comes before the data.
- {"table":"Accounts"} data that follows will be considered belonging to the "Accounts" table.
- Other metadata like row attributes {"row":{"styleNumber":1144}} come before the data row.
- Reserved metadata keyword:
- "jcsv" with version and encoding.
- "kind" is a property that uniquely identify the data, so that it make easier to understand what kind of data is contained in the jcsv file and apply appropriate transformation.
- "table" contain the name of a table.
All rows following the "table" are considered to belong to this table. - "schema" a url to a document that contains the infeormation necessary to verify the document or the table.
- "column-names" is a required element that contains a Json Array with the columns names.
The data rows following the columns are considered to be in the sequence of the columns name.
A "column-names" that does not follow a "table" is considered to start a new table. - "columns" contains information relative to the columns.
The columns information is not necessarily in the sequence of the data, so the "columnsNames" should always be present. - "comment" for entering comments
- "row-attributes" contain supplementary information regarding the following data row.
- They need to be valid Json Objects (JSon document), in compact format (No space and no end of line).
- Data lines.
Thex need to be Json arrays in compact form (no space or line feed).- Data lines start with the "[" and terminate with the "]" an contains the row data.
- The array size need to be the same size as the preceding column-names.
- Data is stored in Json format.
- String are between ".
- Usual string "Bank account".
- Date, Time and Timestamp are Json string in the ISO date format 8601
- Date "2018-01-03".
- Time "10:18:21.000".
- Timestamp "2016-11-19T09:52:39".
- Number in valid Json format, decimal separator "."
- true or false.
- null.
- Other lines not being a valid Json Object or array (like empty lines, text or else) are not considered.
- String are between ".
Examples
In this example it used the column-datatypes to specify the datatype of each column.
/* text that is not within {} or [] is ignored */ {"jcsv" : {"version" : "1.0", "encoding":"UTF-8"}} {"comment": "Example JsonCSV file"} {"kind" : "banana.ch/testfile/test"} {"fileinfo":{"Application":"Banana","Application version":"8.0.4.160915"}} {"table":"Accounts"} {"column-names":["Section","Group","Account","Description","Boolean","BClass","Gr","Opening","Balance"]}{"column-datatypes" :["string","string","string","string","boolean","number","string","number","number"]}["","","1000","Cash on hand",true,"1","10",100,1290.3] ["","","1020","Bank account",false,"1","10",0,10] ["","","2000","Suppliers or Creditors",false,"2","20",-50,-50] {"row-attributes":{"styleNumber":1024}} ["","28","","Equity",false,"","2",-250,-1450.3] {"table":"Transactions"} {"column-names":["Date","Time","Doc","Description","AccountDebit","AccountCredit","Amount"]} {"column-datatypes":["date","time","string","string","string","string","number"]} ["2018-01-03","10:18:21.000","1","Cash to Bank","1020","1000",10] ["2018-02-02","23:55:00.000","2","Sales","1000","3400",1200.3]
In the following example it is used the "columns" specification with metadata information regarding each column.
{"table":"Accounts"} {"column-names":["Account","Balance"]} {"columns":[{"name":"Account", "datatype":"string","titles":"Account"},{"name":"Balance","titles":"Balance", "datatype":{"base":"number","scale":1}}]} ["1020",10] ["2000",-50]
JsonCSV files
- Mime type "text/jcsv".
- File extension ".jcsv".
- Encoding "UTF-8".
Advantages and limitation of JsonCSV format
Advantages of JsonCSV file format over CSV
- JsonCSV follows the JSon format.
- There is just one way to write and read the data. No more doubts about encoding, fields separators, number format, decimal separator.
- For generating and reading a JsonCSV it is possible to use the Json libraries, avoiding therefore escaping error that you find typically on CSV. .
- JsonCSV can contains data of different tables.
- Supplementary information relative to the structure or the attributes of the rows does not interfere with the data.
Advantages over Json
- In JsonCSV each line is a unique json document, independent from the other lines.
- It is possible to add lines to an existing document (Append mode).
- It is possible to parse the lines individually.
Limitation of JsonCSV
- Like CSV the JsonCSV format can be used only to exchange tabular data and not nested data structure (like Json).
Try the JsonCSV format
You can try a new format by installing the Banana Accounting software.
- See JsonCSV example files on Github\BananaAccounting
- Open or drag a JsonCSV file in Banana
Banana will create a new file tables and columns. You can the copy and paste the data in Excel. - Export in JsonCSV
- Export of a single table
Menu Data -> Export Rows->JCsv - Export of all the tables
Menu File -> Export ->JCsv
- Export of a single table
Using Json library to generate or read the JsonCSV format
Generating JsonCSV files
- Create a Json Object that contains and Json Array with the columns name and convert to Json text, plus the line feed.
- For each data row create a JSon array that contains the data and convert to Json text, plus the line feed.
Parse JsonCSV files
- Read each line.
- If lines start with "{" and end with "}" parse as JSon and extract the values.
- If lines start with "[" and end with "]" parse as JSon and get the data.
Javascript example for generating and parsing JsonCSV
// Create and parse JCSV data in Javascript
// header
var text = JSON.stringify({"column-names" : ["Date", "Name", "Amount"]}) + "\n";
// Data row
text += JSON.stringify(["2018-01-24", "John Smith", 1200.10]) + "\n";
text += JSON.stringify(["2018-12-31", "Maria Callas", -200]) + "\n";
// parse JCSV data
var lines = text.split("\n");
for (i = 0; i < lines.length; i++)
{
// header lines
if (lines[i].startsWith("{") && lines[i].endsWith("}"))
{
JSON.parse(lines[i]);
}
// data lines
if (lines[i].startsWith("[") && lines[i].endsWith("]"))
{
JSON.parse(lines[i]);
}
}
Creating and parsing the JsonCSV file without the JSon library
Generating the file
- Write the header line as a simple text with the header.
"{"column-names" : ["Date", "Name", "Amount"]}\n"
- Create a CSV with the data that follow the rules of JSon data.
Add at the begin the "[" and at the end the "]".
Parse the JsonCSV file
- Read the file line by line.
- Process the lines that start with "{" and end with "}".
- Process as data the lines that start with "[" and end with "]" as a normal CSV data structure.
Author
The JsonCSV specification has been conceived and developed by Domenico Zucchetti, founder and CEO of Banana.ch and creator of Banana Accounting.
Domenico Zucchetti has more then 30 year of experience in international accounting and as legal expert and software developers. He has been a blockchain pioneer. In 2002, it was the first in the world to implement a blockchain certification functionality in an accounting software.
D. Zucchetti welcomes feedback.
Translate Banana Software
Prepare for translation
Introduction
This documentation relates to Banana version 9.0.4 and later
Download Banana 9 at https://www.banana.ch/en/download_en
Download and install the tranlsation package
- The translation package contains
- QtLinquist
- The Banana Accounting texts to be translated
- The QtLibrary text (only few to translate)
- In order to access the texts to be translated you have to download the following file:
ban80_translations.zip - (www.banana.ch/accounting/files/banana9/translations/ban90_translations.zip)
last update: 14 january 2016
- Once you downloaded the file, double click on it in order to extract its content - once the process is finished you will have a new directory on your Desktop:
ban80_translations directory, with the following content:- "win_start_linguist.cmd" file - to launch under Windows the software QtLinguist used to translate banana accounting
- "mac_start_linguist.cmd" file - to launch under Mac the software QtLinguist used to translate banana accounting
- "win_compile_translations.cmd" file - to compile under Windows the translations in a binary form readable by banana accounting
- "mac_compile_translations.cmd" file - to compile under Mac the translations in a binary form readable by banana accounting
- "output" directory - once you run "compile_translations.cmd", it contains the compiled translations
- "src/translations" directory - contains the Banana Accounting files with the texts to be translated
- "win_bin", "mac_bin" and "qtrsrc" directories - contain various files
QtLinguist
Is a software tool that allow to insert the translated text.
Before opening the QtLinguist sofware we advise you to read the QtLinquist guide for translators
Start QtLinuist and open the translation file :
- Launch the QtLinguist software with a double on the file "start_linguist.cmd"
- Open the translation file src/translations/ban8000_xxx.ts (where xxx stand for the abbreviation of your language)
QtLinquist Interface
You will face a screenshot similar to this one:
Translate the texts
- You need to translate the missing text and mark every finished text with a green check mark (you will find it
in the toolbar) until all texts will be marked with either one of these symbols:
or
.
- We advise you to start with the more general texts, this means leaving for later texts starting with a Dlg (dialog) or Tab symbol - for example "CDate"
- You won't be able to change the English texts - if you find any mistake in English you will have to ask us to correct it.
- If you want to have a comparison with other languages, you just need to open the corresponding *.ts files.
- If it is not Se non è chiaro come tradurre un termine leggere le indicazioni dello sviluppatore
- f you need further information from us in order to translate a specific texts, there is a field called "Translator notes" where you can enter your comments.
Start with the words: "TODO:" this is just a code so later on we will be able to trace and easily extract all your comments.
Special texts and charachters
- You will find %1, %2, %3 within the text.
The symbol %1 will be replaced by the program by the appropriate value (account number, date, file name, etc.).
If there is a %1, %2, %* this should also be present in the translation in the appropriate place. - Banana Accounting columns name an table names.
For example "ReportWithMovements;With mov.;with movements"- The text is separated by the semicolumn ";"
- First part is the field name, in the translated text
- No space or special charachters
- Camel case (first charachter of the word is Capital)
- Second part is the column header. Should possible fit on the columns with.
- Thirt part is the full description, it is displayed as a tooltip when you go with the mouse on the column header.
QtLibrary translation files
- This are the text of the library file. They contains many text but we do need only to translate a fews.
- This texts are in ban80_translations/src/translations/qt_xx.ts file,
- You need to translate it in the same way as the other, and we actually advise you to start from this one. Attention: in the qt_xx.ts file not all the texts are to be translated, but only those that have a green check mark
in the Italian file qt_it.ts (which you will have to open for comparison).
Do not translate
- It is not necessary to translate the following texts: ResocontoIvaCh*, ReportIvaItalia*I
After the translation
Send the translation back to us:
Once you finish your translation work:
- Send us as an attachement the *.ts files of your languages, this means the file ban8000_xxx.ts and the file qt_xx.ts if you have it in your language.
- Once you have send us the files back do not translate any more text.
Wait until we will make the next version of the translations files available.
How to get your translation text in Banana Accounting software
You can verify how your translation look in the Banana accounting software - here is how to proceed:
- Check that you have the latest version of Banana Accounting.
Get in touch with with Banana Tecnictian to know if the latest version is available. - Double click on the file compile_translations.cmd
- Copy all the files output/*.qm in the Lang folder of the Banana software (usually the location is C:\Program files\Banana90\Lang or , C:\Program files\BananaExpm90\Lang, but it could vary depending on where you have installed Banana 9)
- Restart Banana 9 and select your language from the Option command (Tools menu)
- If some text does not display at the correct place it is due to different software version (can happen with experimental version)
Tools and links for translators
Microsoft Language portal - it contains all Microsoft translation
KDE Qt Translations - suggestion on how to translate the qt_xx.ts texts
Bing Translator - this is an online translator that you can rely on to translate complete sentences if you have not found a suitable solution with the previous links. Please note that technical and specific terms might not always be translated correctly.
Notes
Please let us know if we can improve this documentation.
Open source
Banana Accounting 9 use this open source library:
- Qt Framework Libraries with LGPL 2.1 and LGPL 3.
For more information you can see the page Licenses Used in QT. - Libharu libraries (pdf writing) with zlib/libpng license.
-
QtWebApp HTTP Server with the LGPL license.
The exact version of the library used is showd within the software under
- Info regarding Banana Accounting
- Patent and legal informations
Building the libraries
The above indicated libraries are dinamically linked.
If you want to use modified libraries:
- Qt Framework. Banana use the dll libraries build made available by the The Qt Company for each platform.
For building your own libraries simply follow the Qt instrunctions Building Qt Sources. - Libharu libraries are also build with the default builds scripts.
- QtWebApp are also build with the default builds scripts.
Replacing the libraries
Once you have re-build the library and created the dll:
- Replace the libraries/dll
- In Windows the libraries are in the program directory
- In Mac are under the directory frameworks
- In Android are in the lib directory
- In Linux are in the lib directory
Info
If you have question let us know.
GitHub BananaAccounting
In order to contribute to the BananaAccounting GitHub repository and submit your changes it is necessary to follow some basic steps:
- Install GitHub Desktop
- Clone the repository
- Create a new Branch
- Modify or add files to the repository
- Keep in sync with the BananaAccounting repository
(Repeat this step frequently!! It downloads the changes from the BananaAccounting main repository into your local repository, preventing conflicts). - Submit the changes
Install Github Desktop
Install GitHub Desktop on your computer, and (if you don't have it already) create your own account.
Clone the repository
The second step is to clone the forked repository:
- Click the green button Clone or download -> Open in Desktop -> . GitHub Desktop should automatically open.
- Choose a path on your local machine to clone the repository.
- Click the button Clone and wait a moment while the forked repository is cloned on your local machine.
At this point, you have created on your computer your own copy of the repository.
Create a new Branch
In order to complete this phase you have to do the following steps:
- In GitHub Desktop press the upper and centered button Current Branch > New Branch > Insert in the window that just appeared the name for the Branch.
- Choose the Branch from which you want to fork, by default is master.
- Click the button Create Branch.
- Click the blue button Publish branch.
Now you have your own Branch to work on the project.
Modify or add files to the repository
To work with the repository:
- Start GitHub Desktop
- Choose the repository you want to work on
- Menu Repository -> Show in Explorer
- Work on the repository, create and/or edit the files that you wish to change.
- Open GitHub desktop again, your changes should be visible on the left side of the window.
- Commit the changes to your own repository by clicking on Commit to <your_branch_name>.
- Click the blue button Push Origin.
Sync your branch with the master branch
This is a fundamental step, which should be repeated multiple time when you're modifying files of a repository, by repeating this process you avoid conflicts with the master branch.
In order to Sync a fork of a repository to keep it up-to-date with the upstream repository follow the following step:
Open GitHub Desktop -> Click the upper button on the right Fetch origin
Now your branch should be in sync with the project master branch.
Submit the changes (Pull request)
To submit changes with GitHub desktop:
- Start GitHub Desktop
- Choose the repository
- Click the blue button Create Pull Request
- You should be redirected to your browser on the GitHub page of the project, here add a comment title and a comment text for the pull request, it helps a lot for other people to understand what you changed so be precise and follow these two steps:
- Explain exactly what changes you have made, so that the moderator can more easily accept the changes.
It will also help you later to understand what has been done.
It it is worth to dedicate some time to doing good comments. - You can comment also groups of files you have changed. (see github documentation).
- Explain exactly what changes you have made, so that the moderator can more easily accept the changes.
- Click the button Create Pull Request
- Will appear a message which will verify if you branch has created conflicts, in order to avoid them remember to repeat more and more times the Sync forked repository with the master repository step.
The repository moderator will receive the pull request, evaluate and approve or refuse the contribution.
You will be notified by email when the pull request has been accepted.
Important:
- Do not click on the "Close Pull Request" button, or the pull request will be blocked!
- If the system tell you that there are conflicts, you should not submit the pull request.
Conflicts are probably due to the fact that you have not synched you repository with the Banana Accounting repository.
Eventually:- do a copy of your repository.
- resync again or in case clone again the main repository.
- copy the changed files from the copy repository to the correct one.
- Redo the pull request process.
Banana Accounting Engine (Alpha Stage)
With REST API access and support for JSON data input, the Engine simplifies complex financial processes, allowing developers to focus on enhancing their solutions while relying on a trusted, robust accounting backbone.
The Engine is readily available for developers who want to test and experiment with these advanced financial features directly on their PC, empowering them to evaluate, customize, and seamlessly integrate powerful accounting tools into their software.
We’re also eager to hear from developers about their experience, feedback, and ideas to help shape the evolution of the Engine as we work toward a full version tailored to your needs.
Background and status
For over 30 years, Banana Accounting has been developing and refining the accounting engine that powers Banana Accounting software. With a large user base spanning the globe, we've encountered diverse needs and received valuable input from highly skilled professionals. Their insights have inspired us to expand the functionality and reach of our solution continually. Today, the Banana Accounting engine includes an extensive set of functions designed to meet complex financial needs.
The financial accounting module is a critical component of any financial solution or ERP system. Developing such a powerful and comprehensive suite of functionalities is a significant and costly endeavor for any software company. Early on, we recognized the value of providing developers with access to a library of robust, thoroughly tested accounting functionalities. This ambitious goal guided our approach, and over the years, as we refined and added new features in Banana Accounting, we prioritized separating and abstracting the code responsible for calculations and reporting, so that it can be made available to other applications.
The engine has been continually enhanced to achieve faster calculation speeds, enabling it to handle large datasets efficiently. We subsequently integrated a web server, allowing the engine to deliver most results via REST API. Most recently, we introduced a basic set of commands that let users create accounting files and add transactions, accounts, and other accounting data in JSON format.
We have already packaged the accounting engine as a container and deployed it within our server environment. Our back-office solution leverages multiple functionalities of the engine via a REST API, a setup that has proven to be both effective and stable.
With core functionalities accessible directly through the integrated web server in Banana Accounting, developers can start experimenting and validating results directly on their own PC. This setup, already successfully tested in research projects, provides a practical environment to explore and test the Engine’s capabilities firsthand.
To support developers eager to experiment, we provide clear documentation, examples, and setup instructions, making it easy to test financial reporting and forecasting scenarios through the REST API.
Once developers confirm that the solution meets their needs, the next step is to integrate the Engine into a server environment for broader deployment. We look forward to collaborating with developers to support a seamless integration into their applications.
Possible applications
The integration of the Banana Accounting engine could bring many advantages for existing applications and open new possibilities, for example for:
- Easy develop new application
- Create a simple financial solution based on the professional double entry accounting methodology with a full set of financial reporting.
- Use existing budgeting data for creating a powerful forecast.
- Extend existing solutions
Create more value and preserve your existing solution and investments.- Use existing data to create more precise cash flow forecast.
- Improve your internal budgeting solution.
- Use your e-commerce data to instantly create Balance Sheet, Profit & Loss, and other financial statements.
- Transform your e-commerce or legacy solution in a full ERP.
Accounting Engine Capabilities
The Banana Accounting Engine offers all capabilities of an advanced global accounting solution, the same available to Banana Accounting users.
Through the Rest API the developer should provide all data necessary data and more specifically.
- File properties:
- Accounting period, currency, language, decimal precision, etc.
- Accounts Table:
- List of Accounts, customer and supplier accounts, Costs and profit centers, Segments, Sections and all specific information.
- Grouping Balance Sheet and Profit & Loss structure.
- Transactions Table:
- Where transactions are entered, with all the necessary details.
- Vat Codes Table:
- Flexible VAT Code definition to support specific national requirements.
- Exchange rate Table.
Once the developer has provided all the data, it can requests a series of reports: You Reporting
- Data verification report.
- Financial Reporting:
- Balance sheet reporting.
- Profit and Loss reporting.
- Journal.
- Account card.
- Reporting period.
- Personalized reports.
- VAT:
- Automated VAT calculation. VAT splitting available only on VAT accounts in basic currency.
- VAT Journal.
- Country-specific VAT reporting.
- Invoice printing:
- VAT totals.
- Sub-totals.
- Predefined layout.
- Flexible fully self-programmable layout.
- Export to in different formats:
- CSV, XML, JSON, SQL.
- XBRL.
- PDF.
- SAF-T (Standard Audit File for Taxation).
- Many country-specific data formats.
Forecasting Engine Capabilities
Banana Accounting include a unique double entry based budgeting and forecasting system.
Forecasting data are entered as transactions in the Budget Table.
The software can calculate all the same report available for the accounting:
- Balance sheet a Budget for multiple years.
Budgeting and financial forecasting.
- Based on the double-entry accounting system.
- Create budgets and manage Cash and investment plans.
- Add custom formulas and calculations.
- Single or multi-year projections of:
- Balance sheet.
- Profit & Loss.
- Cash flow projection.
First Step
The first step is to verify whether the data your application provides to the Engine is sufficient to produce the accounting results you need in your application.
- Banana Accounting includes a web server that allows you to experiment by sending data to the Accounting Engine.
- Once you have sent the data Banana Accounting will create and display a new accounting file, which you can use to:
- Verify through the user interface that the data your application has sent is correct and contains all necessary information for the desired reports.
- Retrieve reporting information using a REST API.
Banana Accounting is available for Windows, Mac, and Linux, enabling you to test in these different environments.
While Banana Accounting is also available for iOS, Android, and as a WebApp (WebAssembly running in the browser), the Engine is currently unavailable in these distributions due to Operating Systems limitations.
How to start experimenting
If you are a developer, here are the very basic steps you need to follow, if you want to experiment.
- Basic setup:
- Download and install Banana Accounting on your computer.
With the Free Plan you can test the functionalities and enter up to 70 transactions. - Enable the integrated Web Server
- Download and install Banana Accounting on your computer.
- Use the web server to send data.
- Use the API to create a new file by sending your data.
- Accounting and Forecasting Data is send using a JSON DocumentChange format.
- Use the API to create a new file by sending your data.
- Retrieve data with the webserver.
- Use the RestApi Navigator to find the appropriate API you need in your application to get the data you need.
Best initial approach
Initially we advise developers to:
- Open Banana Accounting.
- Create an accounting file manually and add the accounts and setup you will need.
- Within your application prepare a JSON DocumentChange that add the Transactions.
- Use the API to create a new file by sending your data.
- You will sent the content of the File you have create manually together with the Transactions data.
- The file will be shown in a Banana Accounting Windows and you can use all reporting features.
Examples
- See an Excel Example Application that send data to Banana Accounting.
You have to configure your computer to allows Excel to open a connection with Banana Web Server.
Full Integration Within Your Application
The Banana Accounting Engine is a C++ application built on Qt libraries, making it relatively straightforward to compile the Engine for various Operating System.
This innovative solution is designed to grow and evolve based on developer needs.
We are committed to working together with potential users to determine the most effective way to integrate the Engine within their environments. At present, the interface for data submission is basic, but we plan to expand its functionality as needs emerge.
Terms, Availability, and Pricing
The pricing and terms for this solution are still under consideration. We’re interested in hearing your thoughts on how the Engine could add value in this regard.
Contact Information
The solution and its documentation are currently in an Alpha stage. Please feel free to reach out if you need assistance or if any part of the documentation needs clarification.