ต้องการกำหนดให้แสดงค่ารักษาที่มากกว่า 50 บาทในคำสั่งต้องเพิ่มคำสั่งตรงไหนครับ ตามนี้ครับ
GetDateRangeDialog(date1, date2);
ds1:=formatdatetime('yyyy-mm-dd',date1);
ds2:=formatdatetime('yyyy-mm-dd',date2);
pttype := GetPickupList('select "ALL" as name union select "1 ºÑµÃ»ÃСѹÊØ¢ÀÒ¾¶éǹ˹éÒ" as name '+
' union select "2 »ÃСѹÊѧ¤Á" as name union select "3 µèÒ§´éÒÇ" as name union select "4 àºÔ¡ä´é" as name union select "5 »ÃСѹÀÑÂ" as name union select "6 ªÓÃÐà§Ô¹àͧ" as name ');
pp:=pttype;
if (pttype='') or (pttype='ALL') then
begin
pttype := '';
end else
begin
pttype := GetSQLStringData('select substring("'+pttype+'",1,1) ');
if pttype = '1' then
begin
pttype := 'and pttype in ("21","62","63","70","71","72","73","74","75","76","77","80","81","82","87","88","89","90","91","94","95" ) ';
end;
if pttype = '2' then
begin
pttype := 'and pttype in ("17") ';
end;
if pttype = '3' then
begin
pttype := 'and pttype in ("50","60","68","69","29") ';
end;
if pttype = '4' then
begin
pttype := 'and pttype in ("21","22","75" ';
end;
if pttype = '5' then
begin
pttype := 'and pttype in ("80") ';
end;
if pttype = '6' then
begin
pttype := 'and pttype in ("10") ';
end;
end;
hcode := GetPickupList('select "ALL" as name union select concat(h.hospcode," ",h.name) as cc from vn_stat v '+
' left outer join hospcode h on v.hospmain=h.hospcode '+
' where h.chwpart=60 and concat(h.hospcode," ",h.name) <> "" '+
' group by h.hospcode ');
kk := hcode;
if (hcode='') or (hcode='ALL') then
begin
hcode := '';
end else
begin
hcode := GetSQLStringData('select substring_index("'+hcode+'"," ",1) as ff ');
hcode := 'and hospmain="'+hcode+'"';
end;
{showmessage('select *,if((inc01+inc04+inc05+inc06+inc07+inc09+ '+
' inc10+inc12+inc13+inc14) > 700,700,(inc01+inc04+inc05+inc06+inc07+inc09+inc10+inc12+inc13+inc14)) as mm from vn_stat '+
' where vstdate between "'+ds1+'" and "'+ds2+'" '+pttype+' '+hcode+' '+
' group by vn order by vstdate '); }
vn := GetSQLSubQueryData('select vn from vn_stat '+
' where vstdate between "'+ds1+'" and "'+ds2+'" '+pttype+' '+
' '+hcode+' group by vn order by vstdate');
ChangeReportSQL('select *,if((inc01+inc04+inc05+inc06+inc07+inc09+ '+
' inc10+inc12+inc13+inc17) > 700,700,(inc01+inc04+inc05+inc06+inc07+inc09+inc10+inc12+inc13+inc14)) as mm from vn_stat '+
' where vstdate between "'+ds1+'" and "'+ds2+'" '+pttype+' '+hcode+' '+
' group by vn order by vstdate ');