<!--#include file="conn.asp"-->
<% 
if session("login")<>"1" then
response.write("<script>alert('未登录或者登陆超时，请重新登陆！');window.location.href='login.asp';</script>")   
response.end() 
end if

conn.open Str
if request.QueryString("ac")="enviar" then
set updatearticulo=conn.execute("update abonoproveedor set bloqueado=-1 where DocumentoNo='"&request.QueryString("DocumentoNo")&"' ")
response.write("<script>alert('此账单已提交！\n Ya esta Confirmado!');window.location.href='?ac=ver&DocumentoNo="&request.QueryString("DocumentoNo")&"';window.android.playSuccess();</script>")   
response.end() 
end if
conn.close


 %> 
 
<% if request.QueryString("ac")="" then  %>
<table width="100%"  height="100" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><span class="STYLE2">退货单据</span><br />
Abono A Proveedor<br />
<span class="STYLE2"><%= request.Form("key") %></span>
</td>
 </tr>
</table>

<%

conn.open Str
sql = "select *,empleado.nombre as empleado,proveedor.nombrees as proveedor,abonoproveedor.bloqueado as bloqueado from abonoproveedor,proveedor,empleado where abonoproveedor.Empresaid = proveedor.Empresaid and abonoproveedor.operadorid = empleado.empleadoid order by abonoproveedor.DocumentoNo desc "
set rs = conn.execute(sql)

%>
 
</table>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="25%" align="center">
      <div align="center"></td>
    <td width="75%" align="center"><div align="right"><a href="?ac=check&ac2=addnt"><img src="img/jia.png" width="25" height="25" border="0"  /></a></div></td>
  </tr>
</table>
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="20%" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">单号</span><br /><span class="Menu2"> Numero</span></div></td>
    <td width="20%"  height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">时间</span><br /><span class="Menu2"> Fecha</span></div></td>
    <td width="20%" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">供货商</span><br /><span class="Menu2"> Proveedor</span></div></td>
    <td width="20%"  height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">操作员</span><br /><span class="Menu2"> Operador</span></div></td>
	<td width="10%"  height="30" colspan="2" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">操作</span><br /><span class="Menu2"> OBRA</span></div></td>
   </tr>
 
<%
       while not rs.eof
	   

   %>
  
  <tr>
    <td width="20%"  background="img/bj35.png"><div align="center"><%= rs("DocumentoNo") %></div></td>
    <td width="20%" height="35"  background="img/bj35.png"><div align="center"><%= rs("fecha") %></div></td>
    <td width="20%" height="35"  background="img/bj35.png"><div align="center"><%= rs("proveedor") %></div></td>
    <td width="20%" height="35"  background="img/bj35.png"><div align="center"><%= rs("empleado") %></div></td>
	<% if rs("bloqueado")="-1" then 
	%>
	<td width="30" height="35" background="img/bj35.png"></td>
    <td width="30" background="img/bj35.png"><div align="center"><a href="?ac=ver&DocumentoNo=<%= rs("DocumentoNo") %>"/><img src="img/bd.jpg" width="20" height="20" border="0" /></a></div></td>
	<% ELSE %> 
	<td width="30" height="35" background="img/bj35.png">
    <div align="center">
<a href="javascript:if(confirm('确实要删除该行吗?\nEstás seguro eliminar esta linea ?'))location='?ac=delt&DocumentoNo=<%=rs("DocumentoNo")%>'"><img src="img/del.png" width="20" height="20" border="0" /></a></div>
	</td>
    <td width="30" background="img/bj35.png"><div align="center"><a href="?ac=check&DocumentoNo=<%= rs("DocumentoNo") %>"/><img src="img/labi.png" width="20" height="20" border="0" /></a></div></td>
	<% end if %>
  </tr>
  
<% 
  rs.movenext
  wend
  rs.close
  conn.close
  set rs=nothing 
end if 

%>
</table>
<!----分界线---->
<% 
 if request.QueryString("ac")="add" and request.QueryString("DocumentoNo")<>"" and request.Form("key")="" then
response.Redirect("?ac=check&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
end if

if request.QueryString("ac")="add" and request.QueryString("DocumentoNo")<>"" and request.Form("key")<>"" then
conn.open Str
sql = "select MAX(ordenno) AS MaxordenNo from abonoproveedorarticulo where DocumentoNo= '"&request.QueryString("DocumentoNo")&"' "
set rs = conn.execute(sql)
if not(rs.bof and rs.eof) then
MaxordenNo=RS("MaxordenNo")
else
MaxordenNo=0
set rs=nothing 
end if


sql2 = "select * from articulo where ArticuloID = '"&request.Form("key")&"'or Codigobarra = '"&request.Form("key")&"'"
set rs2 = conn.execute(sql2)
  
if rs2.bof and rs2.eof then 
response.write("<script language='javascript'>alert('无此产品！\nArticulo no hay!');")   
response.write("javascript:history.go(-1);window.android.playFailed();</script>")
response.End()
end if

sql="select * from abonoproveedorarticulo where ArticuloID='"&request.Form("key")&"' and  DocumentoNo='"&request.QueryString("DocumentoNo")&"' "
set rs = conn.execute(sql)

if not(rs.bof and rs.eof) then
set updatearticulo=conn.execute("update abonoproveedorarticulo set OrdenNo='"& MaxordenNo+1 &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and ArticuloID='"&request.Form("key")&"'")
response.Redirect("?ac=check&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
else
set add=conn.execute("insert abonoproveedorarticulo (DocumentoNo,ArticuloID,CodigoBarra,NombreES,NombreCN,Precio,Cantidad,Descuento,Comentario,Temporal,OrdenNo)values('"& request.QueryString("DocumentoNo") &"','"& rs2("ArticuloID") &"','"& rs2("CodigoBarra") &"','"& rs2("NombreES") &"','"& rs2("NombreCN") &"','"& rs2("PrecioCoste") &"',1,0,0,0,'"& MaxordenNo+1 &"' )") 
response.Redirect("?ac=check&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
end if

   conn.close
  set rs2=nothing 
  set rs=nothing 
 end if

 if request.QueryString("ac")="upEmpresaid" and request.QueryString("DocumentoNo")<>"" then
 conn.open Str
set updatearticulo=conn.execute("update abonoproveedor set Empresaid='"& request.Form("Empresaid") &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' ")
response.Redirect("?")
response.End()
  conn.close
  set rs=nothing
end if

 if request.QueryString("ac")="mas" and request.QueryString("DocumentoNo")<>"" and request.QueryString("OrdenNo")<>"" then
 conn.open Str
set updatearticulo=conn.execute("update abonoproveedorarticulo set Cantidad='"& Cint(request.QueryString("Cantidad"))+1 &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and  OrdenNo='"&request.QueryString("OrdenNo")&"' ")
response.Redirect("?ac=check&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
  conn.close
  set rs=nothing
end if

if request.QueryString("ac")="menos" and request.QueryString("DocumentoNo")<>"" and request.QueryString("OrdenNo")<>"" then
 conn.open Str
set updatearticulo=conn.execute("update abonoproveedorarticulo set Cantidad='"& Cint(request.QueryString("Cantidad"))-1 &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and  OrdenNo='"&request.QueryString("OrdenNo")&"' ")
response.Redirect("?ac=check&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
  conn.close
  set rs=nothing
end if

if request.QueryString("ac")="accant" and request.QueryString("DocumentoNo")<>"" and request.QueryString("OrdenNo")<>"" then
 conn.open Str
set updatearticulo=conn.execute("update abonoproveedorarticulo set Cantidad='"& request.Form("Cantidad") &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and  OrdenNo='"&request.QueryString("OrdenNo")&"' ")
response.Redirect("?ac=check&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
  conn.close
  set rs=nothing
end if


if request.QueryString("ac")="del" and request.QueryString("DocumentoNo")<>"" and request.QueryString("OrdenNo")<>"" then
 conn.open Str
sql = "delete from abonoproveedorarticulo where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and  OrdenNo='"&request.QueryString("OrdenNo")&"'"
set rs = conn.execute(sql)
response.Redirect("?ac=check&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
  conn.close
  set rs=nothing
end if


if request.QueryString("ac")="delt" and request.QueryString("DocumentoNo")<>"" then
 conn.open Str

sql = "delete from abonoproveedor where DocumentoNo='"&request.QueryString("DocumentoNo")&"'"
set rs = conn.execute(sql)
sql = "delete from abonoproveedorarticulo where DocumentoNo='"&request.QueryString("DocumentoNo")&"'"
set rs = conn.execute(sql)

response.Redirect("?")  
response.End()
  conn.close
  set rs=nothing
end if



conn.open Str
sql = "delete from abonoproveedorarticulo where cantidad=0"
set rs = conn.execute(sql)
set rs=nothing
conn.close

conn.open Str
sql = "select SUM(cantidad*precio) AS total,SUM(Cantidad) AS cantidadtotal,SUM(Comentario) AS Comentariototal,SUM(Comentario-cantidad) AS diferenciatotal,COUNT(*) AS ArticuloCategoria from abonoproveedorarticulo where DocumentoNo= '"&request.QueryString("DocumentoNo")&"' "
set rs = conn.execute(sql)
total=rs("total")
Cantidadtotal=rs("Cantidadtotal")
ArticuloCategoria=rs("ArticuloCategoria")
Comentariototal=rs("Comentariototal")
diferenciatotal=rs("diferenciatotal")
set rs=nothing
set updateabonoproveedor=conn.execute("update abonoproveedor set total='"& total &"',cantidadtotal='"&cantidadtotal &"',OperadorId='"&session("Empleadoid") &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"'")
conn.close

if request.QueryString("ac")="check" then
 %>

<table width="100%"  height="80" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><span class="STYLE2">退货单据</span><br />
Abono A Proveedor<br />
<span class="STYLE2"><%= request.Form("key") %></span></td>
 </tr>
  <tr>
    <td height="20" align="center"><div align="center" style="font-weight: bold">单据号码：<%= request.QueryString("DocumentoNo") %></div></td>
  </tr>
</table>
<form id="form1" name="form1" method="post" action="?ac=add&DocumentoNo=<%= request.QueryString("DocumentoNo") %>">
<table width="100%"  height="30" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <label>
        <input name="key" type="text" id="key" style=" width:100%;height:30px;" autofocus="autofocus" align="right" autocomplete="off" required="required" />
      </label></td>
		<td width="5%">
	  <INPUT type=image height="30" width="30" src="img/BUSCA.png" border=0 name="form1" onClick="this.form.submit()" autocomplete="off" /></td>
  </tr>
  <tr>
    <td height="20">&nbsp;</td>
    <td height="20">&nbsp;</td>
  </tr>
</table>
</form>

<% 

conn.open Str

if request.QueryString("ac2")="addnt" then
sql = "select * from abonoproveedor order by DocumentoNo desc limit 1"
set rs = conn.execute(sql)

If rs.bof and rs.eof  then
TDocumentoNo1=Year(Date())&Right("0" & Month(Date()),2)&"0001"
elseif left(rs("DocumentoNo"),6)<>Year(Date())&Right("0" & Month(Date()),2) then
TDocumentoNo1=Year(Date())&Right("0" & Month(Date()),2)&"0001"
else
sql = "select max(DocumentoNo) as TDocumentoNo  from abonoproveedor"
set rs = conn.execute(sql)
TDocumentoNo1=ccur(rs("TDocumentoNo"))+1
set rs=nothing
end if

set addnt=conn.execute("insert abonoproveedor (DocumentoNo,Fechaentrada,fecha,Operadorid,EmpresaID)values('"& TDocumentoNo1 &"','"& now() &"','"& now() &"','"& session("Empleadoid") &"','1')")
response.Redirect("?ac=check&DocumentoNo="&TDocumentoNo1 )
response.End()
set rs=nothing
end if

sql = "select * from abonoproveedorarticulo where DocumentoNo= '"&request.QueryString("DocumentoNo")&"'  order by OrdenNo desc"
set rs = conn.execute(sql)

sql = "select * from abonoproveedor where DocumentoNo= '"&request.QueryString("DocumentoNo")&"' "
set rs4 = conn.execute(sql)


 %>


 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form action="?ac=upEmpresaid&DocumentoNo=<%= request.QueryString("DocumentoNo") %>" method="post" name="form3" id="form3">  
  <tr>
    <td  height="30"><div align="center">供应商 Proveedor：</div></td>
    <td colspan="2">
		 		  <select name="Empresaid" id="Empresaid" style=" width:80px;height:25px;">
		<%
if rs4("Empresaid")<>"" then

 sql3 = "select * from proveedor where Empresaid= '"&rs4("Empresaid")&"'"
set rs3 = conn.execute(sql3)
NombreES=rs3("NombreES")
rs3.close
set rs3=nothing 
end if
 %>
 		<option value="<%= rs4("Empresaid") %>" selected="selected"><%= NombreES %></option>
		
		<%

 sql2 = "select * from proveedor "
set rs2 = conn.execute(sql2)
    while not rs2.eof
   %>
          <option value="<%= rs2("Empresaid") %>" ><%= left(rs2("NombreES"),20) %></option>
<% 
  rs2.movenext
  wend
  rs2.close
  set rs2=nothing 


%>
	  </select>
		 		  <input name="Submit" type="submit" value="挂单" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" class="Menu1"/></td>
    <td height="30" colspan="3"><label>
      <div align="center"><a href="javascript:if(confirm('确实要提交该单据吗? 不可修改\nEstás seguro Enviar este Abono? No modificable'))location='?ac=enviar&DocumentoNo=<%= request.QueryString("DocumentoNo") %>'"><img src="img/dh.png" width="20px" height="20px" border="0" />提交退单</a>        </div>
    </label></td>
    </tr>
  </form>
    <tr>
    <td width="30%"  height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">产品</span><br /> <span class="Menu2"> PRODUCTO</span></div></td>
    <td width="25%" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">数量</span><br /><span class="Menu2"> CANT</span></div></div></td>
    <td width="10%" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">库存</span><br /><span class="Menu2"> STOCK</span> </div></td>
	<td width="7%" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">价格</span><br /><span class="Menu2"> PRECIO</span></div></td>
	<td width="8%" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">小计</span><br /><span class="Menu2"> SUMA</span> </div></td>
	<td width="15%"  height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">操作</span><br /><span class="Menu2"> OBRA</span></div></td>
   </tr>
 
<%
       while not rs.eof
	   
	   
	   
	    sql8 = "select * from stock where ArticuloID = '"&rs("ArticuloID")&"'"
 set rs8 = conn.execute(sql8)
 
 if rs8.bof and rs8.eof then
stock="0"

else
stock=rs8("stock")

 end if
	   
	   
	   
	  
   %>
    <form id="form2" name="form2" method="post" action="?ac=accant&DocumentoNo=<%=request.QueryString("DocumentoNo")%>&OrdenNo=<%=rs("OrdenNo")%>">

  <tr background="img/bg60.png" >
    <td width="30%" height="60" ><div align="center"><span class="STYLE15"><a href="updategood.asp?ac=update&articuloid=<%= rs("ArticuloID")  %>"/><%= rs("NombreES") %></a><br />
    <%= rs("ArticuloID") %></span></div></td>
    <td width="25%" height="60"><div align="center">
      <a href="?ac=menos&DocumentoNo=<%=request.QueryString("DocumentoNo")%>&OrdenNo=<%=rs("OrdenNo")%>&Cantidad=<%=rs("Cantidad")%>"/><img src="img/jian1.png" width="15" height="15" /></a>
      <input name="cantidad" type="number"/ id="cantidad"  style=" width:40px;height:20px; font-size:16px; text-align:center" value="<%= rs("Cantidad") %>" maxlength="3" autocomplete="off"  required="required" />
      <a href="?ac=mas&DocumentoNo=<%=request.QueryString("DocumentoNo")%>&OrdenNo=<%=rs("OrdenNo")%>&Cantidad=<%=rs("Cantidad")%>"/><img src="img/jia1.png" width="15" height="17" /></a></div></td>
    <td width="10%" height="60"><div align="center"><%= stock %></div></td>
	<td width="7%" height="60"><div align="center"><%= formatnumber(rs("precio"),2,-1,-1,0) %></div></td>
	<td width="8%" height="60"><div align="center"><%= formatnumber(ccur(rs("precio"))*ccur(rs("Cantidad")),2,-1,-1,0)  %></div></td>
	<td width="15%"  height="60" valign="middle"><label>
    <div align="center">
      <input type="image" name="ac" src="img/ac.png" width="20" height="20" onClick="document.form2.submit()">
<a href="javascript:if(confirm('确实要删除该产品吗?\nEstás seguro eliminar esta linea ?'))location='?ac=del&DocumentoNo=<%=request.QueryString("DocumentoNo")%>&OrdenNo=<%=rs("OrdenNo")%>'"><img src="img/del.png" width="20" height="20" border="0" /></a></div>
	</label>   </tr>
	</form>
	
	<% 
  rs.movenext
  wend
  rs.close
  conn.close
  set rs=nothing 

%>
    <tr>
    <td width="30%" height="35"  background="img/bj35.png" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" ><span class="Menu1">LINEA：<%= ArticuloCategoria %></span></div></td>
    <td width="25%"  background="img/bj35.png" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="center"><span class="Menu1">CANTIDAD:<%= cantidadtotal %></span></div></td>
    <td colspan="4"  background="img/bj35.png" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="center"><span class="Menu1">TOTAL:<%= total %></span></div></td>
   </tr>
</table>
<% end if %>
<% 
 if request.QueryString("ac")="mass" and request.QueryString("DocumentoNo")<>"" and request.QueryString("OrdenNo")<>"" then
 conn.open Str
set updatearticulo=conn.execute("update abonoproveedorarticulo set Comentario='"& Cint(request.QueryString("Cantidad"))+1 &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and  OrdenNo='"&request.QueryString("OrdenNo")&"' ")
response.Redirect("?ac=ver&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
  conn.close
  set rs=nothing
end if

if request.QueryString("ac")="menoss" and request.QueryString("DocumentoNo")<>"" and request.QueryString("OrdenNo")<>"" then
 conn.open Str
set updatearticulo=conn.execute("update abonoproveedorarticulo set Comentario='"& Cint(request.QueryString("Cantidad"))-1 &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and  OrdenNo='"&request.QueryString("OrdenNo")&"' ")
response.Redirect("?ac=ver&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
  conn.close
  set rs=nothing
end if

if request.QueryString("ac")="accants" and request.QueryString("DocumentoNo")<>"" and request.QueryString("OrdenNo")<>"" then
 conn.open Str
set updatearticulo=conn.execute("update abonoproveedorarticulo set Comentario='"& request.Form("Cantidad") &"',Precio='"& request.Form("Precio") &"' where DocumentoNo='"&request.QueryString("DocumentoNo")&"' and  OrdenNo='"&request.QueryString("OrdenNo")&"' ")
response.Redirect("?ac=ver&DocumentoNo="&request.QueryString("DocumentoNo")&"")
response.End()
  conn.close
  set rs=nothing
end if

 %>
<%


if request.QueryString("ac")="ver" and request.QueryString("DocumentoNo")<>"" then
conn.open Str 
sql = "select * from abonoproveedor where DocumentoNo= '"&request.QueryString("DocumentoNo")&"' "
set rs = conn.execute(sql)
fecha=rs("fecha")
rs.close
set rs=nothing

sql = "select * from abonoproveedorarticulo where DocumentoNo= '"&request.QueryString("DocumentoNo")&"' "
set rs = conn.execute(sql)

%>
<table width="100%"  height="80" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><span class="STYLE2">退货单据</span><br />
Abono A Proveedor<br />
</td>
 </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="40%"  height="30"><div align="center"><%= fecha %>-<%= request.QueryString("DocumentoNo") %></div></td>
    <td height="30" colspan="3"><div align="center">
      <% if ArticuloCategoria<>"0" then %>
          <a href="?ac=print&DocumentoNo=<%= request.QueryString("DocumentoNo") %>"><img src="img/print.png" width="25" height="25" border="0" /></a>
      <% end if  %>
    </div></td>
  </tr>
   <tr>
    <td width="40%"  height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">产品</span><br /><span class="Menu2"> PRODUCTO</span></div></td>
    <td width="10%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">退货数量</span><br /><span class="Menu2"> CANT.ABONO</span></div></td>
    <td width="30%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">退货单价</span><br /><span class="Menu2"> PRE.ABONO</span></div></td>
	<td height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">总价</span><br /><span class="Menu2"> SUMA</span></div></td>
  </tr>
 
<%
       while not rs.eof
   %>
  <tr>
    <td width="40%" height="60"  background="img/bg60.png"><div align="center"><span class="STYLE15"><%= rs("NombreES") %><br /><%= rs("nombrecn") %><br /><%= rs("ArticuloID") %></span></div></td>
    <td height="60"  background="img/bg60.png"><div align="center"><%= rs("Cantidad") %></div></td>
    <td height="60"  background="img/bg60.png"><div align="center"><%= rs("precio") %></div>	</td>
	<td height="60"  background="img/bg60.png"><div align="center"><%= formatnumber(ccur(rs("precio"))*ccur(rs("Cantidad")),2,-1,-1,0)  %></div></td>
</tr>
	
	<% 
  rs.movenext
  wend
  rs.close
  conn.close
  set rs=nothing 
%>
  <tr>
    <td width="40%" height="35"  background="img/bj35.png" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="right"><span class="Menu1">LINEA：<%= ArticuloCategoria %></span></div></td>
    <td  background="img/bj35.png" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="center"><span class="Menu1"><%= cantidadtotal %></span></div></td>
    <td  background="img/bj35.png" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="center"><span class="Menu1"></span></div></td>
    <td  background="img/bj35.png" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="center"><span class="Menu1"><%= total %></span></div></td>
  </tr>
</table>
<% end if %>


<%

if request.QueryString("ac")="print" and request.QueryString("DocumentoNo")<>"" then
conn.open Str 
sql = "select *,empleado.nombre as empleado,proveedor.nombrees as proveedor from abonoproveedor,proveedor,empleado where abonoproveedor.Empresaid = proveedor.Empresaid and abonoproveedor.operadorid = empleado.empleadoid order by abonoproveedor.DocumentoNo desc "
set rs = conn.execute(sql)
fecha=rs("fecha")
proveedor=rs("proveedor")
empleado=rs("empleado")
rs.close
set rs=nothing
sql = "select * from abonoproveedorarticulo where DocumentoNo= '"&request.QueryString("DocumentoNo")&"' "
set rs = conn.execute(sql)

%>
<table width="100%"  height="80" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><p><span class="STYLE2" style="font-size: 24px; font-weight: bold">供应商退货单据</span><span style="font-size: 24px; font-weight: bold"><br />
      Devolucion</span><span style="font-size: 24px; font-weight: bold"> A Proveedor</span><span style="font-size: 24px"><br />
      </span></p>
    </td>
 </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="4"><div align="left" style="font-size: 24px">
      <div align="center"><strong>-------------------------------------</strong></div>
    </div></td>
  </tr>
  <tr>
    <td colspan="4"><div align="left" style="font-size: 24px; font-weight: bold">Proveedor:<%= proveedor %></div></td>
  </tr>
  <tr>
    <td colspan="4"><div align="left" style="font-size: 24px">
      <div align="center"><strong>-------------------------------------</strong></div>
    </div></td>
  </tr>
  <tr>
    <td colspan="4"><div align="left" style="font-weight: bold; font-size: 24px">Fecha:<%= fecha %><br />
      NO.:<%= request.QueryString("DocumentoNo") %><br />Operador:<%= empleado %>
    </div></td>
  </tr>
  <tr>
    <td colspan="4"><div align="left" style="font-size: 24px">
      <div align="center"><strong>-------------------------------------</strong></div>
    </div></td>
  </tr>
  <tr>
    <td width="30%"  height="30"><div align="center" style="font-size: 24px">
      <div align="left">PRO<br />
        </div>
    </div></td>
    <td width="20%" height="30"><div align="center">
    <div align="center" style="font-size: 22px">CANT<br />
    </div></td>
    <td width="20%" height="30"><div align="center">
    <div align="center" style="font-size: 22px">PRE<br />
    </div></td>
	<td width="20%" height="30"><div align="center">
	  <div align="center" style="font-size: 22px">SUMA<br />
	  </div></td>
  </tr>
  <tr>
    <td  height="30" colspan="4"><div align="left" style="font-size: 24px">
      <div align="center"><strong>-------------------------------------</strong></div>
    </div></td>
  </tr>
 
<%
       while not rs.eof
   %>
  <tr>
    <td colspan="4" height="40px"  valign="bottom" ><span style="font-size: 24px"><%= rs("NombreES") %><%= rs("nombrecn") %></span></td>
  </tr>
  <tr>
    <td width="30%"><div align="left" style="font-size: 24px"><%= rs("ArticuloID") %></div></td>
    <td width="20%"><div align="center" style="font-size: 24px"><%= rs("Cantidad") %></div></td>
    <td width="20%"><div align="center" style="font-size: 24px"><%= formatnumber(rs("precio"),2,-1,-1,0) %></div>	</td>
	<td width="20%"><div align="center" style="font-size: 24px"><%= formatnumber(ccur(rs("precio"))*ccur(rs("Cantidad")),2,-1,-1,0)  %></div></td>
</tr>
	
	<% 
  rs.movenext
  wend
  rs.close
  conn.close
  set rs=nothing 
%>
    <tr>
      <td colspan="4" class="STYLE18" style="font-weight: bold"><div align="left" style="font-size: 24px">
      <div align="center">-------------------------------------</div>
    </div></td>
    </tr>
  <tr>
    <td width="30%" class="STYLE18" style="font-weight: bold">
      <div align="right" style="font-size: 24px; font-weight: bold">
        <div align="center">Linea:<%= ArticuloCategoria %></div>
    </div></td>
    <td width="20%" class="STYLE18"><div align="center" style="font-size: 24px; font-weight: bold">
      Cant.T:<%= cantidadtotal %>
    </div></td>
    <td width="20%" ><div align="right" style="font-size: 24px; font-weight: bold" >Total:</div></td>
    <td width="20%" >
    <div align="center" style="font-size: 24px; font-weight: bold"><%= formatnumber(total,2,-1,-1,0)&billete %></div></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div align="left" style="font-size: 24px">
      <div align="center"><strong>-------------------------------------</strong></div>
    </div></td>
  </tr>
  <tr>
    <td height="200" valign="top"><span style="font-size: 24px">FIRMA PROVEEDOR </span></td>
  </tr>
  <tr>
    <td><div align="left" style="font-size: 24px">
      <div align="center"><strong>-------------------------------------</strong></div>
    </div></td>
  </tr>
</table>

<% end if %>
<% if request.QueryString("ac")<>"print" THEN %>
<div style="height:100px;"/></div>
<!--#include file="fooder.asp"-->
<% END IF %>