I need to calculate the total of an invoice. This invoice is created with a form, amount, quantity and tax fields, the sum of the fields is made with a bind in cfinput. I can not make the sum of all rows, the total. I tried some operations, but not arriving at the solution
This is an example code:
<cfform action="" method="post">
<cfloop from="1" to="3" index="i">
Q.ta <cfinput type="text" name="quantita#i#" value="0">
+
Importo <cfinput type="text" name="importo#i#" value="0">
+
Tax <cfinput type="text" name="iva#i#" value="0">
=
Totale <cfinput type="text" name="totale#i#" value="0" bind="cfc:somma.getSomma({quantita#i#},{importo#i#},{iva#i#})">
<br /><br />
</cfloop>
CFC:
<cfcomponent>
<cffunction name="getSomma" access="remote" returntype="string">
<cfargument name="quantita" default="0">
<cfargument name="importo" default="0">
<cfargument name="iva" default="0">
<cfset totaleSomma=#evaluate((importo*quantita)*(1+iva))#>
<cfreturn totaleSomma>
</cffunction>
</cfcomponent>