BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: jaynak ที่ เมษายน 02, 2010, 09:38:57 AM
-
ผมทำรายงานตัวนึงออกมา จะมี dialog เด้งขึ้นมาถามดังรูป
ผมต้องการให้ข้อมูลที่เลือกจาก dialog ให้มันไปแสดงในรายงานต้องทำอย่างไรครับ
อยากให้แสดงวันที่ และ สอ. ที่เลือกอะครับ
-
อันนี้โคตรครับ เขียนใน event
procedure GlobalOnCreate;
begin
GetDateRangeDialog(d1, d2);
ds1:=formatdatetime('yyyy-mm-dd',d1);
ds2:=formatdatetime('yyyy-mm-dd',d2);
h1:= InputQuery('รหัส สอ.','รหัส สอ.');
ChangeReportSQL('select distinct vn.hn,vn.vstdate,concat(pname,fname," ",lname) as fullname,concat(pt.addrpart," หมู่ ",pt.moopart," ต.",t3.name," อ.",t2.name," จ.",t1.name) as fulladdressname '+
' from vn_stat vn'+
' left outer join ovst o on o.hn = vn.hn'+
' left outer join patient pt on pt.hn = vn.hn'+
' left outer join thaiaddress t1 on t1.chwpart=pt.chwpart and t1.amppart="00" and t1.tmbpart="00" '+
' left outer join thaiaddress t2 on t2.chwpart=pt.chwpart and t2.amppart=pt.amppart and t2.tmbpart="00" '+
' left outer join thaiaddress t3 on t3.chwpart=pt.chwpart and t3.amppart=pt.amppart and t3.tmbpart=pt.tmbpart'+
' where vn.vstdate between "'+ds1+'" and "'+ds2+'" '+
' and vn.pdx between "E100" and "E149" '+
' and o.hospsub = "'+h1+'" '+
' group by vn.hn'+
' order by vn.vstdate');
end;
-
เอา variable ไปวาง แล้ว ให้ value:=ds1; แล้ว set ds1 เป็นประเภทวันที่ ทำเช่นนี้กับ ds2 ด้วย ส่วนชื่อ สอ.ก็ให้ value:=h1; หรือไม่ก็ใช้ getsqlstringdata('select hospname from hospcode where hospcode="'+h1+'" '); ครับ