diff --git a/modules/scadenzario/controller_after.php b/modules/scadenzario/controller_after.php deleted file mode 100755 index 0fadedb5a..000000000 --- a/modules/scadenzario/controller_after.php +++ /dev/null @@ -1,40 +0,0 @@ -. - */ - -include_once __DIR__.'/../../core.php'; - -if (empty($dbo->fetchArray('SELECT * FROM co_scadenziario'))) { - $class = 'muted'; - $disabled = 'disabled'; -} else { - $class = 'primary'; - $disabled = ''; -} - -?>
- - -
-
- - - -
-
-
diff --git a/modules/stampe_contabili/edit.php b/modules/stampe_contabili/edit.php index 930d9004f..53b3193fb 100755 --- a/modules/stampe_contabili/edit.php +++ b/modules/stampe_contabili/edit.php @@ -104,4 +104,33 @@ echo ' + +
+
+
+

'.tr('Scadenzario').'

+
+ +
'; + +if (empty($dbo->fetchArray('SELECT * FROM co_scadenziario'))) { + $class = 'muted'; + $disabled = 'disabled'; +} else { + $class = 'primary'; + $disabled = ''; +} + + echo ' '; + +echo ' +
+
+
'; + + + +?> \ No newline at end of file diff --git a/modules/stampe_contabili/stampa_scadenzario.php b/modules/stampe_contabili/stampa_scadenzario.php new file mode 100644 index 000000000..6a0f51a7c --- /dev/null +++ b/modules/stampe_contabili/stampa_scadenzario.php @@ -0,0 +1,88 @@ +. + */ + +include_once __DIR__.'/../../core.php'; + +// Trovo id_print della stampa +$link = Prints::getHref('Scadenzario', null); + +echo ' +
+ +
+
+ {[ "type": "date", "label": "'.tr('Data inizio').'", "name": "data_inizio", "value": "" ]} +
+
+ {[ "type": "date", "label": "'.tr('Data fine').'", "name": "data_fine", "value": "" ]} +
+
+ {[ "type": "checkbox", "label": "'.tr('Includi scadenze pagate').'", "name": "is_pagata" ]} +
+
+
+
+ {[ "type": "checkbox", "label": "'.tr('Includi solo Ri.Ba').'", "name": "is_riba" ]} +
+
+ {[ "type": "checkbox", "label": "'.tr('Includi solo scadenze Clienti').'", "name": "is_cliente" ]} +
+
+ {[ "type": "checkbox", "label": "'.tr('Includi solo scadenze Fornitori').'", "name": "is_fornitore" ]} +
+
+ +
+
+ +
+
+ +
+ +'; + +echo ' +'; \ No newline at end of file diff --git a/templates/scadenzario/init.php b/templates/scadenzario/init.php index 843527a30..15264ec37 100755 --- a/templates/scadenzario/init.php +++ b/templates/scadenzario/init.php @@ -21,9 +21,6 @@ include_once __DIR__.'/../../core.php'; use Modules\Fatture\Fattura; -$date_start = $_SESSION['period_start']; -$date_end = $_SESSION['period_end']; - $module = Modules::get('Scadenzario'); $id_module = $module['id']; @@ -32,24 +29,28 @@ $total = Util\Query::readQuery($module); // Lettura parametri modulo $module_query = $total['query']; -$search_filters = []; +if(!empty(get('data_inizio')) AND !empty(get('data_fine'))){ + $module_query = str_replace('1=1', '1=1 AND `data` BETWEEN "'.get('data_inizio').'" AND "'.get('data_fine').'"', $module_query); -if (is_array($_SESSION['module_'.$id_module])) { - foreach ($_SESSION['module_'.$id_module] as $field => $value) { - if (!empty($value) && string_starts_with($field, 'search_')) { - $field_name = str_replace('search_', '', $field); - $field_name = str_replace('__', ' ', $field_name); - $field_name = str_replace('-', ' ', $field_name); - array_push($search_filters, '`'.$field_name.'` LIKE "%'.$value.'%"'); - } - } + $date_start = get('data_inizio'); + $date_end = get('data_fine'); } -if (!empty($search_filters)) { - $module_query = str_replace('2=2', '2=2 AND ('.implode(' AND ', $search_filters).') ', $module_query); +if(get('is_pagata')=='true'){ + $module_query = str_replace('AND ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`) ', '', $module_query); } -$module_query = str_replace('1=1', '1=1 AND ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`) ', $module_query); +if(get('is_riba')=='true'){ + $module_query = str_replace('1=1', '1=1 AND co_pagamenti.codice_modalita_pagamento_fe="MP12"', $module_query); +} + +if(get('is_cliente')=='true'){ + $module_query = str_replace('1=1', '1=1 AND co_tipidocumento.dir="entrata"', $module_query); +} + +if(get('is_fornitore')=='true'){ + $module_query = str_replace('1=1', '1=1 AND co_tipidocumento.dir="uscita"', $module_query); +} // Scelgo la query in base alla scadenza if (isset($id_record)) { @@ -62,8 +63,5 @@ if (isset($id_record)) { } } -// Filtri derivanti dai permessi (eventuali) -$module_query = Modules::replaceAdditionals($id_module, $module_query); - // Scadenze $records = $dbo->fetchArray($module_query); diff --git a/templates/scadenzario/top.php b/templates/scadenzario/top.php index b0c4ca13f..b9f6dc1c3 100755 --- a/templates/scadenzario/top.php +++ b/templates/scadenzario/top.php @@ -24,13 +24,17 @@ if (isset($id_record)) {

'.tr('Scadenza _ANAG_', [ '_ANAG_' => $records[0]['Anagrafica'], ], ['upper' => true]).'

'; -} else { +} else if(!empty($date_start) AND !empty($date_end)) { echo '

'.tr('Scadenze dal _START_ al _END_', [ '_START_' => Translator::dateToLocale($date_start), '_END_' => Translator::dateToLocale($date_end), ], ['upper' => true]).'

'; +}else{ + echo ' +

'.tr('Scadenze').' +

'; } echo '