mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
supplier do
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user