2018-02-19 17:57:27 +01:00
|
|
|
<?php
|
|
|
|
|
2019-03-29 12:46:17 +01:00
|
|
|
use Modules\Fatture\Fattura;
|
2018-02-19 17:57:27 +01:00
|
|
|
|
2019-03-29 12:46:17 +01:00
|
|
|
include_once __DIR__.'/../../core.php';
|
2018-02-19 17:57:27 +01:00
|
|
|
|
2019-03-29 12:46:17 +01:00
|
|
|
$documento = Fattura::find($id_record);
|
2018-02-19 17:57:27 +01:00
|
|
|
|
|
|
|
// Impostazioni per la gestione
|
|
|
|
$options = [
|
2018-10-04 17:25:42 +02:00
|
|
|
'op' => 'manage_riga',
|
2018-02-19 17:57:27 +01:00
|
|
|
'action' => 'edit',
|
2019-03-29 12:46:17 +01:00
|
|
|
'dir' => $documento->direzione,
|
|
|
|
'conti' => $documento->direzione == 'entrata' ? 'conti-vendite' : 'conti-acquisti',
|
|
|
|
'idanagrafica' => $documento['idanagrafica'],
|
|
|
|
'show-ritenuta-contributi' => !empty($documento['id_ritenuta_contributi']),
|
2019-07-11 17:44:42 +02:00
|
|
|
'totale_imponibile' => $documento->totale_imponibile,
|
2018-02-19 17:57:27 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
// Dati della riga
|
2019-03-29 12:46:17 +01:00
|
|
|
$id_riga = get('idriga');
|
|
|
|
$riga = $documento->getRighe()->find($id_riga);
|
2018-02-19 17:57:27 +01:00
|
|
|
|
2019-03-29 12:46:17 +01:00
|
|
|
$result = $riga->toArray();
|
|
|
|
$result['prezzo'] = $riga->prezzo_unitario_vendita;
|
2018-02-19 17:57:27 +01:00
|
|
|
|
|
|
|
// Importazione della gestione dedicata
|
|
|
|
$file = 'riga';
|
2019-03-29 12:46:17 +01:00
|
|
|
if ($riga->isDescrizione()) {
|
2018-02-19 17:57:27 +01:00
|
|
|
$file = 'descrizione';
|
2018-11-23 12:43:45 +01:00
|
|
|
|
2018-11-12 12:18:23 +01:00
|
|
|
$options['op'] = 'manage_descrizione';
|
2019-03-29 12:46:17 +01:00
|
|
|
} elseif ($riga->isArticolo()) {
|
2018-02-19 17:57:27 +01:00
|
|
|
$file = 'articolo';
|
2018-11-23 12:43:45 +01:00
|
|
|
|
2018-10-04 17:25:42 +02:00
|
|
|
$options['op'] = 'manage_articolo';
|
2019-03-29 12:46:17 +01:00
|
|
|
} elseif ($riga->isSconto()) {
|
|
|
|
$file = 'sconto';
|
|
|
|
|
|
|
|
$options['op'] = 'manage_sconto';
|
2018-02-19 17:57:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
echo App::load($file.'.php', $result, $options);
|