2017-08-04 16:28:16 +02: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 />.
*/
2017-08-04 16:28:16 +02:00
2024-03-05 16:01:45 +01:00
use Models\Module ;
use Models\Plugin ;
2024-03-22 15:52:24 +01:00
use Modules\Anagrafiche\Anagrafica ;
use Modules\Anagrafiche\Sede ;
2020-08-25 10:07:46 +02:00
2017-08-04 16:28:16 +02:00
include_once __DIR__ . '/../../core.php' ;
2020-02-14 17:02:16 +01:00
$block_edit = $record [ 'flag_completato' ];
2024-06-11 16:58:27 +02:00
$id_modulo_anagrafiche = Module :: where ( 'name' , 'Anagrafiche' ) -> first () -> id ;
2024-04-30 18:03:45 +02:00
$id_segment = $record [ 'id_segment' ];
2020-02-14 17:02:16 +01:00
2021-02-25 15:16:05 +01:00
// Verifica aggiuntive sulla sequenzialità dei numeri
2024-04-10 12:43:32 +02:00
$numero_previsto = verifica_numero_intervento ( $intervento , $id_segment );
2021-05-04 18:22:44 +02:00
2024-01-15 15:30:45 +01:00
if ( ! empty ( $numero_previsto ) && intval ( setting ( 'Verifica numero intervento' ))) {
2021-02-25 15:16:05 +01:00
echo '
2022-01-11 10:50:24 +01:00
< div class = " alert alert-warning alert-dismissable " >
< i class = " fa fa-warning " ></ i > '.tr("E' assente una attività con numero _NUM_ in data precedente o corrispondente al _DATE_ : potrebbero esserci alcuni errori di continuità con la numerazione delle attività " , [
2024-03-22 15:52:24 +01:00
'_DATE_' => dateFormat ( $intervento -> data_richiesta ),
'_NUM_' => '"' . $numero_previsto . '"' ,
]) . ' .</ b >
2022-01-11 10:50:24 +01:00
< button aria - hidden = " true " data - dismiss = " alert " class = " close " type = " button " > × </ button >
2021-02-25 15:16:05 +01:00
</ div > ' ;
}
2024-05-03 11:06:25 +02:00
$tags = $database -> fetchArray ( 'SELECT `id_tag` FROM `in_interventi_tags` WHERE id_intervento = ' . prepare ( $id_record ));
$tags = $tags ? array_column ( $tags , 'id_tag' ) : [];
2024-02-22 17:03:32 +01:00
echo '
2024-05-16 18:02:50 +02:00
2024-02-22 17:03:32 +01:00
< br >
2020-08-25 10:07:46 +02:00
< form action = " " method = " post " id = " edit-form " >
2017-08-04 16:28:16 +02:00
< input type = " hidden " name = " op " value = " update " >
< input type = " hidden " name = " backto " value = " record-edit " >
2020-08-25 10:07:46 +02:00
< input type = " hidden " name = " id_record " value = " '. $id_record .' " >
< div class = " row " >
2024-05-02 17:00:11 +02:00
< div class = " col-md-12 " >
2020-08-25 10:07:46 +02:00
<!-- DATI CLIENTE -->
2024-05-16 18:02:50 +02:00
< div class = " card card-primary collapsable '.(empty( $espandi_dettagli ) ? 'collapsed-card' : '').' " >
< div class = " card-header with-border " >
< h3 class = " card-title " > '.tr(' Dati cliente ').' </ h3 >
< div class = " card-tools pull-right " >
2024-05-23 17:51:21 +02:00
< button type = " button " class = " btn btn-xs btn-tool " data - card - widget = " collapse " >
2024-05-02 17:00:11 +02:00
< i class = " fa fa-'.(empty( $espandi_dettagli ) ? 'plus' : 'minus').' " ></ i >
</ button >
</ div >
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
< div class = " card-body " >
2024-05-02 17:00:11 +02:00
<!-- RIGA 1 -->
< div class = " row " >
2024-05-02 17:34:31 +02:00
< div class = " col-md-3 " >
2024-05-02 17:00:11 +02:00
'.Modules::link(' Anagrafiche ', $record[' idanagrafica '], null, null, ' class = " pull-right " ').'
{[ " type " : " select " , " label " : " '.tr('Cliente').' " , " name " : " idanagrafica " , " required " : 1 , " value " : " $idanagrafica $ " , " ajax-source " : " clienti " , " readonly " : " '.( $user['gruppo'] == 'Clienti' ? '1' : $record['flag_completato'] ).' " ]}
</ div >
2024-05-02 17:34:31 +02:00
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " '.tr('Zona').' " , " name " : " idzona " , " values " : " query=SELECT id, CONCAT_WS( \ ' - \ ', nome, descrizione) AS descrizione FROM an_zone ORDER BY nome " , " value " : " $idzona $ " , " placeholder " : " '.tr('Nessuna zona').' " , " extra " : " readonly " , " help " : " '.tr('La zona viene definita automaticamente in base al cliente selezionato.').' " ]}
2024-05-02 17:00:11 +02:00
</ div >
2024-05-02 17:34:31 +02:00
< div class = " col-md-3 " > ' ;
2024-01-15 15:30:45 +01:00
if ( ! empty ( $record [ 'idclientefinale' ])) {
echo '
2024-05-02 17:00:11 +02:00
'.Modules::link(' Anagrafiche ', $record[' idclientefinale '], null, null, ' class = " pull-right " ' );
2024-01-15 15:30:45 +01:00
}
2020-11-09 19:19:55 +01:00
echo '
2024-05-02 17:00:11 +02:00
{[ " type " : " select " , " label " : " '.tr('Per conto di').' " , " name " : " idclientefinale " , " value " : " $idclientefinale $ " , " ajax-source " : " clienti " , " readonly " : " '. $record['flag_completato'] .' " ]}
</ div >
2024-05-02 17:34:31 +02:00
< div class = " col-md-3 " >
2024-06-11 16:58:27 +02:00
{[ " type " : " select " , " label " : " '.tr('Referente').' " , " name " : " idreferente " , " value " : " $idreferente $ " , " ajax-source " : " referenti " , " select-options " : '.json_encode([' idanagrafica ' => $record[' idanagrafica '], ' idclientefinale ' => $record[' idclientefinale '], ' idsede_destinazione ' => $record[' idsede_destinazione ']]).' , " readonly " : " '.intval( $record['flag_completato'] ).' " , " icon-after " : " add|'. $id_modulo_anagrafiche .'|id_plugin='.Plugin::where('name', 'Referenti')->first()->id.'&id_parent='. $record['idanagrafica'] .' " ]}
2024-05-02 17:34:31 +02:00
</ div >
2020-08-25 10:07:46 +02:00
</ div >
2024-05-02 17:00:11 +02:00
<!-- RIGA 2 -->
2024-10-02 09:54:10 +02:00
< div class = " row " >
< div class = " col-md-3 " > ' ;
2024-05-02 17:00:11 +02:00
if ( $record [ 'idagente' ] != 0 ) {
2024-10-16 08:56:08 +02:00
echo Modules :: link ( 'Anagrafiche' , $record [ 'idagente' ], null , null , 'class="pull-right"' );
2024-05-02 17:00:11 +02:00
}
2024-05-09 10:29:53 +02:00
echo '
2024-10-02 09:54:10 +02:00
2024-05-02 17:00:11 +02:00
{[ " type " : " select " , " label " : " '.tr('Agente').' " , " name " : " idagente " , " ajax-source " : " agenti " , " select-options " : { " idanagrafica " : '.$record[' idanagrafica '].' }, " value " : " $idagente $ " ]}
</ div >
2024-10-02 09:54:10 +02:00
2024-05-02 17:34:31 +02:00
< div class = " col-md-3 " > ' ;
2024-05-02 17:00:11 +02:00
echo ! empty ( $record [ 'idpagamento' ]) ? Modules :: link ( 'Pagamenti' , $record [ 'idpagamento' ], null , null , 'class="pull-right"' ) : '' ;
echo '
{[ " type " : " select " , " label " : " '.tr('Pagamento').' " , " name " : " idpagamento " , " required " : 0 , " ajax-source " : " pagamenti " , " value " : " $idpagamento $ " ]}
</ div >
2024-05-02 17:34:31 +02:00
< div class = " col-md-6 " > ' ;
2020-08-25 10:07:46 +02:00
if ( ! empty ( $record [ 'idpreventivo' ])) {
echo '
'.Modules::link(' Preventivi ', $record[' idpreventivo '], null, null, ' class = " pull-right " ' );
}
echo '
2024-06-11 16:58:27 +02:00
{[ " type " : " select " , " label " : " '.tr('Preventivo').' " , " name " : " idpreventivo " , " value " : " '. $record['id_preventivo'] .' " , " ajax-source " : " preventivi " , " select-options " : '.json_encode([' idanagrafica ' => $record[' idanagrafica ']]).' , " readonly " : " '. $record['flag_completato'] .' " , " icon-after " : " add|'.Module::where('name', 'Preventivi')->first()->id.'|pianificabile=1&idanagrafica='. $record['idanagrafica'] .' " ]}
2024-05-02 17:00:11 +02:00
</ div >
2020-08-25 10:07:46 +02:00
2024-05-02 17:34:31 +02:00
< div class = " col-md-6 " > ' ;
2020-08-25 10:07:46 +02:00
2024-01-15 15:30:45 +01:00
$idpreventivo_riga = $dbo -> fetchOne ( 'SELECT id FROM co_promemoria WHERE idintervento=' . prepare ( $id_record ))[ 'id' ];
2020-08-25 10:07:46 +02:00
if ( ! empty ( $record [ 'idcontratto' ])) {
echo '
'.Modules::link(' Contratti ', $record[' idcontratto '], null, null, ' class = " pull-right " ' );
}
echo '
2024-06-11 16:58:27 +02:00
{[ " type " : " select " , " label " : " '.tr('Contratto').' " , " name " : " idcontratto " , " value " : " '. $record['id_contratto'] .' " , " ajax-source " : " contratti " , " select-options " : '.json_encode([' idanagrafica ' => $record[' idanagrafica ']]).' , " readonly " : " '. $record['flag_completato'] .' " , " icon-after " : " add|'.Module::where('name', 'Contratti')->first()->id.'|pianificabile=1&idanagrafica='. $record['idanagrafica'] .' " ]}
2020-08-25 10:07:46 +02:00
2024-05-02 17:00:11 +02:00
< input type = " hidden " name = " idcontratto_riga " value = " '. $idcontratto_riga .' " >
</ div >
2021-03-01 15:01:02 +01:00
2024-05-02 17:34:31 +02:00
< div class = " col-md-6 " > ' ;
2021-03-01 15:01:02 +01:00
2024-01-15 15:30:45 +01:00
$idcontratto_riga = $dbo -> fetchOne ( 'SELECT id FROM co_promemoria WHERE idintervento=' . prepare ( $id_record ))[ 'id' ];
2021-03-01 16:01:19 +01:00
2024-01-15 15:30:45 +01:00
if ( ! empty ( $record [ 'idordine' ])) {
echo '
2021-03-01 15:01:02 +01:00
'.Modules::link(' Ordini cliente ', $record[' idordine '], null, null, ' class = " pull-right " ' );
2024-01-15 15:30:45 +01:00
}
echo '
2021-03-01 15:01:02 +01:00
2024-05-02 17:00:11 +02:00
{[ " type " : " select " , " label " : " '.tr('Ordine').' " , " name " : " idordine " , " value " : " '. $record['id_ordine'] .' " , " ajax-source " : " ordini-cliente " , " select-options " : '.json_encode([' idanagrafica ' => $record[' idanagrafica ']]).' , " readonly " : " '. $record['flag_completato'] .' " ]}
</ div >
2024-03-19 18:40:27 +01:00
</ div >
</ div >
2020-08-25 10:07:46 +02:00
</ div >
</ div >
2024-05-02 17:00:11 +02:00
</ div >
</ div > ' ;
2020-08-25 10:07:46 +02:00
$anagrafica_cliente = $intervento -> anagrafica ;
$sede_cliente = $anagrafica_cliente -> sedeLegale ;
if ( ! empty ( $intervento -> idsede_destinazione )) {
$sede_cliente = Sede :: find ( $intervento -> idsede_destinazione );
}
$anagrafica_azienda = Anagrafica :: find ( setting ( 'Azienda predefinita' ));
$sede_azienda = $anagrafica_azienda -> sedeLegale ;
?>
<!-- DATI INTERVENTO -->
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " >< ? php echo tr ( 'Dati intervento' ); ?> </h3>
2020-08-25 10:07:46 +02:00
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2020-08-25 10:07:46 +02:00
<!-- RIGA 3 -->
< div class = " row " >
2024-05-21 14:58:14 +02:00
< div class = " col-md-2 " >
2021-02-25 15:16:05 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Numero'); ?> " , " name " : " codice " , " value " : " $codice $ " , " readonly " : " <?php echo $record['flag_completato'] ; ?> " ]}
2020-08-25 10:07:46 +02:00
</ div >
2024-05-02 17:34:31 +02:00
< div class = " col-md-2 " >
2020-08-25 10:07:46 +02:00
{[ " type " : " timestamp " , " label " : " <?php echo tr('Data/ora richiesta'); ?> " , " name " : " data_richiesta " , " required " : 1 , " value " : " $data_richiesta $ " , " readonly " : " <?php echo $record['flag_completato'] ; ?> " ]}
</ div >
2024-05-02 17:34:31 +02:00
< div class = " col-md-2 " >
2020-08-25 10:07:46 +02:00
{[ " type " : " timestamp " , " label " : " <?php echo tr('Data/ora scadenza'); ?> " , " name " : " data_scadenza " , " required " : 0 , " value " : " $data_scadenza $ " , " readonly " : " <?php echo $record['flag_completato'] ; ?> " ]}
</ div >
2024-05-24 08:42:20 +02:00
< div class = " col-md-3 " >
2024-05-02 17:34:31 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Tipo attività'); ?> " , " name " : " idtipointervento " , " required " : 1 , " ajax-source " : " tipiintervento " , " value " : " $idtipointervento $ " , " readonly " : " <?php echo $record['flag_completato'] ; ?> " ]}
2020-08-25 10:07:46 +02:00
</ div >
2024-05-24 08:42:20 +02:00
< div class = " col-md-3 " >
2024-06-29 01:36:59 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstatointervento " , " required " : 1 , " values " : " query=SELECT `in_statiintervento`.`id`, `title` as descrizione, `colore` AS _bgcolor_ FROM `in_statiintervento` LEFT JOIN `in_statiintervento_lang` ON (`in_statiintervento`.`id` = `in_statiintervento_lang`.`id_record` AND `in_statiintervento_lang`.`id_lang` =<?php echo prepare(Models \ Locale::getDefault()->id); ?>) WHERE `deleted_at` IS NULL ORDER BY `title` " , " value " : " $idstatointervento $ " , " class " : " unblockable " ]}
2024-05-24 08:42:20 +02:00
</ div >
2020-08-25 10:07:46 +02:00
</ div >
2020-08-04 18:33:28 +02:00
< ? php
$tecnici_assegnati = $database -> fetchArray ( 'SELECT id_tecnico FROM in_interventi_tecnici_assegnati WHERE id_intervento = ' . prepare ( $id_record ));
$tecnici_assegnati = array_column ( $tecnici_assegnati , 'id_tecnico' );
echo '
2024-05-02 17:34:31 +02:00
<!-- RIGA 4 -->
< div class = " row " >
2024-06-29 01:36:59 +02:00
< div class = " col-md-3 " >
2024-03-05 16:01:45 +01:00
{[ " type " : " select " , " label " : " '.tr('Tecnici assegnati').' " , " multiple " : " 1 " , " name " : " tecnici_assegnati[] " , " ajax-source " : " tecnici " , " value " : " '.implode(',', $tecnici_assegnati ).' " , " icon-after " : " add|'. $id_modulo_anagrafiche .'|tipoanagrafica=Tecnico&readonly_tipo=1 " ]}
2024-01-11 17:55:15 +01:00
</ div >
2024-05-02 17:34:31 +02:00
' ;
2024-05-09 10:29:53 +02:00
// Conteggio numero articoli intervento per eventuale blocco della sede di partenza
$articoli = $intervento -> articoli ;
echo '
2024-06-29 01:36:59 +02:00
< div class = " col-md-3 " >
2024-05-02 17:34:31 +02:00
{[ " type " : " select " , " label " : " '.tr('Partenza merce').' " , " name " : " idsede_partenza " , " ajax-source " : " sedi_azienda " , " value " : " $idsede_partenza $ " , " readonly " : " '.(( $record['flag_completato'] || ! $articoli->isEmpty ()) ? 1 : 0).' " ]}
</ div >
2024-06-29 01:36:59 +02:00
< div class = " col-md-3 " >
2024-05-02 17:34:31 +02:00
{[ " type " : " select " , " label " : " '.tr('Sede destinazione').' " , " name " : " idsede_destinazione " , " value " : " $idsede_destinazione $ " , " ajax-source " : " sedi " , " select-options " : '.json_encode([' idanagrafica ' => $record[' idanagrafica ']]).' , " placeholder " : " '.tr('Sede legale').' " , " readonly " : " '. $record['flag_completato'] .' " ]}
</ div >
2024-06-29 01:36:59 +02:00
< div class = " col-md-3 " >
2024-07-02 12:39:01 +02:00
{[ " type " : " select " , " label " : " '.tr('Tags').' " , " multiple " : " 1 " , " name " : " tags[] " , " values " : " query=SELECT `id`, `name` as descrizione FROM `in_tags` ORDER BY `name` " , " value " : " '.implode(',', $tags ).' " , " icon-after " : " add|'.Module::where('name', 'Tags')->first()->id.'| " ]}
2024-06-29 01:36:59 +02:00
</ div >
2020-08-25 10:07:46 +02:00
</ div >
<!-- RIGA 5 -->
< div class = " row " >
2024-05-21 14:58:14 +02:00
< div class = " col-lg-6 " > ' ;
2024-01-31 14:23:46 +01:00
echo input ([
'type' => 'ckeditor' ,
'label' => tr ( 'Richiesta' ),
'name' => 'richiesta' ,
'required' => 1 ,
'value' => $record [ 'richiesta' ],
2024-05-02 17:34:31 +02:00
'extra' => 'style=\'max-height:40px;\'' ,
2024-01-31 14:23:46 +01:00
]);
echo '
2020-08-25 10:07:46 +02:00
</ div >
2024-05-21 14:58:14 +02:00
< div class = " col-lg-6 " > ' ;
2024-01-31 14:23:46 +01:00
echo input ([
'type' => 'ckeditor' ,
'label' => tr ( 'Descrizione' ),
'name' => 'descrizione' ,
'value' => $record [ 'descrizione' ],
2024-05-02 17:34:31 +02:00
'extra' => 'style=\'max-height:40px;\'' ,
2024-01-31 14:23:46 +01:00
]);
echo '
2024-05-21 14:58:14 +02:00
</ div >
</ div > ' ;
2024-01-15 15:30:45 +01:00
// Nascondo le note interne ai clienti
if ( $user -> gruppo != 'Clienti' ) {
echo '
2024-01-19 15:19:27 +01:00
< div class = " row " >
< div class = " col-md-12 " >
2024-05-21 14:58:14 +02:00
{[ " type " : " textarea " , " label " : " '.tr('Note interne').' " , " name " : " informazioniaggiuntive " , " class " : " autosize " , " value " : " $informazioniaggiuntive $ " , " extra " : " rows= \ '5 \ ' " ]}
2020-08-25 10:07:46 +02:00
</ div >
</ div >
2024-05-21 15:48:07 +02:00
</ div >
</ div > ' ;
2024-05-02 17:34:31 +02:00
}
2024-01-15 15:30:45 +01:00
// Visualizzo solo se l'anagrafica cliente è un ente pubblico
if ( ! empty ( $record [ 'idcontratto' ])) {
$contratto = $dbo -> fetchOne ( 'SELECT num_item,codice_cig,codice_cup,id_documento_fe FROM co_contratti WHERE id = ' . prepare ( $record [ 'idcontratto' ]));
$record [ 'id_documento_fe' ] = $contratto [ 'id_documento_fe' ];
$record [ 'codice_cup' ] = $contratto [ 'codice_cup' ];
$record [ 'codice_cig' ] = $contratto [ 'codice_cig' ];
$record [ 'num_item' ] = $contratto [ 'num_item' ];
}
2019-01-10 18:41:25 +01:00
2024-01-15 15:30:45 +01:00
?>
2018-11-13 14:51:19 +01:00
<!-- Fatturazione Elettronica PA -->
2024-05-21 16:10:24 +02:00
< div class = " card card-primary collapsable collapsed-card " >
2024-05-21 16:26:19 +02:00
< div class = " card-header with-border <?php echo ( $record['tipo_anagrafica'] == 'Ente pubblico' || $record['tipo_anagrafica'] == 'Azienda') ? '' : 'hidden'; ?> " >
2024-05-21 16:10:24 +02:00
< h3 class = " card-title " >< ? php echo tr ( 'Dati appalto' ); ?> </h3>
< div class = " card-tools pull-right " >
2024-05-23 17:51:21 +02:00
< button type = " button " class = " btn btn-tool " data - card - widget = " collapse " >
2024-05-21 16:10:24 +02:00
< i class = " fa fa-plus " ></ i >
</ button >
</ div >
2018-11-09 12:45:22 +01:00
</ div >
2024-05-21 16:10:24 +02:00
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2024-05-21 16:10:24 +02:00
< div class = " card-body " >
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " <?php echo !empty( $record['idcontratto'] ) ? 'span' : 'text'; ?> " , " label " : " <?php echo tr('Identificatore Documento'); ?> " , " name " : " id_documento_fe " , " required " : 0 , " help " : " <?php echo tr('<span>Obbligatorio per valorizzare CIG/CUP. È possible inserire: </span><ul><li>N. determina</li><li>RDO</li><li>Ordine MEPA</li></ul>'); ?> " , " value " : " <?php echo $record['id_documento_fe'] ; ?> " , " maxlength " : 20 , " readonly " : " <?php echo $record['flag_completato'] ; ?> " , " extra " : " " ]}
</ div >
2018-11-09 12:45:22 +01:00
2024-05-21 16:10:24 +02:00
< div class = " col-md-3 " >
{[ " type " : " <?php echo !empty( $record['idcontratto'] ) ? 'span' : 'text'; ?> " , " label " : " <?php echo tr('Numero Riga'); ?> " , " name " : " num_item " , " required " : 0 , " value " : " <?php echo $record['num_item'] ; ?> " , " maxlength " : 15 , " readonly " : " <?php echo $record['flag_completato'] ; ?> " , " extra " : " " ]}
</ div >
2024-05-21 14:58:14 +02:00
2024-05-21 16:10:24 +02:00
< div class = " col-md-3 " >
{[ " type " : " <?php echo !empty( $record['idcontratto'] ) ? 'span' : 'text'; ?> " , " label " : " <?php echo tr('Codice CIG'); ?> " , " name " : " codice_cig " , " required " : 0 , " value " : " <?php echo $record['codice_cig'] ; ?> " , " maxlength " : 15 , " readonly " : " <?php echo $record['flag_completato'] ; ?> " , " extra " : " " ]}
</ div >
2018-11-09 12:45:22 +01:00
2024-05-21 16:10:24 +02:00
< div class = " col-md-3 " >
{[ " type " : " <?php echo !empty( $record['idcontratto'] ) ? 'span' : 'text'; ?> " , " label " : " <?php echo tr('Codice CUP'); ?> " , " name " : " codice_cup " , " required " : 0 , " value " : " <?php echo $record['codice_cup'] ; ?> " , " maxlength " : 15 , " readonly " : " <?php echo $record['flag_completato'] ; ?> " , " extra " : " " ]}
</ div >
</ div >
2018-11-09 12:45:22 +01:00
</ div >
</ div >
</ div >
2023-02-17 10:59:50 +01:00
</ form >
2019-01-10 18:41:25 +01:00
2023-02-17 10:59:50 +01:00
<!-- ORE LAVORO -->
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " >< ? php echo tr ( 'Sessioni di lavoro' ); ?> </h3>
2023-02-17 10:59:50 +01:00
</ div >
2018-11-09 12:45:22 +01:00
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2023-02-17 10:59:50 +01:00
< ? php
2024-05-21 16:26:19 +02:00
if ( $show_prezzi ) {
echo "
2023-02-17 10:59:50 +01:00
< div class = \ " pull-right \" >
< a class = 'btn btn-default btn-details' onclick = \ " $ ('.extra').removeClass('hide'); $ (this).addClass('hide'); $ ('#dontshowall_dettagli').removeClass('hide'); \" id='showall_dettagli'><i class='fa fa-square-o'></i> <?php echo tr('Visualizza dettaglio costi'); ?></a>
< a class = 'btn btn-info btn-details hide' onclick = \ " $ ('.extra').addClass('hide'); $ (this).addClass('hide'); $ ('#showall_dettagli').removeClass('hide'); \" id='dontshowall_dettagli'><i class='fa fa-check-square-o'></i> <?php echo tr('Visualizza dettaglio costi'); ?></a>
</ div >
< div class = \ " clearfix \" ></div>
< br > " ;
2024-05-21 16:26:19 +02:00
}
2024-01-15 15:30:45 +01:00
?>
2017-08-04 16:28:16 +02:00
2023-02-17 10:59:50 +01:00
< div class = " row " >
< div class = " col-md-12 " id = " tecnici " ></ div >
2017-08-04 16:28:16 +02:00
</ div >
2023-02-17 10:59:50 +01:00
</ div >
</ div >
2017-08-04 16:28:16 +02:00
2023-02-17 10:59:50 +01:00
<!-- RIGHE -->
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " >< ? php echo tr ( 'Righe' ); ?> </h3>
2023-02-17 10:59:50 +01:00
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2023-02-17 10:59:50 +01:00
< div class = " row " >
< div class = " col-md-12 " >
2019-07-12 17:35:14 +02:00
2019-03-29 12:46:17 +01:00
< ? php
2020-02-14 17:02:16 +01:00
if ( ! $block_edit ) {
2021-07-28 10:32:33 +02:00
// Lettura preventivi accettati, in attesa di conferma o in lavorazione
2024-02-26 10:50:43 +01:00
$prev_query = ' SELECT
COUNT ( * ) AS tot
FROM
`co_preventivi`
INNER JOIN `co_statipreventivi` ON `co_preventivi` . `idstato` = `co_statipreventivi` . `id`
INNER JOIN `co_righe_preventivi` ON `co_preventivi` . `id` = `co_righe_preventivi` . `idpreventivo`
WHERE
idanagrafica = '.prepare($record[' idanagrafica ']).' AND `co_statipreventivi` . `is_fatturabile` = 1 AND `default_revision` = 1 AND (( `co_righe_preventivi` . `qta` - `co_righe_preventivi` . `qta_evasa` ) > 0 ) ' ;
2021-07-28 10:32:33 +02:00
$preventivi = $dbo -> fetchArray ( $prev_query )[ 0 ][ 'tot' ];
// Lettura contratti accettati, in attesa di conferma o in lavorazione
2024-02-09 12:08:55 +01:00
$contr_query = 'SELECT COUNT(*) AS tot FROM `co_contratti` WHERE `idanagrafica`=' . prepare ( $record [ 'idanagrafica' ]) . ' AND `idstato` IN (SELECT `id` FROM `co_staticontratti` WHERE `is_fatturabile` = 1) AND `co_contratti`.`id` IN (SELECT `idcontratto` FROM `co_righe_contratti` WHERE `co_righe_contratti`.`idcontratto` = `co_contratti`.`id` AND (`qta` - `qta_evasa`) > 0)' ;
2021-07-28 10:32:33 +02:00
$contratti = $dbo -> fetchArray ( $contr_query )[ 0 ][ 'tot' ];
2020-09-25 11:14:50 +02:00
// Lettura ddt (entrata o uscita)
2024-02-27 11:10:40 +01:00
$ddt_query = ' SELECT
2024-02-27 12:55:27 +01:00
COUNT ( * ) AS tot
FROM
`dt_ddt`
LEFT JOIN `dt_causalet` ON `dt_causalet` . `id` = `dt_ddt` . `idcausalet`
INNER JOIN `dt_statiddt` ON `dt_statiddt` . `id` = `dt_ddt` . `idstatoddt`
2024-03-22 15:52:24 +01:00
LEFT JOIN `dt_statiddt_lang` ON ( `dt_statiddt_lang` . `id_record` = `dt_statiddt` . `id` AND `dt_statiddt_lang` . `id_lang` = '.prepare(Models\Locale::getDefault()->id).' )
2024-02-27 15:51:13 +01:00
INNER JOIN `dt_tipiddt` ON `dt_tipiddt` . `id` = `dt_ddt` . `idtipoddt`
2024-02-27 12:55:27 +01:00
INNER JOIN `dt_righe_ddt` ON `dt_righe_ddt` . `idddt` = `dt_ddt` . `id`
WHERE
`idanagrafica` = '.prepare($record[' idanagrafica ']).'
2024-04-18 17:44:05 +02:00
AND `dt_statiddt_lang` . `title` IN ( " Evaso " , " Parzialmente evaso " , " Parzialmente fatturato " )
2024-02-27 12:55:27 +01:00
AND `dt_tipiddt` . `dir` = '.prepare($intervento->direzione).'
AND `dt_causalet` . `is_importabile` = 1
AND ( `dt_righe_ddt` . `qta` - `dt_righe_ddt` . `qta_evasa` ) > 0 ' ;
2020-09-25 11:14:50 +02:00
$ddt = $dbo -> fetchArray ( $ddt_query )[ 0 ][ 'tot' ];
2021-10-29 11:56:39 +02:00
2023-08-04 14:54:28 +02:00
// Form di inserimento riga documento
echo '
2023-02-17 10:59:50 +01:00
< form id = " link_form " action = " " method = " post " >
< input type = " hidden " name = " op " value = " add_articolo " >
< input type = " hidden " name = " backto " value = " record-edit " >
2019-03-29 12:46:17 +01:00
2023-02-17 10:59:50 +01:00
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " '.tr('Aggiungi un articolo tramite barcode').' " , " name " : " barcode " , " extra " : " autocomplete= \" off \" " , " icon-before " : " <i class= \" fa fa-barcode \" ></i> " , " required " : 0 ]}
</ div >
2019-07-12 17:35:14 +02:00
2023-02-17 10:59:50 +01:00
< div class = " col-md-4 " >
2024-06-11 16:58:27 +02:00
{[ " type " : " select " , " label " : " '.tr('Articolo').' " , " name " : " id_articolo " , " value " : " " , " ajax-source " : " articoli " , " select-options " : '.json_encode([' idsede_partenza ' => $record[' idsede_partenza ']]).' , " icon-after " : " add|'.Module::where('name', 'Articoli')->first()->id.' " ]}
2023-02-17 10:59:50 +01:00
</ div >
2020-08-03 12:43:30 +02:00
2023-02-17 10:59:50 +01:00
< div class = " col-md-4 " style = " margin-top: 25px " >
< button title = " '.tr('Aggiungi articolo alla vendita').' " class = " btn btn-primary tip " type = " button " onclick = " salvaArticolo() " >
< i class = " fa fa-plus " ></ i > '.tr(' Aggiungi ').'
</ button >
< a class = " btn btn-primary " onclick = " gestioneRiga(this) " data - title = " '.tr('Aggiungi riga').' " >
< i class = " fa fa-plus " ></ i > '.tr(' Riga ').'
</ a >
2024-05-16 18:02:50 +02:00
< div class = " btn-group tip " data - card - widget = " tooltip " >
2024-05-22 17:16:50 +02:00
< button type = " button " class = " btn btn-primary dropdown-toggle " data - toggle = " dropdown " aria - haspopup = " true " aria - expanded = " true " >
2023-02-17 10:59:50 +01:00
< i class = " fa fa-list " ></ i > '.tr(' Altro ').'
< span class = " caret " ></ span >
</ button >
< ul class = " dropdown-menu dropdown-menu-right " > ' ;
2023-08-04 14:54:28 +02:00
echo '
2024-05-22 12:00:54 +02:00
< a class = " dropdown-item " style = " cursor:pointer " onclick = " gestioneSconto(this) " data - title = " '.tr('Aggiungi sconto/maggiorazione').' " >
< i class = " fa fa-plus " ></ i > '.tr(' Sconto / maggiorazione ').'
</ a >
< a class = " '.(!empty( $preventivi ) ? '' : ' disabled').' dropdown-item " title = " '.tr( " L 'aggiunta del documento secondo questa procedura non associa l' attività al relativo consuntivo del documento : utilizzare i campi soprastanti a questo fine " ).'. " style = " cursor:pointer " data - href = " '. $structure->fileurl ('add_preventivo.php').'?id_module='. $id_module .'&id_record='. $id_record .' " data - card - widget = " modal " data - title = " '.tr('Aggiungi Preventivo').' " onclick = " saveForm() " >
< i class = " fa fa-plus " ></ i > '.tr(' Preventivo ').'
</ a >
< a class = " '.(!empty( $contratti ) ? '' : ' disabled').' dropdown-item " title = " '.tr( " L 'aggiunta del documento secondo questa procedura non associa l' attività al relativo consuntivo del documento : utilizzare i campi soprastanti a questo fine " ).'. " style = " cursor:pointer " data - href = " '. $structure->fileurl ('add_contratto.php').'?id_module='. $id_module .'&id_record='. $id_record .' " data - card - widget = " modal " data - title = " '.tr('Aggiungi Contratto').' " onclick = " saveForm() " >
< i class = " fa fa-plus " ></ i > '.tr(' Contratto ').'
</ a >
< a class = " '.(!empty( $ddt ) ? '' : ' disabled').' dropdown-item " title = " '.tr('DDT in uscita per il Cliente che si trovano nello stato di Evaso o Parzialmente Evaso con una Causale importabile').'. '.tr( " L 'aggiunta del documento secondo questa procedura non associa l' attività al relativo consuntivo del documento : utilizzare i campi soprastanti a questo fine " ).'. " style = " cursor:pointer " data - href = " '. $structure->fileurl ('add_ddt.php').'?id_module='. $id_module .'&id_record='. $id_record .' " data - card - widget = " modal " data - title = " '.tr('Aggiungi Ddt').' " onclick = " saveForm() " >
< i class = " fa fa-plus " ></ i > '.tr(' Ddt ').'
</ a >
2023-02-17 10:59:50 +01:00
</ ul >
</ div >
</ div >
</ div >
</ form > ' ;
2019-03-29 12:46:17 +01:00
}
?>
2019-07-12 17:35:14 +02:00
</ div >
2023-02-17 10:59:50 +01:00
</ div >
2019-03-29 12:46:17 +01:00
2023-02-17 10:59:50 +01:00
< div class = " row " >
< div class = " col-md-12 " id = " righe " ></ div >
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2023-02-17 10:59:50 +01:00
</ div >
2017-08-04 16:28:16 +02:00
2023-02-17 10:59:50 +01:00
<!-- COSTI TOTALI -->
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " >< ? php echo tr ( 'Costi totali' ); ?> </h3>
2023-02-17 10:59:50 +01:00
</ div >
2017-08-04 16:28:16 +02:00
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2023-02-17 10:59:50 +01:00
< div class = " row " >
< div class = " col-md-12 " id = " costi " ></ div >
</ div >
</ div >
</ div >
2017-08-04 16:28:16 +02:00
2018-09-28 16:17:10 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " , < ? php echo ( $record [ 'flag_completato' ]) ? '"readonly": 1' : '"readonly": 0' ; ?> )}
2017-08-04 16:28:16 +02:00
<!-- EVENTUALE FIRMA GIA ' EFFETTUATA -->
2018-11-21 00:21:09 +01:00
< div class = " text-center row " >
< div class = " col-md-12 " >
< ? php
2018-11-30 16:10:15 +01:00
if ( $record [ 'firma_file' ] == '' ) {
echo '
2018-11-21 00:21:09 +01:00
< div class = " alert alert-warning " >< i class = " fa fa-warning " ></ i > '.tr(' Questo intervento non è ancora stato firmato dal cliente ').' .</ div > ' ;
2018-11-30 16:10:15 +01:00
} else {
echo '
2020-09-23 17:53:19 +02:00
< img src = " '.base_path().'/files/interventi/'. $record['firma_file'] .' " class = " img-thumbnail " >< div >& nbsp ; </ div >
2024-05-17 12:11:00 +02:00
< div class = " col-md-6 offset-md-3 alert alert-success " >< i class = " fa fa-check " ></ i > '.tr(' Firmato il _DATE_ alle _TIME_ da _PERSON_ ' , [
2024-03-22 15:52:24 +01:00
'_DATE_' => Translator :: dateToLocale ( $record [ 'firma_data' ]),
'_TIME_' => Translator :: timeToLocale ( $record [ 'firma_data' ]),
'_PERSON_' => ( ! empty ( $record [ 'firma_nome' ]) ? $record [ 'firma_nome' ] : $intervento -> anagrafica -> ragione_sociale ),
]) . '</div>' ;
2018-11-30 16:10:15 +01:00
}
2020-08-03 12:43:30 +02:00
2024-01-31 14:23:46 +01:00
echo '
2018-11-21 00:21:09 +01:00
</ div >
2017-08-04 16:28:16 +02:00
</ div >
2020-08-03 12:43:30 +02:00
{( " name " : " log_email " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2017-08-04 16:28:16 +02:00
< script >
2024-10-16 10:07:02 +02:00
async function saveForm () {
// Salvataggio via AJAX
await salvaForm ( " #edit-form " );
}
function gestioneSconto ( button ) {
gestioneRiga ( button , " is_sconto=1 " );
}
function gestioneDescrizione ( button ) {
gestioneRiga ( button , " is_descrizione=1 " );
}
async function gestioneRiga ( button , options ) {
// Salvataggio via AJAX
await salvaForm ( " #edit-form " , {}, button );
// Lettura titolo e chiusura tooltip
let title = $ ( button ) . attr ( " data-title " );
// Apertura modal
options = options ? options : " is_riga=1 " ;
openModal ( title , " '. $structure->fileurl ('row-add.php').'?id_module='. $id_module .'&id_record='. $id_record .'& " + options );
}
/**
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento .
*/
function caricaRighe ( id_riga ) {
let container = $ ( " #righe " );
localLoading ( container , true );
return $ . get ( " '. $structure->fileurl ('row-list.php').'?id_module='. $id_module .'&id_record='. $id_record .' " , function ( data ) {
container . html ( data );
localLoading ( container , false );
if ( id_riga != null ) {
$ ( " tr[data-id= " + id_riga + " ] " ) . effect ( " highlight " , 1000 );
}
});
}
/**
* Funzione dedicata al caricamento dinamico via AJAX delle sessioni dei tecnici per l\ ' Attività .
*/
function caricaTecnici () {
let container = $ ( " #tecnici " );
localLoading ( container , true );
return $ . get ( " '. $structure->fileurl ('ajax_tecnici.php').'?id_module='. $id_module .'&id_record='. $id_record .' " , function ( data ) {
caricaRighe ( null );
container . html ( data );
localLoading ( container , false );
});
}
/**
* Funzione dedicata al caricamento dinamico via AJAX delle sessioni dei tecnici per l\ ' Attività .
*/
function caricaCosti () {
let container = $ ( " #costi " );
localLoading ( container , true );
return $ . get ( " '. $structure->fileurl ('ajax_costi.php').'?id_module='. $id_module .'&id_record='. $id_record .' " , function ( data ) {
container . html ( data );
localLoading ( container , false );
});
}
$ ( document ) . ready ( function () {
2023-02-17 10:59:50 +01:00
caricaRighe ( null );
2024-10-16 10:07:02 +02:00
caricaTecnici ();
caricaCosti ();
2020-09-14 10:49:23 +02:00
2024-10-16 10:07:02 +02:00
$ ( " #idsede_partenza " ) . trigger ( " change " );
2020-09-14 10:49:23 +02:00
2024-10-16 10:07:02 +02:00
$ ( " #id_articolo " ) . on ( " change " , function ( e ) {
if ( $ ( this ) . val ()) {
var data = $ ( this ) . selectData ();
2023-02-17 10:59:50 +01:00
2024-10-16 10:07:02 +02:00
if ( data . barcode ) {
$ ( " #barcode " ) . val ( data . barcode );
} else {
$ ( " #barcode " ) . val ( " " );
}
2023-02-17 10:59:50 +01:00
}
2024-10-16 10:07:02 +02:00
e . preventDefault ();
2023-02-17 10:59:50 +01:00
2024-10-16 10:07:02 +02:00
setTimeout ( function (){
$ ( " #barcode " ) . focus ();
}, 100 );
});
2023-02-17 10:59:50 +01:00
2024-10-16 10:07:02 +02:00
$ ( " #barcode " ) . focus ();
});
2020-09-14 10:49:23 +02:00
2021-03-01 16:32:08 +01:00
var anagrafica = input ( " idanagrafica " );
var sede = input ( " idsede_destinazione " );
var contratto = input ( " idcontratto " );
var preventivo = input ( " idpreventivo " );
var ordine = input ( " idordine " );
2021-06-22 17:31:10 +02:00
var cliente_finale = input ( " idclientefinale " );
var referente = input ( " idreferente " );
2024-10-16 10:07:02 +02:00
var sede_partenza = input ( " idsede_partenza " );
2021-03-01 16:32:08 +01:00
// Gestione della modifica dell\'anagrafica
anagrafica . change ( function () {
updateSelectOption ( " idanagrafica " , $ ( this ) . val ());
session_set ( " superselect,idanagrafica " , $ ( this ) . val (), 0 );
let value = ! $ ( this ) . val ();
let placeholder = value ? " '.tr('Seleziona prima un cliente').' " : " '.tr( " Seleziona un 'opzione").' " ;
2021-06-22 17:31:10 +02:00
referente . getElement ()
. selectReset ( placeholder );
2021-03-01 16:32:08 +01:00
sede . setDisabled ( value )
. getElement () . selectReset ( placeholder );
preventivo . setDisabled ( value )
. getElement () . selectReset ( placeholder );
contratto . setDisabled ( value )
. getElement () . selectReset ( placeholder );
ordine . setDisabled ( value )
. getElement () . selectReset ( placeholder );
input ( " idimpianti " ) . setDisabled ( value );
let data = anagrafica . getData ();
if ( data ) {
input ( " idzona " ) . set ( data . idzona ? data . idzona : " " );
// session_set("superselect,idzona", $(this).selectData().idzona, 0);
// Impostazione del tipo intervento da anagrafica
2021-07-14 17:13:24 +02:00
if ( data . idtipointervento ) {
2021-07-14 17:21:41 +02:00
input ( " idtipointervento " ) . getElement ()
2021-07-14 17:13:24 +02:00
. selectSet ( data . idtipointervento );
2021-07-14 17:21:41 +02:00
}
2021-03-01 16:32:08 +01:00
}
2021-06-22 17:31:10 +02:00
});
2021-07-14 17:13:24 +02:00
2021-06-22 17:31:10 +02:00
//gestione del cliente finale
cliente_finale . change ( function () {
updateSelectOption ( " idclientefinale " , $ ( this ) . val ());
session_set ( " superselect,idclientefinale " , $ ( this ) . val (), 0 );
referente . getElement ()
. selectReset ( " '.tr( " Seleziona un 'opzione").' " );
});
2021-03-01 16:32:08 +01:00
// Gestione della modifica della sede selezionato
sede . change ( function () {
updateSelectOption ( " idsede_destinazione " , $ ( this ) . val ());
session_set ( " superselect,idsede_destinazione " , $ ( this ) . val (), 0 );
input ( " idimpianti " ) . getElement () . selectReset ();
2023-01-13 10:02:43 +01:00
input ( " idreferente " ) . getElement () . selectReset ();
2021-03-01 16:32:08 +01:00
let data = sede . getData ();
if ( data ) {
input ( " idzona " ) . set ( data . idzona ? data . idzona : " " );
// session_set("superselect,idzona", $(this).selectData().idzona, 0);
}
});
// Gestione della modifica dell\'ordine selezionato
ordine . change ( function () {
if ( ordine . get ()) {
contratto . getElement () . selectReset ();
preventivo . getElement () . selectReset ();
}
});
2020-08-03 12:43:30 +02:00
2021-03-01 16:32:08 +01:00
// Gestione della modifica del preventivo selezionato
preventivo . change ( function () {
if ( preventivo . get ()){
contratto . getElement () . selectReset ();
ordine . getElement () . selectReset ();
2020-08-03 12:43:30 +02:00
2021-07-14 17:13:24 +02:00
// Impostazione del tipo intervento da preventivo
2021-08-06 15:27:36 +02:00
var data = $ ( this ) . selectData ()
2021-07-14 17:13:24 +02:00
if ( data . idtipointervento ) {
2021-07-14 17:21:41 +02:00
input ( " idtipointervento " ) . getElement ()
2021-07-14 17:13:24 +02:00
. selectSet ( data . idtipointervento );
2021-07-14 17:21:41 +02:00
}
2020-07-31 14:25:50 +02:00
}
2021-03-01 16:32:08 +01:00
});
2020-08-03 12:43:30 +02:00
2021-03-01 16:32:08 +01:00
// Gestione della modifica del contratto selezionato
contratto . change ( function () {
if ( contratto . get ()){
preventivo . getElement () . selectReset ();
ordine . getElement () . selectReset ();
2020-08-03 12:43:30 +02:00
2021-03-01 16:32:08 +01:00
$ ( " input[name=idcontratto_riga] " ) . val ( " " );
}
});
2020-08-03 12:43:30 +02:00
2021-03-01 16:32:08 +01:00
// Gestione delle modifiche agli impianti selezionati
input ( " idimpianti " ) . change ( function () {
updateSelectOption ( " matricola " , $ ( this ) . val ());
session_set ( " superselect,matricola " , $ ( this ) . val (), 0 );
input ( " componenti " ) . setDisabled ( ! $ ( this ) . val ())
. getElement () . selectReset ();
});
2020-07-31 14:25:50 +02:00
2024-10-16 10:07:02 +02:00
// Impostazione della sede di partenza
sede_partenza . change ( function () {
updateSelectOption ( " idsede_partenza " , $ ( this ) . val ());
session_set ( " superselect,idsede_partenza " , $ ( this ) . val (), 0 );
})
2021-03-01 16:32:08 +01:00
$ ( " #codice_cig, #codice_cup " ) . bind ( " keyup change " , function ( e ) {
if ( $ ( " #codice_cig " ) . val () == " " && $ ( " #codice_cup " ) . val () == " " ) {
$ ( " #id_documento_fe " ) . prop ( " required " , false );
2020-07-31 14:25:50 +02:00
} else {
2021-03-01 16:32:08 +01:00
$ ( " #id_documento_fe " ) . prop ( " required " , true );
2020-07-31 14:25:50 +02:00
}
2021-03-01 16:32:08 +01:00
});
2023-02-17 10:59:50 +01:00
2023-03-30 16:36:24 +02:00
async function salvaArticolo () {
// Salvataggio via AJAX
await salvaForm ( " #edit-form " );
2023-02-17 10:59:50 +01:00
$ ( " #link_form " ) . ajaxSubmit ({
url : globals . rootdir + " /actions.php " ,
data : {
id_module : globals . id_module ,
id_record : globals . id_record ,
ajax : true ,
},
type : " post " ,
beforeSubmit : function ( arr , $form , options ) {
return $form . parsley () . validate ();
},
success : function ( response ){
renderMessages ();
if ( response . length > 0 ){
response = JSON . parse ( response );
swal ({
type : " error " ,
title : " '.tr('Errore').' " ,
text : response . error ,
});
}
$ ( " #barcode " ) . val ( " " );
$ ( " #id_articolo " ) . selectReset ();
2023-04-06 13:11:38 +02:00
content_was_modified = false ;
2023-02-17 10:59:50 +01:00
caricaRighe ( null );
2023-03-14 17:24:57 +01:00
caricaCosti ();
2023-02-17 10:59:50 +01:00
}
});
}
2023-02-27 12:09:59 +01:00
$ ( " #link_form " ) . bind ( " keypress " , function ( e ) {
2023-02-17 10:59:50 +01:00
if ( e . keyCode == 13 ) {
e . preventDefault ();
salvaArticolo ();
return false ;
}
});
2020-08-03 12:43:30 +02:00
</ script > ' ;
2018-09-28 16:17:10 +02:00
2018-09-05 10:05:23 +02:00
// Collegamenti diretti
2018-07-04 12:57:53 +02:00
// Fatture collegate a questo intervento
2024-04-18 17:44:05 +02:00
$elementi = $dbo -> fetchArray ( 'SELECT `co_documenti`.*, `co_tipidocumento_lang`.`title` AS tipo_documento, `co_statidocumento_lang`.`title` AS stato_documento, `co_tipidocumento`.`dir` FROM `co_documenti` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_documenti`.`idtipodocumento` AND `co_tipidocumento_lang`.`id_lang` = ' . prepare ( Models\Locale :: getDefault () -> id ) . ') INNER JOIN `co_statidocumento` ON `co_statidocumento`.`id` = `co_documenti`.`idstatodocumento` LEFT JOIN `co_statidocumento_lang` ON (`co_statidocumento_lang`.`id_record` = `co_documenti`.`idstatodocumento` AND `co_statidocumento_lang`.`id_lang` = ' . prepare ( Models\Locale :: getDefault () -> id ) . ') WHERE `co_documenti`.`id` IN (SELECT `iddocumento` FROM `co_righe_documenti` WHERE `idintervento` = ' . prepare ( $id_record ) . ') ORDER BY `data`' );
2017-11-16 18:55:03 +01:00
2018-09-05 10:05:23 +02:00
if ( ! empty ( $elementi )) {
2017-09-15 09:48:56 +02:00
echo '
2024-05-16 18:02:50 +02:00
< div class = " card card-warning collapsable collapsed-card " >
< div class = " card-header with-border " >
< h3 class = " card-title " >< i class = " fa fa-warning " ></ i > '.tr(' Documenti collegati : _NUM_ ' , [
2024-03-22 15:52:24 +01:00
'_NUM_' => count ( $elementi ),
]) . ' </ h3 >
2024-05-16 18:02:50 +02:00
< div class = " card-tools pull-right " >
2024-05-23 17:51:21 +02:00
< button type = " button " class = " btn btn-tool " data - card - widget = " collapse " >< i class = " fa fa-plus " ></ i ></ button >
2018-09-05 10:05:23 +02:00
</ div >
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2018-09-05 10:05:23 +02:00
< ul > ' ;
foreach ( $elementi as $fattura ) {
2020-04-14 17:02:37 +02:00
$descrizione = tr ( '_DOC_ num. _NUM_ del _DATE_ [_STATE_]' , [
2017-09-15 09:48:56 +02:00
'_DOC_' => $fattura [ 'tipo_documento' ],
'_NUM_' => ! empty ( $fattura [ 'numero_esterno' ]) ? $fattura [ 'numero_esterno' ] : $fattura [ 'numero' ],
2020-04-20 10:09:40 +02:00
'_DATE_' => Translator :: dateToLocale ( $fattura [ 'data' ]),
'_STATE_' => $fattura [ 'stato_documento' ],
2017-09-15 09:48:56 +02:00
]);
$modulo = ( $fattura [ 'dir' ] == 'entrata' ) ? 'Fatture di vendita' : 'Fatture di acquisto' ;
$id = $fattura [ 'id' ];
echo '
2018-09-05 10:05:23 +02:00
< li > '.Modules::link($modulo, $id, $descrizione).' </ li > ' ;
2017-09-15 09:48:56 +02:00
}
echo '
</ ul >
2018-09-05 10:05:23 +02:00
</ div >
</ div > ' ;
}
if ( ! empty ( $elementi )) {
echo '
< div class = " alert alert-error " >
'.tr(' Eliminando questo documento si potrebbero verificare problemi nelle altre sezioni del gestionale ').' .
</ div > ' ;
2017-09-15 09:48:56 +02:00
}
2017-11-16 14:27:43 +01:00
?>
< a class = " btn btn-danger ask " data - backto = " record-list " >
2023-09-28 16:08:45 +02:00
< i id = " elimina " class = " fa fa-trash " ></ i > < ? php echo tr ( 'Elimina' ); ?>
2018-01-15 20:28:36 +01:00
</ a >