1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-19 21:10:49 +01:00

Aggiunta marca da bollo in fatture (#73)

Aggiunta la marca da bollo all'interno della stampa delle fatture, secondo le modalità indicate nell'issue relativa #73.
Il posto per l'applicazione sul documento è stato impostato a 2cm*2cm.
This commit is contained in:
Thomas Zilio 2017-12-15 19:03:36 +01:00
parent b0bff16f0d
commit 721f7e3219
3 changed files with 130 additions and 51 deletions

View File

@ -192,6 +192,19 @@ if (!empty($records[0]['note'])) {
<p>'.nl2br($records[0]['note']).'</p>'; <p>'.nl2br($records[0]['note']).'</p>';
} }
if (abs($records[0]['bollo']) > 0) {
echo '
<br>
<table style="width: 20mm; font-size: 50%; text-align: center" class="table-bordered">
<tr>
<td style="height: 20mm;">
<br><br>
'.tr('Spazio per applicazione marca da bollo', [], ['upper' => true]).'
</td>
</tr>
</table>';
}
// Info per il footer // Info per il footer
$imponibile = sum($imponibile); $imponibile = sum($imponibile);
$iva = sum($iva); $iva = sum($iva);

View File

@ -102,22 +102,22 @@ echo '
</td>'; </td>';
// TOTALI // TOTALI
$width = round(100/(!empty($sconto) ? 5 : 3), 2); $width = round(100 / (!empty($sconto) ? 5 : 3), 2);
echo " echo "
<tr> <tr>
<th class='text-center small' style='width:".$width."'> <th class='text-center small' style='width:".$width."'>
".tr('Imponibile', [], ['upper' => true])." ".tr('Imponibile', [], ['upper' => true]).'
</th>"; </th>';
if (!empty($sconto)) { if (!empty($sconto)) {
echo " echo "
<th class='text-center small' style='width:".$width."'> <th class='text-center small' style='width:".$width."'>
".tr('Sconto', [], ['upper' => true])." ".tr('Sconto', [], ['upper' => true])."
</th> </th>
<th class='text-center small' style='width:".$width."'> <th class='text-center small' style='width:".$width."'>
".tr('Imponibile scontato', [], ['upper' => true])." ".tr('Imponibile scontato', [], ['upper' => true]).'
</th>"; </th>';
} }
echo " echo "
@ -132,8 +132,8 @@ echo "
<tr> <tr>
<td class='cell-padded text-center'> <td class='cell-padded text-center'>
".Translator::numberToLocale($imponibile)." &euro; ".Translator::numberToLocale($imponibile).' &euro;
</td>"; </td>';
if (!empty($sconto)) { if (!empty($sconto)) {
echo " echo "
@ -143,11 +143,11 @@ if (!empty($sconto)) {
</td> </td>
<td class='cell-padded text-center'> <td class='cell-padded text-center'>
".Translator::numberToLocale($imponibile - $sconto)." &euro; ".Translator::numberToLocale($imponibile - $sconto).' &euro;
</td>"; </td>';
} }
echo " echo "
<td class='cell-padded text-center'> <td class='cell-padded text-center'>
".Translator::numberToLocale($iva)." &euro; ".Translator::numberToLocale($iva)." &euro;
</td> </td>
@ -157,58 +157,120 @@ if (!empty($sconto)) {
</td> </td>
</tr>'; </tr>';
// Rivalsa INPS // Aggiunta della marca da bollo al totale
if ($records[0]['rivalsainps'] != 0) { $totale = sum($totale, $records[0]['bollo']);
$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 " // Rivalsa INPS
<tr> if (!empty($records[0]['rivalsainps'])) {
<th class='text-center small' colspan=".(!empty($sconto) ? 3 : 2)."> $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)');
".tr("Rivalsa INPS _PRC_%", [
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0),
], ['upper' => true])."
</th>
<th class='text-center small' colspan=".(!empty($sconto) ? 2 : 1)."> $first_colspan = 3;
".tr('Totale documento', [], ['upper' => true])." $second_colspan = 2;
</th> if (abs($records[0]['bollo']) > 0) {
</tr> --$first_colspan;
}
<tr> if (empty($sconto)) {
<td class='cell-padded text-center' colspan=".(!empty($sconto) ? 3 : 2)."> --$first_colspan;
".Translator::numberToLocale($records[0]['rivalsainps'])." &euro; --$second_colspan;
</td>
<td class='cell-padded text-center' colspan=".(!empty($sconto) ? 2 : 1).">
".Translator::numberToLocale($totale + $records[0]['rivalsainps']).' &euro;
</td>
</tr>';
} }
// Ritenuta d'acconto echo '
if ($records[0]['ritenutaacconto'] != 0) {
$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> <tr>
<th class='text-center small' colspan=".(!empty($sconto) ? 3 : 2)."> <th class="text-center small" colspan="'.$first_colspan.'">
".tr("Ritenuta d'acconto _PRC_%", [ '.tr('Rivalsa INPS _PRC_%', [
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0), '_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0),
], ['upper' => true])." ], ['upper' => true]).'
</th> </th>';
<th class='text-center small' colspan=".(!empty($sconto) ? 2 : 1)."> if (abs($records[0]['bollo']) > 0) {
".tr('Netto a pagare', [], ['upper' => true])." echo '
<th class="text-center small" colspan="1">
'.tr('Marca da bollo', [], ['upper' => true]).'
</th>';
}
echo '
<th class="text-center small" colspan="'.$second_colspan.'">
'.tr('Totale documento', [], ['upper' => true]).'
</th> </th>
</tr> </tr>
<tr> <tr>
<td class='cell-padded text-center' colspan=".(!empty($sconto) ? 3 : 2)."> <td class="cell-padded text-center" colspan="'.$first_colspan.'">
".Translator::numberToLocale($records[0]['ritenutaacconto'])." &euro; '.Translator::numberToLocale($records[0]['rivalsainps']).' &euro;
</td> </td>';
<td class='cell-padded text-center' colspan=".(!empty($sconto) ? 2 : 1)."> if (abs($records[0]['bollo']) > 0) {
".Translator::numberToLocale($totale - $records[0]['ritenutaacconto']).' &euro; echo '
<td class="cell-padded text-center" colspan="1">
'.Translator::numberToLocale($records[0]['bollo']).' &euro;
</td>';
}
echo '
<td class="cell-padded text-center" colspan="'.$second_colspan.'">
'.Translator::numberToLocale($totale + $records[0]['rivalsainps']).' &euro;
</td>
</tr>';
}
// Ritenuta d'acconto
if (!empty($records[0]['ritenutaacconto'])) {
$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)');
$first_colspan = 3;
$second_colspan = 2;
if (empty($records[0]['rivalsainps']) && abs($records[0]['bollo']) > 0) {
--$first_colspan;
}
if (empty($sconto)) {
--$first_colspan;
--$second_colspan;
}
echo '
<tr>
<th class="text-center small" colspan="'.$first_colspan.'">
'.tr("Ritenuta d'acconto _PRC_%", [
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0),
], ['upper' => true]).'
</th>';
if (empty($records[0]['rivalsainps']) && abs($records[0]['bollo']) > 0) {
echo '
<th class="text-center small" colspan="1">
'.tr('Marca da bollo', [], ['upper' => true]).'
</th>';
}
echo '
<th class="text-center small" colspan="'.$second_colspan.'">
'.tr('Netto a pagare', [], ['upper' => true]).'
</th>
</tr>
<tr>
<td class="cell-padded text-center" colspan="'.$first_colspan.'">
'.Translator::numberToLocale($records[0]['ritenutaacconto']).' &euro;
</td>';
if (empty($records[0]['rivalsainps']) && abs($records[0]['bollo']) > 0) {
echo '
<td class="cell-padded text-center" colspan="1">
'.Translator::numberToLocale($records[0]['bollo']).' &euro;
</td>';
}
echo '
<td class="cell-padded text-center" colspan="'.$second_colspan.'">
'.Translator::numberToLocale($totale - $records[0]['ritenutaacconto']).' &euro;
</td> </td>
</tr>'; </tr>';
} }

View File

@ -10,6 +10,10 @@ $records = $dbo->fetchArray('SELECT *,
(SELECT dir FROM co_tipidocumento WHERE id=idtipodocumento) AS dir (SELECT dir FROM co_tipidocumento WHERE id=idtipodocumento) AS dir
FROM co_documenti WHERE id='.prepare($iddocumento)); FROM co_documenti WHERE id='.prepare($iddocumento));
$records[0]['rivalsainps'] = floatval($records[0]['rivalsainps']);
$records[0]['ritenutaacconto'] = floatval($records[0]['ritenutaacconto']);
$records[0]['bollo'] = floatval($records[0]['bollo']);
$module_name = ($records[0]['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto'; $module_name = ($records[0]['dir'] == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto';
$id_cliente = $records[0]['idanagrafica']; $id_cliente = $records[0]['idanagrafica'];