diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7e89fcc3..572ef412c 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -66,6 +66,7 @@ Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://k
- Aggiunto il supporto ai valori multipli nelle impostazioni
- Aggiunta colonna Anagrafica in Movimenti
- Aggiunto codice fornitore in ordini cliente
+- Aggiunta selezione periodo nelle stampe contabili
### Modificato(Changed)
- Miglioria per velocizzazione apertura DDT
- Migliorie modulo Causali
diff --git a/modules/stampe_contabili/stampa_scadenzario.php b/modules/stampe_contabili/stampa_scadenzario.php
index c57a17f85..c0fca9621 100644
--- a/modules/stampe_contabili/stampa_scadenzario.php
+++ b/modules/stampe_contabili/stampa_scadenzario.php
@@ -19,29 +19,63 @@
include_once __DIR__.'/../../core.php';
+use Carbon\Carbon;
+
// Trovo id_print della stampa
$link = Prints::getHref('Scadenzario', null);
+$year = (new Carbon($_SESSION['period_end']))->format('Y');
+$periodi[] = [
+ 'id' => 'manuale',
+ 'text' => tr('Manuale'),
+];
+
+$month_start = 1;
+$month_end = 3;
+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;
+}
+
+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'),
+ ];
+}
+
echo '
- {[ "type": "date", "label": "'.tr('Data inizio').'", "name": "data_inizio", "value": "" ]}
+ {[ "type": "date", "label": "'.tr('Data inizio').'", "name": "date_start", "value": "'.$_SESSION['period_start'].'" ]}
- {[ "type": "date", "label": "'.tr('Data fine').'", "name": "data_fine", "value": "" ]}
+ {[ "type": "date", "label": "'.tr('Data fine').'", "name": "date_end", "value": "'.$_SESSION['period_end'].'" ]}
-
- {[ "type": "checkbox", "label": "'.tr('Includi scadenze pagate').'", "name": "is_pagata" ]}
+
+ {[ "type": "select", "label": "'.tr('Periodo').'", "name": "periodo", "required": "1", "values": '.json_encode($periodi).', "value": "manuale" ]}
-
+
+ {[ "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" ]}
@@ -58,15 +92,17 @@ echo '
echo '
';
\ No newline at end of file
diff --git a/templates/scadenzario/init.php b/templates/scadenzario/init.php
index e55c4e226..21b45a1ad 100755
--- a/templates/scadenzario/init.php
+++ b/templates/scadenzario/init.php
@@ -29,16 +29,16 @@ $total = Util\Query::readQuery($module);
// Lettura parametri modulo
$module_query = $total['query'];
-if(!empty(get('data_inizio'))){
- $module_query = str_replace('1=1', '1=1 AND DATE_FORMAT(`data`, "%Y%m%d") >= "'.date('Ymd', strtotime(get('data_inizio'))).'"', $module_query);
+if(!empty(get('date_start'))){
+ $module_query = str_replace('1=1', '1=1 AND DATE_FORMAT(`data`, "%Y%m%d") >= "'.date('Ymd', strtotime(get('date_start'))).'"', $module_query);
- $date_start = get('data_inizio');
+ $date_start = get('date_start');
}
-if(!empty(get('data_fine'))){
- $module_query = str_replace('1=1', '1=1 AND DATE_FORMAT(`data`, "%Y%m%d") <= "'.date('Ymd', strtotime(get('data_fine'))).'"', $module_query);
+if(!empty(get('date_end'))){
+ $module_query = str_replace('1=1', '1=1 AND DATE_FORMAT(`data`, "%Y%m%d") <= "'.date('Ymd', strtotime(get('date_end'))).'"', $module_query);
- $date_start = get('data_inizio');
+ $date_end = get('date_end');
}
if(get('is_pagata')=='false'){