View Single Post
  #3 (permalink)  
Old Apr 2nd, 2007, 15:25
sante140 sante140 is offline
New Member
Join Date: Apr 2007
Location: netherlands
Age: 47
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help needed for alerterrors in orderingscript

the script is in dutch, but i can give yu the link to the test server for it htpp:// goldengatepizza.nl/testing/bestel.js,

Code: Select all
openzo ='16452155';
openma ='16452155';
opendi ='16452155';
openwo ='16452155';
opendo ='16452225';
openvr ='16452225';
openza ='16452225';
openzoa ='16152225';
openmaa ='16152225';
opendia ='16152225';
openwoa ='16152225';
opendoa ='16152225';
openvra ='16152225';
openzaa ='16152225';
are the opininghours for delivery.

I added this extra:
Code: Select all
openzob ='16152225';
openmab ='16152225';
opendib ='16152225';
openwob ='16152225';
opendob ='16152225';
openvrb ='16152225';
openzab ='16152225';
####function to check opening hours####

now i get in trouble, really don';t know how to!!

Code: Select all
function opencheck(dagen,maanden,jaren,uren,minuten,zon,maa,din,woe,don,vri,zat){
ctijd=new Array();
wopen=0;
openconf = "go";

var datum = new Date(jaren,maanden,dagen,uren,minuten,0);
var dag=datum.getDay();

if(dag==0){
 dagvar=zon;
 for(tellerta=0;tellerta<dagvar.length/8;tellerta++){
  ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
 for(tellertb=0;tellertb<dagvar.length/8;tellertb++){
  if(wopen!=1){
   btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
   etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
   tijd=(60*datum.getHours())+datum.getMinutes();
   if(tijd>=btijd&&tijd<=etijd){
    wopen=1;}
  }
 };
};
if(dag==1){dagvar=maa;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}};
};
if(dag==2){dagvar=din;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}};
};
if(dag==3){dagvar=woe;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
if(dag==4){dagvar=don;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
if(dag==5){dagvar=vri;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
if(dag==6){dagvar=zat;
for(tellerta=0;
tellerta<dagvar.length/8;
tellerta++){ctijd[tellerta]=dagvar.substring(tellerta*8,(tellerta+1)*8)};
for(tellertb=0;
tellertb<dagvar.length/8;
tellertb++){if(wopen!=1){btijd=(60*ctijd[tellertb].substring(0,2))+ctijd[tellertb].substring(2,4)*1;
etijd=60*ctijd[tellertb].substring(4,6)+ctijd[tellertb].substring(6,8)*1;
tijd=(60*datum.getHours())+datum.getMinutes();
if(tijd>=btijd&&tijd<=etijd){wopen=1;
}}}};
 

var nutdatum = new Date();
var nudatum =  new Date(nutdatum.getYear(),nutdatum.getMonth(),nutdatum.getDate(),nutdatum.getHours(),nutdatum.getMinutes() + 35,0);

if (datum.getYear() < nudatum.getYear()){wopen=0;}
if (datum.getMonth() < nudatum.getMonth() && datum.getYear() == nudatum.getYear()){wopen=0;}
if (datum.getDate() < nudatum.getDate() && datum.getMonth() == nudatum.getMonth() && datum.getYear() == nudatum.getYear() ){wopen=0;}
if (datum.getHours() < nudatum.getHours() && datum.getDate() == nudatum.getDate() && datum.getMonth() == nudatum.getMonth() && datum.getYear() == nudatum.getYear() ){wopen=0;}
if (datum.getMinutes() < nudatum.getMinutes() && datum.getHours() == nudatum.getHours() && datum.getDate() == nudatum.getDate() && datum.getMonth() == nudatum.getMonth() && datum.getYear() == nudatum.getYear() ){wopen=0;}
 
 
 
return wopen;
};
##################################
thanks for your reply

Last edited by karinne; Apr 2nd, 2007 at 15:32. Reason: Please use [code]...[/code] tags when displaying code!
Reply With Quote