Fix stampe contabili

This commit is contained in:
Pek5892 2024-04-04 17:29:26 +02:00
parent e4a7fa2cf0
commit 62137f0da7
3 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ use Models\PrintTemplate;
$id_record = filter('id_record');
$dir = filter('dir');
$nome_stampa = filter('nome_stampa');
$id_print = (new PrintTemplate())->getByField('name', prepare($nome_stampa));
$id_print = (new PrintTemplate())->getByField('name', $nome_stampa);
$id_module = (new Module())->getByField('name', 'Stampe contabili', Models\Locale::getPredefined()->id);
$year = (new Carbon($_SESSION['period_end']))->format('Y');
@ -96,7 +96,7 @@ echo '
if ($nome_stampa != 'Liquidazione IVA') {
echo '
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_sezionale", "required": "1", "values": "query=SELECT `zz_segments`.`id`, `zz_segments_lang`.`name` AS descrizione FROM `zz_segments` LEFT JOIN `zz_segments_lang` ON (`zz_segments`.`id` = `zz_segments_lang`.`id_record` AND `zz_segments_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `id_module` = (SELECT `id_record` FROM `zz_modules_lang` WHERE `name` = \''.(($dir == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto').'\') AND `is_fiscale` = 1 UNION SELECT -1 AS id, \'Tutti i sezionali\' AS descrizione" ]}
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_sezionale", "required": "1", "values": "query=SELECT `zz_segments`.`id`, `zz_segments_lang`.`name` AS descrizione FROM `zz_segments` LEFT JOIN `zz_segments_lang` ON (`zz_segments`.`id` = `zz_segments_lang`.`id_record` AND `zz_segments_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `id_module` = (SELECT `id_record` FROM `zz_modules_lang` WHERE `name` = \"'.(($dir == 'entrata') ? 'Fatture di vendita' : 'Fatture di acquisto').'\" AND `id_lang` = '.prepare(Models\Locale::getDefault()->id).') AND `is_fiscale` = 1 UNION SELECT -1 AS id, \"Tutti i sezionali\" AS descrizione" ]}
</div>';
}
echo '

View File

@ -207,7 +207,7 @@ class Prints
*/
public static function getHref($print, $id_record, $get = '')
{
$infos = self::get($print);
$infos = PrintTemplate::find((new PrintTemplate())->getByField('name', $print));
if (empty($infos)) {
return false;

View File

@ -23,7 +23,7 @@ use Models\Module;
$dir = $_GET['dir'];
$id_sezionale = filter('id_sezionale');
$sezionale = $dbo->fetchOne('SELECT `zz_segmnets_lang`.`name` FROM `zz_segments` LEFT JOIN `zz_segments_lang` ON (`zz_segments`.`id` = `zz_segments_lang`.`id_record` AND `zz_segments_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `zz_segments`.`id` = '.$id_sezionale)['name'];
$sezionale = $dbo->fetchOne('SELECT `zz_segments_lang`.`name` FROM `zz_segments` LEFT JOIN `zz_segments_lang` ON (`zz_segments`.`id` = `zz_segments_lang`.`id_record` AND `zz_segments_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `zz_segments`.`id` = '.$id_sezionale)['name'];
$date_start = filter('date_start');
$date_end = filter('date_end');