mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +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:
parent
b0bff16f0d
commit
721f7e3219
@ -192,6 +192,19 @@ if (!empty($records[0]['note'])) {
|
||||
<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
|
||||
$imponibile = sum($imponibile);
|
||||
$iva = sum($iva);
|
||||
|
@ -102,22 +102,22 @@ echo '
|
||||
</td>';
|
||||
|
||||
// TOTALI
|
||||
$width = round(100/(!empty($sconto) ? 5 : 3), 2);
|
||||
$width = round(100 / (!empty($sconto) ? 5 : 3), 2);
|
||||
echo "
|
||||
<tr>
|
||||
<th class='text-center small' style='width:".$width."'>
|
||||
".tr('Imponibile', [], ['upper' => true])."
|
||||
</th>";
|
||||
".tr('Imponibile', [], ['upper' => true]).'
|
||||
</th>';
|
||||
|
||||
if (!empty($sconto)) {
|
||||
echo "
|
||||
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>";
|
||||
".tr('Imponibile scontato', [], ['upper' => true]).'
|
||||
</th>';
|
||||
}
|
||||
|
||||
echo "
|
||||
@ -132,8 +132,8 @@ echo "
|
||||
|
||||
<tr>
|
||||
<td class='cell-padded text-center'>
|
||||
".Translator::numberToLocale($imponibile)." €
|
||||
</td>";
|
||||
".Translator::numberToLocale($imponibile).' €
|
||||
</td>';
|
||||
|
||||
if (!empty($sconto)) {
|
||||
echo "
|
||||
@ -143,11 +143,11 @@ if (!empty($sconto)) {
|
||||
</td>
|
||||
|
||||
<td class='cell-padded text-center'>
|
||||
".Translator::numberToLocale($imponibile - $sconto)." €
|
||||
</td>";
|
||||
".Translator::numberToLocale($imponibile - $sconto).' €
|
||||
</td>';
|
||||
}
|
||||
|
||||
echo "
|
||||
echo "
|
||||
<td class='cell-padded text-center'>
|
||||
".Translator::numberToLocale($iva)." €
|
||||
</td>
|
||||
@ -157,58 +157,120 @@ if (!empty($sconto)) {
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
// 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)');
|
||||
// Aggiunta della marca da bollo al totale
|
||||
$totale = sum($totale, $records[0]['bollo']);
|
||||
|
||||
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>
|
||||
// Rivalsa INPS
|
||||
if (!empty($records[0]['rivalsainps'])) {
|
||||
$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)');
|
||||
|
||||
<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'])." €
|
||||
</td>
|
||||
|
||||
<td class='cell-padded text-center' colspan=".(!empty($sconto) ? 2 : 1).">
|
||||
".Translator::numberToLocale($totale + $records[0]['rivalsainps']).' €
|
||||
</td>
|
||||
</tr>';
|
||||
$first_colspan = 3;
|
||||
$second_colspan = 2;
|
||||
if (abs($records[0]['bollo']) > 0) {
|
||||
--$first_colspan;
|
||||
}
|
||||
if (empty($sconto)) {
|
||||
--$first_colspan;
|
||||
--$second_colspan;
|
||||
}
|
||||
|
||||
// Ritenuta d'acconto
|
||||
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 "
|
||||
echo '
|
||||
<tr>
|
||||
<th class='text-center small' colspan=".(!empty($sconto) ? 3 : 2).">
|
||||
".tr("Ritenuta d'acconto _PRC_%", [
|
||||
<th class="text-center small" colspan="'.$first_colspan.'">
|
||||
'.tr('Rivalsa INPS _PRC_%', [
|
||||
'_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0),
|
||||
], ['upper' => true])."
|
||||
</th>
|
||||
], ['upper' => true]).'
|
||||
</th>';
|
||||
|
||||
<th class='text-center small' colspan=".(!empty($sconto) ? 2 : 1).">
|
||||
".tr('Netto a pagare', [], ['upper' => true])."
|
||||
if (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('Totale documento', [], ['upper' => true]).'
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='cell-padded text-center' colspan=".(!empty($sconto) ? 3 : 2).">
|
||||
".Translator::numberToLocale($records[0]['ritenutaacconto'])." €
|
||||
</td>
|
||||
<td class="cell-padded text-center" colspan="'.$first_colspan.'">
|
||||
'.Translator::numberToLocale($records[0]['rivalsainps']).' €
|
||||
</td>';
|
||||
|
||||
<td class='cell-padded text-center' colspan=".(!empty($sconto) ? 2 : 1).">
|
||||
".Translator::numberToLocale($totale - $records[0]['ritenutaacconto']).' €
|
||||
if (abs($records[0]['bollo']) > 0) {
|
||||
echo '
|
||||
|
||||
<td class="cell-padded text-center" colspan="1">
|
||||
'.Translator::numberToLocale($records[0]['bollo']).' €
|
||||
</td>';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
||||
<td class="cell-padded text-center" colspan="'.$second_colspan.'">
|
||||
'.Translator::numberToLocale($totale + $records[0]['rivalsainps']).' €
|
||||
</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']).' €
|
||||
</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']).' €
|
||||
</td>';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
||||
<td class="cell-padded text-center" colspan="'.$second_colspan.'">
|
||||
'.Translator::numberToLocale($totale - $records[0]['ritenutaacconto']).' €
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
@ -10,6 +10,10 @@ $records = $dbo->fetchArray('SELECT *,
|
||||
(SELECT dir FROM co_tipidocumento WHERE id=idtipodocumento) AS dir
|
||||
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';
|
||||
|
||||
$id_cliente = $records[0]['idanagrafica'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user