Page 1 of 1
help js
Posted: Wed May 27, 2015 10:06 am
by darekmer
sorry no english
please help :
or sql, how to calculate this box
subform 'todczytpradu_subform'
Kon 'stan_koncowy'
Pocz 'stan_poczatkowy'
Cena 'cena'
KwZap 'kwota_zaplaty'
equation math (Kon - Pocz) * Cena update KwZap
Re: help js
Posted: Thu May 28, 2015 1:50 am
by admin
darekmer,
Try this..
Code: Select all
function calc_row(pThis){
var p = $('#' + pThis.id).attr('data-prefix');
var a = $('#' + p + 'Kon').val();
var b = $('#' + p + 'Pocz').val();
var c = $('#' + p + 'Cena').val();
var x = (a - b) * c;
$('#' + p + 'Cena').val(x);
}
For Kon, Pocz and Cena..
daremer.PNG
darekmer,
Steven
Re: help js
Posted: Thu May 28, 2015 12:14 pm
by darekmer
Welcome
I do not know English, google translator
not working or do not understand.
I wanted the result of this action appeared in the KwZap.
and nothing appears.
I would add that all four fields are in one table
Re: help js
Posted: Thu Jun 04, 2015 12:36 am
by admin
darekmer,
Are you wanting this update to be done as Kon, Pocz and Cena are edited on the Form or as the Form is saved (with SQL)?
Steven
Re: help js
Posted: Thu Jun 04, 2015 10:45 am
by darekmer
hello;)
Loading Data to the field 'Konc'.
The 'Pocz' is in the Default Value 'SELECT stan_koncowy FROM todczytpradu WHERE id_dzialki = '#RECORD_ID#'ORDER BY id_odczytu DESC
LIMIT 1 '.
field 'Cena' gets data from another table.
I want to field 'KwZap' automatically counted and saved in the table.
Re: help js
Posted: Fri Jun 05, 2015 6:51 am
by admin
darekmer,
Just run
Code: Select all
UPDATE SubformTableName SET kwZap = (Kon - Pocz) * Cena
On Form
After Save.
Steven