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 +