trigger ignoreweekends on order (before insert,before update) {
for (order so : Trigger.new) {
list<account> cd =[select id,JDE_Date_Delivery_Offset__c from account where id =:so.accountid];
for(account et : cd)
{
for(integer i=0;i<=et.JDE_Date_Delivery_Offset__c;i++)
{
Datetime dt = DateTime.newInstance(Date.today() +et.JDE_Date_Delivery_Offset__c.longvalue(), Time.newInstance(0, 0, 0, 0));
String dayOfWeek=dt.format('EEEE');
if(dayOfWeek == 'saturday' || dayOfWeek == 'sunday')
{
et.JDE_Date_Delivery_Offset__c = et.JDE_Date_Delivery_Offset__c+ 1;