ผู้เขียน หัวข้อ: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ  (อ่าน 7111 ครั้ง)

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

ออฟไลน์ panus_t

  • Hero Member
  • *****
  • กระทู้: 2,368
  • Respect: +8
    • ดูรายละเอียด
ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« เมื่อ: กรกฎาคม 16, 2012, 10:46:15 AM »
0
ต้องการ SUM rcpt_money ตามวันที่  ตามสิทธิ ครับ
ต้องการทราบว่าต้องเขียน code mysql แบบไหนครับ
โรงพยาบาลเสิงสาง จ.นครราชสีมา (ขนาด  60  เตียง ปี2554)  ขึ้นระบบโดยทีมงาน BMS  เมื่อเดือนเมษายน 2551
ก่อนหน้านั้นขึ้นระบบเมื่อ 07/07/07 ฤกษ์ดี  Master Server  IBM System x3500M4  RAM ECC 24 GB. HardDisk SAS 450x3 GB. ServerRAID M1100 Series Zero RAID5  OS:CentOS 6.4  MySQLPercona : 5.5.30-30.1

ออฟไลน์ E-Hos

  • Hero Member
  • *****
  • กระทู้: 711
  • Respect: 0
    • ดูรายละเอียด
    • http://www.erawanhospital.com/index.php
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #1 เมื่อ: กรกฎาคม 16, 2012, 11:00:57 AM »
0
 ;D ;D ;D  ??? ???
เอาแค่สิทธิ 2 สิทธินี้เหรอครับ...ข้าราชการ กับ ประกันสังคม..
รายละเอียดที่ต้องการ น่ะครับ.. :D :D
ACADEMIC COMPUTING.  Erawan_Hospital
>> Thanks ... DansaI HospitaL L-o-E-i
>> By อ. Decha, อ.Armds

=> NoW !! HosXP SERVER Version 3.58.1.1
=> Client 50 client  OS: SP2 >> 3.58.1.1
=> ER Room  NoW ! HosXP Version 3.57.7.25D
=> Doctor Room  NoW ! HosXP Version 3.58.1.1
=> HosXP Test  Version 3.58.1.xx
=> Coming Soon >>UP Version 3.58.1.xx
wait...
-----------------------------
Start  System  8 January 2009

ออฟไลน์ panus_t

  • Hero Member
  • *****
  • กระทู้: 2,368
  • Respect: +8
    • ดูรายละเอียด
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #2 เมื่อ: กรกฎาคม 16, 2012, 13:38:06 PM »
0
มันเยอะครับ ก็เลย post แค่ 2 สิทธิเผื่อเอาไปประยุกต์   ;D
จริง ๆ ก็มี สิทธิ ข้าราชการ  ประกัน  พรบ.  กองทุนทดแทน  ต่างด้าว  ชำระเอง  สิทธิอื่น ๆ ค้างชำระ และแยก 16 หมวดอีก ทั้งหมดอยู่ในรายงานเดียว....
โรงพยาบาลเสิงสาง จ.นครราชสีมา (ขนาด  60  เตียง ปี2554)  ขึ้นระบบโดยทีมงาน BMS  เมื่อเดือนเมษายน 2551
ก่อนหน้านั้นขึ้นระบบเมื่อ 07/07/07 ฤกษ์ดี  Master Server  IBM System x3500M4  RAM ECC 24 GB. HardDisk SAS 450x3 GB. ServerRAID M1100 Series Zero RAID5  OS:CentOS 6.4  MySQLPercona : 5.5.30-30.1

ออฟไลน์ pop_hosxp

  • Hero Member
  • *****
  • กระทู้: 3,128
  • Respect: +38
    • ดูรายละเอียด
    • Phanomphrai Hospital
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #3 เมื่อ: กรกฎาคม 16, 2012, 13:44:29 PM »
0
ลองประยุกต์ด้วยการใช้ variable วางลงไปแล้วใช้คำสั่ง

value:=getsqlintegerdata('select sum(rcpt_money) '+
' from vn_stat '+
' where vstdate="'+dbpipeline['vstdate']+'" '+
' group by vstdate')
pop434241@gmail.com
รพ.พนมไพร จ.ร้อยเอ็ด www.phanomphrai.net

ออฟไลน์ panus_t

  • Hero Member
  • *****
  • กระทู้: 2,368
  • Respect: +8
    • ดูรายละเอียด
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #4 เมื่อ: กรกฎาคม 16, 2012, 14:21:55 PM »
0
หน้าตารายงานครับ  ;D
ไม่ทราบว่าจะเขียนคำสั่ง Select ครั้งเดียวจะได้หรือเปล่า   ;D
โรงพยาบาลเสิงสาง จ.นครราชสีมา (ขนาด  60  เตียง ปี2554)  ขึ้นระบบโดยทีมงาน BMS  เมื่อเดือนเมษายน 2551
ก่อนหน้านั้นขึ้นระบบเมื่อ 07/07/07 ฤกษ์ดี  Master Server  IBM System x3500M4  RAM ECC 24 GB. HardDisk SAS 450x3 GB. ServerRAID M1100 Series Zero RAID5  OS:CentOS 6.4  MySQLPercona : 5.5.30-30.1

ออฟไลน์ E-Hos

  • Hero Member
  • *****
  • กระทู้: 711
  • Respect: 0
    • ดูรายละเอียด
    • http://www.erawanhospital.com/index.php
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #5 เมื่อ: กรกฎาคม 16, 2012, 15:07:40 PM »
0
 ;D ;D ;D น่าจะได้ครับ เอาไปประยุกต์เอาครับ..
คำสั่งน่าจะประมาณนี้ครับ.. แล้วไป sum รายการต่างๆ ตามที่ต้องการครับ...  :D :D


select   vstdate,sum(rcpt_money),pttype,
 (if(pttype = "10",rcpt_money,0)) as `Cash`,
 (if(pttype = "89",rcpt_money,0)) as `UC`,
 (if(pttype in("34","35""36"),rcpt_money,0)) as `SSN`,
 (if(pttype = "23",rcpt_money,0)) as `ACC_23` ,
 (if(pttype = "30",rcpt_money,0)) as `Acident`,
 (if(pttype = "20",rcpt_money,0)) as `ACC_20`,
 (if(pttype = "22",rcpt_money,0)) as `ACC_22` ,
 (if(pttype = "37",rcpt_money,0)) as `ACC_37` ,
 (if(pttype = "88",rcpt_money,0)) as `ACC_88` ,

  from vn_stat
 where vstdate="2012-07-12"
 group by vstdate,pttype     order by vstdate,pttype

ลองไปประยุกต์ดูครับ... ถ้าไม่ใช่ที่ต้องการ รอ อ.ท่านอื่นๆครับผม.. ;D ;D ;D ;D

ACADEMIC COMPUTING.  Erawan_Hospital
>> Thanks ... DansaI HospitaL L-o-E-i
>> By อ. Decha, อ.Armds

=> NoW !! HosXP SERVER Version 3.58.1.1
=> Client 50 client  OS: SP2 >> 3.58.1.1
=> ER Room  NoW ! HosXP Version 3.57.7.25D
=> Doctor Room  NoW ! HosXP Version 3.58.1.1
=> HosXP Test  Version 3.58.1.xx
=> Coming Soon >>UP Version 3.58.1.xx
wait...
-----------------------------
Start  System  8 January 2009

ออฟไลน์ panus_t

  • Hero Member
  • *****
  • กระทู้: 2,368
  • Respect: +8
    • ดูรายละเอียด
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #6 เมื่อ: กรกฎาคม 16, 2012, 15:41:42 PM »
0
;D ;D ;D น่าจะได้ครับ เอาไปประยุกต์เอาครับ..
คำสั่งน่าจะประมาณนี้ครับ.. แล้วไป sum รายการต่างๆ ตามที่ต้องการครับ...  :D :D


select   vstdate,sum(rcpt_money),pttype,
 (if(pttype = "10",rcpt_money,0)) as `Cash`,
 (if(pttype = "89",rcpt_money,0)) as `UC`,
 (if(pttype in("34","35""36"),rcpt_money,0)) as `SSN`,
 (if(pttype = "23",rcpt_money,0)) as `ACC_23` ,
 (if(pttype = "30",rcpt_money,0)) as `Acident`,
 (if(pttype = "20",rcpt_money,0)) as `ACC_20`,
 (if(pttype = "22",rcpt_money,0)) as `ACC_22` ,
 (if(pttype = "37",rcpt_money,0)) as `ACC_37` ,
 (if(pttype = "88",rcpt_money,0)) as `ACC_88` ,

  from vn_stat
 where vstdate="2012-07-12"
 group by vstdate,pttype     order by vstdate,pttype

ลองไปประยุกต์ดูครับ... ถ้าไม่ใช่ที่ต้องการ รอ อ.ท่านอื่นๆครับผม.. ;D ;D ;D ;D


จบยังไงครับ
select   vstdate,sum(rcpt_money),pttype,
 (if(pttype = "10",rcpt_money,0)) as `Cash`,
 (if(pttype = "89",rcpt_money,0)) as `UC`,
 (if(pttype in("34","35""36"),rcpt_money,0)) as `SSN`,
 (if(pttype = "23",rcpt_money,0)) as `ACC_23` ,
 (if(pttype = "30",rcpt_money,0)) as `Acident`,
 (if(pttype = "20",rcpt_money,0)) as `ACC_20`,
 (if(pttype = "22",rcpt_money,0)) as `ACC_22` ,
 (if(pttype = "37",rcpt_money,0)) as `ACC_37` ,
 (if(pttype = "88",rcpt_money,0)) as `ACC_88` ,

  from vn_stat
 where vstdate="2012-07-12"
 group by vstdate,pttype     order by vstdate,pttype
โรงพยาบาลเสิงสาง จ.นครราชสีมา (ขนาด  60  เตียง ปี2554)  ขึ้นระบบโดยทีมงาน BMS  เมื่อเดือนเมษายน 2551
ก่อนหน้านั้นขึ้นระบบเมื่อ 07/07/07 ฤกษ์ดี  Master Server  IBM System x3500M4  RAM ECC 24 GB. HardDisk SAS 450x3 GB. ServerRAID M1100 Series Zero RAID5  OS:CentOS 6.4  MySQLPercona : 5.5.30-30.1

ออฟไลน์ วีระวัฒน์ (เอก)

  • Hero Member
  • *****
  • กระทู้: 1,368
  • ให้ก้าวไปข้างหน้าก่อนผู้อืนอย่างน้อย 1 ก้าวเสมอ
  • Respect: +7
    • ดูรายละเอียด
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #7 เมื่อ: กรกฎาคม 16, 2012, 15:50:39 PM »
0
เอาไปใช้คำนวนต้นทุนหรือไม่

http://hosxp.net/index.php?option=com_view_smf_download&attachmentid=83630
รพ.จอมทอง เชียงใหม่ ขนาด 120 เตียง  เริ่มใช้ HOSxP 1 ต.ค 2557 ขึ้นระบบโดย BMS
วีระวัฒน์ ใจอินผล  081-9609614 AIS  Email weerawatjaiinpol@gmail.com  Facebook วีระวัฒน์ ใจอินผล
Server: Xeon 4 core 2.27 GHz, CentOS 7.1 , RAM : 32 GB , HD SAS :300 GBx4 R5, MySQL MariaDB 10.0.20 64 bit

ออฟไลน์ E-Hos

  • Hero Member
  • *****
  • กระทู้: 711
  • Respect: 0
    • ดูรายละเอียด
    • http://www.erawanhospital.com/index.php
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #8 เมื่อ: กรกฎาคม 16, 2012, 16:46:48 PM »
0
;D ;D ;D น่าจะได้ครับ เอาไปประยุกต์เอาครับ..
คำสั่งน่าจะประมาณนี้ครับ.. แล้วไป sum รายการต่างๆ ตามที่ต้องการครับ...  :D :D


select   vstdate,sum(rcpt_money),pttype,
 (if(pttype = "10",rcpt_money,0)) as `Cash`,
 (if(pttype = "89",rcpt_money,0)) as `UC`,
 (if(pttype in("34","35""36"),rcpt_money,0)) as `SSN`,
 (if(pttype = "23",rcpt_money,0)) as `ACC_23` ,
 (if(pttype = "30",rcpt_money,0)) as `Acident`,
 (if(pttype = "20",rcpt_money,0)) as `ACC_20`,
 (if(pttype = "22",rcpt_money,0)) as `ACC_22` ,
 (if(pttype = "37",rcpt_money,0)) as `ACC_37` ,
 (if(pttype = "88",rcpt_money,0)) as `ACC_88` ,

  from vn_stat
 where vstdate="2012-07-12"
 group by vstdate,pttype     order by vstdate,pttype

ลองไปประยุกต์ดูครับ... ถ้าไม่ใช่ที่ต้องการ รอ อ.ท่านอื่นๆครับผม.. ;D ;D ;D ;D


จบยังไงครับ
select   vstdate,sum(rcpt_money),pttype,
 (if(pttype = "10",rcpt_money,0)) as `Cash`,
 (if(pttype = "89",rcpt_money,0)) as `UC`,
 (if(pttype in("34","35""36"),rcpt_money,0)) as `SSN`,
 (if(pttype = "23",rcpt_money,0)) as `ACC_23` ,
 (if(pttype = "30",rcpt_money,0)) as `Acident`,
 (if(pttype = "20",rcpt_money,0)) as `ACC_20`,
 (if(pttype = "22",rcpt_money,0)) as `ACC_22` ,
 (if(pttype = "37",rcpt_money,0)) as `ACC_37` ,
 (if(pttype = "88",rcpt_money,0)) as `ACC_88` ,

  from vn_stat
 where vstdate="2012-07-12"
 group by vstdate,pttype     order by vstdate,pttype


 ;D ;D ;D ;D  (if(pttype = "88",rcpt_money,0)) as `ACC_88` ,

ลบ , ออกเลยครับ ..ตัดมาให้ดูเฉยๆครับ
คือถ้าจะเพิ่ม เอาข้อมูลอะไรก็ใส่ คอมมา แล้วก็เลือกดึงครับ.. มันเป้นตัวอย่างครับ.. ;D ;D ;D ;D

เช่น รวม Income  , paid_money, Uc_monney  ฯลฯ ..
« แก้ไขครั้งสุดท้าย: กรกฎาคม 16, 2012, 16:49:13 PM โดย E-Hos »
ACADEMIC COMPUTING.  Erawan_Hospital
>> Thanks ... DansaI HospitaL L-o-E-i
>> By อ. Decha, อ.Armds

=> NoW !! HosXP SERVER Version 3.58.1.1
=> Client 50 client  OS: SP2 >> 3.58.1.1
=> ER Room  NoW ! HosXP Version 3.57.7.25D
=> Doctor Room  NoW ! HosXP Version 3.58.1.1
=> HosXP Test  Version 3.58.1.xx
=> Coming Soon >>UP Version 3.58.1.xx
wait...
-----------------------------
Start  System  8 January 2009

ออฟไลน์ Farza

  • Newbie
  • *
  • กระทู้: 25
  • Respect: 0
    • ดูรายละเอียด
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #9 เมื่อ: กรกฎาคม 16, 2012, 20:50:20 PM »
0
เอาไปใช้คำนวนต้นทุนหรือไม่

http://hosxp.net/index.php?option=com_view_smf_download&attachmentid=83630


ผิดหน้าหรือเปล่าครับ ^ ^!
 

ออฟไลน์ panus_t

  • Hero Member
  • *****
  • กระทู้: 2,368
  • Respect: +8
    • ดูรายละเอียด
Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
« ตอบกลับ #10 เมื่อ: กรกฎาคม 17, 2012, 15:49:04 PM »
0
เอาไปใช้คำนวนต้นทุนหรือไม่

http://hosxp.net/index.php?option=com_view_smf_download&attachmentid=83630

ไม่ได้เอาไปคำนวนต้นทุนครับ ถามการเงินบอกว่าเขาเก็บแบบนี้มานานแล้วตั้งแต่คนก่อน เก็บเอาไว้เฉย หรือเอาไว้ตรวจสอบ เงินสดที่ได้แต่ละวันโดยแยกตามแบบฟอร์มที่มีครับ
โรงพยาบาลเสิงสาง จ.นครราชสีมา (ขนาด  60  เตียง ปี2554)  ขึ้นระบบโดยทีมงาน BMS  เมื่อเดือนเมษายน 2551
ก่อนหน้านั้นขึ้นระบบเมื่อ 07/07/07 ฤกษ์ดี  Master Server  IBM System x3500M4  RAM ECC 24 GB. HardDisk SAS 450x3 GB. ServerRAID M1100 Series Zero RAID5  OS:CentOS 6.4  MySQLPercona : 5.5.30-30.1