รอแก้แล้ว ครับ มันก็ยังขึ้น error อยู่ครับ
procedure GlobalOnCreate;
begin
stime:='02:30:00';
GetDateTimeRangeDialog(date1, date2);
bdate := FormatDateTime('yyyy-mm-dd',date1);
edate := FormatDateTime('yyyy-mm-dd',date2);
btime := FormatDateTime('hh:nn:ss',time1);
etime := FormatDateTime('hh:nn:ss',time2);
s_main_dep:= GetPickupList('select department from kskdepartment');
main_dep:= GetSQLStringData('select depcode from kskdepartment where department="'+s_main_dep+'" ');
ChangeReportSQL('select o.hn,p.pname,p.fname,p.lname,vs.age_y,k.department,p.moopart,p.tmbpart,op.bpd,op.bps,s.*,spclty.spclty,spclty.name as spclty_name,'+
' sec_to_time(time_to_sec(s.service6)-time_to_sec(o.vsttime)) as totaltime1 '+
' from ovst o '+
' left outer join patient p on p.hn = o.hn '+
' left outer join opdscreen op on op.vn = o.vn '+
' left outer join vn_stat vs on vs.vn = o.vn '+
' left outer join service_time s on s.vn =o.vn '+
{' left outer join kskdepartment k on k.depcode = o.cur_dep '+ }
' left outer join kskdepartment k on k.depcode = o.main_dep '+
' left outer join spclty on spclty.spclty = o.spclty '+
' where o.vstdate between "'+bdate+'" and "'+edate+'" and s.vsttime between "'+btime+'" and "'+etime+'" ' +
' and o.main_dep="'+main_dep+'" and s.service6 is not null');
end;