<%@Language="vbscript" Codepage="936"%> 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
body,td,th {
	font-size: 16px;
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
a {
	font-size: 18px;
	color: #000000;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.STYLE4 {
	color: #FFFFFF;
	font-family: Geneva, Arial, Helvetica, sans-serif;

}
.STYLE5 {color: #FFFFFF}
.STYLE7 {color: #FFFFFF; font-size: 8px; }
.STYLE14 {font-size: 8px}
.STYLE15 {font-size: 14px}
.STYLE17 {font-size: 8px; color:#FFFFFF;}
.STYLE16 {font-size: 14px; color:#FFFFFF;}
.STYLE18 {font-size: 12px; color:#000000;}

.footer {
            position: fixed;
            left: 0px;
            bottom: 0px;
            width: 100%;
            height: 40px;
            background-color:#999999;
            z-index: 9999;
        }
		
-->
</style>
</head>
<%   
if request.QueryString("ac1")="download" then
 response.ContentType="application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename="""& request.QueryString("DocumentoNo") &".xls""" 
end if
%>

<%
set conn=Server.Createobject("adodb.Connection") 
str="dsn=conn;Driver={mysql driver};server=127.0.0.1;Port=3306;uid=root;pwd=bohaosoftware19711978;database=bohaosupermarket3;charset=gb2312"
%>

<%
if request.QueryString("ac")="checkpro" and request.QueryString("DocumentoNo")<>"" and request.Form("Comentario")<>"" and request.QueryString("ArticuloID")<>"" then
sql = "select * from albaranproveedorarticulo where DocumentoNo = '"& request.QueryString("DocumentoNo") &"' and  ArticuloID = '"& request.QueryString("ArticuloID") &"'"
conn.open Str
set UPDATECANT=conn.execute("update albaranproveedorarticulo set Comentario='"& request.Form("Comentario") &"' where DocumentoNo = '"& request.QueryString("DocumentoNo") &"' and ArticuloID='"& request.QueryString("ArticuloID") &"'" )
conn.close
end if


if request.QueryString("ac")="check" and request.QueryString("DocumentoNo")<>"" and request.Form("key")<>""  then

sql = "select * from albaranproveedorarticulo,articulo where albaranproveedorarticulo.DocumentoNo = '"& request.QueryString("DocumentoNo") &"' and  albaranproveedorarticulo.ArticuloID=Articulo.ArticuloID and Articulo.ArticuloID = '"& request.Form("key") &"'"
conn.open Str
set rs = conn.execute(sql)
 If rs.bof and rs.eof then
 sql = "select * from albaranproveedorarticulo,articulo where albaranproveedorarticulo.DocumentoNo = '"& request.QueryString("DocumentoNo") &"' and  albaranproveedorarticulo.ArticuloID=Articulo.ArticuloID and  Articulo.codigobarra= '"& request.Form("key") &"'"
set rs = conn.execute(sql)
end if


if rs.eof then
response.write("<script>alert('本单无此产品\nProducto No Esta!');window.location.href='javascript:history.go(-1)';</script>")
end if
end if

if request.QueryString("ac")="check" and request.QueryString("DocumentoNo")<>"" and request.Form("key")=""  then
sql = "select * from albaranproveedorarticulo where DocumentoNo = '"& request.QueryString("DocumentoNo") &"'"
conn.open Str
set rs = conn.execute(sql)
end if

if request.QueryString("ac")="checkpro" and request.QueryString("DocumentoNo")<>"" and request.QueryString("ArticuloID")<>""  then
sql = "select * from albaranproveedorarticulo where DocumentoNo = '"& request.QueryString("DocumentoNo") &"'"
conn.open Str
set rs = conn.execute(sql)
end if
 %>

<form id="form1" name="form1" method="post" action="alpweb.asp?ac=check&DocumentoNo=<%= request.QueryString("DocumentoNo") %>">
<table width="1024"  height="30" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="700">
      <label>
        <input name="key" type="text" id="key" style=" width:100%;height:30px;" autofocus="autofocus" align="right" autocomplete="off"/>
      </label></td>
		<td width="100">
	      <div align="center">
	        <INPUT type=image height="30" width="30" src="img/BUSCA.png" border=0 name="form1" onClick="this.form.submit()" autocomplete="off" />
      </div></td>
        <td width="100"><div align="right"><a href="?ac=check&DocumentoNo=<%= request.QueryString("DocumentoNo") %>&proveedor=<%= request.QueryString("proveedor") %>&ac1=download"/><img src="img/excel.png" height="30" /></a></div></td>
  </tr>
</table>
</form>


 <table width="1024" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr>
    <td  height="40" colspan="2">单号：<%= request.QueryString("DocumentoNo")  %><br />
    <br /></td>
    <td  height="40" colspan="4">供货商：<%= request.QueryString("proveedor") %> <br />
    <br /></td>
   </tr>
  <tr>
    <td width="30%"  height="30" bgcolor="#cccccc"><div align="center">
     <br /> -----------产品条码-----------<br />
        <span class="STYLE14">CODIGO BARRA</span>
      </div></td>
    <td  height="30" colspan="2" bgcolor="#cccccc"><div align="center"><br />-----------产品名称-----------<span class="STYLE14"><br />
      ARTICULO</span><br />
    </div></td>
    <td width="10%"  height="30" bgcolor="#cccccc"><div align="center">
      <div align="center"><br />---单子数量---<br />
        <span class="STYLE14">CANT.AL</span><br />
      </div>
    </div></td>
	<td width="10%" bgcolor="#cccccc"><div align="center">
      <div align="center"><br />---对货数量---<span class="STYLE14"><br />
        CANT.REAL</span><br />
      </div>
    </div></td>
	<td width="10%" height="30" bgcolor="#cccccc"><div align="center">
      <div align="center"><br />---差数---<br />
        <span class="STYLE14">DIFERENCIA</span><br />
      </div>
    </div></td>
   </tr>
 
<%
       while not rs.eof
   %>
    <form id="form2" name="form2" method="post" action="alp2.asp?ac=checkpro&DocumentoNo=<%=request.QueryString("DocumentoNo")%>&ArticuloID=<%=rs("ArticuloID")%>">
  
  	<% 
	
	X=cstr(rs("Cantidad"))
	IF rs("Comentario")="" THEN
	Y=0
	ELSE
	Y=cstr(rs("Comentario"))
	END IF
	 %>
  
  <tr>
    <td width="40%" height="25"  background="img/bj35.png"><div align="center"><span class="STYLE15">&nbsp;<%= rs("ArticuloID") %><br/>&nbsp;<%= rs("codigobarra") %></span></div></td>
    <td height="25" colspan="2"  background="img/bj35.png"><div align="center"><span class="STYLE15"><%= rs("NombreES") %></span></div></td>
    <td width="10%" height="25"  background="img/bj35.png"><div align="center"><%= rs("Cantidad") %></div></td>
	<td width="10%" height="25"  background="img/bj35.png"><div align="center"><%= Y %></div></td>
	<td width="10%" height="25"  background="img/bj35.png">
	 <div align="center"> <%= Y-X %></div></td>
	</tr>
</form>

<% 
  rs.movenext
  wend
  rs.close
  conn.close
  set rs=nothing 

%>
</table>
