2020-10-09 12:03:09 +02:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-10-09 12:03:09 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
2021-01-22 15:16:57 +01:00
|
|
|
|
2020-10-09 12:03:09 +02:00
|
|
|
if (get('lev') == '2' || get('lev') == '3') {
|
2021-01-22 15:16:57 +01:00
|
|
|
$dare = 0;
|
|
|
|
$avere = 0;
|
2022-12-27 15:10:11 +01:00
|
|
|
$scalare += $saldo_iniziale;
|
2021-01-22 15:16:57 +01:00
|
|
|
for ($i = 0; $i < sizeof($records); ++$i) {
|
|
|
|
if ($records[$i]['totale'] >= 0) {
|
|
|
|
$dare += $records[$i]['totale'];
|
|
|
|
} else {
|
|
|
|
$avere += $records[$i]['totale'];
|
|
|
|
}
|
|
|
|
}
|
2020-10-09 12:03:09 +02:00
|
|
|
echo '
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th>SALDO FINALE</th>
|
2023-08-04 14:54:28 +02:00
|
|
|
<th class="text-right">'.moneyFormat(abs($dare), 2).'</th>
|
|
|
|
<th class="text-right">'.moneyFormat(abs($avere), 2).'</th>
|
|
|
|
<th class="text-right">'.moneyFormat(abs($scalare), 2).'</th>
|
2020-10-09 12:03:09 +02:00
|
|
|
</tr>';
|
2020-10-16 08:31:10 +02:00
|
|
|
} elseif (get('lev') == '1') {
|
2021-01-22 15:16:57 +01:00
|
|
|
$totale_attivo = 0;
|
|
|
|
$totale_passivo = 0;
|
|
|
|
for ($i = 0; $i < sizeof($patrimoniale); ++$i) {
|
|
|
|
if ($patrimoniale[$i]['totale'] >= 0) {
|
|
|
|
$totale_attivo += $patrimoniale[$i]['totale'];
|
|
|
|
} else {
|
|
|
|
$totale_passivo += $patrimoniale[$i]['totale'];
|
|
|
|
}
|
|
|
|
}
|
2020-10-09 12:03:09 +02:00
|
|
|
echo '</table>
|
|
|
|
<table class="table table-striped table-bordered">
|
|
|
|
<tr>
|
|
|
|
<th width="25%">TOTALE ATTIVITÀ</th>
|
2023-08-04 14:54:28 +02:00
|
|
|
<th width="25%" class="text-right">'.moneyFormat(abs($totale_attivo), 2).'</th>
|
2020-10-09 12:03:09 +02:00
|
|
|
<th width="25%">PASSIVITÀ</th>
|
2023-08-04 14:54:28 +02:00
|
|
|
<th width="25%" class="text-right">'.moneyFormat(abs($totale_passivo), 2).'</th>
|
2020-10-09 12:03:09 +02:00
|
|
|
</tr>
|
|
|
|
<tr>';
|
|
|
|
|
2021-01-22 15:16:57 +01:00
|
|
|
if ($utile_perdita['totale'] <= 0) {
|
2020-10-09 12:03:09 +02:00
|
|
|
echo '
|
|
|
|
<th></th>
|
|
|
|
<th></th>
|
|
|
|
<th>UTILE</th>
|
2023-08-04 14:54:28 +02:00
|
|
|
<th class="text-right">'.moneyFormat(abs($utile_perdita['totale']), 2).'</th>
|
2020-10-09 12:03:09 +02:00
|
|
|
</tr>';
|
2021-01-22 15:16:57 +01:00
|
|
|
$totale_passivo = abs($totale_passivo + $utile_perdita['totale']);
|
2020-10-16 08:31:10 +02:00
|
|
|
} else {
|
2020-10-09 12:03:09 +02:00
|
|
|
echo '
|
|
|
|
<th>PERDITA</th>
|
2023-08-04 14:54:28 +02:00
|
|
|
<th class="text-right">'.moneyFormat(abs($utile_perdita['totale']), 2).'</th>
|
2020-10-09 12:03:09 +02:00
|
|
|
<th></th>
|
|
|
|
<th></th>
|
|
|
|
</tr>';
|
2021-01-22 15:16:57 +01:00
|
|
|
$totale_attivo = abs($totale_attivo + $utile_perdita['totale']);
|
2020-10-09 12:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<tr>
|
|
|
|
<th>TOTALE A PAREGGIO</th>
|
2023-08-04 14:54:28 +02:00
|
|
|
<th class="text-right">'.moneyFormat(abs($totale_attivo), 2).'</th>
|
2020-10-09 12:03:09 +02:00
|
|
|
<th>TOTALE A PAREGGIO</th>
|
2023-08-04 14:54:28 +02:00
|
|
|
<th class="text-right">'.moneyFormat(abs($totale_passivo), 2).'</th>
|
2020-10-09 12:03:09 +02:00
|
|
|
</tr>
|
|
|
|
</table>';
|
|
|
|
}
|
|
|
|
|
2020-10-16 08:31:10 +02:00
|
|
|
echo '</tbody></table>';
|