Set completed activity programmatically

n52
Hello, I want set completed activity or module programmatically, how i can it?