BPM to prevent quantities more than previous operation

have you read this thread ? it should give you a good start