Report Extensions

Documentation •
In this article

Report extensions are java-script programs that are used to customize printouts like invoice documents.

The program:

  1. Will call the main function printDocument() with the json object (for example the invoice) and the other parameters.
  2. 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

 

Help us improve the documentation

We welcome feedback on how to improve this page.

Tell us what theme needs a better explanation or how to clarify a topic.

Share this article: Twitter | Facebook | LinkedIn | Email