<?php include 'sesion_user.php';?><!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=utf-8" />

<title>Panel</title>




<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">


<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>



</head>



<body>





<div class="container-fluid">



<div class="row">



<div class="col-lg-3 col-md-3 col-sm-12" style="background-color: #dfdfdf;">





<?php

include 'nav.php';?>

<label>



</label>

</div>



<div class="col-lg-9 col-md-9 col-sm-12">



<? include 'inc_buscar2.php'; ?>




<?

include 'concha.php';



mysql_connect("$host","$usuario","$contra");



mysql_select_db ("$basedatos");





$sql = "SELECT * FROM `ID_ventas` LIMIT 1";









$consulta = mysql_query ($sql);



while ($row = mysql_fetch_array($consulta))



{





$ID_venta = $row["ID"];



}



mysql_free_result($consulta);











?>





<h3 style="padding-top:85px;">VENTA Nº <?php echo $ID_venta ?> - <a href="finalizar_venta.php"><button type="button" class="btn btn-danger">Finalizar Venta <b>(F4)</b></button></a></h3><hr />





<?php





$A = date(Y);

$M = date(m);

$D = date(d);

$HORA = date(H);

$MIN = date(i);







$fecha = "$A$M$D$HORA$MIN";







mysql_db_query("$basedatos","





INSERT INTO `ventas` (`ID`, `fecha`, `hora`, `total`, `usuario`, `forma_pago`) VALUES ('$ID_venta', '$fecha', '0', '', '$user_con', '');



");




mysql_db_query("$basedatos","





INSERT INTO `ventas_costo` (`ID`, `fecha`, `hora`, `total`, `total_costo`, `usuario`, `forma_pago`) VALUES ('$ID_venta', '$fecha', '0', '',  '', '$user_con', '');



");


?>






<form action="agregar_productos.php" method="post">





<img src="lector-codigos-barras.png" width="250" /><br />



Lea el codigo de barras del producto con la lectora.<br />



<? $barcode22 = $_GET['barcode'];?>



<input  autofocus name="barcode" style="max-width: 250px;
border-style: solid;
border-width: 2px;
border-color: red;"  class="form-control "type="text" value="<? echo $barcode22 ?>"  />





<hr />



O escriba el detalle a mano.<br />
<? $get_precio = $_GET['precio'];
$get_detalle = $_GET['detalle']; ?>

<input name="varios" type="text" value="<? echo $get_detalle; ?>" placeholder="Productos Varios."/> / $ <input name="precio_varios" type="text" id="cantidad" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" size="4" maxlength="9" value="<? echo $get_precio; ?>" placeholder="Precio">

<hr>

CANTIDAD x <select name="cantidad">
  <option selected>1</option>
  <option>	2	</option>
  <option>	3	</option>
  <option>	4	</option>
  <option>	5	</option>
  <option>	6	</option>
  <option>	7	</option>
  <option>	8	</option>
  <option>	9	</option>
  <option>	10	</option>
  <option>	11	</option>
  <option>	12	</option>
  <option>	13	</option>
  <option>	14	</option>
  <option>	15	</option>
  <option>	16	</option>
  <option>	17	</option>
  <option>	18	</option>
  <option>	19	</option>
  <option>	20	</option>
  <option>	21	</option>
  <option>	22	</option>
  <option>	23	</option>
  <option>	24	</option>
  <option>	25	</option>
  <option>	26	</option>
  <option>	27	</option>
  <option>	28	</option>
  <option>	29	</option>
  <option>	30	</option>
  <option>	31	</option>
  <option>	32	</option>
  <option>	33	</option>
  <option>	34	</option>
  <option>	35	</option>
  <option>	36	</option>
  <option>	37	</option>
  <option>	38	</option>
  <option>	39	</option>
  <option>	40	</option>
  <option>	41	</option>
  <option>	42	</option>
  <option>	43	</option>
  <option>	44	</option>
  <option>	45	</option>
  <option>	46	</option>
  <option>	47	</option>
  <option>	48	</option>
  <option>	49	</option>
  <option>	50	</option>
  <option>	51	</option>
  <option>	52	</option>
  <option>	53	</option>
  <option>	54	</option>
  <option>	55	</option>
  <option>	56	</option>
  <option>	57	</option>
  <option>	58	</option>
  <option>	59	</option>
  <option>	60	</option>
  <option>	61	</option>
  <option>	62	</option>
  <option>	63	</option>
  <option>	64	</option>
  <option>	65	</option>
  <option>	66	</option>
  <option>	67	</option>
  <option>	68	</option>
  <option>	69	</option>
  <option>	70	</option>
  <option>	71	</option>
  <option>	72	</option>
  <option>	73	</option>
  <option>	74	</option>
  <option>	75	</option>
  <option>	76	</option>
  <option>	77	</option>
  <option>	78	</option>
  <option>	79	</option>
  <option>	80	</option>
  <option>	81	</option>
  <option>	82	</option>
  <option>	83	</option>
  <option>	84	</option>
  <option>	85	</option>
  <option>	86	</option>
  <option>	87	</option>
  <option>	88	</option>
  <option>	89	</option>
  <option>	90	</option>
  <option>	91	</option>
  <option>	92	</option>
  <option>	93	</option>
  <option>	94	</option>
  <option>	95	</option>
  <option>	96	</option>
  <option>	97	</option>
  <option>	98	</option>
  <option>	99	</option>

</select>

<hr />



<input type="submit" name="button" id="button" value="PROCESAR" class="btn btn-success" />



</form>




<hr style="border: solid;">

<H4>VENTA ACTUAL</H4>
<HR>
<?
$total = 0;



$sql = "SELECT * FROM `movimientos` WHERE `ID_venta` = '$ID_venta'";


$consulta = mysql_query ($sql);

while ($row = mysql_fetch_array($consulta))

{
$ID_mov = $row["ID"];
$ID_articulo = $row["ID_articulo"];
$precio = $row["precio"];
$cantidad = $row["cantidad"];
$detalle = $row["detalle"];


$sql22 = "SELECT * FROM `articulos` WHERE `ID` = '$ID_articulo' LIMIT 1";

$consulta22 = mysql_query ($sql22);

while ($row22 = mysql_fetch_array($consulta22))

{
$ID_producto = $row22["ID"];
$titulo = $row22["titulo"];
$foto = $row22["foto"];
$stock = $row22["stock"];
$barcode = $row22["barcode"];

}

mysql_free_result($consulta22);

$precio = $precio * $cantidad;
$total = $total + $precio;

?><div class="row" style="background-color:#FFFFFF">
<div class="col-lg-6 col-sm-12 col-md-6">
<i class="fa fa-check"></i> <span ><?php if($ID_articulo == 0) { echo $detalle; } else { echo $titulo; }; ?> - (x <?php echo $cantidad ?>) <br />
<a href="borrar_producto_de_venta.php?ID=<?php echo $ID_mov ?>">(X)</a></span></div>
<div class="col-lg-6 col-sm-12 col-md-6" align="right">
<span style="color:#006600;"><b>$ <?php echo $precio ?> </b></span></div>
 </div><hr>
<?



}

mysql_free_result($consulta);

?> <hr><div align="right"> <h2>Total:</h2> <h1><span style="color:#006600">$ <?php echo $total ?></span></h1></div> <?

?>



<hr />





</div>

</div>



</div>











  <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>

  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>





  <script type="text/javascript">window.setInterval(function(){

  $('.grid').isotope({

  itemSelector: '.grid-item'

});

}, 2000);

</script>



<script language=javascript>

function ventanaSecundaria56 (URL){

   window.open(URL,"ventana1","width=960,height=630,scrollbars=NO")

}

  </script>




  
      <script language="javascript">
    function PulsarTecla(event)
    {
        tecla = event.keyCode;
     

        
        
        
            if(tecla==115)
        {
            location.href ='finalizar_venta.php';
        }
        
        
        
      
    }
     
    window.onkeydown=PulsarTecla;
    </script>
</body>

</html>
