En este artículo
Embedded Extensions - Javascript Tutorial 1
Universal
Simple table
Education
This template let you try the Banana Extensions basic functionalities, starting with a "Hello World" example.
Abrir en Banana WebApp
Abra Banana Contabilidad Plus en su navegador sin necesidad de instalación. Personaliza la plantilla, introduce las transacciones y guarda el archivo en tu ordenador.
Abrir plantilla en WebApp Abrir tutorial en WebAppDocumentación de la plantilla
List of code examples
| Each of the following rows is a different Banana Extension tutorial | |
| Select the cell of the column Attachments: | |
| - click the first icon to start the script | |
| - click the second icon to edit and experiment with the script | |
| 'Hello world' report | |
| 100 | Hello World |
| REPORTS | |
| Creating Reports | |
| 200 | Add several paragraphs |
| 201 | Add the header |
| 202 | Add the footer |
| 203 | Add an image |
| 204 | Add page break |
| 205 | Add attachments |
| 206 | Print multiple reports |
| 207 | Add structured text |
| Creating Reports with table object | |
| 210 | Create a table with one row |
| 211 | Create a table with multiple rows |
| 212 | Create a table with multiple rows and a header |
| 213 | Create a table with multiple rows, header and borders |
| 214 | Create a table with fixed columns widths |
| 215 | Add multiple paragraphs in one cell |
| 216 | Create a table with fixed columns and cells span |
| Add reporting styles | |
| 220 | Set page margins |
| 221 | Set landscape page |
| 222 | Add bold style to a text |
| 223 | Add a font size to a text |
| 224 | Add a color to a text |
| 225 | First page/cover example |
| SERVICE FUNCTIONS | |
| Format values | |
| 300 | Format numbers |
| 301 | Format dates |
| 302 | Format transactions journal data |
| SDecimal() functions | |
| 310 | Basic mathematical operations (sum, subtract, multiply, divide) |
| 311 | abs function |
| 312 | Compare two values |
| 313 | Invert sign of a value |
| 314 | Check the sign of a value |
| 315 | Number of decimals and rounding properties |
| User interface functions | |
| 320 | Dialog information |
| 321 | Dialog question |
| 322 | Dialog show text |
| 323 | Dialog input text |
| 324 | Dialog item selection |
| 325 | Dialog period selection |
| 326 | Dialog multiple items selection |
| Message functions | |
| 330 | Show messages |
| 331 | Show messages linked to table Transaction |
| 332 | Clear all messages |
| SAVE SETTINGS | |
| 400 | Save settings |
| RETRIEVING DATA FROM BANANA | |
| Retrieving informations from "File and account properties..." | |
| 500 | Retrieve basic accounting informations |
| 501 | Retrieve address informations |
| Retrieving data from Banana tables | |
| 510 | Retrieve rows table values using findRowByValue() function |
| 511 | Retrieve specific rows table values |
| 512 | Retrieve rows table values |
| 513 | Retrieve rows table with account number |
| 514 | Print all table rows in a table format |
| 515 | Find all rows that match a condition using findRows |
| 516 | Retrieve all rows that match a condition using extractRows |
| RETRIEVING DATA WITH THE ACCOUNTING FUNCTIONS | |
| Use currentBalance() function | |
| 600 | Amount of opening for all transactions for an account |
| 601 | Amount of opening for all transactions for multiple accounts |
| 602 | Amount of opening for all transactions for a single group |
| 603 | Amount of opening for all transactions for multiple groups |
| 604 | Amount of opening for all transactions for a BClass |
| 605 | Amount of opening for all transactions for multiple BClass values |
| Use vatCurrentBalance() function | |
| 610 | Sum the Vat amounts for the specified vat code |
| 611 | Sum the Vat amounts for multiple vat codes |
| Use currentCard() function | |
| 620 | For a given account without specifying the period |
| 621 | For a given account and period |
| Use journal() function | |
| 630 | Get all transaction for normal accounts |
| OTHER FEATURES | |
| Reading and writing xml files | |
| 700 | Reading an xml file |
| 701 | Writing an xml file |
| 702 | Validate an xml file via xsd |
| 703 | Filter for xml file |
| 704 | Export Transaction table to xml file |
| 705 | Import Transactions from xml file |
| Debugging | |
| 710 | Ouput messages to the debug panel |
| Progress bar and timeout | |
| 720 | Script timeout |
| 721 | Progess bar |
| User interface | |
| 740 | QTableWidget interaction |
| 740.ui | - User interface for QTableWidget interaction |
| 742 | Find dialog |
| 742.ui | - User interface for Find dialog |
| Image used for the tutorial | |
| logo | banana.jpg image |
| Other files used for the tutorial | |
| xml | xml file |
| xsd | xsd file |
| EXPORT | |
| 800 | Export tutorial1 javascript codes |
Template preview
Embedded JavaScript Tutorial
| Group | Account | Description | Sum In | Gr1 |
|---|---|---|---|---|
| Balance sheet | ||||
| ASSETS | Cash | |||
| Cash | Cash | Cash | 1 | |
| Bank 1 | Bank 1 | Cash | 1 | |
| Bank 2 | Bank 2 | Cash | ||
| Cash | Cash | Current Assets | ||
| Clients | Clients | Accounts Receivable | 1 | |
| Prepaid taxes | Prepaid taxes | Accounts Receivable | 1 | |
| Accounts Receivable | Accounts Receivable | Current Assets | ||
| Inventory | Inventory | Inventory | 1 | |
| Inventory | Inventory | Current Assets | ||
| Transitory assets | Transitory assets | Prepaid Expenses | 1 | |
| Prepaid Expenses | Prepaid Expenses | Current Assets | ||
| Current Assets | Current Assets | Total Assets | ||
| Machinery and applicances | Machinery and applicances | Equipment | 1 | |
| Office furniture | Office furniture | Equipment | 1 | |
| Computer | Computer | Equipment | 1 | |
| Software | Software | Equipment | 1 | |
| Car | Car | Equipment | 1 | |
| Equipment | Equipment | Fixed Assets | ||
| Real Estate | Real Estate | Real Estate | 1 | |
| Real Estate | Real Estate | Fixed Assets | ||
| Fixed Assets | Fixed Assets | Total Assets | ||
| Total Assets | Total ASSETS | 00 | ||
| LIABILITIES | ||||
| Supplier | Supplier | Current Liabilities | 2 | |
| VAT due | VAT due | Current Liabilities | 2 | |
| Current Liabilities | Current Liabilities | Total Liabilities | ||
| Bank loan | Bank loan | Long-term Liabilities | 2 | |
| Transitory liabilities | Transitory liabilities | Long-term Liabilities | 2 | |
| Long-term Liabilities | Long-term Liabilities | Total Liabilities | ||
| Start-up capital | Start-up capital | Shareholders' Equity | 2 | |
| Profit or loss brought forward | Profit or loss brought forward | Shareholders' Equity | 2 | |
| Profit / Loss current year | Profit / Loss current year | Shareholders' Equity | ||
| Shareholders' Equity | Shareholders' Equity | Total Liabilities | ||
| Total Liabilities | Total LIABILITIES | 00 | ||
| Profit & Loss | ||||
| INCOME | ||||
| Income from services | Income from services | Total Income | 4 | |
| Income from sales | Income from sales | Total Income | 4 | |
| Other income | Other income | Total Income | 4 | |
| Total Income | Total INCOME | 02 | ||
| EXPENSES | ||||
| Purchase goods for resale | Purchase goods for resale | Cost of Revenue | 3 | |
| Cost of Revenue | Cost of Revenue | Total Expenses | ||
| Salaries | Salaries | Salary | 3 | |
| Social contributions | Social contributions | Salary | 3 | |
| Pension fund | Pension fund | Salary | 3 | |
| Accident insurance | Accident insurance | Salary | 3 | |
| Health insurance | Health insurance | Salary | 3 | |
| Salary | Salary | Operating Expenses | ||
| Rent | Rent | General and Administrative | 3 | |
| Upkeep machinery and appliances | Upkeep machinery and appliances | General and Administrative | 3 | |
| Car expenses | Car expenses | General and Administrative | 3 | |
| Other insurances | Other insurances | General and Administrative | 3 | |
| Fees | Fees | General and Administrative | 3 | |
| Electricity | Electricity | General and Administrative | 3 | |
| Office supplies | Office supplies | General and Administrative | 3 | |
| Telephone, Fax | Telephone, Fax | General and Administrative | 3 | |
| Mailing fees | Mailing fees | General and Administrative | 3 | |
| Advertising | Advertising | General and Administrative | 3 | |
| General and Administrative | General and Administrative | Operating Expenses | ||
| Interest on bank loan | Interest on bank loan | Financial Expenses | 3 | |
| Bank and current account fees | Bank and current account fees | Financial Expenses | 3 | |
| Financial Expenses | Financial expenses | Operating Expenses | ||
| Operating Expenses | Operating Expenses | Total Expenses | ||
| Ammortize machinery and appliances | Ammortize machinery and appliances | Amortisation | 3 | |
| Ammortize real estate | Ammortize real estate | Amortisation | 3 | |
| Amortisation | Amortisation | Total Expenses | ||
| Taxes | Taxes | Taxes | 3 | |
| Taxes | Taxes | Total Expenses | ||
| Total Expenses | Total EXPENSES | 02 | ||
| 02 | Profit(-) Loss(+) from Profit & Loss Statement | Profit / Loss current year | ||
| 00 | Difference Balance Sheet/Profit & Loss Statement should be = 0 (blank cell) | |||
| COST AND PROFIT CENTERS | ||||
| Division car expenses | ||||
| .PET | Petrol | TC | ||
| .INS | Insurance, other fees | TC | ||
| .REP | Repairs | TC | ||
| TC | Totals cost centers |
| VAT Code | Description | %VAT |
|---|---|---|
| VAT due | ||
| S0 | VAT exempt sales | |
| SE | Foreign sales exempt | |
| S5 | Sales at 5% | 5.00 |
| S10 | Sales at 10% | 10.00 |
| SD5 | Discount on sales at 5% | 5.00 |
| SD10 | Discount on sales at 10% | 10.00 |
| Sales | ||
| Recoverable VAT | ||
| P5 | Purchase at 5% | 5.00 |
| P10 | Purchase at 10% | 10.00 |
| PD5 | Discount on purchases at 5% | 5.00 |
| PD10 | Discount on purchases at 10% | 10.00 |
| Purchase |