<%'@ Language=VBScript %> <% 'If Session("UserLoggedIn") <> "true" Then 'Response.Redirect("login.asp") 'Else %> : : ค้นหาข้อมูลการทาฟลูออไรด์วานิชและสภาวะโรคฟันผุรายอำเภอ ตำบลและจากวันเดือนปีเกิด : :
ค้นหาข้อมูลการทาฟลูออไรด์วานิชและสภาวะโรคฟันผุ
รายอำเภอ ตำบล และจากวันเดือนปีเกิด

จะมีเฉพาะข้อมูลเด็กอายุแรกเกิดถึง 3 ขวบ ( เด็กที่เกิดตั้งแต่ 1 พฤศจิกายน 2544 ถึง ปัจจุบัน )
 [ ไปหน้าหลัก ] [ เพิ่มชื่อและข้อมูลเด็กรายใหม่ ] [ ไปหน้าแก้ไข ] [ ค้นหาข้อมูลรายสถานบริการ ] [ สรุปข้อมูลการทาฟลูออไรด์วานิชและสภาวะโรคฟันผุ ]
วิธีการค้นหา : ลงรายละเอียดในช่องสี่เหลี่ยมด้านล่าง ที่มีคำว่า..จากนั้นจึง Click ที่ปุ่ม แสดงรายการหน้าแรก <% Rem รับค่าจาก form และ set ค่าเริ่มต้น csql=request.form("csql") gDirect=request.form("Direct") gPage=request.form("PageNo") gPageSize=request.form("PageSize") gty="btype" gau="ok" gye="ok" gsu="ok" gisbn="ok" Rem ถ้าเป็นการเรียกมาครั้งแรกจะไม่มีค่า csql ก็ให้ข้ามไปที่ส่วนของ form เลย if csql<>"" then Rem รับค่าจาก form ว่าต้องการให้แสดงข้อมูลอะไรบ้าง gau=request.form("gauth") gye=request.form("gyear") gsu=request.form("gsub") gty=request.form("gtype") gisbn=request.form("gisbn") Rem ตั้งเวลาให้ติดต่อได้ไม่เกิน 10 นาที Session.timeout = 10 Rem เริ่มส่วนการติดต่อกับฐานข้อมูล Set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={Microsoft Access Driver (*.MDB)};DBQ=" & server.mappath("database/metacart.mdb") sql="Select * From [patient]" Rem ตรวจสอบการค้นว่าต้องการค้นจาก column ใดแล้วกำหนดหัวข้อให้ตรง if gty="bookname" then sql = sql & " Where name like '%" & csql & "%'ORDER BY birthdate deSC; " ghead="รายชื่อเด็กที่มีคำว่า" elseif gty="authors" then sql = sql & " Where surname like '%" & csql & "%'ORDER BY birthdate deSC; " ghead="นามสกุลเด็กที่มีคำว่า" elseif gty="office" then sql = sql & " Where catid like '%" & csql & "%' ORDER BY birthdate deSC; " ghead="เลข 13 หลักของเด็กที่มีตัวเลข" elseif gty="btype" then sql = sql & " ORDER BY ntx deSC; " ghead="ว่ามี" elseif gty="bisbn" then sql = sql & " Where ptid like '" & csql & "' ORDER BY birthdate deSC; " ghead="เลขทะเบียนเด็กที่" elseif gty="bampur" then sql = sql & " Where ampur like '%" & csql & "%' ORDER BY ntx deSC; " ghead="เด็กในอำเภอ" elseif gty="btambon" then sql = sql & " Where tambon like '%" & csql & "%' ORDER BY ntx deSC; " ghead="เด็กในตำบล" elseif gty="bbirthdate" then sql = sql & " Where birthdate like '%" & csql & "' ORDER BY ntx deSC; " ghead="วันเดือนปีเกิด" elseif gty="bfnum" then sql = sql & " Where ntx like '" & csql & "' ORDER BY birthdate deSC; " ghead="จำนวนครั้งที่ทาฟลูออไรด์" elseif gty="bcaries" then sql = sql & " Where cariesfree like '" & csql & "' ORDER BY birthdate deSC; " ghead="จำนวนครั้งที่ทาฟลูออไรด์" else sql = sql & " Where ptid like '%" & csql & "%'" ghead="รายชื่อ" end if %> <%''''''''''''''''''''''''''''''''''''''''''''''%> <%''''''''''''''''''''''''''''''''''''''''''''''%> <%''''''''''''''''''''''''''''''''''''''''''''''%> <% if gty="btype" then %> <% Set connectme = Server.CreateObject("ADODB.Connection") connectme.open "DRIVER={Microsoft Access Driver (*.MDB)};DBQ=" & server.mappath("database/metacart.mdb") sqltemp = "Select * From patient where cariesfree =1 " sqltemp2 = "Select * From patient where ntx =1 " set rstemp=Server.CreateObject("adodb.Recordset") set rstemp2=Server.CreateObject("adodb.Recordset") rstemp.open sqltemp, connectme,1,3 rstemp2.open sqltemp2, connectme,1,3 howmanyrecs=rstemp.recordcount howmanyrecs2=rstemp2.recordcount rstemp.close rstemp2.close set rstemp=nothing set rstemp2=nothing %> <%''''''''''''''''''''''''''''''''''''''''''''''%> <% elseif gty="bampur" then %> <% Set connectme = Server.CreateObject("ADODB.Connection") connectme.open "DRIVER={Microsoft Access Driver (*.MDB)};DBQ=" & server.mappath("database/metacart.mdb") sqltemp = "Select * From patient where ampur like '%" & csql & "%' and cariesfree =1 " sqltemp2 = "Select * From patient where ampur like '%" & csql & "%' and ntx =1 " set rstemp=Server.CreateObject("adodb.Recordset") set rstemp2=Server.CreateObject("adodb.Recordset") rstemp.open sqltemp, connectme,1,3 rstemp2.open sqltemp2, connectme,1,3 howmanyrecs=rstemp.recordcount howmanyrecs2=rstemp2.recordcount rstemp.close rstemp2.close set rstemp=nothing set rstemp2=nothing %> <%''''''''''''''''''''''''''''''''''''''''''''''%> <% elseif gty="btambon" then %> <% Set connectme = Server.CreateObject("ADODB.Connection") connectme.open "DRIVER={Microsoft Access Driver (*.MDB)};DBQ=" & server.mappath("database/metacart.mdb") sqltemp = "Select * From patient where tambon like '%" & csql & "%' and cariesfree =1 " sqltemp2 = "Select * From patient where tambon like '%" & csql & "%' and ntx =1 " set rstemp=Server.CreateObject("adodb.Recordset") set rstemp2=Server.CreateObject("adodb.Recordset") rstemp.open sqltemp, connectme,1,3 rstemp2.open sqltemp2, connectme,1,3 howmanyrecs=rstemp.recordcount howmanyrecs2=rstemp2.recordcount rstemp.close rstemp2.close set rstemp=nothing set rstemp2=nothing %> <%''''''''''''''''''''''''''''''''''''''''''''''%> <% elseif gty="bbirthdate" then %> <% Set connectme = Server.CreateObject("ADODB.Connection") connectme.open "DRIVER={Microsoft Access Driver (*.MDB)};DBQ=" & server.mappath("database/metacart.mdb") sqltemp = "Select * From patient where birthdate like '%" & csql & "%' and cariesfree =1 " sqltemp2 = "Select * From patient where birthdate like '%" & csql & "%' and ntx =1 " set rstemp=Server.CreateObject("adodb.Recordset") set rstemp2=Server.CreateObject("adodb.Recordset") rstemp.open sqltemp, connectme,1,3 rstemp2.open sqltemp2, connectme,1,3 howmanyrecs=rstemp.recordcount howmanyrecs2=rstemp2.recordcount rstemp.close rstemp2.close set rstemp=nothing set rstemp2=nothing %> <%''''''''''''''''''''''''''''''''''''''''''''''%> <% else %> <% Set connectme = Server.CreateObject("ADODB.Connection") connectme.open "DRIVER={Microsoft Access Driver (*.MDB)};DBQ=" & server.mappath("database/metacart.mdb") sqltemp = "Select * From patient where cariesfree =1 " sqltemp2 = "Select * From patient where ntx =1 " set rstemp=Server.CreateObject("adodb.Recordset") set rstemp2=Server.CreateObject("adodb.Recordset") rstemp.open sqltemp, connectme,1,3 rstemp2.open sqltemp2, connectme,1,3 howmanyrecs=rstemp.recordcount howmanyrecs2=rstemp2.recordcount rstemp.close rstemp2.close set rstemp=nothing set rstemp2=nothing %> <%''''''''''''''''''''''''''''''''''''''''''''''%> <% end if %> <% ' สร้าง Recordset แบบ Static เพื่อให้สามารถนับได้ Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sql, conn, 1, 3 ' หากเกิดข้อผิดพลาดขึ้นก็เลยตามเลย On Error Resume Next ' นับจำนวนรายการที่สร้างขึ้นมาตามเงื่อนไข TotalRows=RS.RecordCount RS.PageSize = gPageSize PageSize=RS.PageSize TotalPages=RS.PageCount Rem กำหนดหน้าที่จะแสดง จากค่า gDirect ที่ส่งมา Select Case gDirect Case "แสดงรายการหน้าแรก" PageNo=1 Case "หน้าที่ผ่านมา" If gPage=1 then PageNo=1 Else PageNo=gPage-1 End If Case "หน้าถัดไป" If Cint(gPage) >=TotalPages then PageNo=TotalPages Else PageNo=gPage+1 End If Case "หน้าสุดท้าย" PageNo=TotalPages Case "ต้องการดูหน้าที่" If Cint(gPage)>=Totalpages then PageNo=Totalpages Elseif Cint(gPage)<= 1 then PageNo=1 Else PageNo=gPage End If Case "" PageNo=1 End Select %>
พบ  <%=ghead & " " & csql %> <%if ToTalRows=0 then%> ไม่มีรายการตามเงื่อนไข <%Else%> <%=TotalRows%> ราย มีเด็กที่ได้รับการตรวจสุขภาพฟันและทาฟลูออไรด์วานิชแล้ว <%if gty="btype" then %> <%= howmanyrecs2%> ราย พบเด็กที่ มีฟันผุ <%= howmanyrecs%> ราย คิดเป็น <% Function ConvertToPercent(sz) ConvertToPercent = FormatPercent(howmanyrecs/howmanyrecs2,2) End Function response.write ConvertToPercent(sz) %> <%elseif gty="bampur" then%> <%= howmanyrecs2%> ราย พบเด็กที่ มีฟันผุ <%= howmanyrecs%> ราย คิดเป็น <%Function ConvertToPercent(sz) ConvertToPercent = FormatPercent(howmanyrecs/howmanyrecs2,2) End Function response.write ConvertToPercent(sz) %> <% elseif gty="btambon" then %> <%= howmanyrecs2%> ราย พบเด็กที่ มีฟันผุ <%= howmanyrecs%> ราย คิดเป็น <%Function ConvertToPercent(sz) ConvertToPercent = FormatPercent(howmanyrecs/howmanyrecs2,2) End Function response.write ConvertToPercent(sz) %> <% elseif gty="bbirthdate" then %> <%= howmanyrecs2%> ราย พบเด็กที่ มีฟันผุ <%= howmanyrecs%> ราย คิดเป็น <%Function ConvertToPercent(sz) ConvertToPercent = FormatPercent(howmanyrecs/howmanyrecs2,2) End Function response.write ConvertToPercent(sz) %> <%else %> <%= howmanyrecs2%> ราย พบเด็กที่ มีฟันผุ <%= howmanyrecs%> ราย คิดเป็น <%Function ConvertToPercent(sz) ConvertToPercent = FormatPercent(howmanyrecs/howmanyrecs2,2) End Function response.write ConvertToPercent(sz) %> <%end if %>
แสดงข้อมูลหน้าละ 8 รายชื่อ ขณะนี้คือหน้าที่ <%=PageNo%> จากจำนวน <%=TotalPages%> หน้า <%End if%>

<% RS.Absolutepage=pageno RowCount = 1%>
<% count=1 Do while Not RS.EOF and rowcount<=PageSize if bg="#fdfdff" then bg="#ededff" else bg="#fdfdff" %> valign=top> <% RowCount=RowCount+1 rs.MoveNext Loop rs.CLOSE conn.close %> <%End if%>
ลำดับ ชื่อ - นามสกุล เลข 13 หลัก ว/ด/ป เกิด สภาวะฟัน ภูมิลำเนา ประวัติการทา
ฟลูออไรด์วานิช
<%=((PageNo-1)*RS.PageSize)+RowCount%>
  <% if RS("prename")=001 then %> ดช.<% elseIf RS("prename")=002 then %> ดญ.<% else %> <% end if %> <%=hilight(RS("name"))%>  <%= hilight(RS("surname"))%>
<%= hilight(RS("catid"))%> <%= hilight(RS("birthdate")) %> <% if hilight(RS("cariesfree"))=1 then response.write "ผุ" else response.write "ไม่ผุ" end if %>    <%= rs("address") %> ม.<%= rs("moo") %> ต.<%= hilight(rs("tambon")) %> อ.<%= hilight(rs("ampur")) %> <%= hilight(rs("ntx")) %> ครั้ง


<%if gty="btype" then%> รายชื่อทั้งหมด <%else%> รายชื่อทั้งหมด <%end if%>   [ ต้องการค้นหาจาก : <%if gty="btambon" then%> ตำบล <%else%> ตำบล <%end if%> <%if gty="bampur" then%> อำเภอ <%else%> อำเภอ <%end if%> <%if gty="bbirthdate" then%> วันเดือนปีเกิด <%else%> วันเดือนปีเกิด <%end if%> ]
<%if gty="btype" then%> ที่มีคำว่า กรุณากำหนดให้ใกล้เคียงที่สุด เพื่อลดเวลาในการเรียกค้น <%else%> ที่มีคำว่า กรุณากำหนดให้ใกล้เคียงที่สุด เพื่อลดเวลาในการเรียกค้น <%end if%> <%if gau<>"" then%> <%else%> <%end if%> <%if gye<>"" then%> <%else%> <%end if%> <%if gsu<>"" then%> <%else%> <%end if%>
<% 'End If %>