<?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;}
//
if(vbval($_SESSION['SYS_USER_GI'])!=USU_GET_GI($_SESSION['SYS_USER_ID'])){
	JsDir("cerrar.php");	
	return;
}
//++++++++++++++++++
$DOC_DESC="";
//	
$StrGT="";
$VP_RegXPag=10;
$LStrMsg="";
$LStrFoc="";
$LStrMM="";
$LStrPag=V($_POST['TxtPag']);		
//
$LQ_USU=vbval(V($_SESSION['SYS_USER_ID']));
$POL_ELI=USU_PER_GET($LQ_USU,"ELI_GII");
$POL_MOD_COR=USU_PER_GET($LQ_USU,"GII_MOD_COR");
//
include("guia_interna_fun.php");
include("guia_interna_b_fun.php");
$StrHWND_G=$_SESSION['SYS_HW']."_GI";
$GIN_NL=gn("nl","doc_nl","doc='GI'");
$TI=0;
//

?>
<!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>Guia Interna</title>
<!--CSS_NEW------------------------------------->
<link rel="stylesheet" type="text/css" href="estiloss.css"  />
<link rel="stylesheet" type="text/css" href="basic.css"  />
<!--CSS_NEW------------------------------------->
<?php AddJs();?>
<script type="text/javascript" src="fe/guia_interna_ago25.js"></script>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script type="text/javascript" src="fe/leo.js"></script>
<script>
$(document).ready(function(){
   $("#TxtFec").mask("99-99-99");   
});
//

//

</script>
<script>
var myVar=setInterval(function(){myTimer()},500);
function myTimer(){
	var DR=gv("DR_NOM");
	if(jLen(DR)==0){			
		t=GetHora();
		tt=document.getElementById("TxtHora").value;
		if(tt>0){
			if(t-tt>=1){
				document.getElementById("TxtHora").value=0;
				fGetTabla();			
			}
		}
	}
}
function myStopFunction(){
	clearInterval(myVar);
}
//

//
</script>

<style type="text/css">
<!--
.estilo888 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #003366;
	font-weight: bold;
}
#TAB_CAPTION .estilo888 {
	color: #000;
}
-->
</style>
<style type="text/css">
<!--
.estilo777 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #003366;
}
-->
</style>
<style type="text/css">
<!--
body {
	background-color: #CCC;
	background-image: url();
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
	width:1100px;
	height:800px;
	position:absolute;
	left:<?php echo "50%";?>;
	top:<?php echo "50%";?>;
	background-color:#006699;
	margin:<?php echo "-400px";?> 0 0 <?php echo "-550px";?>;
}
#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;
}
.s2 { text-align:left; 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;}
.x4 {color: #000099}
.x5 {color: #000000}

#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}
#Frm center #DivFRM #layer3 .s2 table tr td {
	color: #000;
}
#Frm center #DivFRM #layer3 .s2 table tr td table tr td {
	color: #FFF;
}
.sssss {
	color: #000;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?> onunload="myStopFunction();">
<div Id="DivFRM"  class="centrarFrm"  >
<form id="Frm" name="Frm" method="post" action="guia_interna.php" autocomplete="off">
<input type="hidden" id="TxtDR" value="<?php echo $DR;?>" name="TxtDR"  />
<input type="hidden" id="DR_NOM" value="<?php echo $DR_NOM;?>" name="DR_NOM"  />
<input type="hidden" id="DR_PRI" value="<?php echo $DR_PRI;?>" name="DR_PRI"  />
<input type="hidden" id="DR_DES" value="<?php echo $DR_DES;?>" name="DR_DES"  />
<input type="hidden" id="POL_ELI" value="<?php echo $POL_ELI;?>" name="POL_ELI"  />
<input type="hidden" id="POL_MOD_COR" value="<?php echo $POL_MOD_COR;?>" name="POL_MOD_COR"  />
  
<div class="s1" style="position:absolute; left: 26px; top: 296px; width: 1054px; height: 424px;">

<table width="1033" height="19" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="30" bgcolor="#999999"><span class="x4">Nº</span></td>
<td width="107" bgcolor="#999999"><span class="x4">CODIGO</span></td>
<td width="555" bgcolor="#999999"><span class="x4">DESCRIPCION</span></td>
<td width="128" bgcolor="#999999"><span class="x4">LINEA</span></td>
<td width="37" bgcolor="#999999" align="right"><span class="x4">CANT</span></td>
<td width="42" bgcolor="#999999" align="right"><span class="x4">PIEZAS</span></td>
<td width="32" bgcolor="#999999" align="center">&nbsp;</td>
<td width="29" bgcolor="#999999" align="center">&nbsp;</td>
<td width="24" bgcolor="#999999" align="center">
<a href="javascript:void(0)" onclick="ChK();" >
<img src="img/eliminar.png" width="16" height="16" >
</a>
</td>
<td width="27" bgcolor="#999999" align="right"><span class="x4">S.A</span></td>
</tr>
<?php
$TRZ=0;
$_ALM=gn("id_almacen","almacenes","alm_obs='$StrAlm'");
$SEPARADOR=gs("aux_des","auxiliares","aux_tip='SIM'");
if(strlen($SEPARADOR)==0){$SEPARADOR="-";}
//
$TOT_CA=0;
$s="SELECT * FROM temp_compras WHERE cod_temc='$StrHWND_G' ORDER BY temc_index";
$result = grs($s);
$X_IMPORTE=0;
$X_ST=0;
$X_IG=0;
$X_TO=0;
$TOT_NL=0;
$_IT=0;
while ($row = $result->fetch_row()){	
	$TRZ++;
	$_P="#FFFFFF";
	$TOT_NL++;
	$X_ID=$row[1];	
	$X_CO=VV(gs("COD","vproductos","ID=$X_ID"));
	$X_DE=VV(gs("DESCRIPCION","vproductos","ID=$X_ID"));
	$X_MA=VV(gs("LINEA","vproductos","ID=$X_ID"));
	$X_CA=$row[2];	
	$TOT_CA=$TOT_CA + $X_CA;
	$X_PR=$row[3];	
	$X_IM=$row[4];	
	$X_CAU=$row[8];	
	$X_IMPORTE=$X_IMPORTE+$X_IM;
	$CH="ZH".vbr("00000".$row[5],5);
	$_SA=gn("sp_cantidad","stocks_presentaciones",
			"sp_id_almacen=$_ALM AND sp_id_producto=$X_ID AND sp_presentacion=$X_CAU");
	if(vbval($StrId)==0){		
		if($X_CA>$_SA){
			$_P="#F5E78D";
		}
	}
	$_IT++;
?>
    <tr class="x5" >
    <td  bgcolor="#FFFFFF" ><?php echo $_IT;?></td>
    <td  bgcolor="#FFFFFF" ><?php echo $X_CO.$SEPARADOR.$X_CAU;?></td>
    <td  bgcolor="#FFFFFF"><?php echo $X_DE;?></td>
    <td  bgcolor="#FFFFFF"><?php echo $X_MA;?></td>
    <td  bgcolor="<?php echo $_P;?>" align="right"><?php echo $X_CA;?></td>
    <td  bgcolor="#FFFFFF" align="right"><?php echo $X_CAU;?></td>
    <td  bgcolor="#FFFFFF" align="center">
    <a href="javascript:void(0)" onclick="fKiller('<?php echo $row[5];?>');" >
    <img src="img/eliminar.png" width="16" height="16" />
    </a>
    </td>
    <td  bgcolor="#FFFFFF" align="center">
    <a href="javascript:void(0)" onclick="fEditar('<?php echo $row[5];?>');" >
    <img src="img/b_edit.png"  border="0"/>
    </a>
    </td>
    <td width="24" bgcolor="#FFFFFF" align="center">
	<input name="<?php echo $CH;?>" id="<?php echo $CH;?>" type="checkbox" value="" />
	</td>
    <td width="27" bgcolor="#FFFFFF"  align="right" >
	<?php 
	if(vbval($StrId)==0){
		echo $_SA;
	}
	?>
	</td>
    </tr>
<?php
}		
?>
 <tr class="x5">
 	<td  bgcolor="#FFFFFF"></td>
    <td  bgcolor="#FFFFFF"></td>
    <td  bgcolor="#FFFFFF"></td>
    <td  bgcolor="#FFFFFF">TOTAL CAJAS</td>
    <td  bgcolor="#FFFFFF" align="right"><?php echo $TOT_CA;?></td>
    <td  bgcolor="#FFFFFF" align="right"></td>
    <td  bgcolor="#FFFFFF" align="center">&nbsp;</td>
    <td  bgcolor="#FFFFFF" align="center">&nbsp;</td>
    <td width="24" bgcolor="#FFFFFF" align="center">&nbsp;</td>
    <td width="27" bgcolor="#FFFFFF" align="center">&nbsp;</td>
    </tr>
<tr>
<td colspan="10" bgcolor="#999999">S.A. = SALDO ACTUAL EN EL ALMACEN</td>
</tr>
</table>
</div>

<div id="layer" style="position:absolute; left: 116px; top: 21px; width: 545px; height: 45px; z-index: 100;">
<div align="left" class="Estilo1">
<input type="button" name="CmdUP" id="CmdUP" value="UP" 
onclick="fLoad();" 
style="position:absolute; left: 83px; top: -282px; width: 49px; visibility:hidden"/>
<input name="TxtHW" type="hidden" id="TxtHW" value="<?php echo $StrHWND_G;?>"/>
<input name="TRZ" type="hidden" id="TRZ" value="<?php echo $TRZ;?>"/>

<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtDAT" type="hidden" id="TxtDAT" value="" />
<input name="TxtAc" type="hidden" id="TxtAc" value="" />

<input name="TxtGIN_NL" type="hidden" id="TxtGIN_NL" value="<?php echo $GIN_NL;?>" />
<input name="TxtTOT_NL" type="hidden" id="TxtTOT_NL" value="<?php echo $TOT_NL;?>" />

<input name="TxtHora" type="hidden" id="TxtHora" value="0" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<input name="TxtRuc_" type="hidden" id="TxtRuc_"  />        
<input name="TxtIdCliente" type="hidden" id="TxtIdCliente" 
value="<?php echo $StrIdCliente; ?>"   />        
<span class="sssss"><strong>GUIA INTERNA (Generar desde una proforma)</strong></span></div>

<div id="DivDatosProd">
<input name="Pro_TxtId" type="hidden" id="Pro_TxtId" value="<?php echo $StrPro_ID;?>"/>
<input name="Pro_TxtDes" type="hidden" id="Pro_TxtDes" value="<?php echo $Pro_Des;?>"/>
<input name="Pro_TxtPre" type="hidden" id="Pro_TxtPre" value="<?php echo $Pro_Pre;?>"/>
<input name="Pro_TxtCod" type="hidden" id="Pro_TxtCod" value="<?php echo $Pro_Cod;?>"/>
<input name="Pro_TxtMarca" type="hidden" id="Pro_TxtMarca" value="<?php echo $Pro_Marca;?>"/>
<input name="FEC_SERVER" type="hidden" id="FEC_SERVER" value="<?php echo date("d-m-y");?>"/>  
</div>
    </div>

<div id="LblTit" style="position:absolute; left: 52px; top: 15px; width: 64px; z-index: 100;">
<div align="left" class="Estilo1">
<img src="img/guias.png" width="64" height="53" / onclick="fGetProdDatos_Id('2');"></div>
</div>
<div id="layer8" style="position:absolute; left: 0px; top: 0px; width: 1100px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0;">
<div align="left" class="Estilo1">        
</div>
</div>


<div style="position:absolute; left:32px; top: 124px; width: 96px;">
<div align="left" class="s2">EMPRESA</div></div>
<select name="CboEmp" id="CboEmp" 
style="position:absolute; left:25px; top:148px; width: 98px;" 
onchange="EM_OC();"
onkeydown="return SoloTextoEx(event,'CboAlm');" tabindex="1">
<?php 
	echo LE($StrEmp,"N","S"); 
?>
</select>

<div class="s1" style="left: 132px; top: 130px; width: 77px;"> ALMACEN
</div>
<select name="CboAlm" id="CboAlm" 
style="left: 129px; top: 148px; width: 96px;" 
onkeydown="return SoloTextoEx(event,'TxtSer');" 
tabindex="<?php echo ++$TI;?>">
<?php echo LA($StrEmp,$StrAlm,"N","N"); ?>
</select>

<div class="s1" style="position:absolute; left: 229px; top: 110px; width: 143px; height: 25px;">
<input name="ChN_AUTO" type="checkbox"  
id="ChN_AUTO" tabindex="<?php echo ++$TI;?>"   
onclick="AutoNumeracion(document.getElementById('ChN_AUTO').checked);" value="1"
<?php
	$RO="";
	$RO_CSS="";
	if($StrN_AUTO=="1"){
		echo "checked=\"checked\"";
		$RO=' readonly="readonly" ';
		$RO_CSS=" background-color:#CCC ";
	}
?>
/>
NUM. AUTOMATICA
</div>


<div class="s1" style="left:235px; top: 130px; width: 50px; ">SERIE</div>
<input name="TxtSer" type="text" id="TxtSer"  <?php echo $RO;?>
style="left: 234px; top: 148px; width: 49px;<?php echo $RO_CSS;?>"   
tabindex="<?php echo ++$TI;?>"  onblur="_S(this);"
onkeydown="return SoloEnterosEx(this,event,'TxtNum');" 
value="<?php echo $StrSer;?>" maxlength="4" />


<div class="s1" style="left: 294px; top: 130px; width: 80px;">NUMERO</div>
<input name="TxtNum" type="text" id="TxtNum" <?php echo $RO;?>
style="left: 294px; top: 148px; width: 73px;<?php echo $RO_CSS;?>"   
tabindex="<?php echo ++$TI;?>"  onblur="_N(this);" 
onkeydown="return SoloEnterosEx(this,event,'TxtFec');" 
value="<?php echo $StrNum;?>" maxlength="6" />



<div class="s1" style="left: 378px; top: 116px; width: 91px;">
FEC. EMISION</div>
<div class="EV" style="left: 378px; top: 131px; width: 88px; color:#FF0"><u><a onclick="fFecServer('TxtFec')">(dd-mm-yy) +</a></u></div>
<input name="TxtFec" type="text" id="TxtFec" 
style="left: 377px; top: 148px; width: 80px;" 
value="<?php echo $StrFec;?>"  
onkeydown="return SoloFec(this,event,'TxtCli');" 
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 469px; top: 130px; width: 179px;">
DESTINATARIO / CLIENTE</div>
<input name="TxtCli" type="text" id="TxtCli" 
style="left: 467px; top:149px; width: 157px;" 
value="<?php echo trim($StrCli);?>"  
onkeydown="return SoloTextoEx(event,'CboEmpR');"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left:637px; top: 131px; width: 78px;">
EMPRESA</div>
<select name="CboEmpR" id="CboEmpR" 
style="position:absolute; left:635px; top:149px; width: 93px;" 
onkeydown="return SoloTextoEx(event,'TxtSerR');" tabindex="1">  
<?php 
	if(strlen($DR_NOM)>0){
		echo "<option value=\"$StrEmpR\">$StrEmpR</option> ";
	}else{
		echo FCBO_("emp_nomc","empresas","id_emp>0",$StrEmpR,"N","S");
	}
?>
</select>

<div class="s1" style="left: 738px; top: 114px; width: 87px;">
PROFORMA</div>
<div class="s1" style="left: 736px; top: 131px; width: 44px;">
SERIE</div>
<input name="TxtSerR" type="text" id="TxtSerR"
tabindex="<?php echo ++$TI;?>"  
style="left: 736px; top: 149px; width: 53px;"
onfocus="selecciona_value(this);"    onblur="_S(this);"
onkeydown="return SoloEnterosEx(this,event,'TxtNumR');" 
value="<?php echo $StrSerR;?>" size="6" maxlength="4"  
<?php
if(strlen($DR_NOM)>0){
	echo " readonly=\"readonly\" ";
}
?>          
/>
<div class="s1" style="left: 798px; top:131px; width: 62px;">
NUMERO</div>
<input name="TxtNumR" type="text" id="TxtNumR"
tabindex="<?php echo ++$TI;?>"     onblur="_N(this);" 
style="left: 799px; top: 149px; width: 62px;"
onkeydown="return SoloEnterosEx(this,event,'CmdLoad');" 
value="<?php echo $StrNumR;?>" size="10" maxlength="6"
<?php
if(strlen($DR_NOM)>0){
	echo " readonly=\"readonly\" ";
}
?>
/>

<input type="button" name="CmdLoad" id="CmdLoad"  class="ps"
<?php
	if(strlen($DR_NOM)==0){
		echo " value=\"Cargar referencia\" ";		
	}else{
		echo " value=\"Deshacer referencia\" ";		
	}
?>
onClick="LoadRef();" 
style="left: 869px; top:149px; width: 189px; height:23px" 
tabindex="<?php echo ++$TI;?>"
/>

<div class="s1" style="left:25px; top: 178px; width: 140px;">CARRETILLERO
</div>
<select name="TxtCar" id="TxtCar" 
style="left:25px; top:200px; width:259px;" 
onkeydown="return SoloTextoEx(event,'TxtCod');" 
tabindex="20"  
>
<?php
echo FCBO_("NOMBRE","vpersonal","ID>0 AND CARGO='CARRETILLERO'",$StrCar,"N","S");
?>
</select>

<script>
function OZ1(){
	//Ow('transformaciones_2.php',905*ZO(),390*ZO());
	document.getElementById("LnkTRA").click();
}
</script>

<input type="button" name="CmdSel" id="CmdSel" value="Procesar transformaciones" 
onClick="OZ1();" tabindex="15"
style="position:absolute; left: 371px; top: 233px; width: 232px;" <?php echo _D($R_O);?>
/>
<a href="lq_transformaciones.php" id="LnkTRA" style="display:none" target="_new">lq_transformaciones.php</a>

<div class="EL" style="left: 26px; top: 245px; width: 84px;"><u><a onclick="fLimDet()">CODIGO +</a></u></div>

<input name="TxtCod" type="text" id="TxtCod" 
style="left: 26px; top: 262px; width: 118px;" 
value="<?php echo $StrCod;?>"   readonly="readonly"
onkeydown="return SoloTextoEx(event,'TxtDes');"
onkeyup="document.getElementById('TxtHora').value=GetHora();"
<?php  if (strlen($DR_NOM)>0){ echo "readonly=\"readonly\" "; } ?>
tabindex="<?php echo ++$TI;?>"  />
<div class="s1" style="left: 162px; top: 245px; width: 152px">
DESCRIPCION
</div>
<input name="TxtDes" type="text" id="TxtDes" 
style="left: 161px; top: 262px; width: 443px;" 
value="<?php echo $StrDes;?>"   readonly="readonly"
onkeydown="return SoloTextoEx(event,'TxtMarcas');"
onkeyup="document.getElementById('TxtHora').value=GetHora();"
<?php  if (strlen($DR_NOM)>0){ echo "readonly=\"readonly\" "; } ?>
tabindex="<?php echo ++$TI;?>"  />

<div class="s1" style="left: 614px; top: 245px; width: 100px;">
LINEA</div>
<input name="TxtMarcas" type="text" id="TxtMarcas" 
style="left: 613px; top: 262px; width: 151px;" 
value="<?php echo $StrMARCA;?>"   readonly="readonly"
onkeydown="return SoloTextoEx(event,'TxtCant');"
onkeyup="document.getElementById('TxtHora').value=GetHora();"
<?php  if (strlen($DR_NOM)>0){ echo "readonly=\"readonly\" "; } ?>
tabindex="<?php echo ++$TI;?>"  />

<div class="s1" style="left: 781px; top: 245px; width: 39px;">
CANT</div>
<input name="TxtCant" type="text" id="TxtCant" 
style="left: 773px; top: 262px; width: 47px; text-align:right" 
value="<?php echo $StrCant;?>"   readonly="readonly"
onkeydown="return SoloNum(this,event,'TxtCUni');"          
onfocus="selecciona_value(this);"         
<?php  if (strlen($DR_NOM)>0){ echo "readonly=\"readonly\" "; } ?> 
tabindex="<?php echo ++$TI;?>"  />

<div class="s1" style="left: 827px; top: 245px; width: 39px;">
PIEZAS
</div>
<input name="TxtCUni" type="text" id="TxtCUni" 
style="left: 832px; top: 262px; width: 49px; text-align:right" 
value="<?php echo $StrCUni;?>"   readonly="readonly"
onkeydown="return SoloNum(this,event,'CmdAdd');"          
onfocus="selecciona_value(this);"    
<?php  if (strlen($DR_NOM)>0){ echo "readonly=\"readonly\" "; } ?>      
tabindex="<?php echo ++$TI;?>"  />


<input type="button" name="CmdAdd" 
id="CmdAdd" value="+" onclick="fAgregar();" 
tabindex="<?php echo ++$TI;?>" 
<?php  if (strlen($DR_NOM)>0){ echo " disabled=\"disabled\" "; } ?>

style="position:absolute; left: 891px; top: 261px; width: 30px;" />

<div id="TAB_AJAX" 
    style="visibility: hidden; height:200px; width:859px; overflow-x:hidden; position:absolute; left: 27px; top: 314px; overflow-y:scroll; color: #0FF; background-color: #FFFFFF; layer-background-color: #CCCCCC; border: 1px none #000000;" align="left"></div>
<div id="TAB_CAPTION" 
style="visibility: hidden; height:20px; width:845px; position:absolute; left:27px; top: 297px; color: #0FF; background-color: #CCCCCC; layer-background-color: #CCCCCC; border: 1px none #000000;" align="left">
<table width="760" height="20" border="1" cellpadding="0" cellspacing="0" bgcolor="#d4e3e5" class="estilo888">   
<tr  height="10 px">
<td width="134" bgcolor="#CCCCCC">CODIGO</td>
<td width="364" bgcolor="#CCCCCC">DESCRIPCION</td>
<td width="124" bgcolor="#CCCCCC">MARCA</td>
<td width="60" align="right" bgcolor="#CCCCCC">PC SOL</td>
<td width="66" align="right" bgcolor="#CCCCCC">PC DOL</td>
</tr>  
</table>
  <div style="position:absolute; top:0px; left:758px"><input name="CmdClose" type="button" value="Cerrar" onclick="CerrarDIV();" style="background-color:#F90" /></div>
</div>


<div class="s1" style="position:absolute; left: 801px; top: 84px; width: 85px; height: 22px;">
<input name="TxtTC" type="text" id="TxtTC" 
style="width:5px; text-align:right; background-color:#CCC; visibility:hidden" 
/>
</div>

<div class="s1" style="position:absolute; left: 26px; top: 85px; width: 724px;">

<input name="CmdB" type="button" id="CmdG"
<?php
if(strlen($StrId)==0){
	echo "value=\"Guardar\"";
}else{
	echo "value=\"Modificar\"";
	echo " disabled=\"disabled\"";
}
?>
onclick="fGuardar_V();" style="width:80px" tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdC" 
value="Nuevo" onclick="fCancelarPHP();"  tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdA" value="Imprimir" 
onclick="fImprimirEXE()"
<?php
if(strlen($StrId)==0){
echo "disabled=\"disabled\"";
}else{
$StrAnu=gs("anu","ventas","id_venta=$StrId");
if($StrAnu=="S"){
echo "disabled=\"disabled\"";
}
}
?>
tabindex="<?php echo ++$TI;?>"/>


<script>
function fImprimirEXE(){
    var cod=gv("TxtId");
    if(jVal(cod)==0){
        alert("No se puede determinar el ID del registro activo");
        return;
    }
	document.getElementById("LNK_PRINTER").click();
	//
	//<a id="LNK_PRINTER" style="display:none" href="ACCapp://COT-<?php echo vbval($StrId);?>">PLEASE RUN MS Access exe file</a>
}
</script>
<a id="LNK_PRINTER" style="display:none"  href="LQGI://GIN-<?php echo vbval($StrId);?>">PLEASE RUN MS Access exe file</a>

<input name="CmdB" type="button" id="CmdE" value="Eliminar" onclick="flEliminar();"
<?php
if(strlen($StrId)==0){
	echo "disabled=\"disabled\"";
}else{
	$StrAnu=gs("gi_anu","ginterna","id_gi=$StrId");
	if($StrAnu=="S"){
		echo "disabled=\"disabled\"";
	}
}
?>
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdB" 
value="Buscar" onclick="fBuscar('guia_interna_buscar.php');"  
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdB" style="background-color:#FF9"
value="Buscar X" onclick="fBuscar('guia_interna_buscar_express.php');"  
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdB" 
value="Buscar detallado" onclick="fBuscar('guia_interna_buscar_det.php');"  
tabindex="<?php echo ++$TI;?>"/>
<input name="CmdPDF" type="button" id="CmdPDF" 
value="Generar PDF" onclick="fGenPDF();" tabindex="19"
	<?php
    if(strlen($StrId)==0){
        echo " disabled=\"disabled\" ";
    }else{
        $StrAnu=gs("gi_anu","ginterna","id_gi=$StrId");
        if($StrAnu=="S"){
            echo " disabled=\"disabled\" ";
        }
    }
    ?>
/>
<input name="CmdB" type="button" id="CmdZ" 
value="Menu" onclick="fBuscar('menu.php');"  tabindex="<?php echo ++$TI;?>"/>
</div>

<?php
if(strlen($StrDESCARGAR)>0){
echo "<div id=\"layer51\" 
	  style=\"position:absolute; left: 496px; top: 114px; 
	  width: 90px; background-color: #FFCC00; layer-background-color: #FFCC00; 
	  border: 1px none #000000; height: 17px;\">";
echo "<div align=\"center\" class=\"f2\"> ";
echo " <a href=\"$StrDESCARGAR\" download>Descarga.PDF</a> ";
echo "</div>";
echo "</div>";
}
?>



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