mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
allow empty description in invoice
This commit is contained in:
@@ -54,7 +54,7 @@ class InvoiceController extends Controller
|
||||
'reg_no' => 'required',
|
||||
'lines.*.order' => 'required|numeric',
|
||||
'lines.*.stock_code' => 'required',
|
||||
'lines.*.description' => 'required',
|
||||
'lines.*.description' => 'max:256',
|
||||
'lines.*.quantity' => 'required|numeric',
|
||||
'lines.*.unit_price_rm' => 'required|numeric',
|
||||
'lines.*.unit_price_rmb' => '',
|
||||
@@ -160,7 +160,7 @@ class InvoiceController extends Controller
|
||||
'reg_no' => 'required',
|
||||
'lines.*.order' => 'required|numeric',
|
||||
'lines.*.stock_code' => 'required',
|
||||
'lines.*.description' => 'required',
|
||||
'lines.*.description' => 'max:256',
|
||||
'lines.*.quantity' => 'required|numeric',
|
||||
'lines.*.unit_price_rm' => 'required|numeric',
|
||||
'lines.*.unit_price_rmb' => '',
|
||||
@@ -208,7 +208,7 @@ class InvoiceController extends Controller
|
||||
|
||||
// Generate PO Number - po20200810-001(PO Format)
|
||||
$dt = Carbon::now();
|
||||
$po_number = 'po'.$dt->format('Ymmdd').'-'.$id;
|
||||
$po_number = 'po'.$dt->format('Ymd').'-'.$id;
|
||||
|
||||
$invoice->amount = $total;
|
||||
$invoice->booking_id = (int)$id;
|
||||
@@ -273,13 +273,22 @@ class InvoiceController extends Controller
|
||||
]);
|
||||
|
||||
// Save status to database
|
||||
|
||||
$status = new InvoiceStatuses;
|
||||
$status->status = $validatedData['status'];
|
||||
$status->comment = $validatedData['comment'];
|
||||
$status->invoice_id = Invoice::where('booking_id', $id)->first()['id'];
|
||||
$status->save();
|
||||
|
||||
$booking = Booking::find($id);
|
||||
|
||||
$monthlycount = Invoice::where('ei', 'like', 'EI-'.Carbon::createFromFormat('Y-m-d H:i:s', $booking->created_at)->format('Ym').'%')->count() + 1;
|
||||
$generatednumber = Carbon::createFromFormat('Y-m-d H:i:s', $booking->created_at)->format('Ym').'-'.sprintf("%05d", $monthlycount);
|
||||
|
||||
$invoice = Invoice::where('booking_id', $id)->first();
|
||||
$invoice->ei = 'EI-'.$generatednumber;
|
||||
$invoice->edo = 'EDO-'.$generatednumber;
|
||||
$invoice->save();
|
||||
|
||||
if(!$status) {
|
||||
return response()->json(['message' => 'Unable to Update Status'], 500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user