In this article
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.
- printDocument(jsonContent, repDocObj, repStyleObj [, prefSelected])
- 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