Credit balance

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
stefdefrance
Posts: 7
Joined: 2014-12-05 18:34

Credit balance

Post by stefdefrance » 2019-01-26 10:59

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 141 times
Capture.PNG
Capture.PNG (117.32 KiB) Viewed 141 times

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 90
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Credit balance

Post by jsetzer » 2019-01-26 16:41

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

stefdefrance
Posts: 7
Joined: 2014-12-05 18:34

Re: Credit balance

Post by stefdefrance » 2019-01-26 17:00

Thanks Jan ...

I'm going to try this !

Post Reply