public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Material Stock Overview List'; $pdf->AddPage('L'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Material Name', 'Sloc', 'Qty', 'UOM', 'Prod Trans Type', 'Ref Source'); $model = new Productstock('search'); $dataprovider = $model->search(); $dataprovider->pagination = false; $data = $dataprovider->getData(); $cols = $dataprovider->getKeys(); $dataku = array(count($data)); //var_dump($dataku); $w = array(10, 15, 70, 30, 30, 30, 40, 30); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['productstockid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, Product::model()->findbypk($datas['productid'])->productname, 'LR', 0, 'L', $fill); $pdf->Cell($w[3], 6, Sloc::model()->findbypk($datas['slocid'])->sloccode, 'LR', 0, 'L', $fill); $pdf->Cell($w[4], 6, $datas['qty'], 'LR', 0, 'L', $fill); $pdf->Cell($w[5], 6, Unitofmeasure::model()->findbypk($datas['unitofmeasureid'])->uomcode, 'LR', 0, 'L', $fill); $pdf->Cell($w[6], 6, Prodtranstype::model()->findbypk($datas['prodtranstypeid'])->description, 'LR', 0, 'L', $fill); $pdf->Cell($w[7], 6, $datas['refsource'], 'LR', 0, 'L', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('productstock.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Material Group List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $connection = Yii::app()->db; $sql = "select a.materialgroupcode, a.description,\r\n b.materialgroupcode as parentgroupcode,c.materialtypecode as materialtype\r\n from materialgroup a\r\n left join materialgroup b on b.materialgroupid = a.parentmatgroupid \r\n left join materialtype c on c.materialtypeid = a.materialtypeid"; $command = $connection->createCommand($sql); $dataReader = $command->queryAll(); $pdf->setaligns(array('C', 'C', 'C', 'C')); $pdf->setwidths(array(30, 50, 30, 30)); $pdf->Row(array('Code', 'Material Type', 'Description', 'Parent Group Code')); $pdf->setaligns(array('L', 'L', 'L', 'L')); foreach ($dataReader as $row1) { $pdf->row(array($row1['materialgroupcode'], $row1['description'], $row1['materialtype'], $row1['parentgroupcode'])); } // me-render ke browser $pdf->Output('materialgroup.pdf', 'D'); }
{ } } $pdf = new PDF('P', 'mm', 'A4'); $pdf->setTitle('Invoice'); $pdf->SetAuthor('JULIE GRACE'); $pdf->SetCreator('k-Auto Generated PDF'); $pdf->SetDisplayMode('real'); $pdf->left_margin = 10; $pdf->top_margin = 20; $pdf->page_width = 210; $pdf->page_height = 297; $pdf->font_size = 11; $pdf->line_height = 6; $pdf->AddPage(); $pdf->setFont('Arial', '', $pdf->font_size); //PAGING SETTING $firstpagecount = 41; $nextpagecount = 54; //HEADER RIGHT $head_width = 70; $xpos = $pdf->left_margin + 110; $ypos = $pdf->top_margin; $line_height = 9; $pdf->setFont('Arial', 'B', '13'); $pdf->SetXY($xpos, $ypos); $pdf->MultiCell($head_width, $line_height, 'Invoice', 1); //HEADER LEFT $head_width = 100; $xpos = $pdf->left_margin; $ypos = $pdf->top_margin;
} if ($order_counter % $pdf->label_per_page == 0) { $pdf->AddPage(); } $order_counter++; $xpos_starter = ($labelxpos - 1) * $pdf->label_width + $labelxpad; $ypos_starter = ($labelypos - 1) * $pdf->label_height + $labelypad; $logo_xpos = $xpos_starter + 52; $logo_ypos = $ypos_starter; $pdf->Image(FPDF_IMGPATH . 'jng-logo.png', $logo_xpos, $logo_ypos, 43, 5.33); //WxH 64.5 x 8 $xpos = $xpos_starter; $ypos = $ypos_starter - 2; //NUMBERING $pdf->SetXY($xpos, $ypos); $pdf->setFont('Arial', 'B', '18'); $pdf->Cell(10, 10, $order_counter); //SP FLAG if ($order['prefix_code'] != '') { $pdf->SetXY($xpos + 76, $ypos + 5); $pdf->setFont('Arial', '', '10'); $pdf->Cell(20, 10, $order['prefix_code'], '0', '0', 'R'); } //ORDER DETAIL $pdf->setFont('Arial', '', '12'); $lineheight = 5; $ypos = $ypos_starter + 10; $pdf->SetXY($xpos, $ypos); $labels = array(); $labels[] = 'Kunde'; //Customer
$pdf->Cell(0, 0, utf8_decode("Edificio A-2 "), 0, 1, 'R'); $pdf->Ln(0.41); $pdf->Cell(0, 0, utf8_decode("Ciudad Universitaria "), 0, 1, 'R'); $pdf->Ln(0.41); $pdf->Cell(0, 0, utf8_decode("Tegucigalpa, Honduras "), 0, 1, 'R'); $pdf->ln(3.5); $pdf->SetFont('Cambria', 'BI', 16); $pdf->Cell(0, 0, utf8_decode("CONSTANCIA DE HIMNO"), 0, 1, 'C'); $pdf->Ln(2.9); $pdf->SetFont('Cambria', 'I', 16); $pdf->SetLeftMargin(2.2); $pdf->SetRightMargin(2.2); $pdf->newFlowingBlock(17.0, 1.0, 0, 'J'); $pdf->SetFont('Cambria', 'I', 16); $pdf->WriteFlowingBlock(utf8_decode('El Suscrito, Secretario de la Facultad de Ciencias Jurídicas de la Universidad Nacional ' . 'Autónoma de Honduras, ')); $pdf->setFont('Cambria', 'BI', 16); $pdf->WriteFlowingBlock(utf8_decode('HACE CONSTAR: ')); $pdf->setFont('Cambria', 'I', 16); $pdf->WriteFlowingBlock(utf8_decode('Que ')); $pdf->setFont('Cambria', 'BI', 16); $pdf->WriteFlowingBlock(utf8_decode($nombreTemporal)); $pdf->setFont('Cambria', 'I', 16); $pdf->WriteFlowingBlock(utf8_decode(' con Número de Cuenta ')); $pdf->setFont('Cambria', 'BI', 16); $pdf->WriteFlowingBlock(utf8_decode($numCuentaTemporal)); $pdf->setFont('Cambria', 'I', 16); $pdf->WriteFlowingBlock(utf8_decode(' y Tarjeta de Identidad ')); $pdf->setFont('Cambria', 'BI', 16); $pdf->WriteFlowingBlock(utf8_decode($numIdentidadTemporal)); $pdf->setFont('Cambria', 'I', 16); $pdf->WriteFlowingBlock(utf8_decode(', ha realizado Examen del Himno Nacional de la República de Honduras, habiendo obtenido una ' . 'calificación de '));
$value_width = 80; $product_per_col = 8; $product_per_page = $product_per_col * 2; foreach ($supplier_list as $sup_id => $sl) { $pdf = new PDF('P', 'mm', 'A4'); $pdf->setTitle('J&G Elements Picking List'); $pdf->SetAuthor('JULIE GRACE'); $pdf->SetCreator('k-Auto Generated PDF'); $pdf->SetDisplayMode('real'); $pdf->SetAutoPageBreak(false, 1); $counter = 0; foreach ($sl as $e) { $pdf->currentSupplier = $suppliers[$sup_id]; if ($counter % $product_per_page == 0) { $pdf->AddPage(); $pdf->setFont('Arial', '', '10'); $ypos = $margin_top; } if ($counter % $product_per_col == 0) { $ypos = $margin_top; } $ypos += $spacing; if ($counter % $product_per_page >= $product_per_col) { $xpos = $margin_left + 100; } else { $xpos = $margin_left; } $box_pad = 2; $img_path = DIR_WS_IMAGES . 'imagecache/'; $img_file = basename(webImageSource($e['image'], '', '80', '80')); $img = $img_path . $img_file;
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Purchasing Group List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Purchasing Organization', 'Purchasing Group Code', 'Description'); $model = new Purchasinggroup('searchwstatus'); $dataprovider = $model->searchwstatus(); $dataprovider->pagination = false; $data = $dataprovider->getData(); $cols = $dataprovider->getKeys(); $dataku = array(count($data)); //var_dump($dataku); $w = array(10, 15, 50, 40, 70); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['purchasinggroupid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, Purchasingorg::model()->findbypk($datas['purchasingorgid'])->purchasingorgcode, 'LR', 0, 'L', $fill); $pdf->Cell($w[3], 6, $datas['purchasinggroupcode'], 'LR', 0, 'L', $fill); $pdf->Cell($w[4], 6, $datas['description'], 'LR', 0, 'L', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('purchasinggroup.pdf', 'D'); }
/** * * @global array $DIAMOND_BRAND_IDS * @global string $server * @global jng_sp $class_sp * @global products_minierp $class_pm * @global logger $logger * @global string $icon_diamond * @global string $icon_gold_585_w * @global string $icon_gold_585_g * @param string $timestamp * @param int $jng_sp_id * @return boolean */ function generateReports($timestamp, $jng_sp_id) { global $DIAMOND_BRAND_IDS, $server, $class_sp, $class_pm, $logger, $icon_diamond, $icon_gold_585_w, $icon_gold_585_g; $log_date = strtotime($timestamp); $sp_detail = $jng_sp_id > 0 ? $class_sp->retrieveDetail($jng_sp_id) : array('package_prefix' => 'JG.DE'); $filter_sold = 1; $filter_age = 56; $logger->write("GENERATING REPORT {$sp_detail['package_prefix']}"); /* * Query get new products which: * 1) age <= 8 weeks (56 days) * 2) total sold >= 1 */ $q = "SELECT p.products_id, p.products_model, p.products_image, p.products_price, p.material_expenses, p.stars "; $q .= " , ptc.categories_id AS catid, cd.categories_name"; $q .= " , IFNULL(plps.sold_monthly_1, 0) AS sold_monthly_1, IFNULL(plps.sold_monthly_2, 0) AS sold_monthly_2"; if ($jng_sp_id > 0) { $q .= " , ((jc.total_returned / jc.total_sold) * 100) AS returned_rate, jc.active_age"; } else { $q .= " , 'N/A' AS returned_rate, DATEDIFF(NOW(), p.products_date_added) AS active_age"; } $q .= " FROM products p"; if ($jng_sp_id > 0) { $q .= " INNER JOIN jng_sp_catalog jc ON jc.jng_sp_id = {$jng_sp_id} AND jc.products_id = p.products_id"; } else { $q .= " INNER JOIN orders_products op ON op.products_id = p.products_id"; } $q .= " LEFT JOIN products_log_per_sp plps ON plps.products_id = p.products_id AND plps.jng_sp_id = {$jng_sp_id}"; $q .= " LEFT JOIN products_to_categories ptc ON ptc.products_id = p.products_id"; $q .= " LEFT JOIN categories_description cd ON cd.categories_id = ptc.categories_id AND cd.language_id = 1"; $q .= " WHERE"; if ($jng_sp_id > 0) { $q .= " jc.active_age <= {$filter_age}"; $q .= " AND jc.active_status = 1"; $q .= " AND total_sold >= {$filter_sold}"; } else { //$q .= " p.products_date_added >= '2013-01-01 00:00:00'"; $q .= " DATEDIFF(NOW(), p.products_date_added) <= {$filter_age}"; $q .= " AND p.products_status = 1"; $q .= " AND op.status NOT IN (10, 12)"; $q .= " GROUP BY p.products_id"; $q .= " HAVING SUM(op.products_quantity) >= {$filter_sold}"; } //$q .= " LIMIT 5"; $dbq = tep_db_query($q); $products = array(); while ($row = tep_db_fetch_array($dbq)) { $row['margin'] = $class_pm->calculateMargin($row['products_price'], $row['material_expenses'], 1); $products[$row['catid']][$row['products_id']] = $row; } if (count($products) == 0) { $logger->write("NO DATA RETRIEVED"); return false; } //Start Creating PDF Reports $margin = 20; $ypos = 10; $col_width = 48; $col_height = 77; $line_height = 5; $cell_text_width = $col_width - 3; $no = 0; $row = 1; $icon_w = 4; $icon_h = 4; $first_page = true; $pdf = new PDF('P', 'mm', 'A4'); $pdf->setTitle('New Comer Report'); $pdf->SetAuthor('JULIE GRACE'); $pdf->SetCreator('Manobo PDF Generator'); $pdf->SetDisplayMode('real'); $pdf->SetAutoPageBreak(true, 25); $pdf->AliasNbPages(); $pdf->AddPage('L'); $pdf->setXY($margin, $ypos); $pdf->setFont('Arial', 'B', '14'); $pdf->cell(240, 5, 'SALES REPORT NEWCOMER PRODUCT ' . $sp_detail['package_prefix'] . ' (' . date('d.m.Y', $log_date) . ')', 0, 0, 'C'); $pdf->setFont('Arial', '', '10'); $ypos += 15; $pdf->setXY($margin, $ypos); $catids = load_config('products-categories-sorting'); foreach ($catids as $catid) { $xpos = $margin; if (is_array($products[$catid])) { foreach ($products[$catid] as $pid => $p) { $obj_product = new product($pid); $no++; if ($ypos >= 150 || $no == 1 && !$first_page) { //Reset vars to new page state $xpos = $margin; $ypos = 25; $row = 1; $pdf->AddPage('L'); $pdf->setXY($margin, $ypos); } //Draw product box $pdf->Cell($col_width, $col_height, '', 1, 0); //Start drawing contents $pdf->drawProductsImage($xpos + 10, $ypos + 1, $p['products_image']); if (is_object($obj_product) && in_array($obj_product->brand_id, $DIAMOND_BRAND_IDS)) { $ypos_icon = $ypos + 3; $pdf->drawIcon($icon_diamond, $xpos + 39.5, $ypos_icon, $icon_w, $icon_h); } if (is_object($obj_product) && ($obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925)) { $icon_gold_selected = "icon_gold_" . $obj_product->metal_stamp_code . '_' . strtolower(substr($obj_product->metal_stamp_info, 0, 1)); $icon_gold = ${$icon_gold_selected}; $ypos_icon += $icon_h; //gold icon dimension is 21 x 16 $icon_gold_w = 21 / 16 * $icon_h; $pdf->drawIcon($icon_gold, $xpos + 38, $ypos_icon, $icon_gold_w, $icon_h); } $pdf->setXY($xpos + 2, $ypos + 3); $pdf->setFont('Arial', 'B', '10'); $pdf->Cell($col_width, $line_height, $no . ". " . ($no == 1 ? $p['categories_name'] : '')); $pdf->setFont('Arial', '', '10'); $pdf->drawStar($p['stars'], $xpos + 15, $ypos + 29); $pdf->setXY($xpos + 2, $ypos + 35); $link = "http://{$server}/?open=product-detail&products_id=" . $pid; $pdf->SetFont('Arial', 'U'); $pdf->SetTextColor(0, 0, 255); $pdf->Cell($cell_text_width, $line_height, $pid . ' / ' . $p['products_model'], 0, 0, 'C', 0, $link); $pdf->SetFont('Arial', ''); $pdf->SetTextColor(0, 0, 0); $pdf->setXY($xpos + 2, $ypos + 40); $pdf->Cell($cell_text_width, $line_height, 'Price: ' . displayCurrency('EUR', $p['products_price'], false) . ' EUR', 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 45); $pdf->Cell($cell_text_width, $line_height, 'Margin: ' . number_format($p['margin'], 1) . '%', 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 50); $pdf->Cell($cell_text_width, $line_height, 'Return Rate: ' . ($jng_sp_id > 0 ? number_format($p['returned_rate'], 1) . '%' : $p['returned_rate']), 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 60); $pdf->Cell($cell_text_width, $line_height, 'Age in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['active_age'] . ' days', 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 65); $pdf->Cell($cell_text_width, $line_height, 'Sold L30D in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['sold_monthly_1'], 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 70); $pdf->Cell($cell_text_width, $line_height, 'Sold L60D in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['sold_monthly_2'], 0, 0, 'C'); if ($no % 5 == 0) { $row++; $xpos = $margin; $ypos += $col_height * ($row - 1) + 5; } else { $xpos += $col_width + 5; } $pdf->setXY($xpos, $ypos); } $first_page = false; } $no = 0; } $filepath = 'sales-report-newcomer-products/'; $yeardir = $filepath . date('Y/', $log_date); if (!file_exists(DIR_FS_ARCHIVES . $yeardir) || !is_dir(DIR_FS_ARCHIVES . $yeardir)) { mkdir(DIR_FS_ARCHIVES . $yeardir); } $monthdir = $yeardir . date('m/', $log_date); if (!file_exists(DIR_FS_ARCHIVES . $monthdir) || !is_dir(DIR_FS_ARCHIVES . $monthdir)) { mkdir(DIR_FS_ARCHIVES . $monthdir); } $path_location = DIR_FS_ARCHIVES . $monthdir; $filename = date('YmdHi', strtotime($timestamp)) . '-sales-report-newcomer-products-' . $sp_detail['package_prefix'] . '.pdf'; $pdf->Output($path_location . $filename, 'F'); $logger->write("PDF CREATED: {$filename}"); //$pdf->Output($filename, 'D'); return true; }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Employee Informal List'; $pdf->AddPage('P'); $sql1 = "select splettername, description, validperiod\r\n from splettertype a"; $pdf->setFont('Arial', 'B', 8); $connection = Yii::app()->db; $command1 = $connection->createCommand($sql1); $dataReader1 = $command1->queryAll(); $pdf->text(10, 40, 'Course / Trainig / skill List'); $pdf->SetY(45); $pdf->setaligns(array('C', 'C', 'C')); $pdf->setwidths(array(50, 40, 30)); $pdf->Row(array('SP Letter Name', 'Description', 'Period')); $pdf->setaligns(array('L', 'L', 'L')); foreach ($dataReader1 as $row1) { $pdf->row(array($row1['splettername'], $row1['description'], $row1['validperiod'])); } // me-render ke browser $pdf->Output('splettertype.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Storage Location List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $connection = Yii::app()->db; $sql = "select b.plantcode, a.sloccode, a.description\r\n from sloc a\r\n left join plant b on b.plantid = a.plantid"; $command = $connection->createCommand($sql); $dataReader = $command->queryAll(); $pdf->setaligns(array('C', 'C', 'C', 'C')); $pdf->setwidths(array(30, 30, 70)); $pdf->Row(array('Plant', 'Sloc Code', 'Description')); $pdf->setaligns(array('L', 'L', 'L')); foreach ($dataReader as $row1) { $pdf->row(array($row1['plantcode'], $row1['sloccode'], $row1['description'])); } // me-render ke browser $pdf->Output('sloc.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Schedule Master List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $connection = Yii::app()->db; $sql = "select a.employeestatusname, a.taxvalue\r\n from employeestatus a"; $command = $connection->createCommand($sql); $dataReader = $command->queryAll(); $pdf->setaligns(array('C', 'C', 'C', 'C')); $pdf->setwidths(array(50, 30, 30, 30)); $pdf->Row(array('Employee Status', 'Tax Value')); $pdf->setaligns(array('L', 'R', 'C', 'C')); foreach ($dataReader as $row1) { $pdf->row(array($row1['employeestatusname'], $row1['taxvalue'])); } // me-render ke browser $pdf->Output('employeestatus.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Asset List'; $pdf->AddPage('L'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $connection = Yii::app()->db; $sql = "select b.productname,c.sloccode,a.expiredate,a.serialno,a.qty,d.uomcode,a.buydate,\r\n a.buyprice,e.currencyname,a.picproduct,a.location,a.locationdate\r\n from productdetail a\r\n left join product b on b.productid = a.productid\r\n left join sloc c on c.slocid = a.slocid\r\n left join unitofmeasure d on d.unitofmeasureid = a.unitofmeasureid\r\n left join currency e on e.currencyid = a.currencyid"; $command = $connection->createCommand($sql); $dataReader = $command->queryAll(); $pdf->setaligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C')); $pdf->setwidths(array(50, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20)); $pdf->Row(array('Material Name', 'Sloc', 'Expire Date', 'Serial No', 'Qty', 'UOM Code', 'Buy Date', 'Buy Price', 'Currency', 'PIC Product', 'Location', 'Loc Date')); $pdf->setaligns(array('L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L')); foreach ($dataReader as $row1) { $pdf->row(array($row1['productname'], $row1['sloccode'], $row1['expiredate'], $row1['serialno'], $row1['qty'], $row1['uomcode'], $row1['buydate'], $row1['buyprice'], $row1['currencyname'], $row1['picproduct'], $row1['location'], $row1['locationdate'])); } // me-render ke browser $pdf->Output('productdetail.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Absence Status List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Short Status', 'Long Status', 'Priority'); $model = new Absstatus('searchwstatus'); $dataprovider = $model->searchwstatus(); $dataprovider->pagination = false; $data = $dataprovider->getData(); $cols = $dataprovider->getKeys(); $dataku = array(count($data)); //var_dump($dataku); $w = array(20, 25, 30, 40, 50); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['absstatusid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, $datas['shortstat'], 'LR', 0, 'C', $fill); $pdf->Cell($w[3], 6, $datas['longstat'], 'LR', 0, 'L', $fill); $pdf->Cell($w[4], 6, $datas['priority'], 'LR', 0, 'C', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('absencestatus.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Kelurahan List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Subdistrict', 'Kelurahan'); $model = new Kelurahan('searchwstatus'); $dataprovider = $model->searchwstatus(); $dataprovider->pagination = false; $data = $dataprovider->getData(); $cols = $dataprovider->getKeys(); $dataku = array(count($data)); //var_dump($dataku); $w = array(20, 25, 50, 50); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['kelurahanid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, Subdistrict::model()->findbypk($datas['subdistrictid'])->subdistrictname, 'LR', 0, 'L', $fill); $pdf->Cell($w[3], 6, $datas['kelurahanname'], 'LR', 0, 'L', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('kelurahan.pdf', 'D'); }
} function PutLink($URL, $txt) { // Put a hyperlink $this->setTextColor(0, 0, 255); $this->setStyle('U', true); $this->write(5, $txt, $URL); $this->setStyle('U', false); $this->setTextColor(0); } } $html = 'You can now easily print text mixing different styles: **bold**, <i>italic</i>, <u>underlined</u>, or **<i><u>all at once</u></i>**!You can also insert links on text, such as <a href="http://www.fpdf.org">www.fpdf.org</a>, or on an image: click on the logo.'; $pdf = new PDF(); // First page $pdf->addPage(); $pdf->setFont('Arial', '', 20); $pdf->write(5, "To find out what's new in this tutorial, click "); $pdf->setFont('', 'U'); $link = $pdf->addLink(); $pdf->write(5, 'here', $link); $pdf->setFont(''); // Second page $pdf->addPage(); $pdf->setLink($link); $pdf->image('logo.png', 10, 12, 30, 0, '', 'http://www.fpdf.org'); $pdf->setLeftMargin(45); $pdf->setFontSize(14); $pdf->writeHTML($html); $pdf->output();
public function generarPDFporEntidad() { Session::tienePermiso('estadistica'); if (isset($_POST['fechaInicio2']) && isset($_POST['fechaFin2'])) { $fechaInicio = DateTime::createFromFormat('d/m/Y', $_POST['fechaInicio2'])->format('Y-m-d'); $fechaFin = DateTime::createFromFormat('d/m/Y', $_POST['fechaFin2'])->format('Y-m-d'); $pdf = new PDF(); // Titulos de las columnas $header = array('Entidad', 'Kgs entregados'); $estadisticas = Estadisticas::nuevo(); $datos = $estadisticas->pesoPorEntidadEntre($fechaInicio, $fechaFin); $pdf->setTitulo('Kgs entregados a cada Entidad Receptora'); $pdf->setFont('Arial', '', 14); $pdf->AddPage(); $pdf->BasicTable($header, $datos); $pdf->Output(); } }
<?php define('FPDF_FONTPATH', 'font/'); require 'fpdf.php'; class PDF extends FPDF { function cell2($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $b = 0, $fsize = 10, $font = 'arial') { if ($b == 0) { $this->setFont($font, '', $fsize); } if ($b == 1) { $this->setFont($font, 'B', $fsize); } $this->cell($w, $h, $txt, $border, $ln, $align, $fill); } } $pdf = new PDF(); $pdf->open(); $pdf->addPage(); $pdf->cell2(0, 7, 'Teste', 1, 1, 'C', 0, 1, 20); $pdf->cell2(0, 7, 'Teste', 1, 1, 'L', 0, 0, 20); $pdf->cell2(0, 5, 'O texto abaixo está usando <tags html>'); $pdf->setFont('arial', '', 12); $pdf->setx(10); $pdf->output();
} $pdf->AddPage(); $pdf->SetXY($margin, $pdf->ypos); //Order Items if (count($items) > 0) { //DRAW BARCODE $items_key = array_keys($items); $barcode_width = 35; $pdf->order_barcode = 'JR-' . $items[$items_key[0]]['jng_sp_orders_items_id']; $sh_name = "{$order['customer_shipping_title']} {$order['customer_shipping_firstname']} {$order['customer_shipping_lastname']}"; $sh_addr = "{$order['customer_shipping_address']} {$order['customer_shipping_address2']}"; $sh_city = "{$order['customer_shipping_postcode']} {$order['customer_shipping_city']}"; $feedback = 'Bestellformular an desiree.bock@julie-grace.de oder per Fax an: 04065584051'; $logo_height = 8; $pdf->Image(FPDF_IMGPATH . 'jng-logo.png', $margin, $pdf->ypos, 64.5, $logo_height); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->ypos += $logo_height + 2; $pdf->setXY($margin, $pdf->ypos); $pdf->Cell(80, $lineheight, $sh_name, 0, 1); $pdf->setFont('Arial', '', $fontsize_med); $pdf->Cell(80, $lineheight, $sh_addr, 0, 1); $pdf->Cell(80, $lineheight, $sh_city, 0, 0); $pdf->Cell(80, $lineheight, $feedback, 0, 1); $pdf->OrderBarcode(297 - ($margin + $barcode_width), $margin, $barcode_width); $pdf->ypos += 15; $lineheight = 5; $pdf->setXY($colpos, $pdf->ypos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->SetFillColor(191, 191, 191); $pdf->Cell($col_subcol_width[1], $lineheight, 'Pos.', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[2], $lineheight, 'Bild', 1, 0, 'C', true);
$box_count++; $po_address = $orders[0]; //CREATE SLIP FOR EACH CARTON/BOX $pdf->AddPage(); $pdf->current_page = 0; $margin_env = $margin + 10; $boxes_tab_env = $boxes_tab + 15; $ypos = $margin + 10; $ev_width = 170; $ev_height = 220; $dash_style = array('width' => 0.1, 'dash' => '2, 2'); $solid_style = array('width' => 0.2, 'dash' => 0); $solid_style_med = array('width' => 0.4, 'dash' => 0); $pdf->Rect($margin_env, $ypos, $ev_width, $ev_height, 'D', array('all' => $dash_style)); $pdf->setXY($margin_env + 10, $ypos + 5); $pdf->setFont('Arial', '', '11'); //FILL JNG ADDRESS HEADER $jng_from = "JULIE & GRACE ({$sp_detail['jng_id']})"; $hamburg_office_address = array(); $hamburg_office_address[] = "{$jng_from}"; $hamburg_office_address[] = JNG_ADDRESS_STREET; $hamburg_office_address[] = JNG_ADDRESS_ZIPCODE . " " . JNG_ADDRESS_CITY; $hamburg_office_address[] = JNG_ADDRESS_COUNTRY; $pdf->MultiCell(100, $lineheight, implode("\n", $hamburg_office_address)); $ypos += 30; $pdf->setXY($margin_env + 70, $ypos); $pdf->setFont('Arial', 'B', '16'); $po = key($sscc_po_list); $shipping_address = array(); $shipping_address[] = $orders_data[$po]['customer_shipping_address']; $shipping_address[] = $orders_data[$po]['customer_shipping_address2'];
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Schedule Master List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $connection = Yii::app()->db; $sql = "select a.onleavename, a.cutimax,a.cutistart,b.formatdoc,c.shortstat\r\n from onleavetype a\r\n left join snro b on b.snroid = a.snroid\r\n left join absstatus c on c.absstatusid = a.absstatusid"; $command = $connection->createCommand($sql); $dataReader = $command->queryAll(); $pdf->setaligns(array('C', 'C', 'C', 'C', 'C')); $pdf->setwidths(array(50, 20, 20, 50, 20)); $pdf->Row(array('Onleave', 'Cuti Max', 'Cuti Start', 'Format Doc', 'Cuti Status')); $pdf->setaligns(array('L', 'L', 'L', 'L', 'L')); foreach ($dataReader as $row1) { $pdf->row(array($row1['onleavename'], $row1['cutimax'], $row1['cutistart'], $row1['formatdoc'], $row1['shortstat'])); } // me-render ke browser $pdf->Output('onleavetype.pdf', 'D'); }
// echo "<pre>";var_dump($orders);die(); foreach ($orders as $po) { $firstorder = true; $pdf->AddPage(); $pdf->current_page = 0; $margin_env = $margin + 10; $boxes_tab_env = $boxes_tab + 15; $ypos = $margin + 10; $ev_width = 170; $ev_height = 170; $dash_style = array('width' => 0.1, 'dash' => '2, 2'); $solid_style = array('width' => 0.2, 'dash' => 0); $solid_style_med = array('width' => 0.4, 'dash' => 0); $pdf->Rect($margin_env, $ypos, $ev_width, $ev_height, 'D', array('all' => $dash_style)); $pdf->setXY($margin_env + 10, $ypos + 5); $pdf->setFont('Arial', '', '12'); //FILL JNG ADDRESS HEADER $jng_from = "JULIE & GRACE ({$sp_detail['jng_id']})"; $hamburg_office_address = "{$jng_from}\n"; $hamburg_office_address .= JNG_ADDRESS_STREET . "\n"; $hamburg_office_address .= JNG_ADDRESS_ZIPCODE . " " . JNG_ADDRESS_CITY . "\n"; $hamburg_office_address .= JNG_ADDRESS_COUNTRY; $pdf->MultiCell(100, $lineheight, $hamburg_office_address); $ypos = +30; $pdf->Line($boxes_tab_env, $ypos, 80, $ypos, $solid_style); $ypos += $lineheight; $pdf->Line($boxes_tab_env, $ypos, 80, $ypos); $ypos += $lineheight; $pdf->Line($boxes_tab_env, $ypos, 80, $ypos); $ypos += $lineheight; $pdf->Line($boxes_tab_env, $ypos, 80, $ypos);
$pdf->Cell(3, 5, ':'); $pdf->Cell(0, 5, $alamat, 0, 1); $pdf->Ln(1.5); $pdf->Cell(40, 5, 'Telepon/Hp'); $pdf->Cell(3, 5, ':'); $pdf->Cell(0, 5, $phone, 0, 1); $pdf->Ln(1.5); $pdf->Cell(40, 5, 'Email'); $pdf->Cell(3, 5, ':'); $pdf->Cell(0, 5, $email, 0, 1); $pdf->Ln(1.5); $pdf->Cell(40, 5, 'Facebook'); $pdf->Cell(3, 5, ':'); $pdf->Cell(0, 5, $fb, 0, 1); $pdf->Ln(5); $pdf->setFont('', 'B'); $pdf->Cell(40, 5, 'Rincian Investasi', 0, 1); $pdf->Ln(5); $pdf->setFont('', ''); $pdf->Cell(40, 5, 'Dana Investasi'); $pdf->Cell(3, 5, ':'); $pdf->setFont('', 'B'); $pdf->Cell(0, 5, 'Rp. ' . $inv, 0, 1); $pdf->Ln(1.5); $pdf->setFont('', ''); $pdf->Cell(40, 5, 'Tingkat Bunga'); $pdf->Cell(3, 5, ':'); $pdf->setFont('', 'B'); $pdf->Cell(0, 5, $bunga . ' %', 0, 1); $pdf->Ln(1.5); $pdf->setFont('', '');
$this->Ln(); $this->Ln(); $this->Ln(); $this->Ln(); $this->SetFont('Arial', '', 9); $this->Cell(0, 0.5, 'INDONESIA POWER', 0, 0, 'C'); } } $pdf = new PDF('L', 'mm', 'A4'); $pdf->Open(); $pdf->text(10, 25, 'LAPORAN DATA BARANG'); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 12); $yi = 30; $ya = 24; $pdf->setFont('Arial', '', 9); $pdf->setFillColor(222, 222, 222); $pdf->setXY(10, $ya); $pdf->Cell(8, 5, 'NO', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Kode', 1, 0, 'C', 1); $pdf->Cell(30, 5, 'No Extracom', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'Header', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'NO Urut', 1, 0, 'C', 1); $pdf->Cell(40, 5, 'Nama Barang', 1, 0, 'C', 1); $pdf->Cell(10, 5, 'Merk', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Jumlah', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Satuan', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Keadaan', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Lokasi', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'Supplier', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'Harga', 1, 0, 'C', 1);
// Color and font restoration $this->setFillColor(224, 235, 255); $this->setTextColor(0); $this->setFont(''); // Data $fill = false; foreach ($data as $row) { $this->cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill); $this->cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill); $this->cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill); $this->cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill); $this->ln(); $fill = !$fill; } // Closing line $this->cell(array_sum($w), 0, '', 'T'); } } $pdf = new PDF(); // Column headings $header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)'); // Data loading $data = $pdf->LoadData('countries.txt'); $pdf->setFont('Arial', '', 14); $pdf->addPage(); $pdf->BasicTable($header, $data); $pdf->addPage(); $pdf->ImprovedTable($header, $data); $pdf->addPage(); $pdf->FancyTable($header, $data); $pdf->output();
public function actionDownload() { parent::actionDownload(); Yii::import('application.extensions.fpdf.*'); require_once "pdf.php"; $pdf = new PDF(); $pdf->title = 'Insurance List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Insurance Name'); $dataprovider = Insurance::model()->searchwstatus(); $dataprovider->pagination = false; $data = $dataprovider->getData(); //var_dump(count($data)); $w = array(10, 25, 70); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['addressbookid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, $datas['fullname'], 'LR', 0, 'L', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('insurance.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Material Status List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $connection = Yii::app()->db; $sql = "select a.materialstatusname\r\n from materialstatus a"; $command = $connection->createCommand($sql); $dataReader = $command->queryAll(); $pdf->setaligns(array('C', 'C')); $pdf->setwidths(array(50, 70)); $pdf->Row(array('Material Status Name')); $pdf->setaligns(array('L', 'L')); foreach ($dataReader as $row1) { $pdf->row(array($row1['materialstatusname'])); } // me-render ke browser $pdf->Output('materialstatus.pdf', 'D'); }
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Unit of Measure List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $connection = Yii::app()->db; $sql = "select a.uomcode,a.description\r\n from unitofmeasure a"; $command = $connection->createCommand($sql); $dataReader = $command->queryAll(); $pdf->setaligns(array('C', 'C', 'C', 'C')); $pdf->setwidths(array(50, 90)); $pdf->Row(array('Unit of Measure', 'Description')); $pdf->setaligns(array('L', 'L')); foreach ($dataReader as $row1) { $pdf->row(array($row1['uomcode'], $row1['description'])); } // me-render ke browser $pdf->Output('unitofmeasure.pdf', 'D'); }
function constructPIContent($pdf, $output, $order, $ignoreStockStatusDepot, $print_per_orders) { /* NOTES!!!!!!!!!!!!!!!! * if $print_per_orders == false, $order should contain "collections of orders" * elseif $print_per_orders == true, $order should contain "one order only" */ use_class('Product'); use_class('ProductAttribute'); global $class_pm, $class_pb, $product_categories_name, $DIAMOND_BRAND_IDS; if ($print_per_orders) { $orders[] = $order; } else { $orders = $order; } //echo "<pre>";var_dump($orders);die(); $margin = 5; $fontsize_big = '9'; $fontsize_med = '8'; $fontsize_sml = '7'; $fontsize_tny = '5'; $barcode_width = 32; $barcode_pos = 210 - $margin - $barcode_width - 1; $element_name_max_chars = 30; if ($output == 'F') { //PRODUCE PDF FILE PER ITEM (MULTI PDF FILE PER ORDER) $pdf = new PDF('P', 'mm', 'A4'); $pdf->setTitle('Production Instruction'); $pdf->SetAuthor('JULIE GRACE / Bonofactum'); $pdf->SetCreator('k-Auto Generated PDF'); $pdf->SetDisplayMode('real'); $pdf->SetAutoPageBreak(false); $pdf->AliasNbPages(); $pdf->SetFillColor(191, 191, 191); } //start looping orders foreach ($orders as $order) { $o = $order['detail']; $is_ottob2b = $o['jng_sp_id'] == '11' || strpos(strtolower($o['customer']), 'otto b2b') !== false; foreach ($order['items'] as $oiid => $i) { if ($i['status'] < 8) { $this->pi_printed[strtolower($o['type'])][] = $oiid; } $obj_product = new Product($i['products_id']); $is_gold_product = $obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925; $pdf->pi_number = $o['id']; if ($this->duplex_printing && isset($item_page_count) && $item_page_count % 2 != 0) { $pdf->AddPage(); } $pdf->AddPage(); $item_page_count = 1; $product_key = $i['products_id'] . '-' . $i['articles_id']; $product_qty = intval($i['quantity']); $p = $this->products[$product_key]; $is_elli_premium = $p['p']['products_brand_id'] == '29'; $is_diamore = in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS); $is_pearl = $p['p']['products_brand_id'] == '7'; $ean = $this->products_ean[$product_key]; $product_complexity = strtoupper(productComplexityName($p['p']['complexity'])); $order_type_code = ''; if (strtoupper($o['type']) == 'DP') { $order_type_code = strtoupper($o['type']); $otc_width = 12; } else { $order_type_code = $o['customer_type']; $otc_width = 20; } $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $margin, $barcode_width); $pdf->setFont('Arial', 'B', '12'); $YPOS = $margin; $lineheight = 4; //ORDER TYPE CODE (JG,SP,DP) $pdf->SetXY($barcode_pos - $otc_width, 10); $pdf->Cell(100, $lineheight, $order_type_code); //PROCESS DATE $pdf->setFont('Arial', 'B', $fontsize_big); $process_date = date('d M Y', strtotime($i['prod_target_in'])); $pdf->SetXY($barcode_pos, 22); $pdf->Cell($barcode_width, $lineheight, $process_date, 0, 2, 'R'); //PRODUCT COMPLEXITY $pdf->setFont('Arial', 'B', '12'); $pdf->SetXY($barcode_pos, 22 + $lineheight + 5); $pdf->Cell($barcode_width, $lineheight, $product_complexity, 0, 2, 'R'); //PAGE HEADER $margin_orderinfo = $margin + 50; $pdf->SetXY($margin_orderinfo, $YPOS); $pdf->Cell(100, $lineheight, 'Production Instruction ' . $o['id'] . ' (' . $i['counter'] . ') - print ' . ($i['print_count'] + 1)); $YPOS += $lineheight + 1; //ORDER INFORMATION $lineheight = 3.5; $orderilbl = array(); $orderinfo = array(); $orderilbl[] = 'Ship To (Country)'; $orderinfo[] = ': ' . trim($o['shipto_name']) . ($o['shipto_address'] != '' ? ' (' . $o['shipto_address'] . ')' : ''); //Show shipping window date only for order which using amazon logistic if (in_array($o['jng_sp_id'], array_keys(getSalesPartnerUseAmazonLogistic())) && isset($i['shipping_window_open'])) { $orderilbl[] = 'Shipping Window Date'; $orderinfo[] = ': ' . date('d. M Y', strtotime($i['shipping_window_open'])); } /* Moved to below barcode $orderilbl[] = 'Process Date'; $orderinfo[] = ': '.date('d. M Y', strtotime($i['prod_target_in'])); */ $orderilbl[] = 'Customer Name'; $vip_status = $o['customer_is_vip'] ? ' ( VIP )' : ''; if ($is_ottob2b) { $orderinfo[] = ': OTTO B2B'; } else { $orderinfo[] = ': ' . $o['customer'] . $vip_status; } //$orderilbl[] = 'Order Source / Customer Name'; //$orderinfo[] = ': '.$o['customer_type'].' / '.$o['customer']; //$orderilbl[] = 'Product Qty x EAN (ID / Code)'; //$orderinfo[] = ': '.intval($i['quantity']).' x '.$ean.' ('.$p['p']['products_id'].' / '.$p['p']['products_model'].')'; $orderilbl[] = 'Product Qty x EAN'; $orderinfo[] = ': ' . $product_qty . ' x ' . $ean; $pdf->setFont('Arial', '', $fontsize_med); $pdf->setXY($margin_orderinfo, $YPOS); $pdf->MultiCell(50, $lineheight, implode("\n", $orderilbl)); $pdf->setXY($margin_orderinfo + 30, $YPOS); $pdf->MultiCell(100, $lineheight, implode("\n", $orderinfo)); $maxline = count($orderilbl); $YPOS += $maxline * $lineheight + 10; //STOCK PREPARATION $pdf->setFont('Arial', 'B', $fontsize_big); if ($i['stock_status'] == 'D' && !$ignoreStockStatusDepot) { //USE DEPOT STOCK $lineheight = 6; $pdf->SetXY($margin + 1, $YPOS); $pdf->Cell(100, $lineheight, 'Depot Stock', 1, 0, 'C', true); $YPOS += $lineheight + 3; } elseif ($i['stock_status'] == 'P') { //USE FINISH GOOD STOCK $lineheight = 6; $pdf->SetXY($margin + 1, $YPOS); $pdf->Cell(100, $lineheight, 'Finish Good', 1, 0, 'C', true); $YPOS += $lineheight + 3; } else { //USE ELEMENTS STOCK $lineheight = 4; $pdf->SetXY($margin, $YPOS); $pdf->Cell(100, $lineheight, 'Elements Preparation'); $YPOS += $lineheight + 1; $pue_total = count($p['elements']); $pue_rows = ceil($pue_total / 2); $max_rows_el_per_page_1 = 12; //MAX ROWS ELEMENT ON PAGE 1 $max_rows_el_per_page_n = 14; //MAX ROWS ELEMENT ON NEXT PAGE $max_rows_el_per_page = $max_rows_el_per_page_1; $pue_counter = 0; $pue_number = 0; $rowpos = $YPOS; $colpos = $margin + 1; $colheight = 20; $col_subcol_width = array(); $col_subcol_width[1] = 6; // $col_subcol_width[2] = $colheight; $col_subcol_width[2] = 20; $col_subcol_width[3] = 10; $col_subcol_width[4] = 51; $col_subcol_width[5] = 10; $col_subcol_imgepos = $col_subcol_width[1]; $col_subcol_infopos = $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3]; $colwidth = array_sum($col_subcol_width); $print_header_el = false; foreach ($p['elements'] as $element) { if ($pue_counter == 0 || $print_header_el) { $lineheight = 5; $pdf->setXY($colpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell($col_subcol_width[1], $lineheight, 'No', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[2], $lineheight, 'Image', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[3], $lineheight, 'ID', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[4], $lineheight, 'Info', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[5], $lineheight, 'Qty', 1, 0, 'C', true); $rowpos += $lineheight; } $pue_counter++; $pue_number++; $e = $this->elements[$element['elements_id']]; $element_image = $this->getImageForPDF($e->image, '80', '80'); $element_info = array(); $element_info['n'] = substr($e->detail['name'], 0, $element_name_max_chars) . (strlen($e->detail['name']) > $element_name_max_chars ? '...' : ''); //var_dump($e->attributes); exit; $element_info['c'] = $e->attributes['color']['name']; //$element_info['s'] = $e->attributes['size']['name']; $material_name = array(); $material_name = explode(',', $e->attributes['material']['name']); $element_info['m'] = count($material_name) > 1 ? $material_name[1] : $material_name[0]; $element_info['sh'] = ''; if (!eregi('other', $e->attributes['size']['name'])) { $element_info['sh'] = $e->attributes['size']['name']; } if (!eregi('other', $e->attributes['shape']['name'])) { if ($element_info['sh'] != '') { $element_info['sh'] .= '.'; } $element_info['sh'] .= $e->attributes['shape']['name']; } //$element_info['h'] = $e->attributes['shape']['name']; if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_hammer'] == '1') { $element_info['f'][] = 'Hammered'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_brush'] == '1') { $element_info['f'][] = 'Brushed'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_oxid'] == '1') { $element_info['f'][] = 'Oxidized/No Antitarnish'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_goldplate'] == '1') { $element_info['f'][] = 'Yellow Goldplated'; } if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_rosegoldplate'] == '1') { $element_info['f'][] = 'Rose Goldplate'; } $element_info['f'] = count($element_info['f']) > 0 ? implode(',', $element_info['f']) : ''; if ($element_image != '') { $pdf->Image($element_image, $colpos + $col_subcol_imgepos, $rowpos, $col_subcol_width[2]); } $pdf->setXY($colpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_med); $pdf->Cell($col_subcol_width[1], $colheight, $pue_number, 1, 0, 'C', true); $pdf->Cell($col_subcol_width[2], $colheight, '', 1, 0, 'C'); $pdf->Cell($col_subcol_width[3], $colheight, $element['elements_id'], 1, 0, 'C'); $pdf->Cell($col_subcol_width[4], $colheight, '', 1, 0, 'C'); $pdf->Cell($col_subcol_width[5], 10, $product_qty * $element['quantity'], 1, 0, 'C'); $pdf->setXY($colpos + $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3] + $col_subcol_width[4], $rowpos + 10); $pdf->SetTextColor(209, 209, 209); $pdf->setFont('Arial', 'B', $fontsize_big + 2); $pdf->Cell($col_subcol_width[5], 10, 'QC', 1, 0, 'C'); $pdf->SetTextColor(0, 0, 0); $pdf->setFont('Arial', '', $fontsize_med); //$pdf->setXY($colpos + $col_subcol_infopos, $rowpos); //$pdf->MultiCell($col_subcol_width[4], 4, implode("\n", $element_info), 0, 'C'); $rowpos_incol = $rowpos + 1; //TODO: make column table could wrapped for text and have flexible height, for example please find this reference : http://www.fpdf.de/downloads/addons/3/ $ei_labels = array('s' => 'Size: ', 'm' => 'Material: ', 'h' => 'Shape: '); foreach ($element_info as $key => $ei) { if ($ei != '') { if ($key == 'c') { $pdf->setFont('Arial', 'B', $fontsize_big + 2); $lineheight = 4; } elseif ($key == 'f') { $pdf->setFont('Arial', 'B', $fontsize_big); $lineheight = 4; } else { $pdf->setFont('Arial', '', $fontsize_med); $lineheight = 3.5; } if (array_key_exists($key, $ei_labels)) { $ei = $ei_labels[$key] . $ei; } $pdf->setXY($colpos + $col_subcol_infopos, $rowpos_incol); $pdf->Cell($col_subcol_width[4], $lineheight, $ei, 0, 0, 'C'); $rowpos_incol += $lineheight; } } if ($pue_rows > $max_rows_el_per_page) { //IF ELEMENT USED MORE THAN MAX ROWS ELEMENT COULD FIT PER PAGE $n_rows = $max_rows_el_per_page; } else { $n_rows = $pue_rows; } if ($pue_counter == $n_rows) { $colpos = $margin + $colwidth + 5; $rowpos = $YPOS; $print_header_el = true; } else { $print_header_el = false; $rowpos += $colheight; if ($pue_counter % $max_rows_el_per_page == 0 && $pue_counter / $max_rows_el_per_page > 1) { //IF ELEMENT USED REACH THE END OF PAGE AND THERE STILL ELEMENT NEED TO BE PRINTED $pdf->AddPage(); if ($pdf->PageNo() > 1) { $max_rows_el_per_page = $max_rows_el_per_page_n; } //SET MARGIN TO THE VERY TOP OF PAGE $colpos = $margin + 1; $rowpos = $margin; $YPOS = $rowpos; $pue_rows = ceil(($pue_total - $pue_number) / 2); //RECALCULATE THE REST OF ELEMENTS THAT COULD DIVIDED INTO 2 COLUMNS $pue_counter = 0; } } } $YPOS += 5 + 3 + $pue_rows * $colheight; } //PRODUCT INFORMATION if ($pue_rows > 9) { $pdf->AddPage(); $item_page_count++; $YPOS = $margin; } $lineheight = 4; $imgbig_width = 60; $imgsml_width = 25; $rowpos = $YPOS; $colpos = $margin + 1; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Information'); $YPOS += $lineheight + 1; $rowpos = $YPOS; $imgbig = $this->getImageForPDF($p['p']['products_image'], '', '212'); //if($imgbig!='') $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width); if ($imgbig != '') { $colposmainimage = $colpos; $image_metadata = getimagesize($imgbig); //MAKE IMAGE CENTERED WHEN SIZE IS PORTRAIT if ($image_metadata[0] == 147) { $colposmainimage = $colpos + 9; } $pdf->Image($imgbig, $colposmainimage, $rowpos, 0, $imgbig_width); } $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width); $rowpos_main_image = $YPOS + $imgbig_width + 2; $rowpos = $YPOS; $img_h_resized = 0; //SHOW LOGO DIAMORE AND ELLI PREMIUM FOR NON OTTO B2B ORDERS if ($i['products_id'] > 0 && ($is_diamore || $is_elli_premium)) { $pb = $class_pb->retrieveDetail($p['p']['products_brand_id']); $img_path = DIR_WS_IMAGES . $pb['brand_image']; $imgsize = getimagesize($img_path); $img_w = $imgsize[0]; $img_h = $imgsize[1]; $h_ratio = $img_h / $img_w; $img_w_resized = 50; $img_h_resized = $img_w_resized * $h_ratio; $pdf->Image($img_path, 150, $YPOS, $img_w_resized, $img_h_resized); } /*USE IMAGE DIAMOND if($class_pm->productContainMaterials($i['products_id'], 52)) { $img_path = FPDF_IMGPATH.'diamond.jpg'; $imgsize = getimagesize($img_path); $img_w = $imgsize[0]; $img_h = $imgsize[1]; $h_ratio = $img_h/$img_w; $img_w_resized = 40; $img_h_resized = $img_w_resized * $h_ratio; $pdf->Image($img_path,165,$YPOS,$img_w_resized,$img_h_resized); } */ if ($is_gold_product) { $lineheight = 6; $leftpos = 150; $rowpos = $YPOS + $img_h_resized + 2; $pdf->SetFontSize($fontsize_big + 5); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C'); } //SPECIAL TREATMENT $product_finishing_array_st = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING); $finishing_product_st = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2'); //echo "<pre>";var_dump($finishing_product_st);die(); if (empty($finishing_product_st)) { unset($finishing_product_st); } if ($finishing_product_st == NULL) { $isset_product_finishing = false; } else { $isset_product_finishing = true; } if (!$is_diamore && !$is_elli_premium) { if ($isset_product_finishing) { $rowpos = $YPOS + $img_h_resized; $lineheight = 6; $leftpos = 150; //special treament $pdf->SetFontSize($fontsize_big + 3); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'SPECIAL TREATMENT', 0, 2, 'C'); if ($i['products_id'] > 0 && ($is_gold_product || $is_pearl)) { if ($is_gold_product) { //gold $rowpos = $rowpos + 7; $pdf->SetFontSize($fontsize_big + 1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C'); } /* if ($is_elli_premium) { $products_used_materials = $class_pm->retrieveProductMaterialsUsed($i['products_id']); if (in_array(52, $products_used_materials)) { $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big+1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C'); } if (in_array(5, $products_used_materials)) { $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big+1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C'); } } if ($is_diamore) { //diamore $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big+1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C'); } * */ if ($is_pearl) { //pearl $rowpos = $rowpos + 5; $pdf->SetFontSize($fontsize_big + 1); $pdf->SetXY($leftpos, $rowpos); $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C'); } } //$pdf->Rect(150, 120, $img_w_resized, 30); } } $leftpos = $colpos + $imgbig_width + 2; $rowpos = $YPOS; $lineheight = 4; $linesep = 1; $pilbl = array(); $pinfo = array(); $pilbl[] = 'Product Category'; $pinfo[] = ': ' . $product_categories_name[$p['categories_id']]; $pilbl[] = 'Product ID'; $pinfo[] = ': ' . $i['products_id']; $pilbl[] = 'Product Code'; $pinfo[] = ': ' . $p['p']['products_model']; /* HIDE PRICE (REQUESTED BY CANTY & WAYAN TO PREVENT SMITH SPOTTED THE PRICE) $pilbl[] = 'Product Price'; $pinfo[] = ': '.displayCurrency('EUR', $p['p']['products_price']); */ if ($p['length'] > 0) { $pilbl[] = 'Product Length'; $pinfo[] = ': ' . textLength($p['length']); } $pilbl[] = 'Product Quantity'; $pinfo[] = ': ' . $product_qty; $lbl_width = 30; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pilbl), 0, 'L'); $pdf->SetXY($leftpos + $lbl_width, $rowpos); $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pinfo), 0, 'L'); $rowpos += count($pilbl) * ($lineheight + $linesep) + 2 * $linesep; // $pdf->SetXY($leftpos, $rowpos); // $pdf->setFont('Arial','B',$fontsize_med); // $prodinfo = 'Product ID: '.$p['p']['products_id']; // $pdf->Cell(100, $lineheight, $prodinfo); // $rowpos += $lineheight + $linesep; // $pdf->SetXY($leftpos, $rowpos); // $pdf->setFont('Arial','B',$fontsize_med); // $prodinfo = 'Product Code: '.$p['p']['products_model']; // $pdf->Cell(100, $lineheight, $prodinfo); // $rowpos += $lineheight + $linesep; // if($p['length']>0) { // $pdf->SetXY($leftpos, $rowpos); // $pdf->setFont('Arial','B',$fontsize_med); // $prodinfo = 'Product Length: '.textLength($p['length']); // $pdf->Cell(100, $lineheight, $prodinfo); // $rowpos += $lineheight + $linesep; // } $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Name:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_big); $pdf->Cell(100, $lineheight, $p['pd'][2]['products_name']); $rowpos += $lineheight + 2 * $linesep; if ($p['pnc']['production_instruction_id'] != '') { $rowpos += $lineheight; $piids = explode(",", $p['pnc']['production_instruction_id']); $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Production Instruction:'); $pdf->setFont('Arial', ''); $pims = array(); //MERGE ALL MANUAL PI THAT ATTACHED TO PRODUCT foreach ($piids as $piid) { $pim = new production_instruction_manual($piid); $pi_temp = "\n" . $pim->cat_name . ' - ' . $pim->name; if (trim($pim->description) != '') { $pi_temp .= "\n" . $pim->description; } $pims[] = $pi_temp; } //EXPLODE EACH MANUAL PI WITH LINE FEED $pi_manual = implode("\n", $pims); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->MultiCell(0, $lineheight, trim($pi_manual), 0, 'L'); $manpi_rows = explode("\n", trim($pi_manual)); // $rowpos += $lineheight * 3; } else { if ($p['pnc']['products_instruction'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Production Instruction:'); $pdf->setFont('Arial', ''); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->MultiCell(0, $lineheight, $p['pnc']['products_instruction'], 0, 'L'); $manpi_rows = explode("\n", $p['pnc']['products_instruction']); //$rowpos += ceil(($lineheight-1)*count($manpi_rows)); } } $rowpos_manpi = $pdf->GetY(); $rowpos = $rowpos_manpi + 5; $leftpos = $colpos + $imgbig_width + 2; $rowpos_addimage = 0; $nei = 0; if (strtoupper($o['type']) == 'JG' && $i['custom_img'] != '') { //$imgcus_width = 37; //150px $imgcus_width = $imgsml_width; //100px $imgcus = $this->getImageForPDF($i['custom_img'], '100', '100'); if ($imgcus != '') { $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width); $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width); } $leftpos += $imgcus_width + 2; // } elseif((count($p['pei'])>0 && ($p['categories_id']==2||$p['categories_id']==3||$p['categories_id']==30)) || (count($p['pei'])>1 && $p['categories_id']==9)) { //Show Extra Images only for NL,BL,SETS OR CH that have 2 extra images (only show 1st extra_images) } elseif (count($p['pei']) > 0) { // show extra images for all categories since tends now extra images is used for explain detailly of a product $rowpos = $YPOS + $imgbig_width + 2; $pdf->SetXY($margin, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Additional Images'); $rowpos += $lineheight + 1; foreach ($p['pei'] as $pei) { $nei++; // if($p['categories_id']==9 && $nei>1) continue; //display only 1st extra image for CH $reset_leftpos = true; if ($is_diamore) { //IF DIAMORE PRODUCTS $print_image = false; if (($p['categories_id'] == 2 || $p['categories_id'] == 30) && in_array($nei, array(1, 3))) { $print_image = true; } if ($p['categories_id'] == 4 && in_array($nei, array(2, 3))) { $print_image = true; } if (($p['categories_id'] == 29 || $p['categories_id'] == 3) && in_array($nei, array(1, 2))) { $print_image = true; } if (($p['categories_id'] == 9 || $p['categories_id'] == 28) && in_array($nei, array(1))) { $print_image = true; } if ($print_image) { $leftpos = $colpos; if ($rowpos > 214) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; $rowpos = $YPOS; $rowpos_manpi = $YPOS; } $imgsml = $this->getImageForPDF($pei, '212', '212'); if ($imgsml != '') { $pdf->Image($imgsml, $leftpos, $rowpos, $imgbig_width); $pdf->Rect($leftpos, $rowpos, $imgbig_width, $imgbig_width); $rowpos += $imgbig_width + 2; } } } else { //IF NOT DIAMORE PRODUCTS $check_nei = $nei % 2; if ($check_nei == 1) { if ($nei != 1) { $reset_leftpos = false; //print additional image using 2 columns when manual pi is exceeded bottom of main image if ($nei > 2 && $rowpos_manpi > $rowpos_main_image) { $rowpos += $imgsml_width + 2; $reset_leftpos = true; } } } else { $reset_leftpos = false; } if ($reset_leftpos) { $leftpos = $colpos; } else { $leftpos += $imgsml_width + 2; } $imgsml = $this->getImageForPDF($pei, '100', '100'); if ($imgsml != '') { $pdf->Image($imgsml, $leftpos, $rowpos, $imgsml_width); $pdf->Rect($leftpos, $rowpos, $imgsml_width, $imgsml_width); //$rowpos += $imgsml_width + 2; } } } if ($is_diamore) { //IF DIAMORE PRODUCTS $rowpos_addimage = $rowpos + 2; } else { $rowpos_addimage = $rowpos + $imgsml_width + 2; $leftpos += $imgsml_width + 2; } } //CUSTOMIZE PRODUCTS & PRINTED GIFT VOUCHER FROM JULIE & GRACE if (strtoupper($o['type']) == 'JG') { if (strpos($p['p']['products_model'], 'GIFT-P') !== false) { $gift_amount = substr($p['p']['products_model'], 7); $cgq_query = "SELECT c.coupon_code, c.coupon_amount, c.coupon_expire_date FROM coupon_gv_queue cgq"; $cgq_query .= " LEFT JOIN coupons c ON c.coupon_id=cgq.coupon_id"; $cgq_query .= " WHERE cgq.order_id={$o['id']} AND cgq.amount={$gift_amount}"; $cgq_result = tep_db_query($cgq_query); $vouchers = array(); while ($row = tep_db_fetch_array($cgq_result)) { $vouchers[] = $row; } $vcounter = 0; foreach ($vouchers as $v) { $vcounter++; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell(100, $lineheight, 'Voucher ' . $vcounter . ':'); $rowpos += $lineheight; $vilbl = array(); $vinfo = array(); $vilbl[] = '- Code'; $vinfo[] = ': ' . $v['coupon_code']; $vilbl[] = '- Amount'; $vinfo[] = ': ' . number_format($v['coupon_amount'], 0) . ' EUR'; $vilbl[] = '- Expired Date'; $vinfo[] = ': ' . date('d. M Y', strtotime($v['coupon_expire_date'])); $pdf->setFont('Arial', '', $fontsize_med); $pdf->SetXY($leftpos, $rowpos); $pdf->MultiCell($lbl_width, $lineheight, implode("\n", $vilbl)); $pdf->SetXY($leftpos + $lbl_width, $rowpos); $pdf->MultiCell(100, $lineheight, implode("\n", $vinfo)); $rowpos += count($vilbl) * $lineheight + 2 * $linesep; } } if ($i['custom_text'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Text:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', 12); $pdf->MultiCell(0, 4, $i['custom_text']); $rowpos += 2 * $lineheight + 2 * $linesep; } if ($i['custom_img'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Image:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_big); $pdf->Cell(0, $lineheight, basename($i['custom_img'])); $rowpos += $lineheight + 2 * $linesep; } if ($i['custom_imgcm'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Image Comment:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_big); $pdf->MultiCell(0, $lineheight, basename($i['custom_imgcm']), 0, 'L'); } } else { if ($p['article']['text'] != '') { $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Custom Text:'); $rowpos += $lineheight; $pdf->SetXY($leftpos, $rowpos); $pdf->setFont('Arial', '', 12); $pdf->MultiCell(0, 4, $p['article']['text']); $rowpos += 2 * $lineheight + 2 * $linesep; } } //$YPOS += (($rowpos>($YPOS+$imgbig_width)) ? $rowpos : $imgbig_width) + 10; //CHANGE THIS TO BELOW //if($rowpos>($YPOS+$imgbig_width)) $YPOS = $rowpos + 5; //else $YPOS += $imgbig_width + 10; if (in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS)) { if ($rowpos_manpi > $rowpos_addimage) { $YPOS = $rowpos_manpi + 5; } elseif ($rowpos_addimage > $rowpos_manpi) { $YPOS = $rowpos_addimage + 15; } //if manual pi printed smaller than displayed additional images if ($rowpos_main_image > $rowpos_manpi && $nei == 0) { $YPOS = $rowpos_main_image + 5; } //if manual pi printed smaller than displayed main images and theres no additional images printed if ($rowpos_manpi == $rowpos_addimage) { $YPOS = $rowpos_manpi; } //if manual pi printed and additional images were the same row height } else { if ($rowpos_manpi > $rowpos_addimage) { $YPOS = $rowpos_manpi + 5; } elseif ($rowpos_addimage > $rowpos_manpi) { $YPOS = $rowpos_addimage + 5; } //if manual pi printed smaller than displayed additional images if ($rowpos_main_image > $rowpos_manpi && $nei == 0) { $YPOS = $rowpos_main_image + 5; } //if manual pi printed smaller than displayed main images and theres no additional images printed if ($rowpos_manpi == $rowpos_addimage) { $YPOS = $rowpos_manpi; } //if manual pi printed and additional images were the same row height } //PRODUCTION if ($YPOS > 240) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $lineheight = 5; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Production'); $YPOS += $lineheight + 1; //IF NEED NEW QC COLUMN, ONLY NEED TO ADD BELOW ARRAY $col = array(); $col[1] = 'Workshop'; $col[2] = 'Beading'; $col[3] = 'Enamel'; $col[4] = 'Ferido'; $col[5] = 'Packing'; $leftpos = $margin + 1; $pdf->setXY($leftpos, $YPOS); $qc_table_max_width = 198; $colwidth = number_format($qc_table_max_width / count($col), 1); //$colwidth = 39.6; foreach ($col as $cval) { $pdf->Cell($colwidth, $lineheight, $cval, 1, 0, 'C', true); } $YPOS += $lineheight; $leftpos = $margin + 1; $pdf->setFont('Arial', 'B', $fontsize_big + 5); $pdf->SetTextColor(209, 209, 209); $pdf->setXY($leftpos, $YPOS); for ($x = 1; $x <= count($col); $x++) { $pdf->Cell($colwidth, 15, 'QC', 1, 0, 'C'); } //PRODUCT FINISHING //echo "<pre>";var_dump($finishing);die(); $finishing = array(); /* UPDATE: NOW WE USE PRODUCTS FINISHING IN PRODUCT ATTRIBUTES TO FLAG WHETHER THE PRODUCTS NEEDS RHODIUM OR MICRON */ /* RHODIUM RULES Rule1: OttoB2B, Elli Premium which Silver "without plated" and whitegold product Rule2: Diamore */ /* $rhodium_rule1 = ( ($is_ottob2b || $is_elli_premium) && ($obj_product->metal_stamp_code == Product::METAL_STAMP_CODE_925 || $obj_product->metal_stamp_info == Product::METAL_STAMP_INFO_WHITEGOLD) ); $rhodium_rule2 = $is_diamore; */ //$rhodium_and_micron_rule = in_array_r($finishing_product, $product_finishing_array); //if ($rhodium_rule1 || $rhodium_rule2) { //if ($rhodium_and_micron_rule) { //$finishing[] = 'Rhodium'; //} $is_partial_plated = $p['p']['is_partial_plated'] == '1'; $is_goldplated = false; foreach ($p['finishing'] as $ftext => $fval) { if ($fval) { $is_goldplated = $fval == 'Goldplated' || $fval == 'Rose Goldplate'; if ($is_partial_plated) { if ($fval == 'Goldplated' || $fval == 'Rose Goldplate') { continue; } } //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron /* if (($is_ottob2b || $is_elli_premium) && ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) { $ftext .= ' 1.5 micron'; } */ $finishing[] = $ftext; } } if ($is_partial_plated) { //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron //if (($is_ottob2b || $is_elli_premium) //$finishing_micron_key = array_search('micron', $finishing); //if ($finishing_micron_key !== false //&& ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) { //$finishing[] = 'Partial Plated 1.5 micron'; //} else { $finishing[] = 'Partial Plated'; //} } $product_finishing_array = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING); $finishing_product = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2'); if (!empty($finishing_product)) { $finishing[] = $finishing_product; } /* if ($is_goldplated || $is_partial_plated) { //If using plating, removed finishing Rhodium since it will antitarnished as standard for plated products $finishing_rhodium_key = array_search('Rhodium', $finishing); if ($finishing_rhodium_key !== false) { unset($finishing[$finishing_rhodium_key]); } } */ //echo "<pre>";var_dump($finishing);die(); if (count($finishing) > 0) { if ($YPOS > 250) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $finishing = implode(', ', $finishing); $pdf->SetTextColor(0, 0, 0); $YPOS += $lineheight + 15; $lineheight = 4; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Finishing'); $YPOS += $lineheight + 1; $lineheight = 15; $colwidth = array(); $colwidth[1] = 178; $colwidth[2] = 20; $leftpos = $margin + 1; $pdf->setXY($leftpos, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big + 5); $pdf->Cell($colwidth[1], $lineheight, $finishing, 1, 2, 'C'); $leftpos += $colwidth[1]; $pdf->setXY($leftpos, $YPOS); $pdf->SetTextColor(209, 209, 209); $pdf->Cell($colwidth[2], $lineheight, 'QC', 1, 2, 'C'); } $pdf->SetTextColor(0, 0, 0); //PRODUCT GOLD WEIGHT CHECK (PGWC) if ($is_gold_product) { if ($YPOS > 220) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $YPOS += $lineheight + 15; $lineheight = 5; $pdf->SetXY($margin, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->Cell(100, $lineheight, 'Product Gold Weight Check'); $YPOS += $lineheight + 1; $gold_weight_check_process = array(); $gold_weight_check_process["Safe-WH"] = 'Safe to WH'; $gold_weight_check_process["WH-QC"] = 'WH to QC'; $gold_weight_check_process["QC-GS"] = 'QC to Goldsmith'; $gold_weight_check_process["GS-QC"] = 'Goldsmith to QC'; $leftpos = $margin + 1; $pdf->SetXY($leftpos, $YPOS); $gwc_table_max_width = $qc_table_max_width; $n_col_weight_check = 8; $colwidth = number_format($gwc_table_max_width / $n_col_weight_check, 1); foreach ($gold_weight_check_process as $key => $val) { if ($key == "QC-GS" || $key == "GS-QC") { $pdf->Cell($colwidth * 3, $lineheight, $val, 1, 0, 'C', true); } else { $pdf->Cell($colwidth, $lineheight, $val, 1, 0, 'C', true); } } //Draw PGWC Total Weight Box $YPOS += $lineheight; $leftpos = $margin + 1; $pdf->setFont('Arial', 'B', $fontsize_sml); $pdf->SetTextColor(209, 209, 209); $pdf->SetXY($leftpos, $YPOS); $gw_colheight_big = 10; $gw_colheight_sml = number_format($gw_colheight_big / 2, 1); for ($x = 1; $x <= $n_col_weight_check; $x++) { if ($x == 1) { $pdf->Cell($colwidth, $gw_colheight_sml, 'GW:', 1, 2, 'L'); $pdf->SetX($leftpos); $pdf->Cell($colwidth, $gw_colheight_sml, 'NW:', 1, 0, 'L'); } else { if ($x == 2) { $pdf->SetXY($leftpos + $colwidth, $YPOS); } $box_start = $x == $n_col_weight_check ? 2 : 0; $pdf->Cell($colwidth, $gw_colheight_sml, "Total Weight", 'LR', $box_start, 'C'); } } $pdf->SetX($leftpos + $colwidth); for ($x = 2; $x <= $n_col_weight_check; $x++) { $box_start = $x == $n_col_weight_check ? 2 : 0; $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', $box_start, 'C'); } //Draw PGWC Total Signature Box $colwidth_signature = number_format($colwidth / 2, 1); $pdf->SetX($leftpos); $pdf->SetFontSize($fontsize_med); foreach ($gold_weight_check_process as $key => $val) { if ($key == "QC-GS" || $key == "GS-QC") { $loop = 3; } else { $loop = 1; } list($lsign, $rsign) = explode("-", $key); for ($x = 1; $x <= $loop; $x++) { $pdf->Cell($colwidth_signature, $gw_colheight_big, $lsign, 1, 0, 'C'); $pdf->Cell($colwidth_signature, $gw_colheight_big, $rsign, 1, 0, 'C'); } } $YPOS += $lineheight - 2 + $gw_colheight_big * 2; $pdf->setFont('Arial', '', $fontsize_sml); $pdf->Text($leftpos, $YPOS, 'GW: Total Weight of Gold Elements'); $YPOS += $lineheight - 2; $pdf->Text($leftpos, $YPOS, 'NW: Total Weight of Non-Gold Elements'); //Draw PGWC Dust Box if ($YPOS > 250) { $pdf->show_footer_page_info = true; $pdf->AddPage(); $YPOS = $margin + 5; } $YPOS += $lineheight; $pdf->SetXY($leftpos, $YPOS); $pdf->setFont('Arial', 'B', $fontsize_big); $pdf->SetTextColor(0, 0, 0); $pdf->Cell($colwidth, $lineheight, 'Dust', 1, 2, 'C', true); $pdf->SetFontSize($fontsize_sml); $pdf->SetTextColor(209, 209, 209); $pdf->Cell($colwidth, $gw_colheight_sml, 'Total Weight', 'LR', 2, 'C'); $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', 2, 'C'); $pdf->Cell($colwidth_signature, $gw_colheight_big, 'QC', 1, 0, 'C'); $pdf->Cell($colwidth_signature, $gw_colheight_big, 'GS', 1, 0, 'C'); } $pdf->SetTextColor(0, 0, 0); //ENGRAVING ORDER SLIP global $ENGRAVED_PRODUCTS; if (strtoupper($o['type']) == 'JG' && in_array($i['products_id'], $ENGRAVED_PRODUCTS)) { if ($this->duplex_printing && $item_page_count % 2 != 0) { $pdf->AddPage(); $item_page_count++; } $pdf->AddPage(); $item_page_count++; $lineheight = 4; $midpage = 148.5; $rowpos = $margin + 10; //repeat 2 times for ($s = 1; $s <= 2; $s++) { if ($s == 2) { $rowpos = $midpage + 10; $slipinfo = 'Face2Face'; } else { $slipinfo = 'Bonofactum'; } $colpos = $margin + 1; $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $rowpos, $barcode_width); $pdf->SetXY($margin, $rowpos); $pdf->setFont('Arial', 'B', '12'); $pdf->Cell(100, $lineheight, 'Engraving Order Slip (' . $slipinfo . ')'); $rowpos += $lineheight + 5; $rowpos_fixed = $rowpos; if ($imgbig != '') { $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width); } $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width); $colpos += $imgbig_width + 5; $es_ilbl_width = 30; $es_ilbl = array(); $es_info = array(); $es_ilbl[] = 'Order By'; $es_info[] = ': Bonofactum'; $es_ilbl[] = 'Order Date'; $es_info[] = ': ' . date('d. M Y'); $es_ilbl[] = 'Order Quantity'; $es_info[] = ': ' . $product_qty; $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->SetXY($colpos, $rowpos); $pdf->MultiCell($es_ilbl_width, $lineheight, implode("\n", $es_ilbl)); $pdf->SetXY($colpos + $es_ilbl_width, $rowpos); $pdf->MultiCell($es_ilbl_width * 2, $lineheight, implode("\n", $es_info)); $rowpos += (count($es_ilbl) + 1) * $lineheight + 1; $pdf->SetXY($colpos, $rowpos); $pdf->Cell(100, $lineheight, 'Custom Text'); $rowpos += $lineheight + 1; $pdf->SetDrawColor(128, 128, 128); $pdf->Rect($colpos + 1, $rowpos, 132, 30); $pdf->SetDrawColor(0, 0, 0); if ($i['custom_text'] != '') { $pdf->SetXY($colpos + 3, $rowpos + 3); $pdf->setFont('Arial', 'B', '12'); $pdf->MultiCell(100, $lineheight, $i['custom_text']); } $rowpos = $rowpos_fixed + $imgbig_width + 5; if ($i['custom_img'] != '') { $leftpos = $margin + 1; if ($imgcus != '') { $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width); $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width); } $leftpos += $imgcus_width + 2; $pdf->setXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell(100, $lineheight, 'Custom Image:'); $rowpos += $lineheight; $pdf->setXY($leftpos, $rowpos); $pdf->setFont('Arial', '', $fontsize_med); $pdf->Cell(100, $lineheight, basename($i['custom_img'])); $rowpos += $lineheight + 1; $pdf->setXY($leftpos, $rowpos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->Cell(100, $lineheight, 'Graving Request:'); $rowpos += $lineheight; $engraving_options_pos = $leftpos + $lineheight + 1; $engraving_options = array(); $engraving_options[] = 'Full (gravir penuh)'; $engraving_options[] = 'Centered (gravir tengah, atas dan bawah kosong)'; $engraving_options[] = 'Bottom (gravir bawah penuh, atas kosong)'; $pdf->setXY($engraving_options_pos, $rowpos); $pdf->setFont('Arial', '', $fontsize_med); $pdf->MultiCell(100, $lineheight, implode("\n", $engraving_options)); $cb_sep = 0.5; $cbsize = $lineheight - $cb_sep; $leftpos += 1; $pdf->SetDrawColor(128, 128, 128); foreach ($engraving_options as $eo) { $pdf->Rect($leftpos, $rowpos, $cbsize, $cbsize); $rowpos += $lineheight; } $pdf->SetDrawColor(0, 0, 0); } } $pdf->Line($margin, $midpage, 210 - $margin, $midpage); } if ($i['print_count'] == '0' || $i['print_count'] == '') { $this->qty_total_first_printed++; } } //end looping items } //end looping orders if ($output == 'F') { $filename = $this->filename != '' ? $this->filename : DIR_FS_MINIERP . DIR_WS_GATEWAY . "ready_orders/" . strtoupper($o['type']) . '/' . strtoupper($o['type']) . '-' . $oiid; // $priority_rule_1 = in_array($o['jng_sp_id'], $sp_using_red_paper); // $priority_rule_2 = $o['customer_is_vip']; $priority_rule_1 = $o['priority'] == '1'; // if($priority_rule_1 || $priority_rule_2 || $priority_rule_3) $filename .= '-RED'; if ($priority_rule_1 && $this->filename == '') { $filename .= '-RED'; } $pdf->Output($filename . '.pdf', $output); } }
$pdf->SetAuthor('JULIE GRACE'); $pdf->SetCreator('Manobo PDF Generator'); $pdf->SetDisplayMode('real'); $pdf->SetAutoPageBreak(true, 25); $pdf->AliasNbPages(); $pdf->AddPage('L'); $margin = 30; $ypos = 10; $cellstart = $margin; $cellsize = 48; $cellsize_half = $cellsize / 2; $cellsizecollweek = $cellsize + $margin; $cell_height_col = 55; $cell_height = 5; $pdf->setXY($margin, $ypos); $pdf->setFont('Arial', 'B', '14'); $pdf->cell(240, 5, 'SALES REPORT WEEKLY PRODUCT KW ' . date('W') . ' (' . date('d.m.Y', strtotime($filter_date)) . ')', 0, 0, 'C'); $pdf->setFont('Arial', '', '10'); $ypos += 10; $pdf->setXY($cellstart, $ypos); $firstorder = true; $no = 1; $catids = load_config('products-categories-sorting'); if (SERVER_IS_LOCAL) { use_class('CategoryTop'); //load all categories which not sorted while ($ct = CategoryTop::getOneByOneAsObject()) { if ($ct->getCategoriesTotalCount() > 0) { while ($cat = $ct->getCategoriesOneByOneAsObject()) { if (!in_array($cat->id, $catids)) { $catids[] = $cat->id;
$this->SetFont('Arial', 'I', 8); //Page number $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); } } $tgl = date('d - m - Y'); $pdf = new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Times', '', 12); //$pdf->text(90,30,'PT. NYALINDUNG'); $tahun = $_GET['tahun']; $pdf->text(55, 36, 'LAPORAN ANGGOTA KOPERASI PT. MEDAN JAYA ' . $tahun); $yi = 50; $ya = 44; $pdf->setFont('Arial', '', 6); $pdf->setFillColor(222, 222, 222); $pdf->setXY(35, $ya); $pdf->CELL(20, 5, 'NO ANGGOTA', 1, 0, 'C', 1); $pdf->CELL(20, 5, 'NAMA', 1, 0, 'C', 1); $pdf->CELL(25, 5, 'NO KTP', 1, 0, 'C', 1); $pdf->CELL(30, 5, 'ALAMAT', 1, 0, 'C', 1); $pdf->CELL(15, 5, 'KOTA', 1, 0, 'C', 1); $pdf->CELL(15, 5, 'AKTIVASI', 1, 0, 'C', 1); $ya = $yi + $row; include "../config/koneksi.php"; $tahun = $_GET['tahun']; $sql = mysql_query("select * from mst_anggota where status_pegawai = 0") or die("salah sql"); $i = 1; $no = 1; $max = 31;