BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: onlinelp ที่ ตุลาคม 14, 2010, 08:00:38 AM
-
(http://www.picza.net/uppic/pic/2010_10_13/c00/c008012c9f2799122a0b4d78a91e47bd.jpg) (http://www.picza.net/show.php?id=c008012c9f2799122a0b4d78a91e47bd)
Thanks: Ragnarok (http://www.rag-ro.com/) ฝากรูป (http://www.picza.net)
รบกวนท่านใดที่พอจะทราบว่า report ตัวนี้เขียน อย่างไรแนะนำผมด้วยครับ
โดย code ที่ผมทำขึ้นยังบกพร่องอยู่ รบกวนตรวจสอบให้ทีครับ
ซึ่งผมไม่ทราบว่า ใบสั่งยาทั้งหมดที่มี จะหาจากตารางไหน?
และค่าใช้จ่ายอื่นๆอย่างเช่นค่าบริการทางการแพทย์ ผมหาไม่เจอจริงๆครับ
select op.pttype,py.name,count(distinct(ovs.hn))as vhn,count(rp.hn)as chn,
count(d.icode)as sdrug,sum(d.unitprice)as pdrug,count(nd.icode)as sndrug,
sum(nd.price)as pnondrug,sum(op.sum_price)as total
from vn_stat ovs
left outer join opitemrece op on op.vn=ovs.vn
left outer join drugitems d on d.icode=op.icode
left outer join nondrugitems nd on nd.icode=op.icode
left outer join pttype py on py.pttype=op.pttype
left outer join rcpt_print rp on rp.vn=ovs.vn
where ovs.vstdate between '2010-10-01' and '2010-10-01'
and op.vn<>''
group by op.pttype
ขอขอบคุณล่วงหน้าครับ :'(
ปล.ไปโพสกระทู้ผิดเลยต้องลบออกแล้วย้ายมาอยุ่กระทุ้นี้แทน
-
ต้องนำไฟล์ report .cds แนบไฟล์ด้วยครับ
-
ขออภัยครับ....
เพิ่มอีกตัวที่ผมดัดเปลงเองนะครับ