Applications / Billing Software / Invoice or Booking number auto generate
Invoice number generation
-
Code
$lastBooking=Sale::orderBy('id','DESC')->first(); $year=date("Y"); $invoice_no=10001; if(isset($lastBooking) && $lastBooking->invoice_no!=''){ $bookingNo=explode("/",$lastBooking->invoice_no); if($year==$bookingNo[1]){ $invoice_no=$bookingNo[2]+1; } } $invoice_no='AJ/'.$year.'/'.$invoice_no;