2017-08-04 16:28:16 +02:00
< ? php
2019-11-29 18:21:31 +01:00
2020-02-27 16:37:11 +01:00
include_once __DIR__ . '/../../../core.php' ;
2017-08-04 16:28:16 +02:00
2020-02-27 16:37:11 +01:00
$id_module = Modules :: get ( 'Preventivi' )[ 'id' ];
2017-08-04 16:28:16 +02:00
2020-02-27 16:37:11 +01:00
$rs = $dbo -> fetchArray ( " SELECT *, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=co_preventivi.idanagrafica) AS ragione_sociale FROM co_preventivi WHERE idstato=(SELECT id FROM co_statipreventivi WHERE descrizione='In lavorazione') AND default_revision = 1 ORDER BY data_conclusione ASC " );
2017-08-04 16:28:16 +02:00
2020-02-27 16:37:11 +01:00
if ( ! empty ( $rs )) {
echo "
< table class = 'table table-hover' >
< tr >
< th width = '70%' > Preventivo </ th >
< th width = '15%' > Data inizio </ th >
< th width = '15%' > Data conclusione </ th >
</ tr > " ;
2018-02-18 19:53:23 +01:00
2020-02-27 16:37:11 +01:00
foreach ( $rs as $preventivo ) {
$data_accettazione = ( $preventivo [ 'data_accettazione' ] != '0000-00-00' ) ? Translator :: dateToLocale ( $preventivo [ 'data_accettazione' ]) : '' ;
$data_conclusione = ( $preventivo [ 'data_conclusione' ] != '0000-00-00' ) ? Translator :: dateToLocale ( $preventivo [ 'data_conclusione' ]) : '' ;
2018-02-18 19:53:23 +01:00
2020-02-27 16:37:11 +01:00
if ( strtotime ( $preventivo [ 'data_conclusione' ]) < strtotime ( date ( 'Y-m-d' )) && $data_conclusione != '' ) {
$attr = ' class="danger"' ;
} else {
$attr = '' ;
2018-02-18 19:53:23 +01:00
}
2020-02-27 16:37:11 +01:00
echo '<tr ' . $attr . '><td><a href="' . $rootdir . '/editor.php?id_module=' . $id_module . '&id_record=' . $preventivo [ 'id' ] . '">' . $preventivo [ 'nome' ] . " </a><br><small class='help-block'> " . $preventivo [ 'ragione_sociale' ] . '</small></td>' ;
echo '<td ' . $attr . '>' . $data_accettazione . '</td>' ;
echo '<td ' . $attr . '>' . $data_conclusione . '</td></tr>' ;
2018-02-18 19:53:23 +01:00
}
2020-02-27 16:37:11 +01:00
echo '
</ table > ' ;
} else {
echo '
< p > '.tr(' Non ci sono preventivi in lavorazione ').' .</ p > ' ;
}