รบกวนด้วยคับ
procedure GlobalOnCreate;
begin
GetDateRangeDialog(date1, date2);
bdate := FormatDateTime('yyyy-mm-dd', date1);
edate := FormatDateTime('yyyy-mm-dd', date2);
ChangeReportSQL('select concat(p.pname,p.fname," ",p.lname)as pt_name,p.cid,d.strength,o.qty,'+
'o.unitprice,o.sum_price,o.rxdate,v.*,d.name as dr_name'+
'from vn_stat v '+
'left join patient p on p.hn=v.hn'+
'left join opitemrece o on o.vn=v.vn'+
'left join drugitems d on d.icode=o.icode'+
'where v.vstdate between "'+bdate+'" and "'+edate+'" and d.name like "%morphin%"');
end;