2017-09-07 16:51:14 +02:00
< ? php
// SCADENZE | TOTALI
// TABELLA PRINCIPALE
echo "
2017-09-13 11:15:31 +02:00
< table class = 'table-bordered' >
2017-09-07 16:51:14 +02:00
< tr >
2017-09-13 13:05:35 +02:00
< td colspan = " .(!empty( $sconto ) ? 5 : 3). " class = 'cell-padded' style = 'height:".($records[0][' ritenutaacconto '] != 0 ? 20 : 30)."mm' > " ;
2017-09-07 16:51:14 +02:00
// Tabella (scadenze + iva)
echo "
2017-09-13 11:15:31 +02:00
< table class = 'table-normal' >
2017-09-07 16:51:14 +02:00
< tr >
2017-09-13 11:15:31 +02:00
< td style = 'width:10mm;' >& nbsp ; </ td >
2017-09-07 16:51:14 +02:00
< td style = 'width:45mm;' >
2017-09-13 11:15:31 +02:00
< table class = 'border-bottom' >
2017-09-07 16:51:14 +02:00
< tr >
2017-09-13 11:15:31 +02:00
< td colspan = '2' >
2017-09-10 14:35:41 +02:00
< p class = 'small-bold' > " .tr('Scadenze pagamenti', [], ['upper' => true]).'</p>
2017-09-07 16:51:14 +02:00
</ td >
</ tr > ' ;
// Elenco scadenze
$rs2 = $dbo -> fetchArray ( 'SELECT * FROM co_scadenziario WHERE iddocumento=' . prepare ( $iddocumento ) . ' ORDER BY `data_emissione` ASC' );
if ( ! empty ( $rs2 )) {
for ( $i = 0 ; $i < sizeof ( $rs2 ); ++ $i ) {
echo "
< tr >
2017-09-13 11:15:31 +02:00
< td style = 'width:50%;' >
2017-09-07 16:51:14 +02:00
< small > " .Translator::dateToLocale( $rs2[$i] ['scadenza']). " </ small >
</ td >
2017-09-13 11:15:31 +02:00
< td style = 'width:50%;' class = 'text-right' >
2017-09-21 10:01:07 +02:00
< small > " .Translator::numberToLocale( $rs2[$i] ['da_pagare']).' €</small>
2017-09-07 16:51:14 +02:00
</ td >
</ tr > ' ;
}
}
2017-09-13 11:15:31 +02:00
2017-09-07 16:51:14 +02:00
echo '
</ table >
</ td > ' ;
// Fine elenco scadenze
// Separatore
echo "
< td style = 'width:10mm;' >& nbsp ; </ td > " ;
// Tabella iva
echo "
< td style = 'width:75mm;' > " ;
if ( ! empty ( $v_iva )) {
echo "
2017-09-13 11:15:31 +02:00
< table class = 'border-bottom' >
2017-09-07 16:51:14 +02:00
< tr >
2017-09-13 11:15:31 +02:00
< td style = 'width:40mm;' >
2017-09-10 14:35:41 +02:00
< p class = 'small-bold' > " .tr('Aliquota IVA', [], ['upper' => true]). " </ p >
2017-09-07 16:51:14 +02:00
</ td >
2017-09-13 11:15:31 +02:00
< td style = 'width:20mm;' class = 'text-center' >
2017-09-10 14:35:41 +02:00
< p class = 'small-bold' > " .tr('Importo', [], ['upper' => true]). " </ p >
2017-09-07 16:51:14 +02:00
</ td >
2017-09-13 11:15:31 +02:00
< td style = 'width:20mm;' class = 'text-center' >
2017-09-10 14:35:41 +02:00
< p class = 'small-bold' > " .tr('Importo IVA', [], ['upper' => true]).'</p>
2017-09-07 16:51:14 +02:00
</ td >
</ tr > ' ;
foreach ( $v_iva as $desc_iva => $tot_iva ) {
if ( ! empty ( $desc_iva )) {
2017-09-13 11:15:31 +02:00
echo '
2017-09-07 16:51:14 +02:00
< tr >
2017-09-13 11:15:31 +02:00
< td >
< small > ' . $desc_iva . " </small>
2017-09-07 16:51:14 +02:00
</ td >
2017-09-13 11:15:31 +02:00
< td class = 'text-right' >
2017-09-21 10:01:07 +02:00
< small > " .Translator::numberToLocale( $v_totale[$desc_iva] ). " & euro ; </ small >
2017-09-07 16:51:14 +02:00
</ td >
2017-09-13 11:15:31 +02:00
< td class = 'text-right' >
2017-09-21 10:01:07 +02:00
< small > " .Translator::numberToLocale( $v_iva[$desc_iva] ).' €</small>
2017-09-07 16:51:14 +02:00
</ td >
</ tr > ' ;
}
}
echo '
</ table > ' ;
}
echo '
</ td >
< td style = " width:10mm; " >& nbsp ; </ td > " ;
</ tr > ' ;
// Fine tabelle iva
echo '
</ table > ' ;
// Fine tabella (scadenze + iva)
echo '
</ td > ' ;
2017-09-13 11:15:31 +02:00
// TOTALI
$width = round ( 100 / ( ! empty ( $sconto ) ? 5 : 3 ), 2 );
2017-09-07 16:51:14 +02:00
echo "
2017-09-13 11:15:31 +02:00
< tr >
< th class = 'text-center small' style = 'width:".$width."' >
" .tr('Imponibile', [], ['upper' => true]). "
</ th > " ;
if ( ! empty ( $sconto )) {
echo "
< th class = 'text-center small' style = 'width:".$width."' >
" .tr('Sconto', [], ['upper' => true]). "
</ th >
< th class = 'text-center small' style = 'width:".$width."' >
" .tr('Imponibile scontato', [], ['upper' => true]). "
</ th > " ;
}
2017-09-07 16:51:14 +02:00
echo "
2017-09-13 11:15:31 +02:00
< th class = 'text-center small' style = 'width:".$width."' >
" .tr('Totale IVA', [], ['upper' => true]). "
</ th >
< th class = 'text-center small' style = 'width:".$width."' >
" .tr('Totale documento', [], ['upper' => true]). "
</ th >
2017-09-07 16:51:14 +02:00
</ tr >
< tr >
2017-09-13 11:15:31 +02:00
< td class = 'cell-padded text-center' >
2017-09-21 10:01:07 +02:00
" .Translator::numberToLocale( $imponibile ). " & euro ;
2017-09-13 11:15:31 +02:00
</ td > " ;
if ( ! empty ( $sconto )) {
echo "
< td class = 'cell-padded text-center' >
2017-09-21 10:01:07 +02:00
" .Translator::numberToLocale( $sconto ). " & euro ;
2017-09-07 16:51:14 +02:00
</ td >
2017-09-13 11:15:31 +02:00
< td class = 'cell-padded text-center' >
2017-09-21 10:01:07 +02:00
" .Translator::numberToLocale( $imponibile - $sconto ). " & euro ;
2017-09-13 11:15:31 +02:00
</ td > " ;
}
echo "
< td class = 'cell-padded text-center' >
2017-09-21 10:01:07 +02:00
" .Translator::numberToLocale( $iva ). " & euro ;
2017-09-07 16:51:14 +02:00
</ td >
2017-09-13 11:15:31 +02:00
< td class = 'cell-padded text-center' >
2017-09-21 10:01:07 +02:00
" .Translator::numberToLocale( $totale ).' €
2017-09-07 16:51:14 +02:00
</ td >
</ tr > ' ;
2017-12-14 23:31:18 +01:00
// Rivalsa INPS
if ( $records [ 0 ][ 'rivalsainps' ] != 0 ) {
$rs2 = $dbo -> fetchArray ( 'SELECT percentuale FROM co_rivalsainps WHERE id=(SELECT idrivalsainps FROM co_righe_documenti WHERE iddocumento=' . prepare ( $iddocumento ) . ' AND idrivalsainps!=0 LIMIT 0,1)' );
echo "
< tr >
< th class = 'text-center small' colspan = " .(!empty( $sconto ) ? 3 : 2). " >
" .tr( " Rivalsa INPS _PRC_ % " , [
'_PRC_' => Translator :: numberToLocale ( $rs2 [ 0 ][ 'percentuale' ], 0 ),
], [ 'upper' => true ]) . "
</ th >
< th class = 'text-center small' colspan = " .(!empty( $sconto ) ? 2 : 1). " >
" .tr('Totale documento', [], ['upper' => true]). "
</ th >
</ tr >
< tr >
< td class = 'cell-padded text-center' colspan = " .(!empty( $sconto ) ? 3 : 2). " >
" .Translator::numberToLocale( $records[0] ['rivalsainps']). " & euro ;
</ td >
< td class = 'cell-padded text-center' colspan = " .(!empty( $sconto ) ? 2 : 1). " >
" .Translator::numberToLocale( $totale + $records[0] ['rivalsainps']).' €
</ td >
</ tr > ' ;
}
2017-09-13 11:15:31 +02:00
// Ritenuta d'acconto
2017-09-12 16:17:11 +02:00
if ( $records [ 0 ][ 'ritenutaacconto' ] != 0 ) {
2017-09-07 16:51:14 +02:00
$rs2 = $dbo -> fetchArray ( 'SELECT percentuale FROM co_ritenutaacconto WHERE id=(SELECT idritenutaacconto FROM co_righe_documenti WHERE iddocumento=' . prepare ( $iddocumento ) . ' AND idritenutaacconto!=0 LIMIT 0,1)' );
echo "
< tr >
2017-09-13 11:15:31 +02:00
< th class = 'text-center small' colspan = " .(!empty( $sconto ) ? 3 : 2). " >
" .tr( " Ritenuta d ' acconto _PRC_ % " , [
'_PRC_' => Translator :: numberToLocale ( $rs2 [ 0 ][ 'percentuale' ], 0 ),
], [ 'upper' => true ]) . "
</ th >
< th class = 'text-center small' colspan = " .(!empty( $sconto ) ? 2 : 1). " >
" .tr('Netto a pagare', [], ['upper' => true]). "
</ th >
2017-09-07 16:51:14 +02:00
</ tr >
< tr >
2017-09-13 11:15:31 +02:00
< td class = 'cell-padded text-center' colspan = " .(!empty( $sconto ) ? 3 : 2). " >
2017-09-21 10:01:07 +02:00
" .Translator::numberToLocale( $records[0] ['ritenutaacconto']). " & euro ;
2017-09-07 16:51:14 +02:00
</ td >
2017-09-13 11:15:31 +02:00
< td class = 'cell-padded text-center' colspan = " .(!empty( $sconto ) ? 2 : 1). " >
2017-09-21 10:01:07 +02:00
" .Translator::numberToLocale( $totale - $records[0] ['ritenutaacconto']).' €
2017-09-07 16:51:14 +02:00
</ td >
</ tr > ' ;
}
echo '
</ table > ' ;
echo '
< table style = " font-size:7pt; color:#999; " >
2017-09-13 11:15:31 +02:00
< tr >
< td style = " text-align:center; " >
$dicitura_fissa_fattura $
</ td >
</ tr >
2017-09-07 16:51:14 +02:00
</ table >
2017-09-21 10:18:08 +02:00
$default_footer $ ' ;