Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

help js

Post Reply
darekmer
Posts: 3
Joined: Wed May 27, 2015 9:51 am

help js

Unread post 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
Attachments
Bez tytułu.png
Bez tytułu.png (35.31 KiB) Viewed 6268 times
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: help js

Unread post 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
daremer.PNG (34.86 KiB) Viewed 6260 times
darekmer,


Steven
darekmer
Posts: 3
Joined: Wed May 27, 2015 9:51 am

Re: help js

Unread post 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
Attachments
Bez tytułu2.png
Bez tytułu2.png (33.11 KiB) Viewed 6255 times
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: help js

Unread post 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
darekmer
Posts: 3
Joined: Wed May 27, 2015 9:51 am

Re: help js

Unread post 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.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: help js

Unread post by admin »

darekmer,

Just run

Code: Select all

UPDATE SubformTableName SET  kwZap = (Kon - Pocz) * Cena
On Form After Save.

Steven
Post Reply