openstamanager/modules/preventivi/widgets/preventivi.dashboard.php

59 lines
2.3 KiB
PHP
Raw Normal View History

<?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-11-29 18:21:31 +01:00
2020-02-27 16:37:11 +01:00
include_once __DIR__.'/../../../core.php';
2024-03-05 16:01:45 +01:00
use Models\Module;
2024-03-08 16:29:53 +01:00
use Modules\Preventivi\Preventivo;
use Modules\Preventivi\Stato;
2024-06-11 16:58:27 +02:00
$id_module = Module::where('name', 'Preventivi')->first()->id;
2024-06-11 16:58:27 +02:00
$rs = Preventivo::where('idstato', '=', Stato::where('name', 'In lavorazione')->first()->id)->where('default_revision', '=', 1)->get();
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) {
2024-03-08 16:29:53 +01:00
$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
2024-04-23 15:29:50 +02:00
if ($data_conclusione != '' && strtotime($preventivo->data_conclusione) < strtotime(date('Y-m-d'))) {
2020-02-27 16:37:11 +01:00
$attr = ' class="danger"';
} else {
$attr = '';
2018-02-18 19:53:23 +01:00
}
2024-03-08 16:29:53 +01:00
echo '<tr '.$attr.'><td><a href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$preventivo->id.'">'.$preventivo->nome."</a><br><small class='help-block'>".$preventivo->ragione_sociale.'</small></td>';
2020-02-27 16:37:11 +01:00
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>';
}