Skip to content

Commit 9a79b8a

Browse files
fix: visualizzazione riferimenti import FE
1 parent 80b7230 commit 9a79b8a

File tree

1 file changed

+48
-9
lines changed

1 file changed

+48
-9
lines changed

plugins/importFE/generate.php

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,13 @@ function cleanup(){
451451
'data' => (new Carbon($dato['Data']))->format('d/m/Y'),
452452
];
453453
}
454+
455+
if (!$dato['RiferimentoNumeroLinea']) {
456+
$dati_ordini_documento[] = [
457+
'numero' => $dato['IdDocumento'],
458+
'data' => ( new Carbon($dato['Data']) )->format('d/m/Y'),
459+
];
460+
}
454461
}
455462

456463
// Riorganizzazione dati ordini per numero di riga
@@ -462,6 +469,13 @@ function cleanup(){
462469
'data' => (new Carbon($dato['DataDDT']))->format('d/m/Y'),
463470
];
464471
}
472+
473+
if (!$dato['RiferimentoNumeroLinea']) {
474+
$dati_ddt_documento[] = [
475+
'numero' => $dato['NumeroDDT'],
476+
'data' => ( new Carbon($dato['DataDDT']) )->format('d/m/Y'),
477+
];
478+
}
465479
}
466480

467481
foreach ($righe as $key => $riga) {
@@ -568,25 +582,50 @@ function cleanup(){
568582
}
569583
}
570584

571-
$riferimento_fe = '';
572-
585+
$riferimento_fe = [];
586+
if ($dati_ordini[(int) $riga['NumeroLinea']]) {
587+
$riferimento_fe[] = tr('Ordine _NUMERO_ del _DATA_',
588+
[
589+
'_NUMERO_' => $dati_ordini[(int) $riga['NumeroLinea']]['numero'],
590+
'_DATA_' => $dati_ordini[(int) $riga['NumeroLinea']]['data'],
591+
]);
592+
}
593+
if ($dati_ordini_documento) {
594+
foreach ($dati_ordini_documento as $ordine) {
595+
$riferimento_fe[] = tr('Ordine _NUMERO_ del _DATA_',
596+
[
597+
'_NUMERO_' => $ordine['numero'],
598+
'_DATA_' => $ordine['data'],
599+
]);
600+
}
601+
}
573602
if ($dati_ddt[(int) $riga['NumeroLinea']]) {
574-
$riferimento_fe = tr('DDT _NUMERO_ del _DATA_',
603+
$riferimento_fe[] = tr('DDT _NUMERO_ del _DATA_',
575604
[
576605
'_NUMERO_' => $dati_ddt[(int) $riga['NumeroLinea']]['numero'],
577606
'_DATA_' => $dati_ddt[(int) $riga['NumeroLinea']]['data'],
578607
]);
579608
}
609+
if ($dati_ddt_documento) {
610+
foreach ($dati_ddt_documento as $ddt) {
611+
$riferimento_fe[] = tr('DDT _NUMERO_ del _DATA_',
612+
[
613+
'_NUMERO_' => $ddt['numero'],
614+
'_DATA_' => $ddt['data'],
615+
]);
616+
}
617+
}
580618

581619
echo '
582-
<tr data-id="'.$key.'" data-qta="'.$qta.'" data-descrizione="'.$riga['Descrizione'].'" data-prezzo_unitario="'.$prezzo_unitario.'" data-iva_percentuale="'.$riga['AliquotaIVA'].'">
620+
<tr data-id="'.$key.'" data-qta="'.$qta.'" data-descrizione="'.$riga['Descrizione'].'" data-prezzo_unitario="'.$prezzo_unitario.'" data-iva_percentuale="'.$riga['AliquotaIVA'].'" data-sconto_unitario="'.$sconto_unitario.'">
583621
<td>
584622
'.(empty($codice_principale) ? '<div style="padding:7px;" class="badge badge-warning pull-right text-muted articolo-warning hidden">'.tr('Creazione automatica articolo non disponibile').'</div>' : '<label class="badge badge-success pull-right text-muted articolo-warning hidden"><input class="check" type="checkbox" name="crea_articoli['.$key.']"/> <span style="position:relative;top:-2px;" >'.tr('Crea automaticamente questo articolo').'</span></label>').'
585-
<small class="pull-right text-muted" id="riferimento_'.$key.'"></small><br>
586-
<small class="pull-right text-muted">'.$riferimento_fe.'</small>
587-
623+
<small class="pull-right text-muted" id="riferimento_'.$key.'"></small>';
624+
if (!empty($riferimento_fe)) {
625+
echo '<small class="pull-right text-muted">'.implode('<br>', $riferimento_fe).'</small>';
626+
}
588627

589-
'.$riga['Descrizione'].'<br>
628+
echo $riga['Descrizione'].'<br>
590629
591630
'.(!empty($codici_articoli) ? '<small>'.implode(', ', $codici_articoli).'</small><br>' : '').'
592631
@@ -903,7 +942,7 @@ function impostaRiferimento(id_riga, documento, riga) {
903942
impostaContenuto(riga_fe.data("qta"), riga.qta, (riga.um ? " " + riga.um : ""), "#riferimento_" + id_riga + "_qta", true);
904943
905944
// Informazioni visibili sul prezzo unitario
906-
impostaContenuto(riga_fe.data("prezzo_unitario"), riga.prezzo_unitario, " " + globals.currency, "#riferimento_" + id_riga + "_prezzo", true);
945+
impostaContenuto(riga_fe.data("prezzo_unitario")-riga_fe.data("sconto_unitario"), riga.prezzo_unitario, " " + globals.currency, "#riferimento_" + id_riga + "_prezzo", true);
907946
908947
// Informazioni visibili sull\'aliquota IVA
909948
impostaContenuto(riga_fe.data("iva_percentuale"), parseInt(riga.iva_percentuale), "%", "#riferimento_" + id_riga + "_iva", false);

0 commit comments

Comments
 (0)