fetchArray($query); // Se il cliente รจ uno solo carico la sua intestazione, altrimenti la lascio in bianco $idcliente = $rsi[0]['idanagrafica']; $singolo_cliente = true; for ($i = 0; $i < sizeof($rs); ++$i) { if ($rs[$i]['idanagrafica'] != $idcliente) { $singolo_cliente = false; } } if (!$singolo_cliente) { $idcliente = ''; } // carica report html $report = file_get_contents($docroot.'/templates/riepilogo_contratti/contratto.html'); $body = file_get_contents($docroot.'/templates/riepilogo_contratti/contratto_body.html'); if (!$singolo_cliente) { $body = str_replace('Spett.le', '', $body); } include_once $docroot.'/templates/pdfgen_variables.php'; $body .= 'RIEPILOGO CONTRATTI DAL '.$search_datastart.' al '.$search_dataend."

\n"; // Sostituisco i valori tra | | con il valore del campo del db $body .= preg_replace('/|(.+?)|/', $rs[0]['${1}'], $body); // Tabella con riepilogo contratti $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; // Tabella con i dati for ($i = 0; $i < sizeof($rs); ++$i) { $data_accettazione = Translator::dateToLocale($rs[$i]['data_accettazione']); $data_conclusione = Translator::dateToLocale($rs[$i]['data_conclusione']); if ($data_accettazione == '01/01/1970') { $data_accettazione = ''; } if ($data_conclusione == '01/01/1970') { $data_conclusione = ''; } $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $totale += $rs[$i]['budget_totale']; } // Totale $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "
\n"; $body .= " Numero\n"; $body .= "\n"; $body .= " Ragione sociale\n"; $body .= "\n"; $body .= " Nome\n"; $body .= "\n"; $body .= " Stato\n"; $body .= "\n"; $body .= " Data inizio\n"; $body .= "\n"; $body .= " Data conclusione\n"; $body .= "\n"; $body .= " Budget\n"; $body .= "
\n"; $body .= ' '.$rs[$i]['numero']."\n"; $body .= "\n"; $body .= ' '.str_replace(' ', ' ', $rs[$i]['ragione_sociale'])."\n"; $body .= "\n"; $body .= ' '.str_replace(' ', ' ', $rs[$i]['nome'])."\n"; $body .= "\n"; $body .= ' '.str_replace(' ', ' ', $rs[$i]['stato'])."\n"; $body .= "\n"; $body .= ' '.$data_accettazione."\n"; $body .= "\n"; $body .= ' '.$data_conclusione."\n"; $body .= "\n"; $body .= ' '.Translator::numberToLocale($rs[$i]['budget_totale']).' €\n'; $body .= "
\n"; $body .= " TOTALE:\n"; $body .= "\n"; $body .= ' '.Translator::numberToLocale($totale)." €\n"; $body .= "
\n"; $orientation = 'L'; $report_name = 'Riepilogo_contratti.pdf';