<%
SET rs=Server.CreateObject("ADODB.Recordset")
SET rsMiss=Server.CreateObject("ADODB.Recordset")
SET rsYear=Server.CreateObject("ADODB.Recordset")
Set conn=Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("dbfile\PP30db.mdb")
sqlMiss = "SELECT AutoID, TIN, BraNam, JurNam, ISIC From company WHERE AutoID="&Request.QueryString("id1")
rsMiss.open sqlMiss,conn,1,3
Response.Write "<BR><BR><CENTER><font size='3'> <font color=black><B>รายละเอียดผู้ประกอบการ</B></CENTER><BR>"
Response.Write "<CENTER><B>TIN : </B>"&rsMiss("TIN")&"<font size='3'> <font color=black><B> สถานประกอบการ : </B> "&rsMiss("BraNam")&" <font size='3'> <font color=black><B>ชื่อ-สกุล : </B>"&rsMiss("JurNam") &" <font size='3'> <font color=black><B> ISIC : </B>"&rsMiss("ISIC") &"<HR></CENTER><BR>"
sqlYear = "SELECT DISTINCT PP_Year FROM pp50 WHERE AutoID="&Request.QueryString("id1")& " ORDER BY PP_Year"
rsYear.open sqlYear,conn,1,3
rsYear.MoveFirst
Do While Not rsYear.Eof
sql = "SELECT PP_Year, SaleTax1, SaleTax5 FROM pp50 WHERE AutoID="&Request.QueryString("id1")& " AND PP_Year="&rsYear("PP_Year")& " ORDER BY PP_Year"
rs.open sql,conn,1,3
' On Error Resume Next
IF rs.RecordCount =0 THEN
Response.Write "<CENTER><font face='MS Sans Serif' size='2' color='#3300CC'>* * * ไม่พบข้อมูล * * * <BR><form><input type=button value='ปิดหน้าจอนี้' onClick='javascript:window.close();'></form></CENTER><BR>"
Else
Response.Write "<TABLE table border=1 width=500 cellspacing=0 bordercolor=black bordercolordark=white bordercolorlight=black>"
Response.Write "<TH BGCOLOR='#CCCCCC'><font size='3'> <font color=black> พ.ศ. </TH><TH BGCOLOR='#CCCCCC'><font size='3'> <font color=black> ยอดขายตามงบ </TH><TH BGCOLOR='#CCCCCC'><font size='3'> <font color=black> อากรแสตมป์ </TH>"
Sum1=0
sum2=0
rs.MoveFirst
Do While Not rs.Eof
If Color=0 Then
Response.Write "<TR BGCOLOR=#FFFFCC>"
Color=1
Else
Response.Write "<TR BGCOLOR=#CCFFCC>"
Color=0
End If
Response.Write " <TD ALIGN='center'><font size='2'> <font color=black>"&rs("PP_Year")&"</TD><TD ALIGN='Right'><font size='2'> <font color=black>"&FormatNumber(rs("SaleTax1"),2)&"</TD><TD ALIGN='Right'><font size='2'> <font color=black>"&FormatNumber(rs("SaleTax5"),2)&"</TD></TR>"
Sum1=Sum1+rs("SaleTax1")
Sum2=Sum5+rs("SaleTax5")
rs.MoveNext
loop
Response.Write"</TABLE><BR>"
END IF
rsYear.MoveNext
rs.Close
loop
Dim Conn,strSQL,objRec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
strSQL = "SELECT * FROM customer "
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open strSQL, Conn, 1,3
If objRec.EOF Then
Response.write (" Not found record.")
Else
End IF