openstamanager/templates/partitario_mastrino/bottom.php

91 lines
3.0 KiB
PHP
Raw Permalink Normal View History

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;
$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 '
2024-09-26 10:35:49 +02:00
<tr>
<th></th>
<th>SALDO FINALE</th>
<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>
</tr>
</tbody>
</table>';
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'];
}
}
2024-07-16 16:28:52 +02:00
echo '
</table>
<table class="table table-striped table-bordered">
2020-10-09 12:03:09 +02:00
<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 '
2024-07-16 16:28:52 +02:00
<th></th>
<th></th>
<th>UTILE</th>
<th class="text-right">'.($utile_perdita['totale'] ? moneyFormat(abs($utile_perdita['totale']), 2) : 0).'</th>
</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 '
2024-07-16 16:28:52 +02:00
<th>PERDITA</th>
<th class="text-right">'.moneyFormat(abs($utile_perdita['totale']), 2).'</th>
<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>
2024-07-16 16:28:52 +02:00
</table>';
2020-10-09 12:03:09 +02:00
}