2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/../../core.php' ;
unset ( $_SESSION [ 'superselect' ][ 'idanagrafica' ]);
2018-07-18 15:20:10 +02:00
$_SESSION [ 'superselect' ][ 'idanagrafica' ] = $record [ 'idanagrafica' ];
2017-08-04 16:28:16 +02:00
2018-02-18 19:53:23 +01:00
?> <script src="<?php echo $rootdir; ?>/modules/contratti/js/contratti_helper.js"></script>
2017-08-04 16:28:16 +02:00
2018-02-23 16:04:50 +01:00
< form action = " " method = " post " id = " edit-form " >
2017-08-04 16:28:16 +02:00
< input type = " hidden " name = " backto " value = " record-edit " >
< input type = " hidden " name = " op " value = " update " >
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
<!-- DATI INTESTAZIONE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2018-02-18 19:53:23 +01:00
< h3 class = " panel-title " >< ? php echo tr ( 'Intestazione' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-2 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Numero'); ?> " , " name " : " numero " , " required " : 1 , " class " : " text-center " , " value " : " $numero $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-07 16:40:48 +01:00
< div class = " col-md-6 " >
2018-01-15 20:28:36 +01:00
< ? php
2018-07-18 15:20:10 +02:00
echo Modules :: link ( 'Anagrafiche' , $record [ 'idanagrafica' ], null , null , 'class="pull-right"' );
2018-01-15 20:28:36 +01:00
?>
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Cliente'); ?> " , " name " : " idanagrafica " , " id " : " idanagrafica_c " , " required " : 1 , " value " : " $idanagrafica $ " , " ajax-source " : " clienti " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-05-11 14:48:46 +02:00
2018-11-07 16:40:48 +01:00
< div class = " col-md-4 " >
2018-08-11 15:49:46 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Sede'); ?> " , " name " : " idsede " , " value " : " $idsede $ " , " ajax-source " : " sedi " , " placeholder " : " Sede legale " ]}
2018-04-13 17:55:20 +02:00
</ div >
2017-08-04 16:28:16 +02:00
2018-11-09 11:34:27 +01:00
2018-11-07 16:40:48 +01:00
</ div >
2018-11-09 11:34:27 +01:00
2018-11-07 16:40:48 +01:00
< div class = " row " >
2018-11-09 11:34:27 +01:00
2018-11-07 16:40:48 +01:00
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " <?php echo tr('Nome'); ?> " , " name " : " nome " , " required " : 1 , " value " : " $nome $ " ]}
</ div >
2018-11-09 11:34:27 +01:00
2018-11-07 16:40:48 +01:00
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " <?php echo tr('Referente'); ?> " , " name " : " idreferente " , " value " : " $idreferente $ " , " ajax-source " : " referenti " ]}
</ div >
2018-11-09 11:34:27 +01:00
2017-08-04 16:28:16 +02:00
< div class = " col-md-3 " >
2018-01-15 20:28:36 +01:00
< ? php
2018-07-18 15:20:10 +02:00
if ( $record [ 'idagente' ] != 0 ) {
echo Modules :: link ( 'Anagrafiche' , $record [ 'idagente' ], null , null , 'class="pull-right"' );
2018-02-04 17:26:25 +01:00
}
2018-01-15 20:28:36 +01:00
?>
2018-07-17 08:05:19 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Agente'); ?> " , " name " : " idagente " , " values " : " query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione='Agente' AND deleted_at IS NULL ORDER BY ragione_sociale " , " value " : " $idagente $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-09 11:34:27 +01:00
2018-04-13 17:55:20 +02:00
</ div >
2017-08-04 16:28:16 +02:00
2018-04-13 17:55:20 +02:00
< div class = " row " >
2018-11-09 11:34:27 +01:00
2018-11-09 12:45:22 +01:00
< div class = " col-md-4 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Validità'); ?> " , " name " : " validita " , " decimals " : " 0 " , " value " : " $validita $ " , " icon-after " : " giorni " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-09 11:34:27 +01:00
2018-11-09 12:45:22 +01:00
< div class = " col-md-4 " >
2018-03-22 00:22:30 +01:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Rinnovabile'); ?> " , " name " : " rinnovabile " , " help " : " <?php echo tr('Il contratto è rinnovabile?'); ?> " , " value " : " $rinnovabile $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-09 12:45:22 +01:00
< div class = " col-md-4 " >
2018-09-19 17:15:01 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Preavviso per rinnovo'); ?> " , " name " : " giorni_preavviso_rinnovo " , " decimals " : " 0 " , " value " : " $giorni_preavviso_rinnovo $ " , " icon-after " : " giorni " , " disabled " : < ? php echo $record [ 'rinnovabile' ] ? 0 : 1 ; ?> ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-07 16:40:48 +01:00
</ div >
2018-05-11 14:48:46 +02:00
2018-11-07 16:40:48 +01:00
< div class = " row " >
< div class = " col-md-3 " >
2018-11-09 11:34:27 +01:00
{[ " type " : " date " , " label " : " <?php echo tr('Data bozza'); ?> " , " name " : " data_bozza " , " value " : " $data_bozza $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-07 16:40:48 +01:00
< div class = " col-md-3 " >
2018-11-09 11:34:27 +01:00
{[ " type " : " date " , " label " : " <?php echo tr('Data accettazione'); ?> " , " name " : " data_accettazione " , " value " : " $data_accettazione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-07 16:40:48 +01:00
< div class = " col-md-3 " >
2018-11-09 11:34:27 +01:00
{[ " type " : " date " , " label " : " <?php echo tr('Data conclusione'); ?> " , " name " : " data_conclusione " , " value " : " $data_conclusione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-07 16:40:48 +01:00
< div class = " col-md-3 " >
2018-11-09 11:34:27 +01:00
{[ " type " : " date " , " label " : " <?php echo tr('Data rifiuto'); ?> " , " name " : " data_rifiuto " , " value " : " $data_rifiuto $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Metodo di pagamento'); ?> " , " name " : " idpagamento " , " values " : " query=SELECT id, descrizione FROM co_pagamenti GROUP BY descrizione ORDER BY descrizione " , " value " : " $idpagamento $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstato " , " required " : 1 , " values " : " query=SELECT id, descrizione FROM co_staticontratti " , " value " : " $idstato $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2018-07-17 11:15:31 +02:00
{[ " type " : " select " , " multiple " : " 1 " , " label " : " <?php echo tr('Impianti'); ?> " , " name " : " matricolaimpianto[] " , " values " : " query=SELECT idanagrafica, id AS id, IF(nome = '', matricola, CONCAT(matricola, ' - ', nome)) AS descrizione FROM my_impianti WHERE idanagrafica=' $idanagrafica $ ' ORDER BY descrizione " , " value " : " $idimpianti $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-09 11:34:27 +01:00
2017-09-11 11:28:39 +02:00
< div class = " col-md-3 " >
2018-02-18 19:53:23 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Sconto incondizionato'); ?> " , " name " : " sconto_generico " , " value " : " $sconto_globale $ " , " help " : " <?php echo tr('Sconto complessivo del contratto'); ?> " , " icon-after " : " choice|untprc| $tipo_sconto_globale $ " < ? php
2018-07-18 15:20:10 +02:00
if ( $record [ 'stato' ] == 'Emessa' ) {
2018-02-04 17:26:25 +01:00
echo ', "disabled" : 1' ;
}
2017-09-11 11:28:39 +02:00
?> ]}
</ div >
</ div >
2017-08-04 16:28:16 +02:00
< div class = " row " >
< div class = " col-md-12 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Esclusioni'); ?> " , " name " : " esclusioni " , " class " : " autosize " , " value " : " $esclusioni $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Descrizione'); ?> " , " name " : " descrizione " , " class " : " autosize " , " value " : " $descrizione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
</ div >
2018-11-09 12:45:22 +01:00
<!-- Fatturazione Elettronica -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " >< ? php echo tr ( 'Dati Fatturazione Elettronica' ); ?> </h3>
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Identificatore Documento'); ?> " , " name " : " id_documento_fe " , " required " : 0 , " value " : " $id_documento_fe $ " , " maxlength " : 20 ]}
</ div >
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Codice CIG'); ?> " , " name " : " codice_cig " , " required " : 0 , " value " : " $codice_cig $ " , " maxlength " : 15 ]}
</ div >
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Codice CUP'); ?> " , " name " : " codice_cup " , " required " : 0 , " value " : " $codice_cup $ " , " maxlength " : 15 ]}
</ div >
</ div >
</ div >
</ div >
2017-08-04 16:28:16 +02:00
<!-- COSTI -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2017-09-04 12:02:29 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Costi unitari' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-12 col-lg-12 " >
< ? php
$idtipiintervento = [ '-1' ];
//Loop fra i tipi di attività e i relativi costi del tipo intervento
$rs = $dbo -> fetchArray ( 'SELECT co_contratti_tipiintervento.*, in_tipiintervento.descrizione FROM in_tipiintervento INNER JOIN co_contratti_tipiintervento ON in_tipiintervento.idtipointervento=co_contratti_tipiintervento.idtipointervento WHERE idcontratto=' . prepare ( $id_record ) . ' AND (co_contratti_tipiintervento.costo_ore!=0 OR co_contratti_tipiintervento.costo_km!=0 OR co_contratti_tipiintervento.costo_dirittochiamata!=0) ORDER BY in_tipiintervento.descrizione' );
if ( sizeof ( $rs ) > 0 ) {
echo '
< table class = " table table-striped table-condensed table-bordered " >
< tr >
2017-09-04 12:02:29 +02:00
< th width = " 300 " > '.tr(' Tipo attività ').' </ th >
2017-08-04 16:28:16 +02:00
2017-09-04 12:02:29 +02:00
< th > '.tr(' Costo orario ').' </ th >
< th > '.tr(' Costo al km ').' </ th >
< th > '.tr(' Diritto di chiamata ').' </ th >
2017-08-04 16:28:16 +02:00
2017-09-04 12:02:29 +02:00
< th > '.tr(' Costo orario ( tecnico ) ').' </ th >
< th > '.tr(' Costo al km ( tecnico ) ').' </ th >
< th > '.tr(' Diritto di chiamata ( tecnico ) ').' </ th >
2017-08-04 16:28:16 +02:00
</ tr > ' ;
for ( $i = 0 ; $i < sizeof ( $rs ); ++ $i ) {
echo '
< tr >
< td > '.$rs[$i][' descrizione '].' </ td >
< td >
{[ " type " : " number " , " name " : " costo_ore['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_ore'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_km['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_km'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_dirittochiamata['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_dirittochiamata'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_ore_tecnico['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_ore_tecnico'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_km_tecnico['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_km_tecnico'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_dirittochiamata_tecnico['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_dirittochiamata_tecnico'].' " ]}
</ td >
</ tr > ' ;
$idtipiintervento [] = prepare ( $rs [ $i ][ 'idtipointervento' ]);
}
echo '
</ table > ' ;
}
echo '
2017-09-04 12:02:29 +02:00
< button type = " button " onclick = " $ (this).next().toggleClass( \ 'hide \ '); " class = " btn btn-info btn-sm " >< i class = " fa fa-th-list " ></ i > '.tr(' Mostra tipi di attività non utilizzate ').' </ button >
2017-08-04 16:28:16 +02:00
< div class = " hide " > ' ;
//Loop fra i tipi di attività e i relativi costi del tipo intervento (quelli a 0)
$rs = $dbo -> fetchArray ( 'SELECT * FROM in_tipiintervento WHERE idtipointervento NOT IN(' . implode ( ',' , $idtipiintervento ) . ') ORDER BY descrizione' );
if ( sizeof ( $rs ) > 0 ) {
echo '
< table class = " table table-striped table-condensed table-bordered " >
< tr >
2017-09-04 12:02:29 +02:00
< th width = " 300 " > '.tr(' Tipo attività ').' </ th >
2017-08-04 16:28:16 +02:00
2017-09-04 12:02:29 +02:00
< th > '.tr(' Costo orario ').' </ th >
< th > '.tr(' Costo al km ').' </ th >
< th > '.tr(' Diritto di chiamata ').' </ th >
2017-08-04 16:28:16 +02:00
2017-09-04 12:02:29 +02:00
< th > '.tr(' Costo orario ( tecnico ) ').' </ th >
< th > '.tr(' Costo al km ( tecnico ) ').' </ th >
< th > '.tr(' Diritto di chiamata ( tecnico ) ').' </ th >
2017-08-04 16:28:16 +02:00
</ tr > ' ;
for ( $i = 0 ; $i < sizeof ( $rs ); ++ $i ) {
echo '
< tr >
< td > '.$rs[$i][' descrizione '].' </ td >
< td >
{[ " type " : " number " , " name " : " costo_ore['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_orario'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_km['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_km'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_dirittochiamata['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_diritto_chiamata'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_ore_tecnico['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_orario_tecnico'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_km_tecnico['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_km_tecnico'].' " ]}
</ td >
< td >
{[ " type " : " number " , " name " : " costo_dirittochiamata_tecnico['. $rs[$i] ['idtipointervento'].'] " , " value " : " '. $rs[$i] ['costo_diritto_chiamata_tecnico'].' " ]}
</ TD >
</ tr > ' ;
}
echo '
</ table > ' ;
}
?>
</ div >
</ div >
</ div >
</ div >
</ div >
</ form >
<!-- RIGHE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2017-09-04 12:02:29 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Righe' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< ? php
2018-07-18 15:20:10 +02:00
if ( $record [ 'stato' ] != 'Pagato' ) {
2017-08-04 16:28:16 +02:00
?>
2018-10-25 17:11:02 +02:00
< a class = " btn btn-primary " data - href = " <?php echo $rootdir ; ?>/modules/contratti/row-add.php?id_module=<?php echo $id_module ; ?>&id_record=<?php echo $id_record ; ?>&is_articolo " data - toggle = " modal " data - title = " Aggiungi articolo " >< i class = " fa fa-plus " ></ i > < ? php echo tr ( 'Articolo' ); ?> </a>
2018-02-19 10:52:42 +01:00
2018-10-25 17:11:02 +02:00
< a class = " btn btn-primary " data - href = " <?php echo $rootdir ; ?>/modules/contratti/row-add.php?id_module=<?php echo $id_module ; ?>&id_record=<?php echo $id_record ; ?>&is_riga " data - toggle = " modal " data - title = " Aggiungi riga " >< i class = " fa fa-plus " ></ i > < ? php echo tr ( 'Riga' ); ?> </a>
2018-02-19 10:52:42 +01:00
2018-10-25 17:11:02 +02:00
< a class = " btn btn-primary " data - href = " <?php echo $rootdir ; ?>/modules/contratti/row-add.php?id_module=<?php echo $id_module ; ?>&id_record=<?php echo $id_record ; ?>&is_descrizione " data - toggle = " modal " data - title = " Aggiungi descrizione " >< i class = " fa fa-plus " ></ i > < ? php echo tr ( 'Descrizione' ); ?> </a>
2017-08-04 16:28:16 +02:00
< ? php
}
?>
< div class = " clearfix " ></ div >
< br >
< div class = " row " >
< div class = " col-md-12 " >
< ? php
include $docroot . '/modules/contratti/row-list.php' ;
?>
</ div >
</ div >
</ div >
</ div >
< ? php
2018-07-18 15:20:10 +02:00
if ( ! empty ( $record [ 'idcontratto_prev' ])) {
2017-08-04 16:28:16 +02:00
echo '
<!-- RIGHE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2017-09-04 12:02:29 +02:00
< h3 class = " panel-title " > '.tr(' Rinnovi precedenti ').' </ h3 >
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-12 " > ' ;
2018-07-18 15:20:10 +02:00
$idcontratto_prev = $record [ 'idcontratto_prev' ];
2017-08-04 16:28:16 +02:00
echo '
< table class = " table table-hover table-condensed table-bordered table-striped " >
< tr >
2017-09-04 12:02:29 +02:00
< th > '.tr(' Descrizione ').' </ th >
< th width = " 100 " > '.tr(' Totale ').' </ th >
< th width = " 150 " > '.tr(' Data inizio ').' </ th >
< th width = " 150 " > '.tr(' Data conclusione ').' </ th >
2017-08-04 16:28:16 +02:00
</ tr > ' ;
while ( ! empty ( $idcontratto_prev )) {
$rs = $dbo -> fetchArray ( 'SELECT nome, numero, data_accettazione, data_conclusione, budget, idcontratto_prev FROM co_contratti WHERE id=' . prepare ( $idcontratto_prev ));
echo '
< tr >
< td >
2017-09-14 10:27:49 +02:00
'.Modules::link($id_module, $idcontratto_prev, tr(' Contratto num . _NUM_ ' , [
2017-09-10 14:35:41 +02:00
'_NUM_' => $rs [ 0 ][ 'numero' ],
]) . '<br><small class="text-muted">' . $rs [ 0 ][ 'nome' ] . '</small>' ) . '
2017-08-04 16:28:16 +02:00
</ td >
< td align = " right " > '.Translator::numberToLocale($rs[0][' budget ']).' & euro ; </ td >
< td align = " center " > '.Translator::dateToLocale($rs[0][' data_accettazione ']).' </ td >
< td align = " center " > '.Translator::dateToLocale($rs[0][' data_conclusione ']).' </ td >
</ tr > ' ;
$idcontratto_prev = $rs [ 0 ][ 'idcontratto_prev' ];
}
echo '
</ table >
</ div >
</ div >
</ div >
</ div > ' ;
}
?>
2018-05-11 14:48:46 +02:00
< form action = '<?php echo $rootdir; ?>/editor.php?id_module=<?php echo Modules::get(' Fatture di vendita ')[' id ']; ?>' method = 'post' id = 'form_creafattura' >
2018-03-27 18:34:49 +02:00
< input type = " hidden " name = " backto " value = " record-edit " >
< input type = 'hidden' name = 'op' value = 'fattura_da_contratto' >
< input type = " hidden " name = " id_record " value = " <?php echo $id_record ; ?> " >
</ form >
2017-09-04 11:53:30 +02:00
< script type = " text/javascript " >
$ ( document ) . ready ( function (){
$ ( '#data_accettazione' ) . on ( " dp.change " , function (){
if ( $ ( this ) . val ()){
$ ( '#data_rifiuto' ) . attr ( 'disabled' , true );
} else {
$ ( '#data_rifiuto' ) . attr ( 'disabled' , false );
}
});
$ ( '#data_rifiuto' ) . on ( " dp.change " , function (){
if ( $ ( this ) . val ()){
$ ( '#data_accettazione' ) . attr ( 'disabled' , true );
} else {
$ ( '#data_accettazione' ) . attr ( 'disabled' , false );
}
});
$ ( " #data_accettazione " ) . trigger ( " dp.change " );
$ ( " #data_rifiuto " ) . trigger ( " dp.change " );
});
2018-05-11 14:48:46 +02:00
2018-03-27 18:34:49 +02:00
function fattura_da_contratto (){
$ ( '#form_creafattura' ) . submit ();
}
2018-05-11 14:48:46 +02:00
2018-04-13 17:55:20 +02:00
$ ( '#idanagrafica_c' ) . change ( function (){
session_set ( 'superselect,idanagrafica' , $ ( this ) . val (), 0 );
$ ( " #idsede " ) . selectReset ();
});
2017-09-04 11:53:30 +02:00
</ script >
2017-11-16 14:27:43 +01:00
< ? php
2018-09-05 10:05:23 +02:00
// Collegamenti diretti
// Fatture collegate a questo contratto
$elementi = $dbo -> fetchArray ( 'SELECT `co_documenti`.*, `co_tipidocumento`.`descrizione` AS tipo_documento, `co_tipidocumento`.`dir` FROM `co_documenti` JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id` IN (SELECT `iddocumento` FROM `co_righe_documenti` WHERE `idcontratto` = ' . prepare ( $id_record ) . ') ORDER BY `data`' );
if ( ! empty ( $elementi )) {
2017-09-14 10:27:49 +02:00
echo '
2018-09-05 10:05:23 +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_ ' , [
2018-09-19 09:57:30 +02:00
'_NUM_' => count ( $elementi ),
2018-09-05 10:05:23 +02:00
]) . ' </ h3 >
< 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 $fattura ) {
2017-09-14 10:27:49 +02:00
$descrizione = tr ( '_DOC_ num. _NUM_ del _DATE_' , [
'_DOC_' => $fattura [ 'tipo_documento' ],
'_NUM_' => ! empty ( $fattura [ 'numero_esterno' ]) ? $fattura [ 'numero_esterno' ] : $fattura [ 'numero' ],
'_DATE_' => Translator :: dateToLocale ( $fattura [ 'data' ]),
]);
$modulo = ( $fattura [ 'dir' ] == 'entrata' ) ? 'Fatture di vendita' : 'Fatture di acquisto' ;
$id = $fattura [ 'id' ];
echo '
< li > '.Modules::link($modulo, $id, $descrizione).' </ li > ' ;
}
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-14 10:27:49 +02:00
}
2017-11-16 14:27:43 +01:00
?>
2018-09-28 16:17:10 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
{( " name " : " log_email " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2017-11-16 14:27:43 +01:00
< a class = " btn btn-danger ask " data - backto = " record-list " >
< i class = " fa fa-trash " ></ i > < ? php echo tr ( 'Elimina' ); ?>
2018-01-15 20:28:36 +01:00
</ a >