2019-07-08 10:21:35 +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 />.
*/
2019-07-08 10:21:35 +02:00
2019-07-09 18:29:40 +02:00
include_once __DIR__ . '/../../core.php' ;
2021-02-18 09:57:35 +01:00
include_once __DIR__ . '/../init.php' ;
2024-03-08 11:54:00 +01:00
use Models\Module ;
2019-07-08 10:21:35 +02:00
$id_contratto_precedente = $record [ 'idcontratto_prev' ];
2024-03-08 11:54:00 +01:00
$module = Module :: find ( $id_module );
2019-07-08 10:21:35 +02:00
2021-02-18 09:57:35 +01:00
echo '
< form action = " " method = " post " id = " rinnovo-form " >
< input type = " hidden " name = " backto " value = " record-edit " >
< input type = " hidden " name = " op " value = " update_rinnovo " >
< input type = " hidden " name = " id_record " value = " '. $id_record .' " >
2021-09-01 10:52:22 +02:00
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
2024-05-17 12:11:00 +02:00
< div class = " card-header " >
2024-05-16 18:02:50 +02:00
< h3 class = " card-title " > '.tr(' Informazioni per rinnovo ').' </ h3 >
2021-02-18 09:57:35 +01:00
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2021-02-18 09:57:35 +01:00
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " checkbox " , " label " : " '.tr('Rinnovabile').' " , " name " : " rinnovabile " , " help " : " '.tr('Il contratto è rinnovabile?').' " , " value " : " $rinnovabile $ " ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " checkbox " , " label " : " '.tr('Rinnovo automatico').' " , " name " : " rinnovo_automatico " , " help " : " '.tr('Il contratto è da rinnovare automaticamente alla scadenza').' " , " value " : " $rinnovo_automatico $ " , " disabled " : '.($record[' rinnovabile '] ? 0 : 1).' ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " '.tr('Preavviso per rinnovo').' " , " name " : " giorni_preavviso_rinnovo " , " decimals " : " 2 " , " value " : " $giorni_preavviso_rinnovo $ " , " icon-after " : " giorni " , " disabled " : '.($record[' rinnovabile '] ? 0 : 1).' ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " '.tr('Ore rimanenti rinnovo').' " , " name " : " ore_preavviso_rinnovo " , " decimals " : " 2 " , " value " : " $ore_preavviso_rinnovo $ " , " icon-after " : " ore " , " disabled " : '.($record[' rinnovabile '] ? 0 : 1).' , " help " : " '.tr('Ore residue nel contratto prima di visualizzare una avviso per un eventuale rinnovo anticipato.').' " ]}
</ div >
</ div >
< div class = " col-md-12 text-right " >
< button type = " submit " class = " btn btn-success " >< i class = " fa fa-check " ></ i > '.tr(' Salva ').' </ button >
</ div >
</ div >
</ div >
</ form > ' ;
2019-07-08 10:21:35 +02:00
echo '
2021-09-01 10:52:22 +02:00
< table class = " table table-hover table-condensed table-bordered table-striped " >
< thead >
2019-07-08 10:21:35 +02:00
< tr >
< th > '.tr(' Descrizione ').' </ th >
< th width = " 100 " > '.tr(' Totale ').' </ th >
< th width = " 150 " > '.tr(' Data inizio ').' </ th >
< th width = " 150 " > '.tr(' Data conclusione ').' </ th >
2021-09-01 10:52:22 +02:00
</ tr >
</ thead >
< tbody > ' ;
2019-07-08 10:21:35 +02:00
2021-09-20 17:49:30 +02:00
$counter = 0 ;
while ( ! empty ( $id_contratto_precedente ) && $counter < 50 ) {
2021-09-21 11:50:17 +02:00
++ $counter ;
2019-07-08 10:21:35 +02:00
$rs = $dbo -> fetchArray ( 'SELECT nome, numero, data_accettazione, data_conclusione, budget, idcontratto_prev FROM co_contratti WHERE id=' . prepare ( $id_contratto_precedente ));
2019-07-08 12:25:51 +02:00
echo '
2019-07-08 10:21:35 +02:00
< tr >
< td >
2024-04-18 17:44:05 +02:00
'.Modules::link($module->getTranslation(' title '), $id_contratto_precedente, tr(' Contratto num . _NUM_ ' , [
2024-03-22 15:52:24 +01:00
'_NUM_' => $rs [ 0 ][ 'numero' ],
]) . '<br><small class="text-muted">' . $rs [ 0 ][ 'nome' ] . '</small>' ) . '
2019-07-08 10:21:35 +02:00
</ td >
2020-07-06 13:19:20 +02:00
< td class = " text-right " > '.moneyFormat($rs[0][' budget ']).' </ td >
2019-07-08 10:21:35 +02:00
< td align = " center " > '.Translator::dateToLocale($rs[0][' data_accettazione ']).' </ td >
< td align = " center " > '.Translator::dateToLocale($rs[0][' data_conclusione ']).' </ td >
</ tr > ' ;
$id_contratto_precedente = $rs [ 0 ][ 'idcontratto_prev' ];
}
echo '
2021-09-01 10:52:22 +02:00
</ tbody >
</ table >
< script type = " text/javascript " >
input ( " rinnovabile " ) . on ( " change " , function () {
const disabled = parseInt ( $ ( this ) . val ()) === 0 ;
input ( " giorni_preavviso_rinnovo " ) . setDisabled ( disabled );
input ( " ore_preavviso_rinnovo " ) . setDisabled ( disabled );
input ( " rinnovo_automatico " ) . setDisabled ( disabled );
});
</ script > ' ;