ผู้เขียน หัวข้อ: ทำวันจัทรคติใน report  (อ่าน 8379 ครั้ง)

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

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
ทำวันจัทรคติใน report
« เมื่อ: ธันวาคม 11, 2012, 12:08:40 PM »
0
ผมทำวันจัทรคติใน report
ได้ผลไม่ตรงกับทำใน Script บน HOSxP
บางคำสั่งใน script ไม่สามารถใช้บน report design ได้
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #1 เมื่อ: ธันวาคม 11, 2012, 16:21:10 PM »
0
ตัวอย่าง-ใบรับรองการเกิด
error ตรงคำนวณค่ามาสเกณฑ์(_mas)
ที่ต้อง +25 ไม่รู้เพราะอะไร
คำนวณได้แค่ 2401-2559
หาค่าตารางสังวัตสร (ผมตั้งชื่อว่า sws) ได้แค่นี้
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง

ออฟไลน์ BBT Hospital

  • Jr. Member
  • **
  • กระทู้: 61
  • Respect: +2
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #2 เมื่อ: ธันวาคม 12, 2012, 07:31:21 AM »
0
อยากได้วิธีคำนวนครับ
โหลด .cds มาแล้วมัน error ไม่สามารถดูได้นะครับ
ส่วน .txt มันตาลายนะครับ เลยอยากทราบวิธีคำนวนมากกว่าครับ
แพทย์ โรงพยาบาลบางบัวทอง
Linux server Cent-OS 5 -ram 4 GB
HosXP when 2550
ตัวเองเริ่มใช้ July 2551
Server version: 3.55.11.8
Client version:HOSxP 3.55.2.29  (Most)
                      3.55.7.14(Ward)
การขึ้นระบบโดย : ทีม BMS
การทำ Report + SQL => นั่งเทียนมั่วเอง + copy ของ อาจารย์ ทั้งหลายครับ
** ขอบคุณ ทุกท่านที่เอื้อเฟื้อครับ **
(update signature when 56-01-24)

ออฟไลน์ chitvichai

  • Full Member
  • ***
  • กระทู้: 103
  • Respect: +5
    • ดูรายละเอียด
    • รพ.เมืองปาน
Re: ทำวันจัทรคติใน report
« ตอบกลับ #3 เมื่อ: ธันวาคม 12, 2012, 08:57:35 AM »
0
ตัวอย่าง-ใบรับรองการเกิด
error ตรงคำนวณค่ามาสเกณฑ์(_mas)
ที่ต้อง +25 ไม่รู้เพราะอะไร
คำนวณได้แค่ 2401-2559
หาค่าตารางสังวัตสร (ผมตั้งชื่อว่า sws) ได้แค่นี้
ช่วยแนบตาราง sws มาด้วยได้ไหมครับ
โรงพยาบาลเมืองปาน (ขนาด 30 เตียง) จังหวัดลำปาง โทร 054-276345-6
Master Server : HP Proliant DL360G7 Ram DDR3 1333 ECC 2x2 GB  HDD 2x146 GB  CentOS 6.2 Linux MySQL 5.5.11
Slave Server I : Acer Altos G540 Ram DDR2 667 ECC 2x1 GB HDD 2x146 GB Redhat Ent 5.2 Linux Mysql 5.1.29
Slave Server II : คอมประกอบ Ram DDR2 667  2x2 GB HDD SATA 160 GB Endian Firewall Community release 2.4.1 Mysql 5.5.24
Client : Windows XP Sp2
ขึ้นระบบ 1 มิ.ย.50

ออฟไลน์ snhos

  • Sr. Member
  • ****
  • กระทู้: 373
  • ฉันยังรู้สึกว่าตัวเองยังเด็กในการทำงานและความรู้
  • Respect: +3
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #4 เมื่อ: ธันวาคม 12, 2012, 09:21:22 AM »
0
ผมว่าถ้ามันมี  ตาราง  ปฏิทินจันทรคติ  ไทย  จะง่ายกว่าไหม

มีเวปที่บอกเรื่องการคำนวณ
http://www.payakorn.com/webboard_ans.php?q_id=34139
ลองดูครับ 
ส่วนอันนี้  ความรู้เกี่ยวกับ  สังวัตรสร
http://www.panyathai.or.th/wiki/index.php/%E0%B8%AA%E0%B8%B1%E0%B8%87%E0%B8%A7%E0%B8%B1%E0%B8%95%E0%B8%AA%E0%B8%A3
« แก้ไขครั้งสุดท้าย: ธันวาคม 12, 2012, 10:00:57 AM โดย snhos »
โรงพยาบาลไทรน้อย นนทบุรี 60 เตียง
เริ่มระบบ 2551 ขอบคุณอาจารย์หมาน้อย คุณหนุ่ม (รพ.ปากเกร็ด),อ.อ๊อด อ.นาจ และท่านปราชญ์ทุกท่าน ผู้เป็นอาจารย์และคนช่วยเหลือ
Master:IBM Xeon QuardCore X3650 M2 CPU 2.0 ram 28 g
OS:CentOS 6.4
Percona:5.5.33  
hosxp:3.56.9.30

Slave:IBM Xeon QuardCore E5405 CPU 2.0 ram 6 g
OS:CentOS 6.4
Percona:5.5.33  
hosxp:3.56.9.30

LIS LAB
Pfsense Log

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #5 เมื่อ: ธันวาคม 12, 2012, 12:12:32 PM »
0
ตารางสังวัตสร 2401-2560
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง

ออฟไลน์ BBT Hospital

  • Jr. Member
  • **
  • กระทู้: 61
  • Respect: +2
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #6 เมื่อ: ธันวาคม 15, 2012, 18:08:11 PM »
0
แก้จาก
_mas:=int((y*(nyear-1181)+dd0)/m)- ((_index mod 3) mod 2) * int(((24+(y*(nyear-1181)+dd0)/(m/30))mod 30)/24);
เป็น
int((y*(nyear-1181)+dd0)/m)- ((_index mod 3) mod 2) * int((((24+(y*(nyear-1181)+dd0))/(m/30))mod 30)/24);

เพราะตอนคำนวณ มันหาร 30 ก่อน + 24 ครับ

ตัวอย่าง-ใบรับรองการเกิด
error ตรงคำนวณค่ามาสเกณฑ์(_mas)
ที่ต้อง +25 ไม่รู้เพราะอะไร
คำนวณได้แค่ 2401-2559
หาค่าตารางสังวัตสร (ผมตั้งชื่อว่า sws) ได้แค่นี้

ความจริงต้อง+ แค่ 24ถึง 25 เพราะจาก เวป มีเวปที่บอกเรื่องการคำนวณ
http://www.payakorn.com/webboard_ans.php?q_id=34139

นำไปใส่ใน excel ถึงได้คำตอบว่าผิดตรงที่ แจ้งไว้ครับ

ส่วน จาก cds ที่ได้นี้ทำให้ผมดัดแปลงมาใช้ด้วย ขอบคุณอย่างสูงครับ
« แก้ไขครั้งสุดท้าย: ธันวาคม 18, 2012, 20:34:40 PM โดย piya1111 »
แพทย์ โรงพยาบาลบางบัวทอง
Linux server Cent-OS 5 -ram 4 GB
HosXP when 2550
ตัวเองเริ่มใช้ July 2551
Server version: 3.55.11.8
Client version:HOSxP 3.55.2.29  (Most)
                      3.55.7.14(Ward)
การขึ้นระบบโดย : ทีม BMS
การทำ Report + SQL => นั่งเทียนมั่วเอง + copy ของ อาจารย์ ทั้งหลายครับ
** ขอบคุณ ทุกท่านที่เอื้อเฟื้อครับ **
(update signature when 56-01-24)

ออฟไลน์ BBT Hospital

  • Jr. Member
  • **
  • กระทู้: 61
  • Respect: +2
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #7 เมื่อ: ธันวาคม 15, 2012, 20:38:53 PM »
0
ผมยังเจอปัญหาอีกอย่างครับ
อย่างวันที่ 19 เม.ย. 2555 จะกลายเป็น แรม 43 ค่ำ เดือน 4 ปีมะโรงครับ
ถ้าแก้ได้ขอ code ด้วยครับ
ขอบคุณครับ
แพทย์ โรงพยาบาลบางบัวทอง
Linux server Cent-OS 5 -ram 4 GB
HosXP when 2550
ตัวเองเริ่มใช้ July 2551
Server version: 3.55.11.8
Client version:HOSxP 3.55.2.29  (Most)
                      3.55.7.14(Ward)
การขึ้นระบบโดย : ทีม BMS
การทำ Report + SQL => นั่งเทียนมั่วเอง + copy ของ อาจารย์ ทั้งหลายครับ
** ขอบคุณ ทุกท่านที่เอื้อเฟื้อครับ **
(update signature when 56-01-24)

ออฟไลน์ BBT Hospital

  • Jr. Member
  • **
  • กระทู้: 61
  • Respect: +2
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #8 เมื่อ: ธันวาคม 15, 2012, 20:47:51 PM »
0
ผมลองแก้เองแล้วนะครับ อาจไม่ค่อยน่าดู code ซักเท่าไร แต่ก็คำนวณ ตรงใช้ได้ครับ
จาก
  no:=JD-JD5+1;
จากตรงนี้ครับ
  if nmonth<5 then m:=4 else m:=5;
  lcheck:=True;
  lwork:=False;
  i:=0;
  while not lwork do
    begin
      i:=i+1;
      n:=no;
      nmod:=m mod 2;
      if nmod=1 then _day:=29 else _day:=30;
      if (m=7 and _index=2) then _day:=_day+1;
      if nmonth<5 then m:=m-1 else m:=m+1;
      if m<5 then no:=no+_day else no:=no-_day;
//      showmessage(inttostr(m-1)+'-'+inttostr(_index)+'-'+booltostr(lcheck)+#13+inttostr(nmod)+#13+inttostr(_day)+#13+inttostr(n)+'-'+inttostr(no));
      if m=9 then
        if _index=1 then
          if lcheck then
            begin
              lcheck:=False;
              m:=8;
            end;
      if nmonth<5 then lwork:=no>0 else lwork:=no<=_day;
      if i>12 then lwork:=true;
    end;
    n:=dayofweek(nowdate);
    cthaiday:=formatdatetime('dddd',nowdate);  //getsqldata('select name from thaiday where id="'+inttostr(n)+'" ');
    ram:='';
    if no<16 then ram:='ขึ้น '+inttostr(no) else ram:='แรม '+inttostr(no-15);
    ram:=ram+' ค่ำ';
    if nmonth<5 then m:=m+1;

แก้เป็น
ดังนี้ครับ
 if _index=1 then
 begin
   if (no >=-117)and (no<=-89) then begin no:=no+118;m:=1; end else
   if (no >=-88) and (no<=-59) then begin no:=no+89;m:=2;  end else
   if (no >=-58) and (no<=-30) then begin no:=no+59;m:=3;  end else
   if (no >=-29) and (no<=0)   then begin no:=no+30;m:=4;  end else
   if (no >=1)   and (no<=29)  then begin m:=5;            end else
   if (no >=30)  and (no<=59)  then begin no:=no-29;m:=6;  end else
   if (no >=60)  and (no<=88)  then begin no:=no-59;m:=7;  end else
   if (no >=89)  and (no<=118) then begin no:=no-88;m:=8;  end else
   if (no >=119) and (no<=148) then begin no:=no-118;m:=88;end else
   if (no >=149) and (no<=177) then begin no:=no-148;m:=9; end else
   if (no >=178) and (no<=207) then begin no:=no-177;m:=10;end else
   if (no >=208) and (no<=236) then begin no:=no-207;m:=11;end else
   if (no >=237) and (no<=266) then begin no:=no-236;m:=12;end else
   if (no >=267) and (no<=295) then begin no:=no-266;m:=1; nthaiyear:=nthaiyear+1; end;
 end else
 if _index=2 then
 begin
   if (no >=-117)and (no<=-89) then begin no:=no+118;m:=1; end else
   if (no >=-88) and (no<=-59) then begin no:=no+89;m:=2;  end else
   if (no >=-58) and (no<=-30) then begin no:=no+59;m:=3;  end else
   if (no >=-29) and (no<=0)   then begin no:=no+30;m:=4;  end else
   if (no >=1)   and (no<=29)  then begin m:=5;            end else
   if (no >=30)  and (no<=59)  then begin no:=no-29;m:=6;  end else
   if (no >=60)  and (no<=89)  then begin no:=no-59;m:=7;  end else
   if (no >=90)  and (no<=119) then begin no:=no-88;m:=8;  end else
   if (no >=120) and (no<=148) then begin no:=no-119;m:=9; end else
   if (no >=149) and (no<=178) then begin no:=no-148;m:=10;end else
   if (no >=179) and (no<=207) then begin no:=no-178;m:=11;end else
   if (no >=208) and (no<=237) then begin no:=no-207;m:=12;end else
   if (no >=238) and (no<=266) then begin no:=no-237;m:=1; nthaiyear:=nthaiyear+1; end else
   if (no >=267) and (no<=296) then begin no:=no-266;m:=1; nthaiyear:=nthaiyear+1; end;
 end else
 begin
   if (no >=-117)and (no<=-89) then begin no:=no+118;m:=1; end else
   if (no >=-88) and (no<=-59) then begin no:=no+89;m:=2;  end else
   if (no >=-58) and (no<=-30) then begin no:=no+59;m:=3;  end else
   if (no >=-29) and (no<=0)   then begin no:=no+30;m:=4;  end else
   if (no >=1)   and (no<=29)  then begin m:=5;            end else
   if (no >=30)  and (no<=59)  then begin no:=no-29;m:=6;  end else
   if (no >=60)  and (no<=88)  then begin no:=no-59;m:=7;  end else
   if (no >=89)  and (no<=118) then begin no:=no-88;m:=8;  end else
   if (no >=119) and (no<=147) then begin no:=no-118;m:=9; end else
   if (no >=148) and (no<=177) then begin no:=no-147;m:=10;end else
   if (no >=178) and (no<=206) then begin no:=no-177;m:=11;end else
   if (no >=207) and (no<=236) then begin no:=no-206;m:=12;end else
   if (no >=237) and (no<=265) then begin no:=no-236;m:=1; nthaiyear:=nthaiyear+1; end else
   if (no >=266) and (no<=295) then begin no:=no-265;m:=1; nthaiyear:=nthaiyear+1; end;
 end;

สีเขียวเป็นแก้ไขอีกรอบครับนับจำนวนวันผิด
« แก้ไขครั้งสุดท้าย: มกราคม 16, 2013, 08:22:25 AM โดย piya1111 »
แพทย์ โรงพยาบาลบางบัวทอง
Linux server Cent-OS 5 -ram 4 GB
HosXP when 2550
ตัวเองเริ่มใช้ July 2551
Server version: 3.55.11.8
Client version:HOSxP 3.55.2.29  (Most)
                      3.55.7.14(Ward)
การขึ้นระบบโดย : ทีม BMS
การทำ Report + SQL => นั่งเทียนมั่วเอง + copy ของ อาจารย์ ทั้งหลายครับ
** ขอบคุณ ทุกท่านที่เอื้อเฟื้อครับ **
(update signature when 56-01-24)

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #9 เมื่อ: ธันวาคม 24, 2012, 15:32:12 PM »
0
แก้เป็นแบบนี้คับ
no:=JD-JD5;
  if no=0 then no:=1 else no:=no+1;
  lstep:=false;
  if no>0 then lstep:=true;
  m:=5;
  lcheck:=True;
  lwork:=False;
  i:=0;
  while not lwork do
    begin
      i:=i+1;
      n:=no;
      nmod:=m mod 2;
      if nmod=1 then _day:=29 else _day:=30;
      if (m=7) and (_index=2) then _day:=_day+1;
      if (no>=0) and (no<=_day) then lwork:=true;
      if not lwork then
        begin
          if lstep then no:=no-_day else no:=no+_day;
          if lstep then m:=m+1 else m:=m-1;
//          showmessage(inttostr(m)+'-'+inttostr(_index)+'-'+booltostr(lcheck)+#13+inttostr(nmod)+'-'+inttostr(_day)+#13+inttostr(n)+'-'+inttostr(no));
          if (m=9) and (_index=1) and (lcheck) then
            begin
              lcheck:=False;
              m:=8;
            end;
          if m<1 then m:=12;
          if m>12 then m:=1;
        end;
      if i>12 then lwork:=true;
    end;
    if no=0 then no:=_day;
    cthaiday:=formatdatetime('dddd',nowdate);
    ram:='';
    if no<16 then ram:='&cent;&Ouml;&eacute;&sup1; '+inttostr(no) else ram:='&aacute;&Atilde;&Aacute; '+inttostr(no-15);
    ram:=ram+' &curren;&egrave;&Oacute;';
    cthaimonth:=inttostr(m) //'&agrave;&acute;&times;&Iacute;&sup1; '+inttostr(m);
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง

ออฟไลน์ taw2010

  • Hero Member
  • *****
  • กระทู้: 537
  • Respect: 0
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #10 เมื่อ: ธันวาคม 24, 2012, 21:44:53 PM »
0
ขอเป็นใบเกิดที่ใช้งานได้ไหมครับ
ขอบคุณมากครับ
โรงพยาบาลดำเนินสะดวก จ.ราชบุรี
มือใหม่

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
Re: ทำวันจัทรคติใน report
« ตอบกลับ #11 เมื่อ: ธันวาคม 25, 2012, 10:39:23 AM »
0
ลองแก้ไขดูครับ
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง