2018-02-19 11:25:56 +01:00
|
|
|
<?php
|
|
|
|
|
2019-03-29 12:46:17 +01:00
|
|
|
use Modules\Preventivi\Preventivo;
|
|
|
|
|
2018-02-19 11:25:56 +01:00
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
// Info contratto
|
2019-03-29 12:46:17 +01:00
|
|
|
$documento = Preventivo::find($id_record);
|
2018-02-19 11:25:56 +01:00
|
|
|
|
|
|
|
// Impostazioni per la gestione
|
|
|
|
$options = [
|
2019-05-04 06:39:18 +02:00
|
|
|
'op' => 'manage_riga',
|
2018-02-19 11:25:56 +01:00
|
|
|
'action' => 'edit',
|
2019-03-29 12:46:17 +01:00
|
|
|
'dir' => $documento->direzione,
|
|
|
|
'idanagrafica' => $documento['idanagrafica'],
|
2019-07-11 17:44:42 +02:00
|
|
|
'totale_imponibile' => $documento->totale_imponibile,
|
2020-08-17 16:25:01 +02:00
|
|
|
'select-options' => [
|
|
|
|
'articoli' => [
|
|
|
|
'idanagrafica' => $documento->idanagrafica,
|
|
|
|
'dir' => $documento->direzione,
|
2020-08-18 09:53:58 +02:00
|
|
|
'permetti_movimento_a_zero' => 1,
|
2020-08-17 16:25:01 +02:00
|
|
|
],
|
|
|
|
],
|
2018-02-19 11:25:56 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
// Dati della riga
|
2020-07-06 13:19:20 +02:00
|
|
|
$id_riga = get('riga_id');
|
|
|
|
$type = get('riga_type');
|
2020-01-17 17:31:07 +01:00
|
|
|
$riga = $documento->getRiga($type, $id_riga);
|
2019-03-29 12:46:17 +01:00
|
|
|
|
|
|
|
$result = $riga->toArray();
|
2020-02-14 17:43:39 +01:00
|
|
|
$result['prezzo'] = $riga->prezzo_unitario;
|
2018-02-19 11:25:56 +01:00
|
|
|
|
|
|
|
// Importazione della gestione dedicata
|
|
|
|
$file = 'riga';
|
2019-03-29 12:46:17 +01:00
|
|
|
if ($riga->isDescrizione()) {
|
2018-02-19 11:25:56 +01:00
|
|
|
$file = 'descrizione';
|
2019-05-04 06:39:18 +02:00
|
|
|
|
|
|
|
$options['op'] = 'manage_descrizione';
|
2019-03-29 12:46:17 +01:00
|
|
|
} elseif ($riga->isArticolo()) {
|
2018-02-19 11:25:56 +01:00
|
|
|
$file = 'articolo';
|
2019-05-04 06:39:18 +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 11:25:56 +01:00
|
|
|
}
|
|
|
|
echo App::load($file.'.php', $result, $options);
|