%if Request.Form("cmdPredict")<>"" then
'------------------------------------------------------------------------
Dim MaxDay,StrDay,StrMonth,StrYear,longDay
Dim longMonth,longYear
Dim Lunar
Dim TmpStr,Result
strDay = Cint(request("lstDay"))
strMonth = Cint(request("lstMonth"))
strYear = Cint(request("lstYear"))
strTime=request("strTime")
'--------------------------------------------------------------------------------------------------------
' ตรวจสอบตกฟาก ถ้าเกิด ก่อน หมโมงเช้า ถือว่ายังเป็นวันเก่าอยู่
'--------------------------------------------------------------------------------------------------------
If Cint(Left(strTime, 2)) < 6 Then
If Cint(StrDay) = 1 Then
Select Case (StrMonth - 1)
Case 0
'Go Bacl Last year
StrDay = "31"
StrYear = Cstr(StrYear - 1)
StrMonth = "12"
Case 2
If leapyear(StrYear) = True Then
StrDay = "29"
Else
StrDay = "28"
End If
StrMonth = CStr(StrMonth - 1)
Case 3, 5, 7, 8, 10
StrDay = "31"
StrMonth = cStr(StrMonth - 1)
Case 4, 6, 9, 11
StrDay = 30
StrMonth = cStr(StrMonth - 1)
End Select
Else
StrDay = cStr(StrDay - 1)
End If
End If
If strMonth = 1 Then
MaxDay = 31
ElseIf strMonth = 2 Then
If leapyear(StrYear) = True Then
MaxDay = 29
Else
MaxDay = 28
End If
ElseIf strMonth = 3 Then
MaxDay = 31
ElseIf strMonth = 4 Then
MaxDay = 30
ElseIf strMonth = 5 Then
MaxDay = 31
ElseIf strMonth = 6 Then
MaxDay = 30
ElseIf strMonth = 7 Then
MaxDay = 31
ElseIf strMonth = 8 Then
MaxDay = 31
ElseIf strMonth = 9 Then
MaxDay = 30
ElseIf strMonth = 10 Then
MaxDay = 31
ElseIf strMonth = 11 Then
MaxDay = 30
ElseIf strMonth = 12 Then
MaxDay = 31
End If
If StrDay > MaxDay Then
'MsgBox "กรุณาป้อน วันอีกครั้ง !", , "ป้อนวันผิดพลาด"
'Exit Sub
End If
If StrYear < 2400 Or StrYear > 2574 Then
' MsgBox "กรุณาป้อน ปีอีกครั้ง ในช่วง ๒๔๐๐ ถึง ๒๕๗๔", , "ป้อนปีผิดพลาด"
' Exit Sub
End If
'---------------------------------------------------------------------------------------------------------
Lunar = Solar2Lunar(StrDay, StrMonth, StrYear)
'Response.Write("Lunar=" & Lunar & "
")
arrLunar=split(Lunar,",")
Lunar_Day=arrLunar(0)
Lunar_Month=arrLunar(1)
Lunar_Year=arrLunar(2)
Lunar_DayOfWeek=arrLunar(3)
'----------------------------------------------------------------------------------------------------------
' Prepare data for label on Form
'----------------------------------------------------------------------------------------------------------
'-------------------------------
'วัน
'------------------------------
Select Case Cint(Lunar_DayofWeek)
Case 1
strLunarDate = "วันอาทิตย์ "
Case 2
strLunarDate = "วันจันทร์ "
Case 3
strLunarDate = "วันอังคาร "
Case 4
strLunarDate = "วันพุธ "
Case 5
strLunarDate = "วันพฤหัส "
Case 6
strLunarDate = "วันศุกร์ "
Case 7
strLunarDate = "วันเสาร์ "
End Select
'-------------------------------
' ค่ำ
'-------------------------------
If Lunar_Day > 15 Then
strLunarDate = strLunarDate & "แรม " & (Cint(Lunar_Day) - 15) & " ค่ำ"
Else
strLunarDate = strLunarDate & "ขึ้น " & Cint(Lunar_Day) & " ค่ำ"
End If
'--------------------------
'เดือน
'--------------------------
Select Case Cint(Lunar_Month)
Case 1
strLunarDate = strLunarDate & " เดือน อ้าย"
Case 2
strLunarDate = strLunarDate & " เดือน ยี่"
Case 3
strLunarDate = strLunarDate & " เดือน สาม"
Case 4
strLunarDate = strLunarDate & " เดือน สี่"
Case 5
strLunarDate = strLunarDate & " เดือน ห้า"
Case 6
strLunarDate = strLunarDate & " เดือน หก"
Case 7
strLunarDate = strLunarDate & " เดือน เจ็ด"
Case 8
strLunarDate = strLunarDate & " เดือน แปด"
Case 9
strLunarDate = strLunarDate & " เดือน เก้า"
Case 10
strLunarDate = strLunarDate & " เดือน สิบ"
Case 11
strLunarDate = strLunarDate & " เดือน สิบเอ็ด"
Case 12
strLunarDate = strLunarDate & " เดือน สิบสอง"
End Select
'---------------------------
'ปี
'---------------------------
Select Case Cint(Lunar_Year)
Case 1
strLunarDate = strLunarDate & " ปีชวด"
Case 2
strLunarDate = strLunarDate & " ปีฉลู"
Case 3
strLunarDate = strLunarDate & " ปีขาล"
Case 4
strLunarDate = strLunarDate & " ปีเถาะ"
Case 5
strLunarDate = strLunarDate & " ปีมะโรง"
Case 6
strLunarDate = strLunarDate & " ปีมะเส็ง"
Case 7
strLunarDate = strLunarDate & " ปีมะเมีย"
Case 8
strLunarDate = strLunarDate & " ปีมะแม"
Case 9
strLunarDate = strLunarDate & " ปีวอก"
Case 10
strLunarDate = strLunarDate & " ปีระกา"
Case 11
strLunarDate = strLunarDate & " ปีจอ"
Case 12
strLunarDate = strLunarDate & " ปีกุน"
End Select
'---------------------------------------------------------------------------------------------------------
'คำนวณเศษ
'---------------------------------------------------------------------------------------------------------
'เศษพระจอมเกล้า ท่านให้เอาวัน เดือน ปี บวกเข้าด้วยกัน นับปีชวด เป็นต้น เดือนอ้ายเป็นต้น
'วันอาทิตย์เป็นต้น ถ้ามีเศษเกินกว่า 10 ขึ้นไป ต้องเอา 10 หัก ออกเสมอ เอาเศษแค่ 10 เป็นจำนวนทาย ดังนี้
'--------------------------------------------------------------------------------------------------------
Result = (Cint(Lunar_DayofWeek) + Cint(Lunar_Month) + Cint(Lunar_Year)) Mod 10
Select Case Result
Case 1
strResult = " เศษ ๑ เสาเรือนไฟไหม้ ชะตาใครทั้งชายหญิง
" + _
"ไร้เรือนที่พักพิง ที่พึ่งพักสำนักเนา
" + _
"ร่อนเร่ระเหระหน เร่งเจียมตนอย่าดูเบา
" + _
"เพราะว่าชะตาเรา โทษประกอบจึงเกิดกรรม
"
strResult2 = " เศษ ๑ หญิงชายใดตกเข้าแล้ว จะไม่มีที่พักพิงอาศัย มีเรือนก็ไฟไหม้ ให้พึงเจียมเนื้อเจียมตนให้จงหนัก กระทำการใดให้พินิจพิจารณาอย่างรอบคอบ"
Case 2
strResult = " เศษ ๒ จะครองไข้ มีโรคร้ายรุมประจำ
" + _
"หยูกยาจะหาทำ บ่ถูกแท้จนแก่ตัว
"
strResult2 = " เศษ ๒ จะมีโรคประจำตัว รักษาอย่างไรก็หายได้ยาก ต้องเสียทรัพย์สินอยู่เรื่อยไป ทำให้มีฐานะค่อนข้างจะยากจน"
Case 3
strResult = " เศษ ๓ ความสบาย มีม้าควายเกวียนและวัว
" + _
"พอสมสกุลตัว เข้าที่ทายสถานกลาง
"
strResult2 = " เศษ ๓ เป็นคนมีฐานะพอเหมาะสมตัว แค่สถานประมาณกลาง จะว่าจนก็ไม่ได้ จะว่ารวยก็ไม่เชิง"
Case 4
strResult = " เศษ ๔ มีข้าครอก อเนกนอกคณานาง
" + _
"อุปถัมภ์ล้วนสำอาง บ่ไข้ชุกบ่ทุกข์เป็น
"
strResult2 = " เศษ ๔ เป็นคนมีบุญ คิดการสิ่งใดก็สมความปรารถนา มีข้าทาสบริวาร และทรัพย์สินเงินทองเพียงพอ แก่การใช้จ่ายได้อย่างสะดวก สบาย"
Case 5
strResult = " เศษ ๕ ชะตากลับ ทุนทรัพย์แลแสนเข็ญ
" + _
"ภายหน้าชะตาเป็น ทุนทรัพย์จะนับพัน
"
strResult2 = " เศษ ๕ ในขั้นต้นจะเป็นคนไม่มีฐานะ แต่เมื่ออายุย่างมากเข้า ฐานะก็จะกลับกลายจนมีหลักฐานมั่นคงดี"
Case 6
strResult = " เศษ ๖ จะยกญาติ เป็นเชื้อชาติประเสริฐสรรพ์
" + _
"เงินตรายศถาพันธ์ ทุนทรัพย์ลำดับดี
"
strResult2 = " เศษ ๖ จะได้รับความอุดหนุนจากหมู่ญาติที่สนิทสนมกับตน ช่วยฟื้นฟูฐานะของตนจนกลายเป็นคนมีฐานะดีในอนาคต"
Case 7
strResult = " เศษ ๗ นั้นผ้าขาด จะนุ่งห่มก็เต็มที
" + _
"พักตราย่อมราศี ระคายคับทั้งทรัพย์สิน
"
strResult2 = " เศษ ๗ เป็นคนค่อนข้างอาภัพ กระทำการใดก็ไม่สำเร็จผล ทุนทรัพย์ก็มีน้อย ไม่เพียงพอแก่การใช้จ่าย การนุ่งห่มก็ซมซ่อ เป็นที่เหยียดหยามของคนทั่วไป"
Case 8
strResult = " เศษ ๘ นั้นเปรื่องยศ จะปรากฏกระเดื่องดิน
" + _
"ทรัพย์ศฤงคารสถานถิ่น ทั้งอำนาจวาสนา
"
strResult2 = " เศษ ๘ เป็นคนมีชาติมีตระกูล จะกระทำการใดก็ได้ดังความปรารถนา จะเป็นคมมีเกียรติยศเป็นที่เชื่อถือของคนทั่วไป และสมบูรณ์ด้วยทรัพย์สิน"
Case 9
strResult = " เศษ ๙ กินข้าวกลางตลาด เสมอชาติสุนักขา
" + _
"ถึงจะมีวาสนา ต้องประกอบกิจการ
" + _
"แม้นตระกูลทลิทก ถึงตกต่ำก็บ่นาน
" + _
"ดั่งนักเลงสุราบาน พอขวนขวายใส่ท้องตน
"
strResult2 = " เศษ ๘ เป็นคนมีชาติมีตระกูล จะกระทำการใดก็ได้ดังความปรารถนา จะเป็นคมมีเกียรติยศเป็นที่เชื่อถือของคนทั่วไป และสมบูรณ์ด้วยทรัพย์สิน"
Case 0
strResult = " เศษ ๐ นกแขกเต้า เฝ้าทำรวงรังระวังผล
" + _
"แสวงดีย่อมมีผล อย่าคลอเคล้ากับเหล่าพาล
" + _
"เหมือนปักษีอันมีปีก รู้หลบหลีกธนูพราน
" + _
"ถ้าประมาทจะเสียการ ถึงชอกช้ำระกำกาย
"
strResult2 = " เศษ ๐ ให้พึงระวังการคบหาสมาคม เพราะคบกับผู้ใดก็เป็นเช่นนั้น เปรียบเสมือนนิทานนกแขกเต้าที่อยู่กับโจรและพระฤษี ทั้งที่เป็นพี่น้องท้องเดียวกัน ดังนั้นคนในเศษนี้ ไม่ควรที่จะประมาท เพราะภัยจะตกต้องมาถึงตนได้"
End Select
end if%>