$x_image = 20; $y_image = 21; while ($alumno = mysqli_fetch_object($result)) { if ($i % 5 == 0) { $ln = 1; } else { $ln = 0; } $pdf->Cell(37, 43, '', 1, $ln, 'C'); // Dibuja una cuadrícula $foto = "../../xml/fotos/{$alumno->claveal}.jpg"; if (file_exists($foto)) { $pdf->Image($foto, $x_image, $y_image, 23, 30, 'JPG'); } $pdf->SetFont('NewsGotT', 'B', 9); $pdf->Text($x_texto1 - strlen($alumno->apellidos) / 2, $y_texto1, $alumno->apellidos); $pdf->SetFont('NewsGotT', '', 9); $pdf->Text($x_texto1 - strlen($alumno->nombre) / 2, $y_texto1 + 4, $alumno->nombre); // Texto $x_texto1 += 37; if ($ln) { $x_texto1 = 29.5; $y_texto1 += 43; } // Imagen $x_image += 37; if ($ln) { $x_image = 20; $y_image += 43; } // En una hoja caben 30 fotos, se añade una nueva hoja y se reinicializan las variables
global $num, $days, $first, $last; $num = cal_days_in_month(CAL_GREGORIAN, $bulan, $tahun); $first = $tahun . '/' . $bulan . '/' . '01'; $last = $tahun . '/' . $bulan . '/' . $num; list($namacabang) = mysql_fetch_row(mysql_query("select gudang from gl_gudang where id='{$cabang}'")); //instansiasi fpdf $pdf = new PDF_MC_Table('L', 'cm', 'A3'); $pdf->AliasNbPages(); $pdf->SetAutoPageBreak(false); $pdf->AddPage(); $pdf->SetMargins(0.7, 0.7, 0.7); #tampilkan judul laporan $pdf->SetFont('Arial', 'B', '16'); $pdf->Cell(0, 0, "CIPAGANTI RENTAL CAR & TRAVEL", 0, 1, 'C'); $pdf->Cell(41, 2, "LAPORAN EFEKTIFITAS UNIT", 0, 1, 'C'); $pdf->Text(18.5, 3.2, DateToIndo($bulan, $tahun)); $pdf->SetFont('Arial', 'B', '12'); $pdf->SetXY(1.5, 3); function DateToIndo($bulan, $tahun) { // fungsi atau method untuk mengubah tanggal ke format indonesia // variabel BulanIndo merupakan variabel array yang menyimpan nama-nama bulan $BulanIndo = array("JANUARI", "FEBRUARI", "MARET", "APRIL", "MEI", "JUNI", "JULI", "AGUSTUS", "SEPTEMBER", "OKTOBER", "NOVEMBER", "DESEMBER"); $result = $BulanIndo[(int) $bulan - 1] . " " . $tahun; return $result; } $sql = "SELECT gudang FROM gl_gudang WHERE id = '{$cabang}' "; $cekdata = mysql_query($sql) or die(mysql_error()); $row_data = mysql_fetch_array($cekdata); $pdf->Cell(8, 3, "CABANG : " . $row_data['gudang'], 0, 0, 'L'); //HEADER TABLE