27 include_once LIBRARY_PATH.
'fpdf/fpdf.php';
29 class PDF extends FPDF
42 $active_app = Router::get_application();
46 $this->SetFont(
'Arial',
'', 7);
51 $this->SetFont(
'Arial',
'',7);
53 $this->Cell(0,10,
$config->$active_app->name,0,0,
'C');
58 $this->SetFont(
'Arial',
'',8);
60 $this->Cell(0,10,
'-- '.$this->PageNo().
' --',0,0,
'C');
75 function pdf($result, $sumArray, $title, $weightArray, $headerArray){
78 $active_app = Router::get_application();
95 if($paper==
'letter'&&$orientation==
'P'){
100 if($paper==
'legal'&&$orientation==
'L'){
105 if($paper==
'letter'&&$orientation==
'L'){
111 $pdf =
new PDF($orientation,
'mm', $paper);
117 $pdf->SetFillColor(255, 255, 255);
118 $pdf->AddFont(
'Verdana',
'',
'verdana.php');
119 $pdf->SetFont(
'Verdana',
'', 14);
126 if(
$config->$active_app->name){
127 $pdf->MultiCell(0, 6, strtoupper(
$config->$active_app->name), 0,
"C", 0);
129 $pdf->MultiCell(0, 6,
"REPORTE DE ".strtoupper($title), 0,
"C", 0);
130 $pdf->SetFont(
'Verdana',
'', 12);
131 if(isset($_SESSION[
'fecsis'])){
132 $pdf->MultiCell(0, 6,
"FECHA ".date(
"Y-m-d"), 0,
"C", 0);
137 $pdf->SetFillColor(0xF2,0xF2, 0xF2);
138 $pdf->SetTextColor(0);
139 $pdf->SetDrawColor(0,0,0);
140 $pdf->SetLineWidth(.2);
141 $pdf->SetFont(
'Arial',
'B', 10);
143 if($weightArray[0]<11){
144 $weightArray[0] = 11;
148 $pos = floor(($widthPage/2)-($sumArray/2));
150 for($i=0;$i<=count($headerArray)-1;$i++){
151 $pdf->Cell($weightArray[$i],7,$headerArray[$i], 1, 0,
'C', 1);
156 $pdf->SetFillColor(224, 235, 255);
157 $pdf->SetTextColor(0);
158 $pdf->SetFont(
'Arial',
'B', 7);
166 foreach($result as $row){
168 if($n>$numRows||($p==1&&($n>$numRows-3))){
169 $pdf->AddPage($orientation);
172 $pdf->SetFillColor(0xF2,0xF2, 0xF2);
173 $pdf->SetTextColor(0);
174 $pdf->SetDrawColor(0,0,0);
175 $pdf->SetLineWidth(.2);
176 $pdf->SetFont(
'Arial',
'B', 10);
177 for($i=0;$i<count($headerArray);$i++){
178 $pdf->Cell($weightArray[$i], 7, $headerArray[$i], 1, 0,
'C', 1);
181 $pdf->SetFillColor(224, 235, 255);
182 $pdf->SetTextColor(0);
183 $pdf->SetFont(
'Arial',
'B', 7);
188 for($i=0;$i<=count($row)-1;$i++){
189 if(is_numeric($row[$i])){
190 $pdf->Cell($weightArray[$i], 5, trim($row[$i]),
'LRTB', 0,
'C');
192 $pdf->Cell($weightArray[$i], 5, trim($row[$i]),
'LRTB', 0,
'L');
202 $pdf->SetFont(
'Arial',
'B', 7);
203 $pdf->SetFillColor(0xF2,0xF2, 0xF2);
204 $pdf->Cell($weightArray[0], 5,
"TOTAL",
'LRTB', 0,
'R');
205 $pdf->Cell($weightArray[1], 5, $t,
'LRTB', 0,
'L');
215 $file = md5(uniqid());
216 $pdf->Output(
CORE_PATH.
'public/temp/'.$file .
".pdf",
'F');
217 if(isset($raw_output)){
218 print
"<script type='text/javascript'> window.open('".KUMBIA_PATH.
"temp/".$file.
".pdf', null); </script>";
220 Generator::forms_print(
"<script type='text/javascript'> window.open('".KUMBIA_PATH.
"temp/".$file.
".pdf', null); </script>");