can i get code for generating serial number through the combination of data and product id.if date is current date and product is produce eg.p1 on the same date then serial number start from 0001,same product i.e. p1 produce on same date then its serial no is 0002,but if date or product change then serial number start from 0001.if product id is same as earlier product id then its serial number start from max of that product serial number which we get earlier.
for eg. date prodid serial number
25/03/2012 p1 0001
25/03/2012 p1 0002
26/03/2012 p1 0001
26/03/2012 p2 0001
26/03/2012 p2 0002
the serial number generation should be in this manner.