Aggiunto filtro per anagrafica in stampa scadenzario

This commit is contained in:
Pek5892 2023-08-31 11:56:24 +02:00
parent 117049f4fc
commit c4d00e718a
2 changed files with 14 additions and 5 deletions

View File

@ -55,15 +55,18 @@ for ($i = 1; $i <= 12; ++$i) {
echo ' echo '
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data inizio').'", "name": "date_start", "value": "'.$_SESSION['period_start'].'" ]} {[ "type": "date", "label": "'.tr('Data inizio').'", "name": "date_start", "value": "'.$_SESSION['period_start'].'" ]}
</div> </div>
<div class="col-md-4"> <div class="col-md-3">
{[ "type": "date", "label": "'.tr('Data fine').'", "name": "date_end", "value": "'.$_SESSION['period_end'].'" ]} {[ "type": "date", "label": "'.tr('Data fine').'", "name": "date_end", "value": "'.$_SESSION['period_end'].'" ]}
</div> </div>
<div class="col-md-4"> <div class="col-md-3">
{[ "type": "select", "label": "'.tr('Periodo').'", "name": "periodo", "required": "1", "values": '.json_encode($periodi).', "value": "manuale" ]} {[ "type": "select", "label": "'.tr('Periodo').'", "name": "periodo", "required": "1", "values": '.json_encode($periodi).', "value": "manuale" ]}
</div> </div>
<div class="col-md-3">
{[ "type": "select", "label": "'.tr('Anagrafica').'", "name": "id_anagrafica", "values": "'.$id_anagrafica.'", "ajax-source": "anagrafiche" ]}
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
@ -97,12 +100,13 @@ echo '
function avvia_stampa (){ function avvia_stampa (){
var date_start = $("#date_start").val(); var date_start = $("#date_start").val();
var date_end = $("#date_end").val(); var date_end = $("#date_end").val();
var id_anagrafica = $("#id_anagrafica").val();
var is_pagata = $("#is_pagata").is(":checked"); var is_pagata = $("#is_pagata").is(":checked");
var is_riba = $("#is_riba").is(":checked"); var is_riba = $("#is_riba").is(":checked");
var is_cliente = $("#is_cliente").is(":checked"); var is_cliente = $("#is_cliente").is(":checked");
var is_fornitore = $("#is_fornitore").is(":checked"); var is_fornitore = $("#is_fornitore").is(":checked");
window.open("'.$link.'&date_start="+date_start+"&date_end="+date_end+"&is_pagata="+is_pagata+"&is_riba="+is_riba+"&is_cliente="+is_cliente+"&is_fornitore="+is_fornitore, "_blank"); window.open("'.$link.'&date_start="+date_start+"&date_end="+date_end+"&is_pagata="+is_pagata+"&is_riba="+is_riba+"&is_cliente="+is_cliente+"&is_fornitore="+is_fornitore+"&id_anagrafica="+id_anagrafica, "_blank");
} }
$("#is_cliente").change(function() { $("#is_cliente").change(function() {

View File

@ -41,6 +41,11 @@ if (!empty(get('date_end'))) {
$date_end = get('date_end'); $date_end = get('date_end');
} }
if (get('id_anagrafica') != 'null') {
$module_query = str_replace('1=1', '1=1 AND co_scadenziario.idanagrafica="'.get('id_anagrafica').'"', $module_query);
$id_anagrafica = get('id_anagrafica');
}
if (get('is_pagata') == 'false') { if (get('is_pagata') == 'false') {
$module_query = str_replace('1=1', '1=1 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);
} }