ผู้เขียน หัวข้อ: ต้องการกำหนดค่าในรายงาน นค1  (อ่าน 3296 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ nksawan2011

  • Full Member
  • ***
  • กระทู้: 130
  • Respect: 0
    • ดูรายละเอียด
ต้องการกำหนดค่าในรายงาน นค1
« เมื่อ: มกราคม 11, 2012, 15:14:33 PM »
0
ต้องการกำหนดให้แสดงค่ารักษาที่มากกว่า 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 ');
   
   
ยังใหม่อยู่ โปรดชี้แนะ
ร.พ.จิตเวชนครสวรรค์ราชนครินทร์
ขึ้นระบบ 01 มีนาคม 2554

ออฟไลน์ เกื้อกูล ครับ..

  • Hero Member
  • *****
  • กระทู้: 12,611
  • Respect: +169
    • ดูรายละเอียด
    • โรงพยาบาลปากท่อ
Re: ต้องการกำหนดค่าในรายงาน นค1
« ตอบกลับ #1 เมื่อ: มกราคม 11, 2012, 16:09:04 PM »
0
'  where vstdate between "'+ds1+'" and "'+ds2+'" '+pttype+' '+hcode+' '+
    ' and income > 50 group by vn order by vstdate ');

ได้ไหมครับ
Implement  HOSxP  Start 2548 ---> NOW!
Station : 130 Client   V.3 Version  3.67.1.XX
Server  : CENTOS  +MySQL maria 10.x.x

ออฟไลน์ nksawan2011

  • Full Member
  • ***
  • กระทู้: 130
  • Respect: 0
    • ดูรายละเอียด
Re: ต้องการกำหนดค่าในรายงาน นค1
« ตอบกลับ #2 เมื่อ: มกราคม 11, 2012, 16:19:19 PM »
0
ได้แล้วครับ ขอบคุณมากครับ

'  where vstdate between "'+ds1+'" and "'+ds2+'" '+pttype+' '+hcode+' '+
    ' and income > 50 group by vn order by vstdate ');

ได้ไหมครับ
ยังใหม่อยู่ โปรดชี้แนะ
ร.พ.จิตเวชนครสวรรค์ราชนครินทร์
ขึ้นระบบ 01 มีนาคม 2554