$fdate=F("FDATE");
$endtoday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;
if($fdate['time'] != $endtoday)
{$fdate['time']=$endtoday;
$fdate['code']='1';
}
if($fdate['code'] < 1 || $fdate['code'] > 999)
{$fdate['code']='1';
}
$date['orderstatus'] = '1';
$date['orderno'] =date('Ymd').str_pad($fdate['code'],3,"0",STR_PAD_LEFT);
$fdate['code'] =$fdate['code'] + 1;
F("FDATE",$fdate);