I do some calculations but the interested fields of grid remain unchanged

Hi all,

I’ve a php method with a calculation, where I do the update of 2 forms grid fields.
Only when you access to form the first time all calculation and fields are sincronized and correct.
If you edit a row value, for istance VAT percentage of the item, and then click on update row button nothing happens.
I put the calculation … everywhere but without result. The echo message are all correct so the calculation is correct.
Only the 2 fields updating is missing.
Really mysterious to me.

The two fields to be updated are: {total_row_value} and {total_row_vat_incl}

Calculation :

$tot_value = round({quantityOrdered} * {price} * {exchange_rate},2);

IF (!{VatRate})
{
echo " No VAT " . $tot_value ;
{total_row_value} = $tot_value;
{total_row_vat_incl} = $tot_value;
}
else
{
sc_lookup(vat_perc,“SELECT VarPerc FROM vatrates WHERE VatID = {VatRate}”);
$vat_perc = {vat_perc[0][0]};

$tot_value_vat = $tot_value + ($tot_value * $vat_perc / 100);	
{total_row_value} = $tot_value;
{total_row_vat_incl} = $tot_value_vat;
echo " CON IVA VAT " . $tot_value_vat;

}

update.jpg

Try:

[tot_value] = round(…

{total_row_value} = [tot_value];

I have a similar problem, but no (other) solution.

Hi RHS,
I did the modification and still nothing changed.
I’m not a programmer but at the end (as last beach…) I tried also to insert the calculation ref also on each ONCLICK events of each interested field of line grid and… MAGICALLY now it works.
Probably it’s connected to Ajax on line update that are only available under same features only.
I add also sc_format_num([tot_value_vat], ‘.’, ‘,’, 2, ‘S’, ‘1’, ‘’); becouse, don’t tell me why, the calculation insert the result on two field without decimal also if the two field are defined as decimal 9,2 . Mah !!!
[CLOSED]