Page 1 of 1

AUTO CALCULATION WHILE TEXT CHANGE EVENT

Posted: 2018-11-15 05:19
by skumar
Hi,

I know only few basics of PHP. Pls advice me on writing code

Pls go through the attached screen shot of my app gini application.

I want to calculate some field values(CGST @ 1.5 %, SGST@ 1.5% on Taxable Amount) automatically; and the calculation should be done during text change event.

I have found before or after insert code to be written on hooks files . But it is not helpful for me. I need calculation to happen during text change event

PLEASE HELP
APPGINI CUST.jpg
APPGINI CUST.jpg (126.73 KiB) Viewed 1689 times
Regards,
SAMPATH

Re: AUTO CALCULATION WHILE TEXT CHANGE EVENT

Posted: 2018-11-15 16:58
by pbottcher
Hi,

you need to do this via Javascript (here in combination with jquery).

You can put the code in the <tablename>-dv.js file in the hooks folder.

You need to so something like:

$j('#taxalbleamount').on('change', function () {
var tax=+($j('#taxalbleamount').val());
$j('#cgst').val(tax*1.5/100);
$j('#sgst').val(tax*1.5/100);
$j('#billtotal').val(tax+tax*1.5/100+tax*1.5/100);

}

You need your identifiere of course, as I cannot see them :-).

Re: AUTO CALCULATION WHILE TEXT CHANGE EVENT

Posted: 2018-11-16 17:14
by skumar
THANKS :D YOU SOLVED MY PROBLEM
regards,
Sampath