
PK 
<!--#include file="includes/openconn.asp" -->
<%Response.Buffer = TRUE
Response.CharSet = "ISO-8859-1"
Response.CodePage = 0
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=COMPRAS_A_PEDIDO_" & year(now()) & "-" & month(now()) & "-" & day(now()) & ".xls"
Server.ScriptTimeout = 1200%>
<html>
<meta http-equiv="Content-Type" content="charset=ISO-8859-1" />
<body name="Compras a pedido" id="Compras a pedido">
<%
dim sqlstr
sqlstr="SELECT * FROM Q_rep_items_apedido WHERE art_apedido = true ORDER BY item_nombre"
'sqlstr="SELECT DISTINCT idPedido* FROM Q_Pedido_items WHERE ped_verificado = true AND ped_descargado = false AND art_apedido = true ORDER BY ped_now"
rs.open sqlstr,conn,3,1
if not rs.EOF then%>
<%dim tot_compra, cantstr
tot_compra=0
rs.movefirst%>
<table style="background-color:#EEEEEE;">
<thead>
<tr>
<th>Cajas</th>
<th>Unid</th>
<th>Articulo</th>
<th>Stock</th>
<th>Faltan</th>
<th>Monto</th>
</tr>
</thead>
<tbody>
<%do until rs.EOF%>
<tr >
<td><% if rs("art_unidadespc") > 0 then%>
<%if Int (rs("sumadeitem_cantidad")/rs("art_unidadespc")) > 0 then%>
<%=Int (rs("sumadeitem_cantidad")/rs("art_unidadespc"))%> (x<%=rs("art_unidadespc")%>)
<%end if%>
<%end if%>
</td>
<td><% if rs("art_unidadespc") > 0 then%>
<%if rs("sumadeitem_cantidad")-(Int (rs("sumadeitem_cantidad")/rs("art_unidadespc"))*rs("art_unidadespc")) > 0 then%>
<%=rs("sumadeitem_cantidad")-(Int (rs("sumadeitem_cantidad")/rs("art_unidadespc"))*rs("art_unidadespc"))%>
<%end if%>
<%else%>
<%if rs("sumadeitem_cantidad") > 0 then%>
<%=rs("sumadeitem_cantidad")%>
<%end if%>
<%end if%></td>
<td><%=rs("item_nombre")%></td>
<td ><%=rs("art_stock")%></td>
<td ><%if rs("sumadeitem_cantidad") > rs("art_stock") then response.Write(rs("sumadeitem_cantidad") - rs("art_stock"))%></td>
<td align="right" ><%if not isnull(rs("art_precio_compra")) then%>
$ <%=formatnumber(rs("sumadeitem_cantidad") * rs("art_precio_compra"),2)%>
<%tot_compra = tot_compra +(rs("sumadeitem_cantidad") * rs("art_precio_compra"))
end if%></td>
</tr>
<%rs.movenext
loop%>
</tbody>
<tr style="background-color:#EEEEEE;">
<td></td>
<td ></td>
<td ></td>
<td>TOTAL = </td>
<td><b>$ <%=formatnumber(tot_compra,2)%></b></td>
</tr>
</table>
<%else%>
<table cellpadding="0" cellspacing="0">
<tr>
<td><font color="#E7038C">No hay Articulos</font></td>
</tr>
</table>
<%end if
rs.close%>
</body>
</html>
<!--#include file="includes/closeconn.asp" -->


PK 99