BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: nksawan2011 ที่ มกราคม 11, 2012, 15:14:33 PM

หัวข้อ: ต้องการกำหนดค่าในรายงาน นค1
เริ่มหัวข้อโดย: nksawan2011 ที่ มกราคม 11, 2012, 15:14:33 PM
ต้องการกำหนดให้แสดงค่ารักษาที่มากกว่า 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 ');
   
   
หัวข้อ: Re: ต้องการกำหนดค่าในรายงาน นค1
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ มกราคม 11, 2012, 16:09:04 PM
'  where vstdate between "'+ds1+'" and "'+ds2+'" '+pttype+' '+hcode+' '+
    ' and income > 50 group by vn order by vstdate ');

ได้ไหมครับ
หัวข้อ: Re: ต้องการกำหนดค่าในรายงาน นค1
เริ่มหัวข้อโดย: nksawan2011 ที่ มกราคม 11, 2012, 16:19:19 PM
ได้แล้วครับ ขอบคุณมากครับ

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

ได้ไหมครับ