BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: sahavej_pct ที่ มกราคม 10, 2017, 08:00:11 AM

หัวข้อ: ช่วยแก้คำสั่งนี้ให้หน่อยครับ ต้องการให้รายการที่ยกเลิกใบเสร็จแสดงข้อมูล
เริ่มหัวข้อโดย: sahavej_pct ที่ มกราคม 10, 2017, 08:00:11 AM
รบกวนพี่ๆๆช่วยแก้คำสั่งนี้ให้หน่อยครับ ต้องการให้รายการที่ยกเลิกใบเสร็จแสดงข้อมูลออกมาด้วยครับ...ขอบคุณครับ
select i.wtlos,concat(trim(p.pname) , trim(fname)," ",trim(lname)) as ptname ,i.vn,i.an,i.hn,i.regdate,i.dchdate,income,i.pttype,rcpno_list,bill_date_time,rcpt_money,debt_id_list,amount
,credit_card_amount
from an_stat a
left outer join patient p on p.hn=a.hn
left outer join ipt i on i.an=a.an
left outer join dchtype dc on dc.dchtype=i.dchtype
left outer join rcpt_print rc on rc.vn=a.an
left outer join rcpt_debt bt on bt.vn=a.an
left outer join pttype t on t.pttype=a.pttype
where date(bill_date_time) between "2017-01-08" and "2017-01-08"
group by a.an
หัวข้อ: Re: ช่วยแก้คำสั่งนี้ให้หน่อยครับ ต้องการให้รายการที่ยกเลิกใบเสร็จแสดงข้อมูล
เริ่มหัวข้อโดย: tumtouch28 ที่ กุมภาพันธ์ 18, 2017, 11:54:47 AM
ลองดูนะครับ น่าจะใช้คำสั่งประมาณนี้

select i.wtlos,concat(trim(p.pname) , trim(fname)," ",trim(lname)) as ptname ,i.vn,i.an,i.hn,i.regdate,i.dchdate,income,i.pttype,rcpno_list,bill_date_time,rcpt_money,debt_id_list,amount
,credit_card_amount ,
(select group_concat(rd.rcpno) from rcpt_print rd where rd.status = "ABORT" and rd.vn = a.an) as rcpt_abort ,
(select sum(rp.cash_amount) from rcpt_print rp where rp.status = "ABORT" and rp.vn = a.an ) as total_abort
from an_stat a
left outer join patient p on p.hn=a.hn
left outer join ipt i on i.an=a.an
left outer join dchtype dc on dc.dchtype=i.dchtype
left outer join rcpt_print rc on rc.vn=a.an
left outer join rcpt_debt bt on bt.vn=a.an
left outer join pttype t on t.pttype=a.pttype
where date(bill_date_time) between "2016-10-01" and "2016-10-10"
group by a.an