BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: woravet ที่ ธันวาคม 11, 2012, 12:08:40 PM

หัวข้อ: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: woravet ที่ ธันวาคม 11, 2012, 12:08:40 PM
ผมทำวันจัทรคติใน report
ได้ผลไม่ตรงกับทำใน Script บน HOSxP
บางคำสั่งใน script ไม่สามารถใช้บน report design ได้
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: woravet ที่ ธันวาคม 11, 2012, 16:21:10 PM
ตัวอย่าง-ใบรับรองการเกิด
error ตรงคำนวณค่ามาสเกณฑ์(_mas)
ที่ต้อง +25 ไม่รู้เพราะอะไร
คำนวณได้แค่ 2401-2559
หาค่าตารางสังวัตสร (ผมตั้งชื่อว่า sws) ได้แค่นี้
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: BBT Hospital ที่ ธันวาคม 12, 2012, 07:31:21 AM
อยากได้วิธีคำนวนครับ
โหลด .cds มาแล้วมัน error ไม่สามารถดูได้นะครับ
ส่วน .txt มันตาลายนะครับ เลยอยากทราบวิธีคำนวนมากกว่าครับ
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: chitvichai ที่ ธันวาคม 12, 2012, 08:57:35 AM
ตัวอย่าง-ใบรับรองการเกิด
error ตรงคำนวณค่ามาสเกณฑ์(_mas)
ที่ต้อง +25 ไม่รู้เพราะอะไร
คำนวณได้แค่ 2401-2559
หาค่าตารางสังวัตสร (ผมตั้งชื่อว่า sws) ได้แค่นี้
ช่วยแนบตาราง sws มาด้วยได้ไหมครับ
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: snhos ที่ ธันวาคม 12, 2012, 09:21:22 AM
ผมว่าถ้ามันมี  ตาราง  ปฏิทินจันทรคติ  ไทย  จะง่ายกว่าไหม

มีเวปที่บอกเรื่องการคำนวณ
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
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: woravet ที่ ธันวาคม 12, 2012, 12:12:32 PM
ตารางสังวัตสร 2401-2560
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: BBT Hospital ที่ ธันวาคม 15, 2012, 18:08:11 PM
แก้จาก
_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 ที่ได้นี้ทำให้ผมดัดแปลงมาใช้ด้วย ขอบคุณอย่างสูงครับ
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: BBT Hospital ที่ ธันวาคม 15, 2012, 20:38:53 PM
ผมยังเจอปัญหาอีกอย่างครับ
อย่างวันที่ 19 เม.ย. 2555 จะกลายเป็น แรม 43 ค่ำ เดือน 4 ปีมะโรงครับ
ถ้าแก้ได้ขอ code ด้วยครับ
ขอบคุณครับ
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: BBT Hospital ที่ ธันวาคม 15, 2012, 20:47:51 PM
ผมลองแก้เองแล้วนะครับ อาจไม่ค่อยน่าดู 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;

สีเขียวเป็นแก้ไขอีกรอบครับนับจำนวนวันผิด
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: woravet ที่ ธันวาคม 24, 2012, 15:32:12 PM
แก้เป็นแบบนี้คับ
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);
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: taw2010 ที่ ธันวาคม 24, 2012, 21:44:53 PM
ขอเป็นใบเกิดที่ใช้งานได้ไหมครับ
ขอบคุณมากครับ
หัวข้อ: Re: ทำวันจัทรคติใน report
เริ่มหัวข้อโดย: woravet ที่ ธันวาคม 25, 2012, 10:39:23 AM
ลองแก้ไขดูครับ