<? 
require_once('../conf/connection.php');

 $numero=$_GET["num"];
 $efectivo=$_GET["efectivo"];
 $fecha = date("Y-m-d");
 $hora =  date("H:i:s");
 
  $query_sum="SELECT sum(valor_total) AS total_venta FROM detalles_pedido  WHERE numero='$numero'";
  $res_sum=mysql_query($query_sum); 
  $total=mysql_result($res_sum,0,"total_venta");
  
  $vuelto=$total-$efectivo;

  if($efectivo<>""){

?>
<!DOCTYPE html>
<html dir="ltr" lang="en-US"><head>
    <meta charset="utf-8">
    <title>mod_venta</title>
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">
    <script type='text/javascript' src='jquery-1.7.1.min.js'></script>
    <!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <link rel="stylesheet" href="../style.css" media="screen">
    <!--[if lte IE 7]><link rel="stylesheet" href="style.ie7.css" media="screen" /><![endif]-->
    <link rel="stylesheet" href="../style.responsive.css" media="all">

    <script src="../jquery.js"></script>
    <script src="../script.js"></script>
    <script src="../script.responsive.js"></script>



<style>.art-content .art-postcontent-0 .layout-item-0 { border-top-width:1px;border-top-style:solid;border-top-color:#B1C9C7;margin-top: 10px;margin-bottom: 10px;  }
.art-content .art-postcontent-0 .layout-item-1 { border-right-style:solid;border-right-width:1px;border-right-color:#B1C9C7; padding-right: 10px;padding-left: 10px;  }
.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }

</style>
<script>
function volver(){
	  window.history.back();
	}
function info (elEvento) { 
         evento = elEvento || window.event;
         k=evento.keyCode; //número de código de la tecla.
        
		       //finalizar con boleta 
          if (k==119){
			   
			    miPopup = window.open("boleta.php?num=<? echo $numero ?>","cant_","width=900,height=500,top=80,left=200,status=no, scrollbars=no, toolbars=no, menubar=no,resizable=yes,directories=no");
			miPopup.focus();
			  
			  }
			  
		  //finalizar con factura 
          if (k==120){
			   
			    miPopup = window.open("rut.php?num=<? echo $numero ?>","cant_","width=900,height=500,top=80,left=200,status=no, scrollbars=no, toolbars=no, menubar=no,resizable=yes,directories=no");
			miPopup.focus();
			  
			  }
		 
		 		 
		 }
window.onload = function() {
document.onkeydown = info;
}
</script>

</head>
<body>
<div id="art-main">

<div class="art-sheet clearfix">
            <div class="art-layout-wrapper">
                <div class="art-content-layout">
                    <div class="art-content-layout-row">
                        <div class="art-layout-cell art-content"><article class="art-post art-article">
                                
                                                
                                <div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout">
    <div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-1" style="width: 100%" >
       
        <p>
      <div id='suma'>
      <form action="add_bol.php" method="post" id="boleta" name="boleta">    
          <table width="347" border="0">
  <tr>
    <td colspan="2" align="right"><h3>Registro de boleta </h3></td>
    </tr>
  <tr>
    <td colspan="2" align="right">Fecha: <? echo $fecha; ?>
    <input type="hidden" value="<? echo $fecha; ?>" name="fecha" id="fecha">
    <input type="hidden" value="<? echo $numero; ?>" name="numero" id="numero">
    </td>
  </tr>
  <tr>
    <td width="147">Total a pagar: </td>
    <td width="190"><div class='input'><input name="pago" type="text" id="pago" value="<? echo $total; ?>"
    style="font-size:18px" readonly="readonly" ></div></td>
  </tr>
  <tr>
    <td>N° de boleta</td>
    <td><div class='input'><input type="text" id="boleta" name="boleta" autofocus  style="font-size:18px" ></div></td>
    </tr>
  <tr>
    <td colspan="2" align="right"><input type="submit" value="Finalizar (Enter)" class="art-button" 
    style="height:50px; width:120px;">
    <input type="button" value="Volver" class="art-button" style="height:50px; width:120px;" onClick="volver()"></td>
  </tr>
          </table>

        </div>
       
        </p>
    </div>
    </div>
</div>
<div class="art-content-layout-br layout-item-0">
</div></div>


</article></div>
                    </div>
                </div>
            </div>

    </div>
    
</div>


</body></html>
<? }else{?><script>alert("Existen campos vacíos, verifique la información..."); window.history.back();</script> <? } ?>