openstamanager/templates/fatturato/body.php

89 lines
3.0 KiB
PHP
Raw Normal View History

2020-03-14 14:32:47 +01:00
<?php
2020-09-07 15:04:06 +02:00
/*
* 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-09-07 15:04:06 +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/>.
*/
2020-03-14 14:32:47 +01:00
include_once __DIR__.'/../../core.php';
if ($dir == 'entrata') {
$title = tr('Fatturato mensile dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($date_start),
'_END_' => Translator::dateToLocale($date_end),
], ['upper' => true]);
} else {
$title = tr('Acquisti mensili dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($date_start),
'_END_' => Translator::dateToLocale($date_end),
], ['upper' => true]);
}
echo '
<h4><strong>'.$title.'</strong></h4>';
// Intestazione tabella per righe
echo '
<table class="table table-bordered">
<thead>
<tr>
<th>'.tr('Mese').'</th>
<th class="text-center" style="width: 15%">'.tr('Imponibile').'</th>
<th class="text-center" style="width: 15%">'.tr('IVA').'</th>
<th class="text-center" style="width: 15%">'.tr('Totale').'</th>
</tr>
</thead>
<tbody>';
echo '
</tbody>';
$totale_imponibile = 0;
$totale_iva = 0;
$totale_finale = 0;
// Nel fatturato totale è corretto NON tenere in considerazione eventuali rivalse, ritenute acconto o contributi.
foreach ($raggruppamenti as $raggruppamento) {
2024-01-15 15:30:45 +01:00
$data = new Carbon\Carbon($raggruppamento['data_competenza']);
2020-03-14 14:59:27 +01:00
$mese = ucfirst($data->formatLocalized('%B %Y'));
2020-03-14 14:32:47 +01:00
2023-05-22 11:51:23 +02:00
$imponibile = SUM($raggruppamento['imponibile'], null, 2);
$iva = SUM($raggruppamento['iva'], null, 2);
2023-05-15 10:52:54 +02:00
$totale = $imponibile + $iva;
2020-03-14 14:32:47 +01:00
echo '
<tr>
<td>'.$mese.'</td>
<td class="text-right">'.moneyFormat($imponibile, 2).'</td>
<td class="text-right">'.moneyFormat($iva, 2).'</td>
<td class="text-right">'.moneyFormat($totale, 2).'</td>
2020-03-14 14:32:47 +01:00
</tr>';
$totale_imponibile += $imponibile;
$totale_iva += $iva;
$totale_finale += $totale;
}
echo '
<tr>
<td class="text-right text-bold">'.tr('Totale', [], ['upper' => true]).':</td>
<td class="text-right text-bold">'.moneyFormat($totale_imponibile, 2).'</td>
<td class="text-right text-bold">'.moneyFormat($totale_iva, 2).'</td>
<td class="text-right text-bold">'.moneyFormat($totale_finale, 2).'</td>
2020-03-14 14:32:47 +01:00
</tr>
</tbody>
</table>';