In this article

    Embedded Exstension - Javascript Tutorial 1

    Universal
    Simple table
    Education

    This template let you try the BananaApp basic functionalities, starting with a "Hello World" example.

    Open in Banana WebApp

    Run Banana Accounting Plus on your browser without any installation. Customize the template, enter the transactions and save the file on your computer.

    Open template in WebApp Open tutorial in WebApp

    Template documentation

     

    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
    100Hello World
      
     REPORTS
     Creating Reports
    200Add several paragraphs
    201Add the header
    202Add the footer
    203Add an image
    204Add page break
    205Add attachments
    206Print multiple reports
    207Add structured text
      
     Creating Reports with table object
    210Create a table with one row
    211Create a table with multiple rows
    212Create a table with multiple rows and a header
    213Create a table with multiple rows, header and borders
    214Create a table with fixed columns widths
    215Add multiple paragraphs in one cell
    216Create a table with fixed columns and cells span
      
     Add reporting styles
    220Set page margins
    221Set landscape page
    222Add bold style to a text
    223Add a font size to a text
    224Add a color to a text
    225First page/cover example
      
     SERVICE FUNCTIONS
     Format values
    300Format numbers
    301Format dates
    302Format transactions journal data
      
     SDecimal() functions
    310Basic mathematical operations (sum, subtract, multiply, divide)
    311abs function
    312Compare two values
    313Invert sign of a value
    314Check the sign of a value
    315Number of decimals and rounding properties 
      
     User interface functions
    320Dialog information
    321Dialog question
    322Dialog show text
    323Dialog input text
    324Dialog item selection
    325Dialog period selection
    326Dialog multiple items selection
      
     Message functions
    330Show messages
    331Show messages linked to table Transaction
    332Clear all messages
      
     SAVE SETTINGS
    400Save settings
      
     RETRIEVING DATA FROM BANANA
     Retrieving informations from "File and account properties..."
    500Retrieve basic accounting informations
    501Retrieve address informations
      
     Retrieving data from Banana tables
    510Retrieve rows table values using findRowByValue() function
    511Retrieve specific rows table values
    512Retrieve rows table values
    513Retrieve rows table with account number
    514Print all table rows in a table format
    515Find all rows that match a condition using findRows
    516Retrieve all rows that match a condition using extractRows
      
     RETRIEVING DATA WITH THE ACCOUNTING FUNCTIONS
     Use currentBalance() function
    600Amount of opening for all transactions for an account
    601Amount of opening for all transactions for multiple accounts
    602Amount of opening for all transactions for a single group
    603Amount of opening for all transactions for multiple groups
    604Amount of opening for all transactions for a BClass
    605Amount of opening for all transactions for multiple BClass values
      
     Use vatCurrentBalance() function
    610Sum the Vat amounts for the specified vat code
    611Sum the Vat amounts for multiple vat codes
      
     Use currentCard() function
    620For a given account without specifying the period
    621For a given account and period
      
     Use journal() function
    630Get all transaction for normal accounts
      
     OTHER FEATURES
     Reading and writing xml files
    700Reading an xml file
    701Writing an xml file
    702Validate an xml file via xsd
    703Filter for xml file
    704Export Transaction table to xml file
    705Import Transactions from xml file
      
     Debugging
    710Ouput messages to the debug panel
      
     Progress bar and timeout
    720Script timeout
    721Progess bar
      
     User interface
    740QTableWidget interaction
    740.ui- User interface for QTableWidget interaction
      
    742Find dialog
    742.ui- User interface for Find dialog
      
     Image used for the tutorial
    logobanana.jpg image
      
     Other files used for the tutorial
    xmlxml file
    xsdxsd file
      
      
     EXPORT
    800Export tutorial1 javascript codes

     

    Template preview

    Embedded JavaScript Tutorial

    Table: Accounts
    Group 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    
    Table: VAT codes
    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  
    Tell us how we can help you better
    If the information on this page is not what you're looking for, is not clear enough, or is not up-to-date, let us know.

    Share this article: Twitter | Facebook | LinkedIn | Email