@tisuchi can you assist me , i have my code also i want to generate the invoice no automatically
Invoice no can start like this "three end digtis of year(019), month-1,2,3... ,number 001P
so the first invoice looks like this 0191001P, next = 019002P like this on the column of invoice no
see my code: of store sales records
public function store(Request $request)
{
// dd($request);
$validator = Validator::make($request->all(), [
'invoice_no' => 'required',
'clientAddress' => 'required|max:100',
'ClientPhone' => 'required',
'product_name' => 'required',
'qty' => 'required',
'price' => 'required',
'total' => 'required',
'sub_total' => 'required',
'tax_amount' => 'required',
'total_amount' => 'required',
// 'ClientPhone' => 'required',
]);
$CURDproduct = $request->all();
if ($validator->passes()) {
$CURDproduct = new sales;
$CURDproduct->invoice_no = $request->input('invoice_no');
$CURDproduct->clientAddress = $request->input('clientAddress');
$CURDproduct->ClientPhone = $request->input('ClientPhone');
$CURDproduct->product_name = $request->input('product_name');
$CURDproduct->qty = $request->input('qty');
$CURDproduct->price = $request->input('price');
$CURDproduct->total = $request->input('total');
$CURDproduct->sub_total = $request->input('sub_total');
$CURDproduct->tax_amount = $request->input('tax_amount');
$CURDproduct->total_amount = $request->input('total_amount');
$CURDproduct->save();
// return view('product.CURDproduct')->with('CURDproduct', $CURDproduct)->with('message', 'Successfully Stored');
return redirect('salesView')->with('message', 'Successfully Stored');
}
return Response::json(['errors' => $validator->errors()]); // 'stops'= json_encode($CURDproduct),
}