I created this function that works well.
// ListOptions Load event
function ListOptions_Load() {
$opt = &$this->ListOptions->Add("saldo");
$opt->Header = "Saldo";
}
// ListOptions Rendered event
function ListOptions_Rendered() {
$totaldebe = ew_ExecuteScalar("SELECT SUM(economia.debe) FROM economia");
$totalhaber = ew_ExecuteScalar("SELECT SUM(economia.haber) FROM economia");
$GLOBALS["saldototal"] = $totaldebe - $totalhaber;
$this->ListOptions->Items["saldo"]->Footer ="Total Saldo: " . $GLOBALS["saldototal"];
}
and having me these results. for example.
id | debe | haber | saldo
1 | 10 | 0 |
2 | 0 | 10 |
3 | 10 | 0 |
4 | 10 | 0 |
Total:30 Total:10 Total Saldo: 20
I would like to create a function that calculates the balance and type in each row.
and all balances will be updated if there is any modification of any row.
id | debe | haber | saldo
1 | 10 | 0 | 10
2 | 0 | 10 | 0
3 | 10 | 0 | 10
4 | 10 | 0 | 20
Total:30 Total:10
some member of the community has done something similar?
appreciate any idea. thank you.