<?php
	session_start();
	include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
	include("phpmnu_fun.php");
	if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
	
	$StrId=V($_POST['TxtId']);
	$StrCmd=V($_POST['TxtAc']);
	//-------------------------
	$StrAlm=V($_POST['CboAlm']);		
	$StrAcc=V($_POST['CboAcc']);		
	$StrNum=V($_POST['TxtNum']);		
	$StrDex=V($_POST['TxtDex']);		
	$StrHax=V($_POST['TxtHax']);	
	$StrSN=V($_POST['CboSN']);			
	$StrDes=V($_POST['TxtDes']);		
	$StrMar=V($_POST['TxtMar']);
	$StrLin=V($_POST['TxtLin']);	
	
	$IdUsu=$_SESSION['SYS_USER_ID'];
	
	if($_SESSION['SYS_USER_ALM']=="%"){
		if(strlen($StrAlm)==0)$StrAlm=T($StrAlm);//$StrAlm=GetSO("alm_nombre","almacenes","","alm_nombre");
	}else{
		$StrAlm=$_SESSION['SYS_USER_ALM'];
	}
	
	if(strlen($StrAcc)==0) $StrAcc="QUITAR";
	if(strlen($StrSN)==0) $StrSN="NO";
	
	
	$StrAlm=T($StrAlm);
	$StrAcc=substr($StrAcc,0,1);
	$StrNum_=$StrNum."%";
	//-------------------------	
	$StrDex_=D($StrDex);
	$StrHax_=H($StrHax);

	$StrSN_=substr($StrSN,0,1);
	$StrDes_=$StrDes."%";
	$StrMar_=$StrMar."%";
	$StrLin_=VCbo($StrLin);
	//-------------------------
	$FF="ID>0 
	AND ALM LIKE '$StrAlm' 
	AND ACC LIKE '$StrAcc' 
	AND NUM LIKE '$StrNum_' 
	AND FEC >= '$StrDex_' 
	AND FEC <= '$StrHax_' 
	AND ANU LIKE '$StrSN_' 
	AND DES LIKE '$StrDes_' 
	AND MAR LIKE '$StrMar_'
	AND LIN LIKE '$StrLin_' ";
	
	$LStrTR=gn("count(*)","vajustes_det",$FF);	
				
	$LStrPag=V($_POST['TxtPag']);	
	if($StrCmd=="F"){$LStrPag="1";}
	$VP_RegXPag=50000;	
	$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
	//-------------------------
?>

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajustes - Buscar - Detallado</title>
<!----------------------------------------->
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>

<!----------------------------------------->
<link rel="stylesheet" type="text/css" href="css/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="css/basic.css"  />
<link rel="stylesheet" type="text/css" href="css/mnu.css"  />
<!----------------------------------------->
<style type="text/css">
.cF {height:600px;width:1250px;position:relative;top:0px}
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}

</style>

<!----------------------------------------->
<script>
$(document).ready(function(){  
   Inicializar();
   jF("CboAlm");
});


function fGenPDF(){	
	document.getElementById("TxtAc").value="GEN_PDF";
	document.getElementById("Frm").submit();
}

function fGenPDF_2(){	
	document.getElementById("TxtAc").value="GEN_PDF_2";
	document.getElementById("Frm").submit();
}

</script>

<script language="javascript">
$(document).ready(function() {
	$(".botonExcel").click(function(event) {
		$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
		$("#FormularioExportacion").submit();
});
});
</script>
<!----------------------------------------->
<body  <?php echo $LStrMsg;?>  >
<div align="center">

<div class="mM" align="left" style="font-size:12px">
<?php
//$HTM=file_get_contents("http://inversionessounduniversal.com/ventas/phpmnu.php?USER_ID=$IdUsu");
echo GEN_MENU(vbval(V($_SESSION['SYS_USER_ID'])));
?>
</div>

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;" >
<form id="Frm" name="Frm" method="post" autocomplete="off"
action="ajustes_buscar_det.php" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">
<!----------------------------------------->
<div id="DivT" class="dT"  style="width:1250px; ">
<img src="b.png" class="iT" />
<div class="tT">AJUSTES - BUSCAR - Detallado</div>
</div>
<!----------------------------------------->

<div class="s1" style="left: 33px; top: 121px; width: 106px;">
ALMACEN</div>
<select name="CboAlm" id="CboAlm" 
style="position: absolute; left: 31px; top: 138px; width: 238px;" 
onkeydown="return SoloTextoEx(event,'CboAcc');">
<?php 
	if($IdUsu>=1  && V($_SESSION['SYS_USER_ALM'])!="%"){
		echo ListALM($StrAlm);
	}else{
    	echo FCBO("alm_nombre","almacenes","id_almacen>0",$StrAlm,"S","N");
    }
?>
</select>

<div class="s1" style="left: 278px; top: 121px; width: 84px;">
ACCION</div>
<select name="CboAcc" id="CboAcc" 
style="position: absolute; left: 276px; top: 136px; width: 103px;" 
onkeydown="return SoloTextoEx(event,'TxtNum');">
<?php
	if(substr($StrAcc,0,1)=="Q" || strlen($StrAcc)==0){
		echo "<option value=\"QUITAR\" selected=\"selected\">QUITAR</option>";
		echo "<option value=\"AGREGAR\" >AGREGAR</option>";
	}else{
		echo "<option value=\"QUITAR\">QUITAR</option>";
		echo "<option value=\"AGREGAR\"  selected=\"selected\">AGREGAR</option>";
	}
?>
</select>

<div class="s1" style="left: 387px; top: 121px; width: 74px;">
NUMERO</div>
<input name="TxtNum" type="text" id="TxtNum" 
style="position: absolute; left: 388px; top: 138px; width: 83px;" 
value="<?php echo $StrNum;?>"  
onkeydown="return SoloTextoEx(event,'TxtDex');"
tabindex="1" />

<div class="s1" style="left: 477px; top: 121px; width: 45px;">
DESDE</div>
<input name="TxtDex" type="text" id="TxtDex" 
style="position: absolute; left: 477px; top: 138px; width: 73px;" 
value="<?php echo $StrDex;?>"  
onkeydown="return SoloFec(this,event,'TxtHax');"
tabindex="1" />

<div class="s1" style="left: 559px; top: 121px; width: 60px;">
HASTA</div>
<input name="TxtHax" type="text" id="TxtHax" 
style="position: absolute; left: 560px; top: 138px; width: 73px;" 
value="<?php echo $StrHax;?>"  
onkeydown="return SoloFec(this,event,'CboSN');"
tabindex="1" />

<div class="s1" style="left: 642px; top: 121px; width: 75px;">
ANULADO</div>
<select name="CboSN" id="CboSN" 
style="position: absolute; left: 641px; top: 138px; width: 81px;" 
onkeydown="return SoloTextoEx(event,'CmdB');">
          <?php
	if($StrSN=="" || $StrSN=="NO"){
		AD("NO",1);	AD("SI",0);
	}else{
		AD("NO",0);	AD("SI",1);
	}
?>
</select>

<div class="s1" style="left: 733px; top: 121px; width: 74px;">
DESCRIPCION</div>
<input name="TxtDes" type="text" id="TxtDes" 
style="position: absolute; left: 732px; top: 138px; width: 93px;" 
value="<?php echo $StrDes;?>"  
onkeydown="return SoloTextoEx(event,'TxtMar');"
tabindex="1" />

<div class="s1" style="left: 836px; top: 121px; width: 74px;">
MARCA</div>
<input name="TxtMar" type="text" id="TxtMar" 
style="position: absolute; left: 834px; top: 138px; width: 89px" 
value="<?php echo $StrMar;?>"  
onkeydown="return SoloTextoEx(event,'TxtLin');"
tabindex="1" />

<div class="s1" style="left: 936px; top: 121px; width: 63px;">
LINEA</div>
<select name="TxtLin" id="TxtLin" 
style="position: absolute; left: 934px; top: 138px; width: 75px" 
onkeydown="return SoloTextoEx(event,'CmdB');">
<?php echo FCBOO_("lin_nombre","lineas","id_linea>0",$StrLin,"S","","lin_nombre");?>
</select>
    


<!----------------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width: 551px; height: 26px;">
<input name="CmdB" type="button" id="CmdB" class="btm"
value="Buscar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdZ" class="btm"
value="Volver" onClick="fBuscar('ajustes.php?TxtAc=X');"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdPDF" type="button" id="CmdPDF" class="btm" 
value="Generar PDF" onClick="fGenPDF_2();" style="display:none"
tabindex="<?php echo ++$TI;?>" />

<input name="CmdPDF" type="button" id="CmdPDF" class="btm" 
value="PDF.Det" onClick="fGenPDF();"  style="display:none"
tabindex="<?php echo ++$TI;?>" />
</div>
    
<!----------------------------------------->


<div class="datagrid" style="position: absolute; left: 35px; top: 165px; width: 1180px; height: 409px; overflow: auto">
<table id="Exportar_a_Excel" width="75%">
<thead>
<tr>
<td colspan="8" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>

<tr>
<th width="222" style="text-align:left; background:#999">ALMACEN</th>
<th width="63" style="text-align:left; background:#999"">ACCION</th>
<th width="63"  style="text-align:left; background:#999"">NUMERO</th>
<th width="78"  style="text-align:left; background:#999"">FECHA</th>
<th width="336" style="text-align:left; background:#999"">DESCRIPCION</th>
<th width="167" style="text-align:left; background:#999"">MARCA</th>
<th width="159" style="text-align:left; background:#999"">LINEA</th>
<th width="54" style="text-align:right; background:#999"">CANT</th>
</tr>
</thead>
<tbody>
<?php		  			
	$s="SELECT ID,ALM,ACC,NUM,DATE_FORMAT(FEC,'%d-%m-%y'),DES,MAR,LIN,KA
		 FROM vajustes_det  
		 WHERE  $FF 
		 ORDER BY ALM,ACC,NUM,FEC,DES  ";

	$result = grs($s);	
	while ($row = $result->fetch_row()){
		?>	
		<tr onDblClick="location.href='ajustes.php?Id=<?php echo $row[0];?>&Pag=0'">
		<!----------------------------------------------->
		<td><?php echo vbl($row[1],30);?></td>  
		<td><?php echo $row[2];?></td>
		<td><a target="_blank" href="compras.php?Id=<?php echo $row[0];?>">'<?php echo $row[3];?></a></td>
		<td style="text-align:left;"><?php echo $row[4];?></td> 
		<td><?php echo vbl($row[5],46);?></td>
		<td><?php echo vbl($row[6],20);?></td> 
		<td><?php echo vbl($row[7],21);?></td> 
		<td style="text-align:right"><?php echo $row[8];?></td> 
		<!----------------------------------------------->
		</tr>
		<?php
	
		$ST=$ST+$row[8];
	}
?>		  
  <tr> 
	<td colspan="7" bgcolor="#999999" style="text-align:right"><span class="Estilo4">TOTAL</span></td>
	<td width="54" bgcolor="#999999" style="text-align:right"><span class="Estilo4"><?php echo $ST;?></span></td>
  </tr> 
     
</tbody>
</table>
</div>

<!----------------------------------------->
<?php include("ocultos.php");?>

<div class="s1" style="left: 33px; top: 579px; width: 426px;">
Doble Click sobre el registro para activar Actualizacion</div>

</form>

<form action="ficheroExcel.php" 
	method="post" target="_blank" id="FormularioExportacion" >
<div style="position: absolute; left: 408px; top: 71px; width: 45px; height: 15px;">  
    <input name="" type="button" class="botonExcel btm" value="Exportar" />
    <input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</div>
</form>

<?php
if($StrCmd=="GEN_PDF"){
	$_PDF=GEN_PDF($FF,$StrAlm,$StrAcc,$StrNum,$StrDex,$StrHax,$StrSN,$StrDes,$StrMar);
	$StrDESCARGAR=$_PDF;
}

if($StrCmd=="GEN_PDF_2"){
	$_PDF=GEN_PDF_2($FF,$StrAlm,$StrAcc,$StrNum,$StrDex,$StrHax,$StrSN,$StrDes,$StrMar);
	$StrDES_2=$_PDF;
}
//-------------------------


//-------------------------------------
function GEN_PDF_2($FF,$StrAlm,$StrAcc,$StrNum,$StrDex,$StrHax,$StrSN,$StrDes,$StrMar){
$_CxL=90;
$_S=10;	

$pdf = new PDF('P','mm',A4);
$pdf->AddPage();$pdf->SetFont('courier','',10);
$pdf->Cell(0,4,"",0,1);	
$pdf->Cell(0,4,"AJUSTES",0,1);	
$pdf->Cell(0,4,"",0,1);	
//
if(strlen($StrAlm)>0){
if($StrAlm=="%")$StrAlm="TODOS";
$_ENC=vbl("ALMACEN".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrAlm.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrAcc)>0){
$_ENC=vbl("ACCION".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrAcc.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrNum)>0){
$_ENC=vbl("NUMERO".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrNum.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrDex)>0){
$_ENC=vbl("DESDE".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrDex.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrHax)>0){
$_ENC=vbl("HASTA".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrHax.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrDes)>0){
$_ENC=vbl("DESCRIPCION".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrDes.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrMar)>0){
$_ENC=vbl("MARCA".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrMar.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrSN)>0){
$_ENC=vbl("ANULADO S/N".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrSN.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}
$pdf->Cell(0,4,"",0,1);	
$pdf->Cell(0,4,"",0,1);

//------------------------------------------
$P=0;
$P++;	$T[$P]=18;	$_ENC=vbl("ALMMACEN".vbfill(" ",$T[$P]),$T[$P]);
$P++;	$T[$P]=3;	$_ENC=$_ENC." ".vbl("ACC".vbfill(" ",$T[$P]),$T[$P]);
$P++;	$T[$P]=8;	$_ENC=$_ENC." ".vbl("NUMERO".vbfill(" ",$T[$P]),$T[$P]);
$P++;	$T[$P]=8;	$_ENC=$_ENC." ".vbl("FECHA".vbfill(" ",$T[$P]),$T[$P]);
$P++;	$T[$P]=28;	$_ENC=$_ENC." ".vbl("DESCRIPCION".vbfill(" ",$T[$P]),$T[$P]);
$P++;	$T[$P]=15;	$_ENC=$_ENC." ".vbl("MARCA".vbfill(" ",$T[$P]),$T[$P]);
$P++;	$T[$P]=4;	$_ENC=$_ENC." ".vbr(vbfill(" ",$T[$P])."CANT",$T[$P]);
$pdf->Cell(0,4,$_ENC,0,1);
$pdf->Cell(0,4,vbfill("-",$_CxL),0,1);	

$s="SELECT ID,ALM,ACC,NUM,DATE_FORMAT(FEC,'%d-%m-%y'),DES,MAR,KA
	FROM vajustes_det  WHERE  $FF ORDER BY ALM,ACC,NUM,FEC,DES  ";

$result = grs($s);
while ($row = $result->fetch_row()){	
	$P=0;
	$P++;	$_ENC=vbl($row[1].vbfill(" ",$T[$P]),$T[$P]);
	$P++;	$_ENC=$_ENC." ".vbl($row[2].vbfill(" ",$T[$P]),$T[$P]);
	$P++;	$_ENC=$_ENC." ".vbl($row[3].vbfill(" ",$T[$P]),$T[$P]);
	$P++;	$_ENC=$_ENC." ".vbl($row[4].vbfill(" ",$T[$P]),$T[$P]);
	$P++;	$_ENC=$_ENC." ".vbl($row[5].vbfill(" ",$T[$P]),$T[$P]);
	$P++;	$_ENC=$_ENC." ".vbl($row[6].vbfill(" ",$T[$P]),$T[$P]);
	$P++;	$_ENC=$_ENC." ".vbr(vbfill(" ",$T[$P]).$row[7],$T[$P]);
	$pdf->Cell(0,4,$_ENC,0,1);
	$TOT=$TOT+$row[7];
}

$pdf->Cell(0,4,vbfill("-",$_CxL),0,1);	
$_TI=vbr(vbfill(" ",75)."TOTAL :",75);
$_TD=vbr(vbfill(" ",14).$TOT,14);
$pdf->Cell(0,4,$_TI." ".$_TD,0,1);	

$_S=20;
$pdf->Cell(0,4,"",0,1);	
$pdf->Cell(0,4,"",0,1);	
//
$PDF_NAME="Ajustes.pdf";
$pdf->Output($PDF_NAME);
return $PDF_NAME;
}

//-----------------------------------
function GEN_PDF($FF,$StrAlm,$StrAcc,$StrNum,$StrDex,$StrHax,$StrSN,$StrDes,$StrMar){
$_CxL=90;
$_S=10;	

$pdf = new PDF('P','mm',A4);
$pdf->AddPage();$pdf->SetFont('courier','',10);
$pdf->Cell(0,4,"",0,1);	
$pdf->Cell(0,4,"AJUSTES DETALLADO",0,1);	
$pdf->Cell(0,4,"",0,1);	
//
if(strlen($StrAlm)>0){
if($StrAlm=="%")$StrAlm="TODOS";
$_ENC=vbl("ALMACEN".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrAlm.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrAcc)>0){
$_ENC=vbl("ACCION".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrAcc.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrNum)>0){
$_ENC=vbl("NUMERO".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrNum.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrDex)>0){
$_ENC=vbl("DESDE".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrDex.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrHax)>0){
$_ENC=vbl("HASTA".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrHax.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrDes)>0){
$_ENC=vbl("DESCRIPCION".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrDes.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrMar)>0){
$_ENC=vbl("MARCA".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrMar.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}

if(strlen($StrSN)>0){
$_ENC=vbl("ANULADO S/N".vbfill(" ",15),15)." ".vbl(":".vbfill(" ",1),1);
$_ENC=$_ENC." ".vbl($StrSN.vbfill(" ",30),30);
$pdf->Cell(0,4,$_ENC,0,1);	
}
$pdf->Cell(0,4,"",0,1);	
$pdf->Cell(0,4,"",0,1);
//
$s="SELECT ID,ALM,ACC,NUM,DATE_FORMAT(FEC,'%d-%m-%y'),DES,MAR,KA
	FROM vajustes_det  WHERE  $FF GROUP BY ID ORDER BY ALM,ACC,NUM,FEC,DES  ";
$result = grs($s);
while ($row = $result->fetch_row()){
	$_ENC=vbl("NUMERO : ".$row[3].vbfill(" ",20),20);
	$_ENC=$_ENC." ".vbl("FECHA : ".$row[4].vbfill(" ",15),15);
	$pdf->Cell(0,4,$_ENC,0,1);	

	$StrT1=8;	$_ENC=vbl("CODIGO".vbfill(" ",$StrT1),$StrT1);
	$StrT2=39;	$_ENC=$_ENC." ".vbl("DESCRIPCION".vbfill(" ",$StrT2),$StrT2);
	$StrT3=30;	$_ENC=$_ENC." ".vbl("MARCA".vbfill(" ",$StrT3),$StrT3);
	$StrT4=10;	$_ENC=$_ENC." ".vbr(vbfill(" ",$StrT4)."CANT",$StrT4);
	$pdf->Cell(0,4,$_ENC,0,1);
	$pdf->Cell(0,4,vbfill("-",$_CxL),0,1);	
	//
	$TOT=0;
	//
	$sS="SELECT ID,COD,DES,MAR,KA
	FROM vajustes_det  WHERE  ID=$row[0] ORDER BY ALM,ACC,NUM,FEC,DES ";
	$resultS = grs($sS);
	while ($rowS = $resultS->fetch_row()){	
	$_ENC=vbl($rowS[1].vbfill(" ",$StrT1),$StrT1);	
	$_ENC=$_ENC." ".vbl($rowS[2].vbfill(" ",$StrT2),$StrT2);
	$_ENC=$_ENC." ".vbl($rowS[3].vbfill(" ",$StrT3),$StrT3);
	$_ENC=$_ENC." ".vbr(vbfill(" ",$StrT4).$rowS[4],$StrT4);
	$pdf->Cell(0,4,$_ENC,0,1);	
	$TOT=$TOT+$rowS[4];
	}

	$pdf->Cell(0,4,vbfill("-",$_CxL),0,1);
	$_TI=vbr(vbfill(" ",75)."TOTAL :",75);
	$_TD=vbr(vbfill(" ",14).$TOT,14);
	$pdf->Cell(0,4,$_TI." ".$_TD,0,1);	
	//
	$pdf->Cell(0,4,vbfill("",$_CxL),0,1);
	$pdf->Cell(0,4,vbfill("",$_CxL),0,1);	
	$pdf->Cell(0,4,"",0,1);	
}
$_S=20;
$pdf->Cell(0,4,"",0,1);	
$pdf->Cell(0,4,"",0,1);	
//
$PDF_NAME="Ajustes_Detallado.pdf";
$pdf->Output($PDF_NAME);
return $PDF_NAME;
}

?>

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

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

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