1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-26 07:44:02 +01:00
openstamanager/modules/interventi/row-edit.php

75 lines
2.3 KiB
PHP
Raw Normal View History

2019-03-29 12:46:17 +01:00
<?php
2020-09-07 15:04:06 +02:00
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
2021-01-20 15:08:51 +01:00
* Copyright (C) DevCode s.r.l.
2020-09-07 15:04:06 +02:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2019-03-29 12:46:17 +01:00
use Modules\Interventi\Intervento;
include_once __DIR__.'/../../core.php';
$documento = Intervento::find($id_record);
$show_prezzi = Auth::user()['gruppo'] != 'Tecnici' || (Auth::user()['gruppo'] == 'Tecnici' && setting('Mostra i prezzi al tecnico'));
2019-03-29 12:46:17 +01:00
// Impostazioni per la gestione
$options = [
'op' => 'manage_riga',
'action' => 'edit',
'dir' => $documento->direzione,
'idanagrafica' => $documento['idanagrafica'],
'totale_imponibile_documento' => $documento->totale_imponibile,
'totale_documento' => $documento->totale,
'nascondi_prezzi' => !$show_prezzi,
2020-08-17 16:25:01 +02:00
'select-options' => [
'articoli' => [
'idanagrafica' => $documento->idanagrafica,
'dir' => $documento->direzione,
'idsede_partenza' => $documento->idsede_partenza,
'idsede_destinazione' => $documento->idsede_destinazione,
'permetti_movimento_a_zero' => 0,
2020-08-17 16:25:01 +02:00
],
'impianti' => [
'idintervento' => $documento->id,
],
],
2019-03-29 12:46:17 +01:00
];
// Dati della riga
$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;
2019-03-29 12:46:17 +01:00
// Importazione della gestione dedicata
$file = 'riga';
if ($riga->isDescrizione()) {
$file = 'descrizione';
$options['op'] = 'manage_descrizione';
} elseif ($riga->isArticolo()) {
$file = 'articolo';
$options['op'] = 'manage_articolo';
} elseif ($riga->isSconto()) {
$file = 'sconto';
$options['op'] = 'manage_sconto';
}
echo App::load($file.'.php', $result, $options);