See this thread and solution by RAKESH MANE
Automatically TECO PM Orders after a defined ti... | SCN
You need to extend this information further to achieve your rest of the requirements. OBviously this is a skilled developer's job.
It should be possible.