<?php
 
session_start();
include("DMMYSQLG.php");
//include("DSA1000.php");
include("DMMYSQLG.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=iso-8859-1" />
<title>---TECLADO/EXTRA---</title>
<script>
    
//autor: karlankas -Actualizado por panino5001-
texto="";
var Tletras= new Array ("1","2","3","4","5","6","7","8","9","0",".");
var z=0;
var mayus=true
function anadir(letra){

texto=document.f.barra.value;
if(letra=="\b"){
numeroLetras=texto.length-texto.length
texto=texto.substring(0,numeroLetras);
}
else{
if(!mayus){letra=letra.toLowerCase()}
texto=texto+letra;
}
document.f.barra.value=texto;
}
function mostrar(){
if (z==0){z=1;document.getElementById('botones').style.visibility="visible";pregunta.innerHTML="Ocultar teclado";}
else {z=0;document.getElementById('botones').style.visibility="hidden";pregunta.innerHTML="Mostrar teclado";}
 }
 function cambiomayus(aqui){
 if(aqui.checked){mayus=true}
 else{mayus=false}
 }
function soloNumeros(evt) { 
    evt = (evt) ? evt : event; 
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0)); 
    if (charCode > 31 && (charCode < 46 || charCode > 57)) { 
        alert("Solo se permiten numeros en este campo."); 
        return false; 
    } 
    return true; 
 }  
 </script>
   
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css">

body {
	background: #82C0FF;
	background-repeat: repeat;
        
}
input[type="Button"]{
padding: 5px;
    background: #4682B4;
    background: -moz-linear-gradient(top, #87CEEB 0%, #4682B4 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#87CEEB), color-stop(100%,#4682B4));
    box-shadow: inset 0px 0px 6px #fff;
    -webkit-box-shadow: inset 0px 0px 6px #fff;
    border: 1px solid #fff;
    border-radius: 8px;
    font: bold 15px Helvetica, Sans-Serif;
    text-align: center;
    text-transform: uppercase;
    text-decoration: none;
    color: #000;
    text-shadow: -2px 1px 2px #fff;
       min-width: 30px;
    min-height: 30px;
}

</style></head>

<body style="font:normal 10px/15px verdana" onLoad = "self.focus (); mostrar(); document.f.barra.focus ()">
<div align="center">
<form name="f" id="f" method="post" action="">

<div align="center">
<input type="Text" name="barra"  id="barra" autofocus="autofocus" onload="this.blur()" onblur="var that = this;
                                                          setTimeout(function () {
                                                              that.focus();
                                                          }, 0);" style="width:300px;border:solid 1px black" onKeyPress="return soloNumeros(event)"/>

<div align="center" id="botones" style="font:normal 15px/4px verdana;visibility:visible;"></div>
<script>
var letras="";
var p=0;
for (a=0;a<Tletras.length;a++){
     //document.write(Tletras[a] + " ");
letras=letras+"<input style='width:25px;' type='Button' value="+Tletras[a]+" onclick=anadir('"+Tletras[a]+"')>&nbsp;";
p=p+1;

if(p==10){p=0;letras=letras+"<br><br>";}
}
document.getElementById('botones').innerHTML=letras+"<input style='width:40px;' alt='Borrar' type='Button' value=&laquo; onClick=anadir('\b')><br><br><input style='width:205px;height:22px;' type='Button' value='espacio' onclick=anadir('&#160')><br><input type=hidden name=mayusculas onclick='cambiomayus(this)' checked>";

</script>

<label><input name="actec" type="submit"  value="Aceptar"/>
</label>
<?PHP 
  $_SESSION['folio']=(isset($_GET['nop']))?$_GET['nop']:"";
  $_SESSION['prod']=(isset($_GET['prod']))?$_GET['prod']:"";
  $_SESSION['fcom']=(isset($_GET['fcom']))?$_GET['fcom']:"";
  $vpb=(isset($_POST['barra']))?$_POST['barra']:"";
 $sq_pememd=mysqli_query($con ,"select * from dgpememd where cons_ven ='".$_SESSION['folio']."' AND nparte1 ='".$_SESSION['prod']."' and fcomd='".$_SESSION['fcom']."'");
echo mysqli_error($con);
$dt_pememd=mysqli_fetch_array($sq_pememd);
		echo mysqli_error($con);		
				if($dt_pememd['can_ref']>1) {
					$esCargado=true;
					 $dt_pememd['fol_ven1'];
				}else {
					$esCargado=false;
					$dt_pememd['fol_ven1'];
				} 
		
		
	$comen=$vpb;
if ($vpb!=""){
	$invent=mysqli_query($con ,"update dginventp set lim_vta1='$comen' where nparte1='".$_SESSION['prod']."'");
	
	@$com_invt=mysqli_query($con ,"update dgpememd set total_cd='".$vpb."', pre_bas='".$vpb."', pre_uni='".$vpb."', subtotal='".$vpb."' where cons_ven='".$_SESSION['folio']."' and fol_ven1='".$dt_pememd['fol_ven1']."'");
	
    $select=mysqli_query($con ,"select * from dgpemema where fol_ven='".$_SESSION['folio']."'");
	$sel=mysqli_fetch_array($select);
	$subven=$sel['sub_ven']+$vpb;
	$totven=$sel['tot_ven']+$vpb;
	@$comInvt=mysqli_query($con ,"update dgpemema set sub_ven='$subven', tot_ven='$totven' where fol_ven='".$_SESSION['folio']."'");
	echo  mysqli_error($con);
	echo "<script type='text/javascript'>window.close(); window.opener.getDetVen();</script> ";
}
?>
</div>
</form>


</div>
</body>
</html>
