When creating a new quotation auto generate serial number like AP-00-0001
but after create and edit this quotation and save again create a new entry without affecting existing quotation number or data and generate new sub quotation number like AP-01-0001
.
when add new quotation generate my new number but how to write on revise quotation:
$count_quot = $this->QuotationGeneration->find('count');
$count_quot = $count_quot + 1;
$number = str_pad($count_quot, 4, '0', STR_PAD_LEFT);
$quotation_number = 'AP-00-'.$number;
$this->set('quotation_number',$quotation_number);
Use the beforeSave() or afterSave() callback of your table object and generate your number there.
Or look at the code of this behavior. It pretty much does the same just that it generates a slug. https://github.com/UseMuffin/Slug
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.