Auto-add record on some event
I'm here again with some kind of crazy question. My aim is quite complicated, maybe you will show me where and how it was done before or give me some others advices.
I'm working on purchase order DB. When I order smth it is delivered by a full truck, not less then that. But sometimes I make a bigger orders to the mills with 2,3,xxx10 trucks in one, so I don't know. I have order total volume and I know that 1 truck carries about 30cbm. So, using Round operator and dividing one to another - I can get total amount of trucks I will need.
So, I would like my DB to make extra records (if needed) according to total amount of trucks to track shipments later and to calculate what is shipped and what is left.
I see it like a finish button that will run some kind of a script after I prepared a record.
Also, I have order numeration like 003-10, where 003 - is serial number and 10 is 2 last digits of current year. So, if there is more then 1 truck in order, I want this numeration to have extra index, like 003-10-01, where 02 will be index for each truck.
I really can't get even close into making this idea real. Where to start from? I have only this draft algorithm. Please help. Thank you!