Miglioramento stampe registri iva
This commit is contained in:
parent
b937323d02
commit
ef34cce631
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/*
|
||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||
* Copyright (C) DevCode s.n.c.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Header di default.
|
||||
* I contenuti di questo file vengono utilizzati per generare l'header delle stampe nel caso non esista un file header.php all'interno della stampa.
|
||||
*
|
||||
* Per modificare l'header della stampa basta aggiungere un file header.php all'interno della cartella della stampa con i contenuti da mostrare (vedasi templates/fatture/header.php).
|
||||
*
|
||||
* La personalizzazione specifica dell'header deve comunque seguire lo standard della cartella custom: anche se il file header.php non esiste nella stampa originaria, se si vuole personalizzare l'header bisogna crearlo all'interno della cartella custom.
|
||||
*/
|
||||
|
||||
echo '
|
||||
<div class="col-xs-12 text-right" >
|
||||
<p><b>'.$f_ragionesociale.'</p>
|
||||
</div>';
|
|
@ -33,13 +33,15 @@ $v_iva = [];
|
|||
$v_totale = [];
|
||||
|
||||
$query = 'SELECT *,
|
||||
co_documenti.id AS id,
|
||||
IF(numero = "", numero_esterno, numero) AS numero,
|
||||
SUM(subtotale - sconto) AS subtotale,
|
||||
(SELECT SUM(subtotale - sconto + iva + rivalsainps - ritenutaacconto) FROM co_righe_documenti WHERE co_righe_documenti.iddocumento=co_documenti.id GROUP BY iddocumento) + co_documenti.iva_rivalsainps AS totale,
|
||||
SUM(iva) AS iva, an_anagrafiche.ragione_sociale,
|
||||
an_anagrafiche.codice AS codice_anagrafica
|
||||
FROM co_documenti
|
||||
co_movimenti.id AS idmovimenti, co_documenti.id AS id,
|
||||
IF(numero = "", numero_esterno, numero) AS numero,
|
||||
(SELECT SUM(subtotale - sconto) FROM co_righe_documenti WHERE co_righe_documenti.iddocumento=co_documenti.id GROUP BY iddocumento) AS subtotale,
|
||||
(SELECT SUM(subtotale - sconto + iva + rivalsainps - ritenutaacconto) FROM co_righe_documenti WHERE co_righe_documenti.iddocumento=co_documenti.id GROUP BY iddocumento) + co_documenti.iva_rivalsainps AS totale,
|
||||
(SELECT SUM(iva) FROM co_righe_documenti WHERE co_righe_documenti.iddocumento=co_documenti.id GROUP BY iddocumento) + co_documenti.iva_rivalsainps AS iva,
|
||||
an_anagrafiche.ragione_sociale,
|
||||
an_anagrafiche.codice AS codice_anagrafica
|
||||
FROM co_movimenti
|
||||
INNER JOIN co_documenti ON co_movimenti.iddocumento=co_documenti.id
|
||||
INNER JOIN co_righe_documenti ON co_documenti.id=co_righe_documenti.iddocumento
|
||||
INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id
|
||||
INNER JOIN co_iva ON co_righe_documenti.idiva=co_iva.id
|
||||
|
@ -52,4 +54,4 @@ $records = $dbo->fetchArray($query);
|
|||
// Sostituzioni specifiche
|
||||
$custom = [
|
||||
'tipo' => $tipo,
|
||||
];
|
||||
];
|
|
@ -19,46 +19,24 @@
|
|||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
$previous_number = $previous_number ?: null;
|
||||
|
||||
if ($record['numero'] != $previous_number) {
|
||||
if ($color == '#dddddd') {
|
||||
$color = '#ffffff';
|
||||
} elseif ($color == '#ffffff') {
|
||||
$color = '#dddddd';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
<tr>';
|
||||
|
||||
echo '
|
||||
<tr bgcolor="'.$color.'" >';
|
||||
|
||||
if ($record['numero'] == $previous_number) {
|
||||
echo '
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>';
|
||||
} else {
|
||||
echo '
|
||||
<td>'.(($dir == 'uscita') ? $record['numero'] : '-').'</td>
|
||||
<td>'.$record['numero_esterno'].'</td>
|
||||
<td>'.Translator::datetoLocale($record['data']).'</td>
|
||||
<td>'.Translator::datetoLocale($record['data_competenza']).'</td>
|
||||
<td>'.$record['codice_tipo_documento_fe'].'</td>
|
||||
<td>'.$record['codice_anagrafica'].' / '.safe_truncate(mb_strtoupper(html_entity_decode($record['ragione_sociale']), 'UTF-8'), 50).'</td>
|
||||
<td>'.moneyFormat($record['totale']).'</td>';
|
||||
}
|
||||
<td>'.str_pad($record['idmovimenti'], 8, "0", STR_PAD_LEFT).'</td>
|
||||
<td>'.Translator::datetoLocale($record['data_competenza']).'</td>
|
||||
<td>'.$record['numero_esterno'].'</td>
|
||||
<td>'.Translator::datetoLocale($record['data']).'</td>
|
||||
<td>'.$record['codice_tipo_documento_fe'].'</td>
|
||||
<td>'.$record['codice_anagrafica'].' / '.safe_truncate(mb_strtoupper(html_entity_decode($record['ragione_sociale']), 'UTF-8'), 50).'</td>
|
||||
<td class="text-right">'.moneyFormat($record['totale']).'</td>';
|
||||
|
||||
echo '
|
||||
<td class="text-right">'.moneyFormat($record['subtotale']).'</td>
|
||||
<td class="text-center">'.Translator::numberToLocale($record['percentuale'], 0).'</td>
|
||||
<td class="text-center">'.$record['desc_iva'].'</td>
|
||||
<td class="text-right">'.moneyFormat($record['iva']).'</td>
|
||||
</tr>';
|
||||
|
||||
$previous_number = $record['numero'];
|
||||
<td class="text-right">'.moneyFormat($record['subtotale']).'</td>
|
||||
<td class="text-left">'.Translator::numberToLocale($record['percentuale'], 0).'</td>
|
||||
<td class="text-left">'.$record['desc_iva'].'</td>
|
||||
<td class="text-right">'.moneyFormat($record['iva']).'</td>
|
||||
</tr>';
|
||||
|
||||
$iva[$record['desc_iva']][] = $record['iva'];
|
||||
$totale[$record['desc_iva']][] = $record['subtotale'];
|
||||
|
|
|
@ -42,17 +42,16 @@ if ('entrata' == $dir) {
|
|||
|
||||
$tipo = $dir == 'entrata' ? tr('Cliente') : tr('Fornitore');
|
||||
$i = 0;
|
||||
$color = '#dddddd';
|
||||
|
||||
echo '<h4><b>'.$titolo.'</b></h4>
|
||||
|
||||
<table class="table table-condensed" border="0">
|
||||
<table class="table table-condensed table-striped" border="0">
|
||||
<thead>
|
||||
<tr bgcolor="'.$color.'">
|
||||
<tr>
|
||||
<th>'.tr('Prot.').'</th>
|
||||
<th>'.tr('Data comp.').'</th>
|
||||
<th>'.tr('N<sup>o</sup> doc.').'</th>
|
||||
<th>'.tr('Data doc.').'</th>
|
||||
<th>'.tr('Data comp.').'</th>
|
||||
<th>'.tr('Tipo').'</th>
|
||||
<th>'.$tipo.'</th>
|
||||
<th>'.tr('Tot. doc.').'</th>
|
||||
|
|
Loading…
Reference in New Issue