Stop sales order if payment terms exceeded

How do i set that the sales order is stopped when the payment terms have exceeded for the customer.

Use scheduler for change the status of sales order as “Closed” by comparing the sales order posting date and payment terms date for particular customer. Use some scripts to achieve this.