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 (46.66 KiB) Viewed 1632 times
- Capture.PNG (117.32 KiB) Viewed 1632 times
Re: Credit balance
Posted: 2019-01-26 16:41
by jsetzer
Just to point you into the right direction:
- In TABLENAME.php edit the TABLENAME_dv hook function
- Calculate the balance by subtracting the sum of debit from the sum of credit. $balance = ... - ... (your calc here)
- Using PHP, create a span-tag "balance" for example: <span class="pull-right" id="balance"><?=$balance?></span>
- Create or edit javascript file TABLENAME-tv.js
- 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 !