I am trying to create a custom number for my quotes (ID-YYYY-MM-DD-NNN). I tried to replicate the actions in another post(https://www.salesagility.com/forum/8-aos-5x/1254-custom-quote-number), but did not have any luck.
Suggestion from post:
++++++++++++++++++++++++
I had similar need. I need to count quotes per month basis, so I modified line 39 like this:
$this->number = (empty($this->id)) ? date(“Y-m-”) . ($this->db->getOne(“SELECT count(id)+1 FROM aos_quotes WHERE YEAR(date_entered)=YEAR(now()) AND MONTH(date_entered)=MONTH(NOW())”)): $this->number;
Result is YYYY-MM-N, where N is counter for running month.
+++++++++++++++++++++++++++++
I found the script in AOS_Quotes.php below and tried to make adjustments noted in the prior post, but still no joy. Any assistance is greatly appreciated to resolve the issue.
if($sugar_config['dbconfig']['db_type'] == 'mssql'){
$this->number = $this->db->getOne("SELECT MAX(CAST(number as INT))+1 FROM aos_quotes");
} else {
$this->number = $this->db->getOne("SELECT MAX(CAST(number as UNSIGNED))+1 FROM aos_quotes");
}