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
include_once __DIR__ . '/../../core.php' ;
?> <form action="" method="post">
< input type = " hidden " name = " op " value = " update " >
< input type = " hidden " name = " backto " value = " record-edit " >
2018-02-18 19:53:23 +01:00
< input type = " hidden " name = " id_record " value = " <?php echo $id_record ; ?> " >
2017-08-04 16:28:16 +02:00
< div class = " row " >
2021-11-02 09:42:40 +01:00
< div class = " col-md-3 " >
2019-07-08 16:45:00 +02:00
{[ " type " : " span " , " label " : " <?php echo tr('Codice'); ?> " , " name " : " codice " , " value " : " $codice $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2021-11-02 09:42:40 +01:00
< div class = " col-md-5 " >
2024-03-07 15:20:23 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Descrizione'); ?> " , " name " : " descrizione " , " required " : 1 , " value " : " $name $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-07-04 17:15:14 +02:00
2021-11-02 09:42:40 +01:00
< div class = " col-md-2 " >
{[ " type " : " checkbox " , " label " : " <?php echo tr('Calcola km'); ?> " , " name " : " calcola_km " , " help " : " <?php echo tr('Specifica se inserire automaticamente i km percorsi tra sede azienda e sede cliente'); ?>. " , " value " : " $calcola_km $ " ]}
</ div >
2018-05-21 11:14:37 +02:00
< div class = " col-md-2 " >
2021-02-22 10:08:36 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Tempo standard'); ?> " , " name " : " tempo_standard " , " help " : " <?php echo tr('Valore compreso tra 0,25 - 24 ore. <br><small>Esempi: <em><ul><li>60 minuti = 1 ora</li><li>30 minuti = 0,5 ore</li><li>15 minuti = 0,25 ore</li></ul></em></small> Suggerisce il tempo solitamente impiegato per questa tipologia di attivita'); ?>. " , " min-value " : " 0 " , " max-value " : " 24 " , " class " : " text-center " , " value " : " $tempo_standard $ " , " icon-after " : " ore " ]}
2018-05-21 11:14:37 +02:00
</ div >
2018-07-04 17:15:14 +02:00
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2019-06-13 18:05:19 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Addebiti unitari al cliente' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
2017-09-21 10:01:07 +02:00
< div class = " col-md-4 " >
2020-03-13 10:27:20 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Addebito orario'); ?> " , " name " : " costo_orario " , " required " : 1 , " value " : " $costo_orario $ " , " icon-after " : " <i class='fa fa-euro'></i> " , " help " : " <?php echo tr('Addebito al cliente'); ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
2017-09-21 10:01:07 +02:00
< div class = " col-md-4 " >
2020-03-13 10:27:20 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Addebito km'); ?> " , " name " : " costo_km " , " required " : 1 , " value " : " $costo_km $ " , " icon-after " : " <i class='fa fa-euro'></i> " , " help " : " <?php echo tr('Costo al Cliente per KM'); ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
2017-09-21 10:01:07 +02:00
< div class = " col-md-4 " >
2020-08-11 08:10:06 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Addebito diritto ch.'); ?> " , " name " : " costo_diritto_chiamata " , " required " : 1 , " value " : " $costo_diritto_chiamata $ " , " icon-after " : " <i class='fa fa-euro'></i> " , " help " : " <?php echo tr('Addebito al Cliente per il diritto di chiamata'); ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
</ div >
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2019-06-13 18:05:19 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Costi unitari del tecnico' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
2017-09-21 10:01:07 +02:00
< div class = " col-md-4 " >
2020-03-13 10:27:20 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Costo orario'); ?> " , " name " : " costo_orario_tecnico " , " required " : 1 , " value " : " $costo_orario_tecnico $ " , " icon-after " : " <i class='fa fa-euro'></i> " , " help " : " <?php echo tr('Costo interno'); ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
2017-09-21 10:01:07 +02:00
< div class = " col-md-4 " >
2020-03-13 10:27:20 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Costo km'); ?> " , " name " : " costo_km_tecnico " , " required_tecnico " : 1 , " value " : " $costo_km_tecnico $ " , " icon-after " : " <i class='fa fa-euro'></i> " , " help " : " <?php echo tr('Costo interno per KM'); ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
2017-09-21 10:01:07 +02:00
< div class = " col-md-4 " >
2020-08-11 08:10:06 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Costo diritto ch.'); ?> " , " name " : " costo_diritto_chiamata_tecnico " , " required " : 1 , " value " : " $costo_diritto_chiamata_tecnico $ " , " icon-after " : " <i class='fa fa-euro'></i> " , " help " : " <?php echo tr('Costo interno per il diritto di chiamata'); ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
</ div >
2021-12-16 12:25:25 +01:00
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " >< ? php echo tr ( 'Righe aggiuntive predefinite' ); ?> </h3>
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-12 " id = " righe " >
2023-08-04 14:54:28 +02:00
< script > $ ( '#righe' ) . load ( '<?php echo $module->fileurl(' ajax_righe . php '); ?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>' ); </ script >
2021-12-16 12:25:25 +01:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 text-right " >
2023-08-04 14:54:28 +02:00
< button type = " button " class = " btn btn-primary " onclick = " launch_modal('<?php echo tr('Aggiungi riga'); ?>', '<?php echo $module->fileurl ('add_righe.php'); ?>?id_module=<?php echo $id_module ; ?>&id_record=<?php echo $id_record ; ?>', 1); " >< i class = " fa fa-plus " ></ i >< ? php echo tr ( ' Aggiungi' ); ?> ..</button>
2021-12-16 12:25:25 +01:00
</ div >
</ div >
</ div >
</ div >
2022-03-31 16:50:23 +02:00
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2022-10-06 16:08:21 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Addebiti e costi per fasce orarie' ); ?> </h3>
2022-03-31 16:50:23 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-12 " id = " addebiti_costi " >
2023-08-04 14:54:28 +02:00
< script > $ ( '#addebiti_costi' ) . load ( '<?php echo $module->fileurl(' ajax_addebiti_costi . php '); ?>?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>' ); </ script >
2022-03-31 16:50:23 +02:00
</ div >
</ div >
</ div >
</ div >
2017-08-04 16:28:16 +02:00
</ form >
< ? php
2024-01-15 15:30:45 +01:00
// Permetto eliminazione tipo intervento solo se questo non è utilizzado da nessun'altra parte nel gestionale
// UNION SELECT `in_tariffe`.`idtipointervento` FROM `in_tariffe` WHERE `in_tariffe`.`idtipointervento` = '.prepare($id_record).'
// UNION SELECT `co_contratti_tipiintervento`.`idtipointervento` FROM `co_contratti_tipiintervento` WHERE `co_contratti_tipiintervento`.`idtipointervento` = '.prepare($id_record).'
2020-07-21 17:04:46 +02:00
$elementi = $dbo -> fetchArray ( 'SELECT `in_interventi`.`idtipointervento`, id, codice AS numero, data_richiesta AS data, "Intervento" AS tipo_documento FROM `in_interventi` WHERE `in_interventi`.`idtipointervento` = ' . prepare ( $id_record ) . '
2019-11-14 17:27:33 +01:00
UNION
2020-07-21 17:04:46 +02:00
SELECT `in_interventi_tecnici` . `idtipointervento` , idintervento AS id , codice AS numero , orario_inizio AS data , " Sessione intervento " AS tipo_documento FROM `in_interventi_tecnici` LEFT JOIN in_interventi ON in_interventi_tecnici . idintervento = in_interventi . id WHERE `in_interventi_tecnici` . `idtipointervento` = '.prepare($id_record).'
2019-11-14 17:27:33 +01:00
UNION
2020-07-21 17:04:46 +02:00
SELECT `an_anagrafiche` . `idtipointervento_default` AS `idtipointervento` , idanagrafica AS id , codice , " 0000-00-00 " AS data , " Anagrafica " AS tipo_documento FROM `an_anagrafiche` WHERE `an_anagrafiche` . `idtipointervento_default` = '.prepare($id_record).'
2019-11-14 17:27:33 +01:00
UNION
2020-07-21 17:04:46 +02:00
SELECT `co_preventivi` . `idtipointervento` , id , numero , data_bozza AS data , " Preventivo " AS tipo_documento FROM `co_preventivi` WHERE `co_preventivi` . `idtipointervento` = '.prepare($id_record).'
2019-11-14 17:27:33 +01:00
UNION
2020-07-21 17:04:46 +02:00
SELECT `co_promemoria` . `idtipointervento` , idcontratto AS id , numero , data_richiesta AS data , " Promemoria contratto " AS tipo_documento FROM `co_promemoria` LEFT JOIN co_contratti ON co_promemoria . idcontratto = co_contratti . id WHERE `co_promemoria` . `idtipointervento` = '.prepare($id_record).'
2019-11-14 17:27:33 +01:00
ORDER BY `idtipointervento` ' );
if ( ! empty ( $elementi )) {
2017-08-04 16:28:16 +02:00
echo '
2020-07-21 17:04:46 +02:00
< div class = " box box-warning collapsable collapsed-box " >
< div class = " box-header with-border " >
< h3 class = " box-title " >< i class = " fa fa-warning " ></ i > '.tr(' Documenti collegati : _NUM_ ' , [
2024-03-22 15:52:24 +01:00
'_NUM_' => count ( $elementi ),
]) . ' </ h3 >
2020-07-21 17:04:46 +02:00
< div class = " box-tools pull-right " >
< button type = " button " class = " btn btn-box-tool " data - widget = " collapse " >< i class = " fa fa-plus " ></ i ></ button >
</ div >
</ div >
< div class = " box-body " >
< ul > ' ;
foreach ( $elementi as $elemento ) {
$descrizione = tr ( '_DOC_ num. _NUM_ del _DATE_' , [
'_DOC_' => $elemento [ 'tipo_documento' ],
'_NUM_' => $elemento [ 'numero' ],
'_DATE_' => Translator :: dateToLocale ( $elemento [ 'data' ]),
]);
if ( in_array ( $elemento [ 'tipo_documento' ], [ 'Intervento' ])) {
$modulo = 'Interventi' ;
2020-07-30 18:08:02 +02:00
}
if ( in_array ( $elemento [ 'tipo_documento' ], [ 'Sessione intervento' ])) {
2020-07-21 17:04:46 +02:00
$modulo = 'Interventi' ;
2020-07-30 18:08:02 +02:00
}
2020-07-21 17:04:46 +02:00
if ( in_array ( $elemento [ 'tipo_documento' ], [ 'Anagrafica' ])) {
$modulo = 'Anagrafiche' ;
2020-07-30 18:08:02 +02:00
}
2020-07-21 17:04:46 +02:00
if ( in_array ( $elemento [ 'tipo_documento' ], [ 'Preventivo' ])) {
$modulo = 'Preventivi' ;
2020-07-30 18:08:02 +02:00
}
if ( in_array ( $elemento [ 'tipo_documento' ], [ 'Promemoria contratto' ])) {
2020-07-21 17:04:46 +02:00
$modulo = 'Contratti' ;
}
$id = $elemento [ 'id' ];
echo '
< li > '.Modules::link($modulo, $id, $descrizione).' </ li > ' ;
}
echo '
</ ul >
</ div >
</ div > ' ;
2022-06-06 17:46:35 +02:00
}
echo '
2023-04-18 16:55:37 +02:00
< a class = " btn btn-danger ask " data - backto = " record-list " >
2019-07-08 16:45:00 +02:00
< i class = " fa fa-trash " ></ i > '.tr(' Elimina ').'
</ a > ' ;