BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: panus_t ที่ กรกฎาคม 16, 2012, 10:46:15 AM

หัวข้อ: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: panus_t ที่ กรกฎาคม 16, 2012, 10:46:15 AM
ต้องการ SUM rcpt_money ตามวันที่  ตามสิทธิ ครับ
ต้องการทราบว่าต้องเขียน code mysql แบบไหนครับ
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: E-Hos ที่ กรกฎาคม 16, 2012, 11:00:57 AM
 ;D ;D ;D  ??? ???
เอาแค่สิทธิ 2 สิทธินี้เหรอครับ...ข้าราชการ กับ ประกันสังคม..
รายละเอียดที่ต้องการ น่ะครับ.. :D :D
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: panus_t ที่ กรกฎาคม 16, 2012, 13:38:06 PM
มันเยอะครับ ก็เลย post แค่ 2 สิทธิเผื่อเอาไปประยุกต์   ;D
จริง ๆ ก็มี สิทธิ ข้าราชการ  ประกัน  พรบ.  กองทุนทดแทน  ต่างด้าว  ชำระเอง  สิทธิอื่น ๆ ค้างชำระ และแยก 16 หมวดอีก ทั้งหมดอยู่ในรายงานเดียว....
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: pop_hosxp ที่ กรกฎาคม 16, 2012, 13:44:29 PM
ลองประยุกต์ด้วยการใช้ variable วางลงไปแล้วใช้คำสั่ง

value:=getsqlintegerdata('select sum(rcpt_money) '+
' from vn_stat '+
' where vstdate="'+dbpipeline['vstdate']+'" '+
' group by vstdate')
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: panus_t ที่ กรกฎาคม 16, 2012, 14:21:55 PM
หน้าตารายงานครับ  ;D
ไม่ทราบว่าจะเขียนคำสั่ง Select ครั้งเดียวจะได้หรือเปล่า   ;D
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: E-Hos ที่ กรกฎาคม 16, 2012, 15:07:40 PM
 ;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

หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: panus_t ที่ กรกฎาคม 16, 2012, 15:41:42 PM
;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
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: วีระวัฒน์ (เอก) ที่ กรกฎาคม 16, 2012, 15:50:39 PM
เอาไปใช้คำนวนต้นทุนหรือไม่

http://hosxp.net/index.php?option=com_view_smf_download&attachmentid=83630
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: E-Hos ที่ กรกฎาคม 16, 2012, 16:46:48 PM
;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  ฯลฯ ..
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: Farza ที่ กรกฎาคม 16, 2012, 20:50:20 PM
เอาไปใช้คำนวนต้นทุนหรือไม่

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


ผิดหน้าหรือเปล่าครับ ^ ^!
หัวข้อ: Re: ต้องการ sum vn_stat.rcpt_money ซ้อน Select ทำไงครับ
เริ่มหัวข้อโดย: panus_t ที่ กรกฎาคม 17, 2012, 15:49:04 PM
เอาไปใช้คำนวนต้นทุนหรือไม่

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

ไม่ได้เอาไปคำนวนต้นทุนครับ ถามการเงินบอกว่าเขาเก็บแบบนี้มานานแล้วตั้งแต่คนก่อน เก็บเอาไว้เฉย หรือเอาไว้ตรวจสอบ เงินสดที่ได้แต่ละวันโดยแยกตามแบบฟอร์มที่มีครับ