This commit is contained in:
Edmond Teh
2020-09-14 17:12:19 +08:00
parent 75bb7d0d9c
commit f7f62fb677
3 changed files with 202 additions and 248 deletions
+82 -71
View File
@@ -359,11 +359,36 @@ class InvoiceController extends Controller
'lines' => $lines,
'amount' => $invoice->amount
];
$pdf = PDF::loadView('pdf/po', $data);
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new \Mpdf\Config\FontVariables())->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
$mpdf = new \Mpdf\Mpdf([
'fontDir' => array_merge($fontDirs, [
__DIR__ . '/custom/font/directory',
]),
]);
$mpdf->shrink_tables_to_fit=1;
$mpdf->keep_table_proportions = true;
$mpdf->SetTitle('Invoice');
// Send
return $pdf->download('po.pdf');
$html = view('pdf/po', $data);
$mpdf->Bookmark('Start of the document');
$mpdf->SetHTMLFooter('
<table width="100%">
<tr>
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
</tr>
</table>
');
$mpdf->setHeader($invoice->po_number);
$mpdf->WriteHTML($html);
$mpdf->Output();
}
@@ -398,8 +423,8 @@ class InvoiceController extends Controller
'ref' => $booking->id
],
'buyer' => [
'buyer_company' => 'CIEF Worldwide Sdn Bhd (1134596-M)',
'reg_no' => '',
'buyer_company' => 'CIEF Worldwide Sdn Bhd',
'reg_no' => '1134596-M',
'address' => 'Malaysia Global Innovation & Creativity Centre, Level
1 CWS, Block 3730, Persiaran APEC 63000
Cyberjaya.',
@@ -415,16 +440,6 @@ class InvoiceController extends Controller
'lines' => $lines,
'amount' => $invoice->amount
];
$pdf = PDF::loadView('pdf/po', $data);
// Send
return $pdf->download('do.pdf');
}
public function CIEFToCustomerInvoice($id)
{
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new \Mpdf\Config\FontVariables())->getDefaults();
@@ -437,8 +452,29 @@ class InvoiceController extends Controller
]);
$mpdf->shrink_tables_to_fit=1;
$mpdf->keep_table_proportions = true;
$mpdf->SetTitle('Purchase Order');
$mpdf->SetTitle('Invoice');
$html = view('pdf/po', $data);
$mpdf->Bookmark('Start of the document');
$mpdf->SetHTMLFooter('
<table width="100%">
<tr>
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
</tr>
</table>
');
$mpdf->setHeader($invoice->po_number);
$mpdf->WriteHTML($html);
$mpdf->Output();
}
public function CIEFToCustomerInvoice($id)
{
$booking = Booking::where('id', $id)->first();
$invoice = Invoice::where('booking_id', $booking['id'])->first();
$lines = InvoiceDetails::where('invoice_id', $invoice->id)->get();
@@ -447,8 +483,8 @@ class InvoiceController extends Controller
'title' => 'Invoice',
'detail' => [
'date' => Carbon::createFromFormat('Y-m-d H:i:s', $booking->created_at)->format('d-m-Y'),
'ei' => '',
'edo' => 'EDO-202009-000001',
'ei' => $invoice->ei,
'edo' => null,
'ref' => $booking->id
],
'billto' => [
@@ -464,18 +500,21 @@ class InvoiceController extends Controller
'amount' => $invoice->amount
];
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new \Mpdf\Config\FontVariables())->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
$mpdf = new \Mpdf\Mpdf([
'fontDir' => array_merge($fontDirs, [
__DIR__ . '/custom/font/directory',
]),
]);
$mpdf->shrink_tables_to_fit=1;
$mpdf->keep_table_proportions = true;
$mpdf->SetTitle('Invoice');
$html = view('pdf/invoice', $data);
$footer = array(
"C" => array(
"content" => "This is generated by computer , no signature required."
),
"R" => array(
"content" => "Page {PAGENO} of {nb}"
),
"line" => 1
);
$mpdf->Bookmark('Start of the document');
$mpdf->SetHTMLFooter('
@@ -486,7 +525,7 @@ class InvoiceController extends Controller
</tr>
</table>
');
$mpdf->setHeader("EDO-202009-000001");
$mpdf->setHeader($invoice->ei);
$mpdf->WriteHTML($html);
$mpdf->Output();
@@ -501,11 +540,11 @@ class InvoiceController extends Controller
$lines = InvoiceDetails::where('invoice_id', $invoice->id)->get();
$data = [
'title' => 'DO',
'title' => 'Delivery Order',
'detail' => [
'date' => Carbon::createFromFormat('Y-m-d H:i:s', $booking->created_at)->format('d-m-Y'),
'ei' => '',
'edo' => 'EDO-202009-000001',
'edo' => $invoice->edo,
'ref' => $booking->id
],
'billto' => [
@@ -520,16 +559,6 @@ class InvoiceController extends Controller
'amount' => $invoice->amount
];
$pdf = PDF::loadView('pdf/invoice', $data);
// Send
return $pdf->download('do.pdf');
}
public function showpo() {
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new \Mpdf\Config\FontVariables())->getDefaults();
@@ -540,40 +569,22 @@ class InvoiceController extends Controller
__DIR__ . '/custom/font/directory',
]),
]);
$mpdf->SetTitle('Purchase Order');
$id = '2020';
$booking = Booking::where('id', $id)->first();
$invoice = Invoice::where('booking_id', $booking['id'])->first();
$lines = InvoiceDetails::where('invoice_id', $invoice->id)->get();
$data = [
'title' => 'Delivery Order',
'detail' => [
'date' => Carbon::createFromFormat('Y-m-d H:i:s', $booking->created_at)->format('d-m-Y'),
'ei' => '',
'edo' => 'EDO-202009-000001',
'ref' => $booking->id
],
'billto' => [
'buyer_company' => $invoice->buyer_company,
'reg_no' => $invoice->reg_no,
'address' => $invoice->address,
'gst' => '',
'phone' => $invoice->contact_no,
'marking_no' => ''
],
'total_page' => (count($lines) / 10),
'lines' => $lines,
'amount' => $invoice->amount
];
$mpdf->shrink_tables_to_fit=1;
$mpdf->keep_table_proportions = true;
$mpdf->SetTitle('do');
$html = view('pdf/invoice', $data);
$mpdf->Bookmark('Start of the document');
$mpdf->SetHTMLFooter('
<table width="100%">
<tr>
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
</tr>
</table>
');
$mpdf->setHeader($invoice->edo);
$mpdf->WriteHTML($html);
$mpdf->Output();