From 8b63b963c07e05b9c88d4ee22d26b9bd060d766f Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 2 Oct 2020 07:36:46 +0000 Subject: [PATCH] Modify pdf form. #515 --- .../JobOrderHandler/CMBJobOrderHandler.php | 92 ++++++++++--------- translations/cmb.messages.en.yaml | 18 +++- translations/messages.en.yaml | 11 +++ 3 files changed, 76 insertions(+), 45 deletions(-) diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index ece0ff70..3456d97f 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -2220,17 +2220,15 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $pdf->Cell(0, $jo_line_height, $translator->trans('pdf_company_number_email')); // insert INVOICE header - $pdf->Ln($line_height * 3); + $pdf->Ln($line_height * 2); $pdf->SetFont($font_face, 'BU', $jo_font_size); $pdf->MultiCell(0 , $jo_line_height, 'INVOICE', 0, 'C'); // insert customer details header - $pdf->SetFont($font_face, 'B', $body_font_size); - $pdf->SetTextColor(0, 0, 0); - $pdf->SetX($col1_x); - $pdf->Cell(0, $jo_line_height, $translator->trans('pdf_customer_details_header')); - - $pdf->Ln($line_height * 2); + $pdf->SetFont($font_face, 'B', $header_font_size); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_customer_details_header')); + $pdf->Ln($line_height); + $pdf->SetFont($font_face, '', $body_font_size); // insert customer info $customer = $obj->getCustomer(); @@ -2315,8 +2313,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $pdf->Ln($line_height * 2); $pdf->SetFont($font_face, 'B', $header_font_size); $pdf->Cell($label_width, $line_height, 'Invoice Details'); - $pdf->Ln($line_height * 2); - + $pdf->Ln($line_height); $pdf->SetFont($font_face, '', $body_font_size); // get current Y @@ -2365,16 +2362,17 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $pdf->Cell($table_col_width * 2, $table_line_height, number_format($item->getPrice(), 2), 1, 0, 'R'); $pdf->Cell($table_col_width * 2, $table_line_height, number_format($item->getPrice() * $item->getQuantity(), 2), 1, 1, 'R'); } + $pdf->Cell($table_col_width * 6, $table_line_height, 'SubTotal', 1); + $pdf->Cell($table_col_width * 2, $table_line_height, '', 1, 0, 'R'); + $pdf->Cell($table_col_width * 2, $table_line_height, '', 1, 0, 'R'); + $pdf->Cell($table_col_width * 2, $table_line_height, number_format($invoice->getTotalPrice(), 2), 1, 1, 'R'); } else { $pdf->Cell($table_col_width * 12, 7, 'No items', 1, 1); } - $pdf->Ln($line_height * 2); - - // get current Y - $y = $pdf->GetY(); + $pdf->Ln($line_height); // insert invoice footer details $pdf->Cell($label_width, $line_height, 'Dispatched by:'); @@ -2387,48 +2385,54 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $pdf->Cell($label_width, $line_height, 'JO Done by:'); $pdf->MultiCell(0, $line_height, $obj->getRider() ? $obj->getRider()->getFullName() : '', 0, 'L'); - // get Y after left cell - $y = $pdf->GetY(); - - // TODO: resume here - - $pdf->SetXY($col2_x, $y); - $pdf->SetFont($font_face, 'B'); - $pdf->Cell($label_width, $line_height, 'TAX:'); - $pdf->SetFont($font_face, ''); - $pdf->MultiCell(0, $line_height, $invoice ? number_format($invoice->getVAT(), 2) : '', 0, 'R'); - - // get current Y - $y = $pdf->GetY(); - - $pdf->SetXY($col1_x, $y); - $pdf->Cell($label_width, $line_height, 'Emp. ID/Card No./Ref. By:'); - $pdf->MultiCell($val_width, $line_height, $obj->getPromoDetail(), 0, 'L'); - // get Y after left cell $y1 = $pdf->GetY(); - $pdf->SetXY($col2_x, $y); - $pdf->SetFont($font_face, 'B'); - $pdf->Cell($label_width, $line_height, 'DISCOUNT:'); - $pdf->SetFont($font_face, ''); - $pdf->MultiCell(0, $line_height, $invoice ? number_format($invoice->getDiscount(), 2) : '', 0, 'R'); - // get Y after right cell $y2 = $pdf->GetY(); - // get row height $y = max($y1, $y2); - $pdf->SetXY($col1_x, $y); - $pdf->Cell($label_width, $line_height, 'Discount Type:'); - $pdf->MultiCell($val_width, $line_height, $invoice && $invoice->getPromo() ? $invoice->getPromo()->getName() : '', 0, 'L'); - + // insert the scan to pay $pdf->SetXY($col2_x, $y); $pdf->SetFont($font_face, 'B'); - $pdf->Cell($label_width, $line_height, 'FINAL AMOUNT:'); - $pdf->MultiCell(0, $line_height, $invoice ? number_format($invoice->getTotalPrice(), 2) : '', 0, 'R'); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_scan_to_pay')); + + // get Y after right cell + $y2 = $pdf->GetY(); + + $y = max($y1, $y2); + + // insert space here + $pdf->SetXY($col1_x, $y); + $pdf->Ln($line_height); + + // get Y after left cell + $y1 = $pdf->GetY(); + + $y = max($y1, $y2); + + // insert the footer text + $pdf->SetXY($col1_x, $y); $pdf->SetFont($font_face, ''); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_payments')); + + $pdf->Ln(); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_company_name')); + $pdf->Ln(); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_bank')); + $pdf->Ln(); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_return_policy')); + $pdf->Ln(); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_warranty_private_label')); + $pdf->Ln(); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_warranty_private_text')); + $pdf->Ln(); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_warranty_commercial_label')); + $pdf->Ln(); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_warranty_commercial_text')); + $pdf->Ln($line_height * 2); + $pdf->Cell($label_width, $line_height, $translator->trans('pdf_footer_document')); $params['obj'] = $pdf; $params['filename'] = $filename; diff --git a/translations/cmb.messages.en.yaml b/translations/cmb.messages.en.yaml index 1f269944..1da85db5 100644 --- a/translations/cmb.messages.en.yaml +++ b/translations/cmb.messages.en.yaml @@ -12,6 +12,21 @@ add_cust_vehicle_battery_info: This vehicle is using a Motolite battery jo_title_pdf: Res-Q for CMB Job Order country_code_prefix: '+60' delivery_instructions_label: 'Other Details' +pdf_company_name: ENTITY LOGISTICS SDN BHD(1045869-H) +pdf_company_address: 26/1 Lebuh Persekutuan 47301 Petaling Jaya Selangor +pdf_company_number_email: 'Tel: 03-7872 9072 E-Mail: enquiry@entitylogistic.com.my' +pdf_customer_details_header: Customers Details +pdf_footer_scan_to_pay: Scan To Pay +pdf_footer_payments: 'Note: All payments are made payable to' +pdf_footer_company_name: Entity Logistic Sdn Bhd +pdf_footer_bank: 'Malayan Banking: 512307611410' +pdf_footer_return_policy: Goods Sold are not returnable or exchangeable +pdf_footer_warranty_private_label: 'Petrol vehicles / private use : -' +pdf_footer_warranty_private_text: 'Warranty 12 months + 6 months extended or 25,000 km (whichever + comes first) and on selected models' +pdf_footer_warranty_commercial_label: 'Diesel vehicles / commercial use : -' +pdf_footer_warranty_commercial_text: 'Warranty 6 months extended or 20,000 km (whichever comes first)' +pdf_footer_document: 'THIS IS A COMPUTER GENERATED DOCUMENT - NO SIGNATURE REQUIRED' # images image_logo_login: /assets/images/black-text-logo-01.png @@ -19,7 +34,8 @@ icon_login: /assets/images/battery-assist-bm-logo-32x32.png icon_base_32x32: /assets/images/black-text-logo-01-32x32.png icon_base_16x16: /assets/images/black-text-logo-01-16x16.png image_dashboard: /assets/images/century_logo.png -image_jo_pdf: /public/assets/images/black-text-logo-01-115x115.png +image_jo_pdf_battery_assist_logo: /public/assets/images/battery-assist-bm-logo-edited.png +image_jo_pdf_century_logo: /public/assets/images/black-text-logo-01-115x115.png # default point for maps default_lat: 3.084216 diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index ce55e323..1da85db5 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -16,6 +16,17 @@ pdf_company_name: ENTITY LOGISTICS SDN BHD(1045869-H) pdf_company_address: 26/1 Lebuh Persekutuan 47301 Petaling Jaya Selangor pdf_company_number_email: 'Tel: 03-7872 9072 E-Mail: enquiry@entitylogistic.com.my' pdf_customer_details_header: Customers Details +pdf_footer_scan_to_pay: Scan To Pay +pdf_footer_payments: 'Note: All payments are made payable to' +pdf_footer_company_name: Entity Logistic Sdn Bhd +pdf_footer_bank: 'Malayan Banking: 512307611410' +pdf_footer_return_policy: Goods Sold are not returnable or exchangeable +pdf_footer_warranty_private_label: 'Petrol vehicles / private use : -' +pdf_footer_warranty_private_text: 'Warranty 12 months + 6 months extended or 25,000 km (whichever + comes first) and on selected models' +pdf_footer_warranty_commercial_label: 'Diesel vehicles / commercial use : -' +pdf_footer_warranty_commercial_text: 'Warranty 6 months extended or 20,000 km (whichever comes first)' +pdf_footer_document: 'THIS IS A COMPUTER GENERATED DOCUMENT - NO SIGNATURE REQUIRED' # images image_logo_login: /assets/images/black-text-logo-01.png