<?php
ini_set("session.cookie_lifetime",60*60*10);
ini_set("session.gc_maxlifetime", 60*60*10);
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
//if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
//-------------------------
$StrI=V($_GET['I']);	
$StrH=V($_GET['H']);	
//-------------------------
if(strlen($StrI)>0){	
	$StrCan=gn("cajas","ajustes_presentacion_det_temp","item=$StrI AND aju_hw='$StrH'");
	$IDPRO=gn("id_producto","ajustes_presentacion_det_temp","item=$StrI AND aju_hw='$StrH'");
	$StrUni=gn("piezas_ajuste","ajustes_presentacion_det_temp","item=$StrI AND aju_hw='$StrH'");
}else{
	$StrPre="";
	$StrCan="";
	$StrUni="";
}
//-------------------------
if($StrCmd=="OK"){
	$StrC=V($_POST['TxtCan']);
	$StrU=V($_POST['TxtUni']);
	$StrI=V($_POST['TxtI']);
	$StrH=V($_POST['TxtH']);

	$SQL="UPDATE ajustes_presentacion_det_temp SET 
			cajas=$StrC,
			piezas_ajuste=$StrU
		WHERE aju_hw='$StrH' AND item=$StrI";
	ejt($SQL);
	$StrMsg="onload=\"window.opener.document.Frm.CmdUP.click();window.close();\"";	
}else{
	$StrMsg="onload=\"document.getElementById('TxtCan').select();\"";	
}

?>
<!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>AJUSTES - EDITAR</title>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="jquery.maskedinput.min.js" type="text/javascript"></script>
<script type="text/javascript" src="fe/funciones.js"></script>
<script type="text/javascript">

function Aceptar(){	
	var c=document.getElementById("TxtCan").value;
	var u=document.getElementById("TxtUni").value;
	if(jVal(c)<=0){
		alert("La cantidad debe ser un numero positivo");
		jFocus("TxtCan");
		return;
	}
	if(jVal(u)<0){
		alert("la unidad no puede ser un valor negativo");
		jFocus("TxtPre");
		return;
	}
	document.getElementById("TxtAc").value="OK";
	document.getElementById("Frm").submit();
}
</script>
<script>
$(document).ready(function(){
   $("#TxtDex").mask("99-99-99");
   $("#TxtHax").mask("99-99-99");
});
</script>
<style type="text/css">
<!--
body {
background-color: #CCC;
}
#Layer1 {
position:absolute;
left:345px;
top:115px;
width:123px;
height:35px;
z-index:1;
}
.centrarFrm{
	width:550px;
	height:280px;
	position:absolute;
	left:50%;
	top:50%;
	background-color:#666666;
	margin:-140px 0 0 -275px;
}
#Layer2 {
position:absolute;
left:409px;
top:205px;
width:82px;
height:24px;
z-index:1;
}
.Estilo1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFFFFF;
}
.f2 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; font-size: 12px; }
.Estilo3 {color: #FFFFFF; font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.Estilo4 {color: #000099}
.Estilo5 {color: #000000}

-->
</style>

</head>
<body  <?php echo $StrMsg;?>>
<form id="Frm" name="Frm" method="post" action="ajustes_piezas_editar.php">
<center> 
<div Id="DivFRM"  class="centrarFrm" >
<div id="layer" style="position:absolute; left: 16px; top: 12px; width: 246px; height: 24px;">
<div align="left" class="Estilo1">AJUSTES PIEZAS EDITAR</div></div>
<div >
<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtI" type="hidden" id="TxtI" value="<?php echo $StrI;?>"/>
<input name="TxtH" type="hidden" id="TxtH" value="<?php echo $StrH;?>"/>
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
</div>

<div id="layer6" style="position:absolute; left: 19px; top: 39px; width: 465px;">
<div align="left" class="f2">COD : <?php 
$SEPARADOR=gs("aux_des","auxiliares","aux_tip='SIM'");
if(strlen($SEPARADOR)==0){$SEPARADOR="x";}

echo gs("COD","vproductos","ID=$IDPRO").$SEPARADOR.$StrUni;?></div></div>

<div id="layer6" style="position:absolute; left: 19px; top: 70px; width: 515px;">
<div align="left" class="f2">DES : <?php echo gs("DESCRIPCION","vproductos","ID=$IDPRO");?></div></div>

<div id="layer6" style="position:absolute; left: 19px; top: 105px; width: 461px;">
<div align="left" class="f2">LIN : <?php echo gs("MARCA","vproductos","ID=$IDPRO");?></div></div>



<div id="layer6" style="position:absolute; left: 20px; top: 152px; width: 59px;">
<div align="left" class="f2">CAJAS</div></div>
<input name="TxtCan" type="text" id="TxtCan" 
style="position:absolute; left: 20px; top: 169px; width: 70px;"
value="<?php echo $StrCan;?>"  
onkeydown="return SoloNum(this,event,'TxtUni');" 
tabindex="1" />

<div id="layer6" style="position:absolute; left: 105px; top: 152px; width: 59px;">
<div align="left" class="f2">AJU.PIEZAS</div></div>
<input name="TxtUni" type="text" id="TxtUni" 
style="position:absolute; left: 104px; top: 169px; width: 70px;"
value="<?php echo $StrUni;?>"  
onkeydown="return SoloNum(this,event,'CmdB');" 
tabindex="2" />


<input name="CmdB" type="button" 
style="position:absolute; left: 189px; top: 170px; width: 76px;"
id="CmdB" value="Aceptar" onclick="Aceptar();" tabindex="3" />
</div>
</center>	
</form>
</body>
</html>
