$value) { if (!empty($value) && 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.'%"'); } } } if (!empty($search_filters)) { $module_query = str_replace('2=2', '2=2 AND ('.implode(' AND ', $search_filters).') ', $module_query); } // Filtri derivanti dai permessi (eventuali) $module_query = Modules::replaceAdditionals($id_module, $module_query); $scadenze = $dbo->fetchArray($module_query); // carica report html $report = file_get_contents($docroot.'/templates/scadenzario/scadenzario.html'); $body = file_get_contents($docroot.'/templates/scadenzario/scadenzario_body.html'); include_once $docroot.'/templates/pdfgen_variables.php'; //Filtro in base al segmento $id_segment = $_SESSION['module_'.$id_module]['id_segment']; $rs_segment = $dbo->fetchArray('SELECT * FROM zz_segments WHERE id='.prepare($id_segment)); $add_where = 'AND '.$rs_segment[0]['clause']; $body .= '

'.$titolo.' dal '.Translator::dateToLocale($date_start).' al '.Translator::dateToLocale($date_end)."

\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= "\n"; $body .= "\n"; /*$rs = $dbo->fetchArray("SELECT co_scadenziario.id AS id, ragione_sociale AS `Anagrafica`, co_pagamenti.descrizione AS `Tipo di pagamento`, CONCAT( co_tipidocumento.descrizione, CONCAT( ' numero ', IF(numero_esterno<>'', numero_esterno, numero) ) ) AS `Documento`, DATE_FORMAT(data_emissione, '%d/%m/%Y') AS `Data emissione`, DATE_FORMAT(scadenza, '%d/%m/%Y') AS `Data scadenza`, da_pagare AS `Importo`, pagato AS `Pagato`, IF(scadenza= '".$date_start."' AND scadenza <= '".$date_end."' ORDER BY scadenza ASC");*/ for ($i = 0; $i < sizeof($scadenze); ++$i) { $body .= ' '; $body .= ' \n"; $body .= ' \n"; $body .= ' \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $totale_da_pagare += $scadenze[$i]['Importo']; $totale_pagato += $scadenze[$i]['Pagato']; } $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= "\n"; $body .= "
DocumentoAnagraficaTipo di pagamentoData scadenzaImportoGiĆ  pagato
'.$scadenze[$i]['Rif. Fattura'].'
'.Translator::dateToLocale($scadenze[$i]['Data emissione'])."
'.$scadenze[$i]['Anagrafica']."'.$scadenze[$i]['Tipo di pagamento']."".Translator::dateToLocale($scadenze[$i]['Data scadenza'])."".moneyFormat($scadenze[$i]['Importo'], 2)."".moneyFormat($scadenze[$i]['Pagato'], 2)."
TOTALE:".moneyFormat($totale_da_pagare, 2)."".moneyFormat($totale_pagato, 2)."
\n"; $orientation = 'L'; $report_name = 'Scadenzario_Totale.pdf';