supplier do

This commit is contained in:
Edmond Teh
2020-09-07 02:35:36 +08:00
parent 48a9a20462
commit 3e04391342
4 changed files with 395 additions and 301 deletions
+44 -14
View File
@@ -14,6 +14,8 @@ use App\Booking;
use App\Invoice;
use App\InvoiceDetails;
use App\InvoiceStatuses;
use App\SupplierBooking;
use App\SettingSupplier;
use PDF;
class InvoiceController extends Controller
@@ -367,18 +369,18 @@ class InvoiceController extends Controller
$data = [
'title' => 'Delivery Order',
'buyer' => [
'buyer_company' => 'CIEF Worldwide Sdn Bhd',
'buyer_company' => $invoice->buyer_company,
'reg_no' => '',
'address' => $invoice->address,
'gst' => '',
'phone' => $invoice->contact_no
],
'seller' => [
'seller_company' => 'CIEF Worldwide Sdn Bhd',
'address' => 'Malaysia Global Innovation & Creativity Centre, Level
1 CWS, Block 3730, Persiaran APEC 63000
Cyberjaya.',
'gst' => '',
'phone' => '018 2909252'
],
'seller' => [
'seller_company' => $invoice->buyer_company,
'address' => $invoice->address,
'phone' => $invoice->contact_no,
'phone' => '018 2909252',
'date' => $invoice->updated_at,
'po_number' => $invoice->po_number,
'order_number' => $booking->order_no
@@ -396,13 +398,41 @@ class InvoiceController extends Controller
public function getSupplierDO($id)
{
// Only Admin Can get Supplier DO
// Generate PO
// Ensure Invoice Exist and Completed
// Generate PO
// Send
$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' => $invoice->buyer_company,
'address' => $supplier->company_name,
'phone' => '',
'date' => '',
'po_number' => $invoice->po_number,
'order_number' => $booking->order_no
],
'lines' => $lines,
'amount' => $invoice->amount
];
$pdf = PDF::loadView('pdf/po', $data);
// Send
return $pdf->download('do.pdf');
}
// private invoiceExist($id)