Page 1 of 1

Credit balance

Posted: 2019-01-26 10:59
by stefdefrance
Hello

I have an app made with appgini for a non profit association. In this app, I have a table with "Crédit" and "Débit". I'd like to have a credit balance but just near the name of the table like in the picture. Can someone help me please ?
table.PNG
table.PNG (46.66 KiB) Viewed 1608 times
Capture.PNG
Capture.PNG (117.32 KiB) Viewed 1608 times

Re: Credit balance

Posted: 2019-01-26 16:41
by jsetzer
Just to point you into the right direction:
  1. In TABLENAME.php edit the TABLENAME_dv hook function
  2. Calculate the balance by subtracting the sum of debit from the sum of credit. $balance = ... - ... (your calc here)
  3. Using PHP, create a span-tag "balance" for example: <span class="pull-right" id="balance"><?=$balance?></span>
  4. Create or edit javascript file TABLENAME-tv.js
  5. In $j(function(){ ... }) Move the $j('#balance') field to the page header using jquery's appendTo-method: $j('#balance').appendTo(yourNewTarget);
Regards,
Jan

Re: Credit balance

Posted: 2019-01-26 17:00
by stefdefrance
Thanks Jan ...

I'm going to try this !