0)) { $pageid=$_REQUEST['pageid']; $head = ''; $head .= ''; $head .= ''; $head .= ''; $head .= ''; $head .= ''; $head .= ''; $head .= '
'; $header = ''; if ($pageid==6) $header = '
'; $footer = '
'; $foot = '
'; $foot .= ''; $foot .= ''; $result = $header.''; if ($pageid==1) $result .= "Costituzione Fondo per la contrattazione integrativa per il triennio ". $systemYear . " - ". ($systemYear+1) . " - ". ($systemYear+2); else if ($pageid==2) $result .= "Destinazione fondo a seguito di contrattazione integrativa per il triennio ". $systemYear . " - ". ($systemYear+1) . " - ". ($systemYear+2); else if ($pageid==3) $result .= "Economie in aumento del fondo dell'anno successivo"; else if ($pageid==4) $result .= "Controllo limite fondo ex art. 23, comma 2, D. Lgs. n. 75/2017"; else if ($pageid==5) $result .= "Totale costituzione fondo al netto delle riduzioni"; else if ($pageid==6) $result .= "TABELLA 15 - Fondi per la contrattazione integrativa"; $result .= "". $footer; $sections=Array(); $querytxt ="SELECT S.* FROM sections AS S "; $querytxt.="INNER JOIN fields F ON S.id=F.section AND F.page=".$pageid; $querytxt.=" GROUP BY S.id ORDER BY F.orderidx"; if ($query=mysqli_query($db, $querytxt)) while ($query && ($row=mysqli_fetch_assoc($query))) array_push($sections, $row); $vals=Array(); $querytxt = "SELECT D.fieldid, D.number, D.value FROM data AS D "; $querytxt .= "INNER JOIN fields AS F ON F.id=D.fieldid AND F.page=".$pageid; $querytxt .= " WHERE D.userid=". $udata['id']; if ($query=mysqli_query($db, $querytxt)) while ($query && ($row=mysqli_fetch_row($query))) { if (!isset($vals[$row[0]])) $vals[$row[0]]=Array(); $vals[$row[0]][$row[1]]=$row[2]; } foreach ($sections as $key => $section) { $result .= "".$header.$section['print3']; $counter=1; $querytxt="SELECT * FROM fields WHERE page=".$pageid." AND section=".$section['id']." ORDER BY orderidx"; if ($query=mysqli_query($db, $querytxt)) while ($query && ($row=mysqli_fetch_assoc($query))) { if ($counter%$section['rowPdf']==0) { $result .= $footer; $result .= "".$header.$section['print3']; } $result .= ''; if ($row['rifcontr']!='') $result .= ''. $row['rifcontr'] .""; else if ($pageid==6) $result .= ''; else $result .= ''; $result .= $row['name'] .""; if ($pageid==3) $result .= ''. number_format($vals[$row['id']][2], 2, ',', "'") .''; if ($pageid==6) $result .= ''. $row['number'] .''; if (($pageid==2)||($pageid==4)) for ($i=0;$i<$row['numfields'];$i++) { $result .= ''. number_format($vals[$row['id']][$i], 2, ',', "'") .''; if ($i==0) for ($j=1;$j<=$row['addYears'];$j++) $result .= ''. number_format($vals[$row['id']][$systemYear+$j], 2, ',', "'") .''; } else if ($row['hide']!="1") $result .= ''. number_format($vals[$row['id']][0], 2, ',', "'") .''; if (($pageid!=2)&&($pageid!=4)) for ($j=1;$j<=$row['addYears'];$j++) $result .= ''. number_format($vals[$row['id']][$systemYear+$j], 2, ',', "'") .''; if ($pageid==3) $result .= ''. number_format($vals[$row['id']][3], 2, ',', "'") .''; $result .= ''."\n"; $counter++; } $result .= $footer; } if (isset($result) && $result!='') { require_once $_SERVER['DOCUMENT_ROOT']."/../include/pdf/html2fpdf.php"; $pdf=new HTML2FPDF("L","mm","A4"); if ($pageid==6) $pdf=new HTML2FPDF("P","mm","A4"); $pdf->AddPage(); $pdf->WriteHTML($head.$result.$foot); $filedata = $pdf->Output("","S"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // header("Cache-Control: no-store, no-cache, must-revalidate"); // header("Cache-Control: post-check=0, pre-check=0", false); // header("Pragma: no-cache"); header("Cache-Control: "); header("Cache-Control: "); header("Pragma: "); header("Content-Type: application/pdf"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . strlen($filedata)); header("Content-Disposition: inline; filename=stampa.pdf"); print($filedata); } return FALSE; } ?>