From fb70812aeb00b406d0a4617e508604d78a360963 Mon Sep 17 00:00:00 2001 From: Edmond Teh Date: Mon, 7 Sep 2020 03:12:49 +0800 Subject: [PATCH] add reg_no --- app/Http/Controllers/InvoiceController.php | 12 ++++--- ...20_09_07_024530_add_reg_no_to_invoices.php | 32 +++++++++++++++++++ resources/assets/js/components/NewInvoice.vue | 20 ++++++++++++ resources/views/myPDF.blade.php | 15 --------- resources/views/pdf/po.blade.php | 2 +- 5 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 database/migrations/2020_09_07_024530_add_reg_no_to_invoices.php delete mode 100644 resources/views/myPDF.blade.php diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index fe7da199..ba836ebc 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -49,6 +49,7 @@ class InvoiceController extends Controller 'buyer_company' => 'required', 'contact_no' => 'required', 'marking' => 'required', + 'reg_no' => 'required', 'lines.*.order' => 'required|numeric', 'lines.*.stock_code' => 'required', 'lines.*.description' => 'required', @@ -99,6 +100,7 @@ class InvoiceController extends Controller $invoice = new Invoice; $invoice->amount = $total; $invoice->booking_id = (int)$id; + $invoice->reg_no = $validatedData['reg_no']; $invoice->buyer_company = $validatedData['buyer_company']; $invoice->address = $validatedData['address']; $invoice->contact_no = $validatedData['contact_no']; @@ -153,6 +155,7 @@ class InvoiceController extends Controller 'buyer_company' => 'required', 'contact_no' => 'required', 'marking' => 'required', + 'reg_no' => 'required', 'lines.*.order' => 'required|numeric', 'lines.*.stock_code' => 'required', 'lines.*.description' => 'required', @@ -207,6 +210,7 @@ class InvoiceController extends Controller $invoice->amount = $total; $invoice->booking_id = (int)$id; + $invoice->reg_no = $validatedData['reg_no']; $invoice->buyer_company = $validatedData['buyer_company']; $invoice->address = $validatedData['address']; $invoice->contact_no = $validatedData['contact_no']; @@ -320,7 +324,7 @@ class InvoiceController extends Controller 'title' => 'Purchase Order', 'buyer' => [ 'buyer_company' => $invoice->buyer_company, - 'reg_no' => '', + 'reg_no' => $invoice->reg_no, 'address' => $invoice->address, 'gst' => '', 'phone' => $invoice->contact_no @@ -370,7 +374,7 @@ class InvoiceController extends Controller 'title' => 'Delivery Order', 'buyer' => [ 'buyer_company' => $invoice->buyer_company, - 'reg_no' => '', + 'reg_no' => $invoice->reg_no, 'address' => $invoice->address, 'gst' => '', 'phone' => $invoice->contact_no @@ -418,8 +422,8 @@ class InvoiceController extends Controller 'phone' => '018 2909252' ], 'seller' => [ - 'seller_company' => $invoice->buyer_company, - 'address' => $supplier->company_name, + 'seller_company' => $supplier->company_name, + 'address' => '', 'phone' => '', 'date' => '', 'po_number' => $invoice->po_number, diff --git a/database/migrations/2020_09_07_024530_add_reg_no_to_invoices.php b/database/migrations/2020_09_07_024530_add_reg_no_to_invoices.php new file mode 100644 index 00000000..5dddf6c7 --- /dev/null +++ b/database/migrations/2020_09_07_024530_add_reg_no_to_invoices.php @@ -0,0 +1,32 @@ +string('reg_no'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('invoices', function (Blueprint $table) { + // + }); + } +} diff --git a/resources/assets/js/components/NewInvoice.vue b/resources/assets/js/components/NewInvoice.vue index 4608c127..e54d97a4 100644 --- a/resources/assets/js/components/NewInvoice.vue +++ b/resources/assets/js/components/NewInvoice.vue @@ -68,6 +68,21 @@ Contact Number Required +
+ + +
+ Company Registration Number Required +
+