invoice live edit: Parse dynamic table and calculate sum of rows and cols

Recommend this page to a friend!
  All requests RSS feed  >  invoice live edit  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

invoice live edit

A request is featured when there is no good recommended package on the site when it is posted. Edit

Picture of waredy karim by waredy karim - 9 years ago (2014-12-01)

Parse dynamic table and calculate sum of rows and cols

This request is clear and relevant.
This request is not clear or is not relevant.

+3

I need to calculate the grand total of invoices using PHP and jQuery and rounded to 2 decimals with comma, the thousands separated with space Ex: 12 850,00 Euros.

Rows must be added or removed dynamically with recalculating the sum, like the example

ITEM | PRICE | QTY | VAT% | VAT Value| Amount(Ex-VAT)

1 50,00 20 21% 210 1 000,00 x DELETE ROW

2 200,00 10 14% 280 2 000,00 x DELETE ROW

                                                     + ADD ROW 

                                 ----------------- 
      Total amount (exluded VAT)         3 000,00    
                                 -----------------
                       Total VAT           490,00
                                 -----------------
                 Grand Total             3 490,00

  • 1 Clarification request
  • 1. Picture of Manuel Lemos by Manuel Lemos - 9 years ago (2014-12-17) Reply

    I am not sure if making computations from values displayed on HTML is the way to go. Maybe it makes more sense to make computations of values stored in arrays and then update the presentation of the values from the arrays.

    Anyway, there seems to not exist a package to do that in JavaScript.

    • 2. Picture of waredy karim by waredy karim - 9 years ago (2014-12-17) in reply to comment 1 by Manuel Lemos Comment

      thank you Mr Lemos for your reply.

      I compute input fields contained in table cells.

Ask clarification

1 Recommendation

Xtemplate: Template engine that uses HTML page fragments

This recommendation solves the problem.
This recommendation does not solve the problem.

+1

Picture of Diego La Monica by Diego La Monica package author package author Reputation 30 - 8 years ago (2015-05-25) Comment

Hi Waredy, If you are still interested in got solution to your problem, maybe Xtemplate can help you in this purpose (see the Invoice example). You will pass the json object with all invoice data and it (XTemplate) will compute the total (total ammount, vat and grand total). Take a look to it and if it would be useful for you please rate me :)


Recommend package
: 
: