. */ include_once __DIR__.'/../../core.php'; use Carbon\Carbon; use Models\Module; use Models\PrintTemplate; $id_record = filter('id_record'); $dir = filter('dir'); $nome_stampa = filter('nome_stampa'); $id_print = PrintTemplate::where('name', $nome_stampa)->first()->id; $id_module = Module::where('name', 'Stampe contabili')->first()->id; $year = (new Carbon($_SESSION['period_end']))->format('Y'); $periodi[] = [ 'id' => 'manuale', 'text' => tr('Manuale'), ]; $month_start = 1; $month_end = 3; if (setting('Liquidazione iva') == 'Trimestrale') { for ($i = 1; $i <= 4; ++$i) { $periodi[] = [ 'id' => ''.$i.'_trimestre', 'text' => tr('_NUM_° Trimestre _YEAR_', ['_NUM_' => $i, '_YEAR_' => $year]), 'date_start' => $year.','.$month_start.',01', 'date_end' => $year.','.$month_end.','.(new Carbon($year.'-'.$month_end.'-01'))->endOfMonth()->format('d'), ]; $month_start += 3; $month_end += 3; } } if (setting('Liquidazione iva') == 'Mensile') { for ($i = 1; $i <= 12; ++$i) { $month = (new Carbon($year.'-'.$i.'-01'))->locale('it')->getTranslatedMonthName('IT MMMM'); $periodi[] = [ 'id' => ''.$i.'_mese', 'text' => tr('_MONTH_ _YEAR_', ['_MONTH_' => $month, '_YEAR_' => $year]), 'date_start' => $year.','.$i.',01', 'date_end' => $year.','.$i.','.(new Carbon($year.'-'.$i.'-01'))->endOfMonth()->format('d'), ]; } } // Trovo id_print della stampa $link = Prints::getHref($nome_stampa, $id_record); echo '
'; echo '
{[ "type": "select", "label": "'.tr('Periodo').'", "name": "periodo", "required": "1", "values": '.json_encode($periodi).', "value": "manuale" ]}
{[ "type": "date", "label": "'.tr('Data inizio').'", "required": "1", "name": "date_start", "value": "'.$_SESSION['period_start'].'" ]}
{[ "type": "date", "label": "'.tr('Data fine').'", "required": "1", "name": "date_end", "value": "'.$_SESSION['period_end'].'" ]}
'; echo '
'; if ($nome_stampa != 'Liquidazione IVA') { echo '
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_sezionale", "required": "1", "values": "query=SELECT `zz_segments`.`id`, `zz_segments_lang`.`title` 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 `title` = \"'.(($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" ]}
'; } echo '
{[ "type": "select", "label": "'.tr('Formato').'", "name": "format", "required": "1", "values": "list=\"A4\": \"'.tr('A4').'\", \"A3\": \"'.tr('A3').'\"", "value": "'.$_SESSION['stampe_contabili']['format'].'" ]}
{[ "type": "select", "label": "'.tr('Orientamento').'", "name": "orientation", "required": "1", "values": "list=\"L\": \"'.tr('Orizzontale').'\", \"P\": \"'.tr('Verticale').'\"", "value": "'.$_SESSION['stampe_contabili']['orientation'].'" ]}
'; if ($nome_stampa != 'Liquidazione IVA') { echo '
{[ "type": "checkbox", "label": "'.tr('Definitiva').'", "disabled": "1", "name": "definitiva", "help": "'.tr('Per abilitare il pulsante è necessario impostare nei campi Data inizio e Data fine uno dei 4 trimestri o un singolo mese e non deve essere già stata creata la stampa definitiva del periodo selezionato').'" ]}
'; } echo '

 


'; if ($nome_stampa != 'Liquidazione IVA') { $elementi = $dbo->fetchArray('SELECT * FROM co_stampecontabili WHERE date_end BETWEEN '.prepare($_SESSION['period_start']).' AND '.prepare($_SESSION['period_end']).' AND id_print='.prepare($id_print).' AND dir='.prepare($dir)); echo '

'.tr('Stampe definitive registro iva _DIR_ dal _START_ al _END_', [ '_DIR_' => $dir == 'entrata' ? 'vendite' : 'acquisti', '_START_' => dateFormat($_SESSION['period_start']), '_END_' => dateFormat($_SESSION['period_end']), ]).'

'; echo ' '; } echo ' ';