%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))*3) Mod 8
Select Case Result
Case 1
strResult="เศษ ๑ ตำราว่ามี รูปโยนีเท่าใบพลูไม่สู้ใหญ่
" + _
"หนทางเข้านั้นขยับไป ขนก็ไม่รกปรกแคมรู
" + _
"พิเคราะห์ดูสินทรัพย์อาภัพมาก แต่ขันหมากไม่จนมีคนสู้
" + _
"ชะตาแรงหนักหนาตำราครู จะมีคู่เลือกเอาเองไม่เกรงใคร
"
Case 2
strResult = " เศษ ๒ ท่านขยายทำนายว่า โตเท่าฝ่ามือกางอย่างใหญ่
" + _
"ทั้งขนดำนั้นรกดกกระไร เนื่องขึ้นไปจนบนหนอกดูออกดำ
" + _
"ทายว่าจะอาภัพอัปลักษณ์ ทั้งยศศักดิ์เสื่อมทรามแม่งามขำ
" + _
"สิ่งสมบัติต้องหาอุตส่าห์จำ ทรัพย์ที่ทำกว่าจะได้เหงื่อไหลเซาะ
"
Case 3
strResult = " เศษ๓ ท่านทำนายทายทักไว้ ว่าโตใหญ่ขาวโคกดูโหนกเหมาะ
" + _
"ที่รองกางทางจะทำก็จำเพาะ แต่พอเหมาะไม่สู้กว้างเป็นอย่างดี
" + _
"อันโลมามีอยู่ไม่สู้มาก เว้นแต่หากดำสนิทดูมิดหมี
" + _
"แม้นชายใดร่วมรักภักคินี ต้องคลุกคลีอยู่เคล้าเจ้าร่ำไป
"
Case 4
strResult = " เศษ๔ ตำราท่านว่าถ่อย เหมือนกาบหอยแมลงภู่ไม่สู้ใหญ่
" + _
"ประการหนึ่งถ้าจะอุปไมย พิเคราะห์ไปแล้วก็ลีบเหมือนกีบกวาง
" + _
"ทั้งโลมาดำดกดูรกเลี้ยว หนทางเที่ยวทำเลลึกดูกว้างขวาง
" + _
"ถึงมีคู่คงคิดนอกใจนาง มักรักร้างแรมสนุกไปทุกคราว
"
Case 5
strResult = " เศษ ๕ ว่าโคกกะปะเหลาะ เหมือนตาลเฉาะน่าดูสองพูขาว
" + _
"พอสมกายกันไม่สั้นยาว ไม่ห่างหาวแคมสนิทมิดชิดดี
" + _
"ขนก็มีรำไรไม่สู้ดก ด้วยเศษตกเบญจเลิศประเสริฐศรี
" + _
"เป็นมหาสิทธิโชคโฉลกดี ทรัพย์ก็มีมากครันด้วยปัญญา
"
Case 6
strResult = " เศษ ๖ โคกขาวยาวสลวย เหมือนกาบกล้วยตานีดีนักหนา
" + _
"ทั้งโตยาวขาวล้วนชวนวิญญาณ์ เส้นโลมาละเอียดลออมากพอควร
" + _
"เมื่อสาวยังมีทุกข์ไม่สุขแท้ ต่อเมื่อแก่จึงวายหายกำสรวล
" + _
"สุขสมบัติสมบูรณ์ประมูลมวล ประเสริฐส่วนเศษโชคโฉลกงาม
"
Case 7
strResult = " เศษ ๗ ไม่เท็จถ่อยเหมือนหอยโข่ง กะเปาะโป่งติดตัวชั่วส่ำสาม
" + _
"ตัณหามากราคะจัดกำดัดนาม มักทำตามใจตัวไม่กลัวใคร
" + _
"ทั้งก้าวร้าวห้าวหาญในการโลก สาระโกกเกเรเถลไถล
" + _
"น้ำจิตรักนักเลงโผงเผงไป มีข้อได้พึ่งพาแต่สามี
" + _
"ลำพังตัวแล้วต้องเที่ยวซ่องแซ่ง ไม่มีแหล่งเป็นหลักสิ้นศักดิ์ศรี
" + _
"แม้นชายใดได้ร่วมประเวณี ก็เป็นที่หมองมัวเหมือนต้องไฟ
"
Case 0
strResult = " เศษ ๘ นูนโหนกเป็นโคกเค้า เหมือนน้ำเต้าผ่าแล่งแถลงไข
" + _
"โลมาร่ายริมรอบเป็นขอบไป ที่ลานใหญ่มีบ้างแต่บางเบา
" + _
"น่าสงวนควรสนองประคองคู่ เป็นคนรู้จักเจียมเสงี่ยมเหงา
" + _
"มักชิงชังสิ่งที่ชั่วไม่มัวเมา ประกอบด้วยเชาวน์ปรีชาปัญญายง
" + _
"ใจประมาณบอกอาการที่เพ่งพิศ เจือนักเลงอยู่สักนิดน่าพิศวง
" + _
"มีกลเม็ดเด็ดแท้แม่อนงค์ ชายใดลิ้มรสต้องหลงเสน่ห์นาง
"
End Select
end if%>