
PK 
<!--#include file="includes/openconn.asp" -->
<!--#include file="includes/checkadmin.asp" -->
<!--#include file="includes/formatdateX.asp" -->
<!DOCTYPE html>
<html lang="en">
<%if request("idcliente") <> "" then
rs.open "SELECT * FROM Clientes WHERE idcliente = " & request("idcliente"),conn,3,1
rs.movefirst
session("cli_nombre") = rs("cli_nombre")
session("cli_email") = rs("cli_email")
session("cli_telefono") = rs("cli_telefono")
session("cli_domicilio") = rs("cli_domicilio")
rs.close
end if%>
<head>
<!--#include file="includes/metatags.asp" -->
<link rel="stylesheet" href="lightbox/css/bootstrap-lightbox.min.css">
<link rel="stylesheet" href="lightbox/prettify/prettify.css">
</head>
<body>
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<!--#include file="includes/navup_comprarapida.asp" -->
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<%session("seccion") = "Compras"%>
<!--#include file="includes/navizq.asp" -->
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<form class="product-form" role="form" action="comprarapida1.asp" id="form_pedidorapido" name="form_pedidorapido" method="post">
<div class="panel-group" id="accordion">
<%dim xcant,ax, ant_cat,sqlstr
sqlstr = "SELECT * FROM Q_articulos WHERE art_publicado = true ORDER BY sec_nombre, cat_nombre, art_nombre"
rs.open sqlstr,conn,3,1
a=0
rs.movefirst
ant_cat = rs("idcategoria")
do until rs.EOF%>
<div class="panel panel-default" style="margin-bottom:0px;">
<div class="panel-heading">
<h4 class="panel-title" style="font-size:16px;"><a data-toggle="collapse" data-parent="#accordion" href="#collapse-<%=rs("idcategoria")%>"
> <i class="fa fa-angle-down control-icon"></i> <i class="fa fa-th-list"></i> <%=rs("sec_nombre")%> - <%=rs("cat_nombre")%> </a> </h4>
</div>
<div id="collapse-<%=rs("idcategoria")%>" class="panel-collapse collapse">
<div class="panel-body">
<div class="table-responsive" style="margin-bottom:5px;">
<table class="table table-striped table-hover">
<thead>
<tr>
<th >Cod</th>
<th>Nombre</th>
<th style="text-align:center;">Pesent</th>
<th style="text-align:center;">U/caj</th>
<th style="text-align:right; width:120px;" >Precio Compra</th>
<th style="text-align:right;">May</th>
<th style="text-align:right;">Min</th>
<th width="70">Cajas</th>
<th width="70">Unid</th>
<th width="70">Subtotal</th>
</tr>
</thead>
<tbody>
<%do until rs.EOF%>
<tr>
<td><%=rs("idarticulo")%></td>
<td><%=rs("art_nombre")%></td>
<td style="text-align:center;"><%=rs("art_presentacion")%></td>
<td style="text-align:center;"><%=rs("art_unidadespc")%></td>
<td style="text-align:center;">
<% if rs("art_precio_compra") > 0 then%>
<input type="number" min="0" step="0.01" id="item_<%=rs("idarticulo")%>_compra" name="item_<%=rs("idarticulo")%>_compra" value="<%=rs("art_precio_compra")%>" class="form-control" style="padding:2px 4px; height:24px; text-align:right;" placeholder="Compra" onChange="calcular();">
<%else%>
<input type="number" min="0" step="0.01" id="item_<%=rs("idarticulo")%>_compra" name="item_<%=rs("idarticulo")%>_compra" value="0" class="form-control" style="padding:2px 4px; height:24px; text-align:right;" placeholder="Compra" onChange="calcular();">
<%end if%>
</td>
<%if rs("art_precio_may") > 0 then%>
<td style="text-align:right;"><b>$ <%=rs("art_precio_may")%></b></td>
<%else%>
<td style="text-align:right;"><a href="articulo.asp?idarticulo=<%=rs("idarticulo")%>&art_nombre=<%=rs("art_nombre")%>">consultar</a></td>
<%end if%>
<%if rs("art_precio") > 0 then%>
<td style="text-align:right;"><b>$ <%=rs("art_precio")%></b></td>
<%else%>
<td style="text-align:right;"><a href="articulo.asp?idarticulo=<%=rs("idarticulo")%>&art_nombre=<%=rs("art_nombre")%>">consultar</a></td>
<%end if%>
<%for a = 0 to 300
if session("sss_iditem" & a) = rs("idarticulo") then exit for
next%>
<td>
<% if rs("art_unidadespc") > 0 then%>
<input type="number" min="0" id="item_<%=rs("idarticulo")%>_c" name="item_<%=rs("idarticulo")%>_c" value="<% if session("sss_cantidad" & a) <> "" then response.Write(Int(session("sss_cantidad" & a)/rs("art_unidadespc")))%>" class="form-control" style="padding:2px 4px; height:24px; text-align:right;" placeholder="cajas" onChange="calcular();">
<%end if%></td>
<td>
<% if rs("art_ventaunitaria") then%>
<input type="number" min="0" id="item_<%=rs("idarticulo")%>_u" name="item_<%=rs("idarticulo")%>_u"
<% if session("sss_cantidad" & a) > 0 then%>
value="<%if rs("art_unidadespc") > 0 then%>
<%=session("sss_cantidad" & a)-(Int(session("sss_cantidad" & a)/rs("art_unidadespc"))*rs("art_unidadespc"))%>
<%else%>
<%=session("sss_cantidad" & a)%>
<%end if%>"
<%end if%>class="form-control" style="padding:2px 4px; height:24px; text-align:right;" placeholder="unid." onChange="calcular();">
<%end if%>
</td>
<td style="text-align:right;"><span id="sub_<%=rs("idarticulo")%>" name="sub_<%=rs("idarticulo")%>"></span></td>
</tr>
<%rs.movenext
if rs.eof then exit do
if ant_cat <> rs("idcategoria") then exit do
ant_cat = rs("idcategoria")
loop%>
</tbody>
</table>
</div>
</div>
</div>
</div>
<%if rs.eof then exit do
ant_cat = rs("idcategoria")
loop%>
</div>
<input type="submit" name="submit_btn" class="btn btn-primary" id="submit_btn" value="Hacer Pedido">
</form>
</div>
<script type="text/javascript">
function calcular() {
tot_pesos = 0;
subtot_pesos = 0;
<%rs.movefirst
do until rs.EOF%>
subtot_pesos = 0;
<% if rs("art_unidadespc") > 0 then%>
if (Number(document.getElementById("item_<%=rs("idarticulo")%>_c").value) > 0) {
subtot_pesos = subtot_pesos + (Number(document.getElementById("item_<%=rs("idarticulo")%>_c").value) * Number(document.getElementById("item_<%=rs("idarticulo")%>_compra").value) * <%=rs("art_unidadespc")%>);
//alert("Cajas <%=rs("idarticulo")%> ->" + document.getElementById("item_<%=rs("idarticulo")%>_c").value + " $ " + document.getElementById("item_<%=rs("idarticulo")%>_compra").value));
}
<%end if%>
<% if rs("art_ventaunitaria") then%>
if (Number(document.getElementById("item_<%=rs("idarticulo")%>_u").value) > 0) {
subtot_pesos = subtot_pesos + Number(document.getElementById("item_<%=rs("idarticulo")%>_u").value) * Number(document.getElementById("item_<%=rs("idarticulo")%>_compra").value);
//alert("Unidades <%=rs("idarticulo")%> ->" + document.getElementById("item_<%=rs("idarticulo")%>_u").value) + " $ " + document.getElementById("item_<%=rs("idarticulo")%>_compra").value);
}
<%end if%>
if (subtot_pesos > 0) {
document.getElementById("sub_<%=rs("idarticulo")%>").innerHTML = subtot_pesos.toFixed(2);
}else{
document.getElementById("sub_<%=rs("idarticulo")%>").innerHTML = "";
}
tot_pesos = tot_pesos + subtot_pesos;
<%rs.movenext
loop
rs.close%>
document.getElementById("tot_pesos").innerHTML = "$ " + tot_pesos.toFixed(2);
//alert(tot_pesos.toFixed(2));
}
</script>
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script src="lightbox/js/scale.fix.js"></script>
<script src="lightbox/prettify/prettify.js"></script>
<script src="lightbox/js/bootstrap-lightbox.min.js"></script>
</body>
</html>
<!--#include file="includes/closeconn.asp" -->


PK 99