Value:= GetSQLstringData('select concat("ÁÒµÃǨµÒÁ¹Ñ´ ¤ÅÔ¹Ô¡"," ",b.name) as dd from oapp a '+
'left outer join clinic b on a.clinic=b.clinic '+
'where a.hn="'+DBPipeline['hn'] +'" '+
' and a.nextdate="'+Formatdatetime('yyyy/mm/dd',DBPipeline['vstdate'] )+'"');
fvn:= GetSQLstringData('select vn from oapp a '+
'where a.hn="'+DBPipeline['hn'] +'" '+
' and a.nextdate="'+Formatdatetime('yyyy/mm/dd',DBPipeline['vstdate'] )+'"');
if length(fvn)>0 then
begin
subgroup:= GetSQLStringData('select sub_group_list from lab_app_head where vn="'+fvn+'" ');
if subgroup<>'' then
begin
lab:=GetSQLSubQueryData('select b.lab_items_sub_group_name '+
' from lab_items_sub_group b '+
'where lab_items_sub_group_code in('+subgroup+') ') ;
lab:=lab+','+GetSQLSubQueryData('select c.lab_items_name from lab_app_head a '+
'left outer join lab_app_order b on a.lab_app_order_number=b.lab_app_order_number '+
'left outer join lab_items c on b.lab_items_code=c.lab_items_code '+
'where a.vn="'+fvn+'" '+
'and c.sub_group_list not in ('+lab+') ');
lab:=SearchAndReplace(lab,'''','');
memo1.lines.text:=SearchAndReplace(lab,'Urine Analysis','UA');
Memo1.Visible:=True;
end else
begin
lab:=GetSQLSubQueryData('select c.lab_items_name from lab_app_head a '+
'left outer join lab_app_order b on a.lab_app_order_number=b.lab_app_order_number '+
'left outer join lab_items c on b.lab_items_code=c.lab_items_code '+
'where a.vn="'+fvn+'" ');
lab:=SearchAndReplace(lab,'''','');
memo1.lines.text:=SearchAndReplace(lab,'Urine Analysis','UA');
Memo1.Visible:=True;
end else
Memo1.Visible:=False;
end;