Sales order total quantity validation as per customer

Hi All,
Use Case:- Validate sales order total quantity as per customer in a day.
how can we validate total quantity of a sales order for A Specific customer and it daily limit will be in customer master.

how to achieve this please give your suggestions so i could find a way to achieve that.

Thanks in advance

  1. customize form for Customer DocType, add daily limit field
    2.server script for Sales order, doc event validate

@szufisher can you help me in that? I am trying to do but i am getting error.

@szufisher i validate that using custom script but its applicable only for a certain sales order but not for existing sales orders for that particular day

so you need to somehow store the number for each particular day. not sure that adding that to the customer directly is a good idea. probably more like a n:m customer-day-count.
and then update/check that in your scripts?