<?php $pdf = new MYPDF(); //$pdf->setMargins(20,20,20); $pdf->AliasNbPages(); $pdf->AddPage('L', 'A4'); $pdf->AddFont('PT_Serif-Web-Bold', '', 'PT_Serif-Web-Bold.php'); $pdf->SetFont('PT_Serif-Web-Bold', '', 32); $pdf->image('./images/lippo.jpg', 25, 4, 50, 30); $pdf->Text(290 / 2 - $pdf->GetStringWidth('Lumiere Club') / 2, 15, 'Lumiere Club'); $pdf->SetFont('PT_Serif-Web-Bold', '', 30); $pdf->Text(290 / 2 - $pdf->GetStringWidth('Lippo Mall Kemang') / 2, 26, 'Lippo Mall Kemang'); $pdf->SetFont('Times', '', 12); $pdf->Text(290 / 2 - $pdf->GetStringWidth('Jl. Pangeran Antasari 36 Jakarta Selatan - 12150') / 2, 33, 'Jl. Pangeran Antasari 36 Jakarta Selatan - 12150'); //$pdf->setDrawColor(105,102,102); $pdf->Line(10, 36, 290 - 5, 36); $pdf->SetFont('Arial', '', 22); $pdf->Text(290 / 2 - $pdf->GetStringWidth('Report Data Upgrade Membership') / 2, 45, 'Report Data Upgrade Membership'); $awal = date('d F Y', strtotime($tgl1)); $akhir = date('d F Y', strtotime($tgl2)); $periode = "{$awal} to {$akhir}"; $pdf->SetFont('Arial', '', 14); $pdf->Text(290 / 2 - $pdf->GetStringWidth($periode) / 2, 54, $periode); //$pdf->Line(10, 10, 210-10, 10); $pdf->SetXY(10, 60); $pdf->SetFont('Helvetica', '', 12); $content = UpgradeMembership::model()->with(array('member', 'user'))->findAll(array('condition' => 'upgrade_date BETWEEN :date1 AND :date2', 'params' => array(':date1' => $tgl1, ':date2' => $tgl2))); if ($content == null) { $pdf->SetFont('Helvetica', '', 48); $pdf->Text(290 / 2 - $pdf->GetStringWidth("No Data Found") / 2, 84, "No Data Found"); $pdf->Output();
// get customer name from first row of first project $customer_name = $customer[$project_ids[0]][0]['customerName']; $pdf->ln(); $pdf->WriteHtml("<h2>{$customer_name}</h2>"); foreach ($project_ids as $project_id) { // process each project in second dimension $project_name = $customer[$project_id][0]['projectName']; $pdf->ln(); $pdf->WriteHtml("<h4>{$project_name}</h4>"); $max_money_width = 0; $max_time_width = 0; // calculate maximum width for time and money // and add to summary array foreach ($customer[$project_id] as $row) { // maximum width calculation $max_money_width = max($max_money_width, $pdf->GetStringWidth($pdf->money($row['wage']))); $time_width = 0; if (isset($columns['date'])) { $time_width += $pdf->GetStringWidth(strftime($dateformat, $row['time_in'])); } if (isset($columns['from']) && isset($columns['to'])) { $time_width += max($pdf->GetStringWidth(strftime($timeformat, $row['time_in'])), $pdf->GetStringWidth(strftime($timeformat, $row['time_out']))); } else { if (isset($columns['from'])) { $time_width += $pdf->GetStringWidth(strftime($timeformat, $row['time_in'])); } else { $time_width += $pdf->GetStringWidth(strftime($timeformat, $row['time_out'])); } } $max_time_width = max($max_time_width, $time_width); }
} $pdf->ln(); $pdf->WriteHtml('<h3>' . $kga['lang']['export_extension']['summary'] . '</h3>'); $pdf->ln(); $pdf->printSummary(array($kga['lang']['activity'], $kga['lang']['export_extension']['duration'], $kga['lang']['export_extension']['costs']), $orderedExportData); $pdf->AddPage(); } // Write to the PDF document which, if any, customer filters were applied. $customers = array(); foreach ($filterCustomers as $customerID) { $customer_info = $database->customer_get_data($customerID); $customers[] = $customer_info['name']; } if (count($customers) > 0) { $label = $kga['lang']['customer'] . ': '; $labelWidth = $pdf->GetStringWidth($label); $pdf->cell($labelWidth, 6, $label); $pdf->cell($labelWidth, 6, implode(', ', $customers)); $pdf->ln(); } // Write to the PDF document which, if any, project filters were applied. $projects = array(); foreach ($filterProjects as $projectID) { $project_info = $database->project_get_data($projectID); $projects[] = $project_info['name']; } if (count($projects) > 0) { $label = $kga['lang']['project'] . ': '; $labelWidth = $pdf->GetStringWidth($label); $pdf->cell($labelWidth, 6, $label); $pdf->cell($labelWidth, 6, implode(', ', $projects));