Aggiunto widget Preventivi da fatturare #375

This commit is contained in:
Pek5892 2023-09-15 10:51:52 +02:00
parent 6c5f774b8d
commit b8f442c409
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,60 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* 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/>.
*/
include_once __DIR__.'/../../../core.php';
use Modules\Preventivi\Stato;
$id_module = Modules::get('Preventivi')['id'];
$rs = $dbo->fetchArray("SELECT *, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=co_preventivi.idanagrafica) AS ragione_sociale FROM co_preventivi WHERE idstato IN (SELECT id FROM co_statipreventivi WHERE is_fatturabile = 1) AND default_revision = 1 ORDER BY data_conclusione ASC");
if (!empty($rs)) {
echo "
<table class='table table-hover'>
<tr>
<th width='60%'>Preventivo</th>
<th width='15%'>Data inizio</th>
<th width='15%'>Data conclusione</th>
<th width='15%'>Stato</th>
</tr>";
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']) : '';
$stato_preventivo = Stato::find($preventivo['idstato'])->descrizione;
if (strtotime($preventivo['data_conclusione']) < strtotime(date('Y-m-d')) && $data_conclusione != '') {
$attr = ' class="danger"';
} else {
$attr = '';
}
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>';
echo '<td '.$attr.'>'.$data_accettazione.'</td>';
echo '<td '.$attr.'>'.$data_conclusione.'</td>';
echo '<td '.$attr.'>'.$stato_preventivo.'</td></tr>';
}
echo '
</table>';
} else {
echo '
<p>'.tr('Non ci sono preventivi da fatturare').'.</p>';
}

View File

@ -60,4 +60,6 @@ UPDATE `zz_settings` SET `tipo` = 'query=SELECT codice AS id, CONCAT(codice, \'
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `default`, `visible`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini cliente'), 'Data scadenza', 'data_scadenza_predefinita', 3, 1, 0, 1, 1, 1);
UPDATE `zz_widgets` SET `text` = 'Listini disattivati' WHERE `zz_widgets`.`name` = 'Listini scaduti';
UPDATE `zz_widgets` SET `text` = 'Listini disattivati' WHERE `zz_widgets`.`name` = 'Listini scaduti';
INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`, `query`, `bgcolor`, `icon`, `print_link`, `more_link`, `more_link_type`, `php_include`, `text`, `enabled`, `help`) VALUES (NULL, 'Preventivi da fatturare', 'stats', '1', 'controller_top', NULL, 'SELECT COUNT(id) AS dato FROM co_preventivi WHERE idstato IN (SELECT id FROM co_statipreventivi WHERE is_fatturabile=1) AND default_revision=1', '#44aae4', 'fa fa-file', '', './modules/preventivi/widgets/preventivi.fatturare.dashboard.php', 'popup', '', 'Preventivi da fatturare', 0, NULL);