BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: sahavej_pct ที่ มีนาคม 15, 2016, 09:25:01 AM

หัวข้อ: จากคำสั่งมีแต่รายการจ่ายยานอก จะต้องแก้ให้แสดงข้อมูลจ่ายยาในได้อย่างไรครับ
เริ่มหัวข้อโดย: sahavej_pct ที่ มีนาคม 15, 2016, 09:25:01 AM
จากคำสั่งมีแต่รายการจ่ายยานอก จะต้องแก้ให้แสดงข้อมูลจ่ายยาในได้อย่างไรครับ...ขอบคุณมากครับ งานกำลังเข้าผมมากเลย  :'( :'( :'( :'( :'(
---------------------------------------------------------------------------

select concat(b.name,' ',strength) as drugname,generic_name,g.pharmacology_group_name,unitcost,sum(qty),units,
b.unitprice ,sum(qty*b.unitprice) as total,f.cur_dep,department
from opitemrece a
left outer join drugitems b on a.icode=b.icode
left outer join ovst f  on f.vn = a.vn
left outer join kskdepartment c on f.cur_dep=c.depcode
left outer join pharmacology_group g on g.pharmacology_group_id=b.pharmacology_group1
where a.icode like'1%'
and qty>=1
and f.vstdate between '2016-03-10'  and '2016-03-12'
group by b.name,strength,units,b.unitprice,a.dep_code,department
order by f.cur_dep,b.name
หัวข้อ: Re: จากคำสั่งมีแต่รายการจ่ายยานอก จะต้องแก้ให้แสดงข้อมูลจ่ายยาในได้อย่างไรครับ
เริ่มหัวข้อโดย: golf_win ที่ มีนาคม 15, 2016, 09:36:38 AM
OPD

select concat(b.name,' ',strength) as drugname,generic_name,g.pharmacology_group_name,unitcost,sum(qty),units,
b.unitprice ,sum(qty*b.unitprice) as total,f.cur_dep,department
from opitemrece a
left outer join drugitems b on a.icode=b.icode
left outer join ovst f  on f.vn = a.vn
left outer join kskdepartment c on f.cur_dep=c.depcode
left outer join pharmacology_group g on g.pharmacology_group_id=b.pharmacology_group1
where a.icode like'1%'
and qty>=1
and a.rxdate between '2016-03-10'  and '2016-03-12' and a.an is null
group by b.name,strength,units,b.unitprice,a.dep_code,department
order by f.cur_dep,b.name


IPD

select concat(b.name,' ',strength) as drugname,generic_name,g.pharmacology_group_name,unitcost,sum(qty),units,
b.unitprice ,sum(qty*b.unitprice) as total,f.cur_dep,department
from opitemrece a
left outer join drugitems b on a.icode=b.icode
left outer join ovst f  on f.vn = a.vn
left outer join kskdepartment c on f.cur_dep=c.depcode
left outer join pharmacology_group g on g.pharmacology_group_id=b.pharmacology_group1
where a.icode like'1%'
and qty>=1
and a.rxdate between '2016-03-10'  and '2016-03-12' and a.an<>""
group by b.icode
order by f.cur_dep,b.name
หัวข้อ: Re: จากคำสั่งมีแต่รายการจ่ายยานอก จะต้องแก้ให้แสดงข้อมูลจ่ายยาในได้อย่างไรครับ
เริ่มหัวข้อโดย: sahavej_pct ที่ มีนาคม 15, 2016, 10:01:56 AM
ขอบพระคุณ อ. มากๆๆๆๆๆครับ :)