diff --git a/DroidSansFallback.ttf b/DroidSansFallback.ttf new file mode 100644 index 00000000..1099b177 Binary files /dev/null and b/DroidSansFallback.ttf differ diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 8e83c699..91b5be5c 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -450,39 +450,34 @@ class InvoiceController extends Controller { // Generate PO - $booking = Booking::where('id', $id)->first(); - $invoice = Invoice::where('booking_id', $booking['id'])->first(); - $lines = InvoiceDetails::where('invoice_id', $invoice->id)->get(); - $supplierbooking = SupplierBooking::where('booking_id', $id)->first(); - $supplier = SettingSupplier::where('id', $supplierbooking->supplier_id)->first(); - - $data = [ - 'title' => 'Delivery Order', - 'buyer' => [ - 'buyer_company' => 'CIEF Worldwide Sdn Bhd', - 'reg_no' => '', - 'address' => 'Malaysia Global Innovation & Creativity Centre, Level - 1 CWS, Block 3730, Persiaran APEC 63000 - Cyberjaya.', - 'gst' => '', - 'phone' => '018 2909252' - ], - 'seller' => [ - 'seller_company' => $supplier->company_name, - 'address' => '', - 'phone' => '', - 'date' => '', - 'po_number' => $invoice->po_number, - 'order_number' => $booking->order_no - ], - 'lines' => $lines, - 'amount' => $invoice->amount - ]; - $pdf = PDF::loadView('pdf/po', $data); - + $booking = Booking::where('id', $id)->first(); + $invoice = Invoice::where('booking_id', $booking['id'])->first(); + $lines = InvoiceDetails::where('invoice_id', $invoice->id)->get(); + + $data = [ + 'title' => 'DO', + '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' => '' + ], + 'lines' => $lines, + 'amount' => $invoice->amount + ]; + + $pdf = PDF::loadView('pdf/invoice', $data); // Send - return $pdf->download('do.pdf'); + return $pdf->download('do.pdf'); } private function isUser($booking_id, $user_id) { diff --git a/composer.json b/composer.json index a8618b18..0954d4ee 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "laravel/tinker": "~1.0", "laravelcollective/html": "^5.6", "maatwebsite/excel": "^3.1", + "mpdf/mpdf": "^8.0", "pusher/pusher-php-server": "~3.0", "tymon/jwt-auth": "^1.0.0-rc.2", "zizaco/entrust": "dev-master" diff --git a/resources/views/pdf/invoice.blade.php b/resources/views/pdf/invoice.blade.php index d26a7954..f06ec4cc 100644 --- a/resources/views/pdf/invoice.blade.php +++ b/resources/views/pdf/invoice.blade.php @@ -4,7 +4,7 @@ Document