mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
add new fields into pdf
This commit is contained in:
@@ -359,17 +359,16 @@ class InvoiceController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure Invoice Status is Approve
|
||||
// if ($this->invoiceStatus($id) !== 'approve') {
|
||||
// return response()->json(['message' => 'Invoice must and exist and approve status.'], 403);
|
||||
// }
|
||||
|
||||
// Generate PO
|
||||
|
||||
$booking = Booking::where('id', $id)->first();
|
||||
$invoice = Invoice::where('booking_id', $booking['id'])->first();
|
||||
$lines = InvoiceDetails::where('invoice_id', $invoice->id)->get();
|
||||
$marking = User::find($booking->user_id)->marking;
|
||||
$subtotal = InvoiceDetails::where('invoice_id', $invoice->id)->sum('total');
|
||||
$adjustment = $invoice->adjustment;
|
||||
$billing_charges = $booking->billing_charge;
|
||||
$total = $subtotal + $adjustment + $billing_charges;
|
||||
|
||||
$data = [
|
||||
'title' => 'Purchase Order',
|
||||
@@ -395,7 +394,10 @@ class InvoiceController extends Controller
|
||||
'phone' => '018 2909252',
|
||||
],
|
||||
'lines' => $lines,
|
||||
'amount' => $invoice->amount
|
||||
'subtotal' => $subtotal,
|
||||
'adjustment' => $adjustment,
|
||||
'billingcharges' => $billing_charges,
|
||||
'total' => $total
|
||||
];
|
||||
|
||||
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
|
||||
@@ -456,6 +458,10 @@ class InvoiceController extends Controller
|
||||
$lines = InvoiceDetails::where('invoice_id', $invoice->id)->get();
|
||||
$supplierbooking = SupplierBooking::where('booking_id', $id)->first();
|
||||
$supplier = SettingSupplier::where('id', $supplierbooking->supplier_id)->first();
|
||||
$subtotal = InvoiceDetails::where('invoice_id', $invoice->id)->sum('total');
|
||||
$adjustment = $invoice->adjustment;
|
||||
$billing_charges = $booking->billing_charge;
|
||||
$total = $subtotal + $adjustment + $billing_charges;
|
||||
|
||||
$data = [
|
||||
'title' => 'Delivery Order',
|
||||
@@ -481,7 +487,10 @@ class InvoiceController extends Controller
|
||||
'phone' => '',
|
||||
],
|
||||
'lines' => $lines,
|
||||
'amount' => $invoice->amount
|
||||
'subtotal' => $subtotal,
|
||||
'adjustment' => $adjustment,
|
||||
'billingcharges' => $billing_charges,
|
||||
'total' => $total
|
||||
];
|
||||
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
|
||||
$fontDirs = $defaultConfig['fontDir'];
|
||||
@@ -532,6 +541,11 @@ class InvoiceController extends Controller
|
||||
$booking = Booking::where('id', $id)->first();
|
||||
$invoice = Invoice::where('booking_id', $booking['id'])->first();
|
||||
$lines = InvoiceDetails::where('invoice_id', $invoice->id)->get();
|
||||
$subtotal = InvoiceDetails::where('invoice_id', $invoice->id)->sum('total');
|
||||
$adjustment = $invoice->adjustment;
|
||||
$billing_charges = $booking->billing_charge;
|
||||
$total = $subtotal + $adjustment + $billing_charges;
|
||||
|
||||
|
||||
$data = [
|
||||
'title' => 'Invoice',
|
||||
@@ -551,7 +565,10 @@ class InvoiceController extends Controller
|
||||
],
|
||||
'total_page' => (count($lines) / 10),
|
||||
'lines' => $lines,
|
||||
'amount' => $invoice->amount
|
||||
'subtotal' => $subtotal,
|
||||
'adjustment' => $adjustment,
|
||||
'billingcharges' => $billing_charges,
|
||||
'total' => $total
|
||||
];
|
||||
|
||||
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
|
||||
@@ -603,6 +620,11 @@ class InvoiceController extends Controller
|
||||
$booking = Booking::where('id', $id)->first();
|
||||
$invoice = Invoice::where('booking_id', $booking['id'])->first();
|
||||
$lines = InvoiceDetails::where('invoice_id', $invoice->id)->get();
|
||||
$subtotal = InvoiceDetails::where('invoice_id', $invoice->id)->sum('total');
|
||||
$adjustment = $invoice->adjustment;
|
||||
$billing_charges = $booking->billing_charge;
|
||||
$total = $subtotal + $adjustment + $billing_charges;
|
||||
|
||||
|
||||
$data = [
|
||||
'title' => 'Delivery Order',
|
||||
@@ -621,7 +643,10 @@ class InvoiceController extends Controller
|
||||
'marking_no' => ''
|
||||
],
|
||||
'lines' => $lines,
|
||||
'amount' => $invoice->amount
|
||||
'subtotal' => $subtotal,
|
||||
'adjustment' => $adjustment,
|
||||
'billingcharges' => $billing_charges,
|
||||
'total' => $total
|
||||
];
|
||||
|
||||
$defaultConfig = (new \Mpdf\Config\ConfigVariables())->getDefaults();
|
||||
@@ -629,6 +654,7 @@ class InvoiceController extends Controller
|
||||
$defaultFontConfig = (new \Mpdf\Config\FontVariables())->getDefaults();
|
||||
$fontData = $defaultFontConfig['fontdata'];
|
||||
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'fontDir' => array_merge($fontDirs, [
|
||||
__DIR__ . '/custom/font/directory',
|
||||
|
||||
Reference in New Issue
Block a user