<?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;}
//
$HW=V($_SESSION['SYS_HW']);
$IdUsu=vbval(V($_SESSION['SYS_USER_ID']));
$StrGT="";
$SYS_MSG="";
$SYS_FOC="";
//
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$LStrPag=V($_POST['TxtPag']);
//
include("productoz_fun.php");
//
$VP_RegXPag=5;
$LStrTR=gn("count(*)","vis_web_productos","ID>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Productos</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/productoz.js"></script>
<!--FIN_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:700px;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();
   //
   SYS_LOAD();
});
</script>
</head>

<body  <?php echo $LStrMsg;?>>
<div align="center">

<div class="mM" align="left" style="font-size:12px">
<?php
echo GEN_MENU($IdUsu);
?>
</div>

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;">
<form id="Frm" name="Frm" method="post" autocomplete="off"
action="productoz.php" enctype="multipart/form-data" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="img/categorias.png" width="128" height="128" class="iT" />
<div class="tT">PRODUCTOS</div>
</div>
<!--FIN_TITULO--------------------------------->
<div class="s1" style="left:35px; top: 115px; width: 56px;">
ID</div>
<?php if(strlen($Kod)==0)$Kod="***";?>
<input name="Kod"  type="text" id="Kod"
class="roi" style="left:35px; top: 135px; width: 67px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Kod;?>"/>

<div class="s1" style="left:112px; top: 115px; width: 77px;">
CODIGO </div>
<input name="Cod"  type="text" id="Cod"
class="lt" style="left:111px; top: 135px; width: 108px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Cod;?>"/>

<div class="s1" style="left:229px; top: 115px; width: 102px;">
MARCA*</div>
<select name="Mar" id="Mar" 
class="lt" style="left:230px; top: 135px; width: 170px;"
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("mar_nom","marcas","id_mar>0 AND mar_hab='SI'",$Mar,"","S")?> 
</select>


<div class="s1" style="left:412px; top: 115px; width: 251px;">
  MODELO / NOMBRE</div>
<input name="Noc"  type="text" id="Noc"
class="lt" style="left:411px; top: 135px; width: 319px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Noc;?>"/>

<div class="s1" style="left:35px; top: 169px; width: 297px;">
MODELO / NOMBRE en lista de precios (Opcional )
</div>
<input name="Nol"  type="text" id="Nol"
class="lt" style="left:35px; top: 189px; width: 364px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Nol;?>"/>

<?php if(strlen($Hab)==0)$Hab="SI";?>
<div class="s1" style="left: 411px; top: 169px; width: 148px;">
HABILITADO* </div>
<select name="Hab" id="Hab" 
class="lt" style="left: 411px; top: 189px; width: 137px;"
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("aux_nom","auxiliar","aux_des='SN'",$Hab,"","S")?> 
</select>

<div class="s1" style="left:35px; top: 218px; width: 184px;">
<b>CARACTERISTICAS BASICAS</b></div>

<div class="s1" style="left:35px; top: 234px; width: 116px;">
MEMORIA RAM (GB)</div>
<input name="Ram"  type="text" id="Ram"
class="ndd" style="left:35px; top: 252px; width: 113px"
tabindex="<?php echo ++$TI;?>"
value='<?php echo $Ram;?>'/>

<div class="s1" style="left:157px; top: 234px; width: 86px;">BATERIA</div>
<input name="Bat"  type="text" id="Bat"
class="ndd" style="left:157px; top: 252px; width: 78px"
tabindex="<?php echo ++$TI;?>"
value='<?php echo $Bat;?>'/>

<div class="s1" style="left:248px; top: 219px; width: 103px;">
CAMARA PRINCIPAL (Mpx)</div>
<input name="Cpr"  type="text" id="Cpr"
class="ndd" style="left:248px; top: 252px; width: 102px"
tabindex="<?php echo ++$TI;?>"
value='<?php echo $Cpr;?>'/>

<div class="s1" style="left:363px; top: 219px; width: 103px;">
CAMARA FRONTAL (Mpx)</div>
<input name="Cfr"  type="text" id="Cfr"
class="ndd" style="left:363px; top: 252px; width: 102px"
tabindex="<?php echo ++$TI;?>"
value='<?php echo $Cfr;?>'/>

<div class="s1" style="left:472px; top: 234px; width: 86px;">TAMAÑO (in)</div>
<input name="Tam"  type="text" id="Tam"
class="ndd" style="left:472px; top: 252px; width: 78px"
tabindex="<?php echo ++$TI;?>"
value='<?php echo $Tam;?>'/>

<div class="s1" style="left:35px; top: 283px; width: 107px;">
<b>COLORES</b></div>

<div class="s1" style="left:35px; top: 301px; width: 699px;">
<table width="70" border="0" style="font-size:12px">
<tr>
<?php
$PRO_ID=vbval($StrId);
$s="SELECT * FROM colores WHERE id_col>0 ORDER BY col_nom";
$rs=grs($s);
while($r=$rs->fetch_assoc()){
	$CH="ch_".$r['id_col'];
	$SEL="";
	if(gn("count(*)","productos_colores",
		  "pc_id_pro=$PRO_ID AND pc_id_col=".$r['id_col'])>0){
		$SEL=' checked ';
	}	
?>
<td width="1">
<input class="lt" name="<?php echo $CH;?>" id="<?php echo $CH;?>" <?php echo $SEL;?>
type="checkbox" value="1" tabindex="<?php echo ++$TI;?>" style="position:inherit"></td>
<td width="1">&nbsp;</td>
<td width="10"><?php echo $r['col_nom']?></td>
<td width="1">&nbsp;</td>
<td width="1">&nbsp;</td>
<?php
}
?>
</tr>
</table>

</div>





<div class="datagrid" style="position: absolute; left:35px; top: 499px; ; width: 703px; height: 179px; overflow:auto">
<table width="100%">
<thead>
<tr>
<td colspan="10" height="18" align="center">
<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>
<tr>
<th width="6%">ID</th>
<th width="12%">CODIGO</th>
<th width="18%">MARCA</th>
<th width="55%">NOMBRE CORTO</th>
<th width="5%">HAB</th>
<th width="4%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php	
$PX=0;
$s="SELECT * FROM vis_productos WHERE ID>0 ORDER BY NOC ";	
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
$rs=grs($s);
while($r=$rs->fetch_assoc()){
	$PX++;
	if(strlen(trim($r['ARC']))==0){
		$r['ARC']="NO ASIGNADA";
	}else{
		$FX="adjuntos/".$r['ARC'];
		if(!file_exists($FX)){
			$r['ARC']="NO DISPONIBLE";
		}
	}
	$CSS="";
	if($PX%2==0){
		$CSS=' style="background-color:#CCC" ';
	}
?>
<tr onDblClick="fActivar(<?php echo $r['ID'];?>);" <?php echo $CSS;?>>
<!----------------------------------------------->
<td><?php echo $r['ID'];?></td>
<td><?php echo $r['COD'];?></td>
<td><?php echo $r['MAR'];?></td>
<td><?php echo $r['NOC'];?></td>
<td><?php echo $r['HAB'];?></td>
<!----------------------------------------------->
<td align="center">
<a href="javascript:void(0)" onClick="fActivar(<?php echo $r['ID'];?>);">
<img src="img/b_edit.png" border="0"/></a></td>
</tr>
<?php
}
?>		  

</tbody>
</table>
</div>

<div class="s1" style="left: 35px; top: 337px; width: 698px;">
<b>VIDEOS TUTORIALES / REFENCIALES</b>
</div>

<div class="s1" style="left:35px; top: 357px; width: 115px;">
URL VIDEO EST 1</div>
<input name="Vi1"  type="text" id="Vi1"
class="lt" style="left:35px; top: 377px; width: 155px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Vi1;?>"/>

<div class="s1" style="left:202px; top: 357px; width: 133px;">
URL VIDEO EST 2</div>
<input name="Vi2"  type="text" id="Vi2"
class="lt" style="left:201px; top: 377px; width: 155px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Vi2;?>"/>

<div class="s1" style="left:368px; top: 357px; width: 159px;">
URL VIDEO INSTRUC 1</div>
<input name="Vi3"  type="text" id="Vi3"
class="lt" style="left:367px; top: 377px; width: 155px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Vi3;?>"/>

<div class="s1" style="left:530px; top: 357px; width: 159px;">
URL VIDEO INSTRUC 2</div>
<input name="Vi4"  type="text" id="Vi4"
class="lt" style="left:530px; top: 377px; width: 201px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Vi4;?>"/>


<div class="s1" style="left: 35px; top: 411px; width: 482px;">
FOTO PRINCIPAL ( Las imagenes deben del formato <b>.jpg, .jpeg o png</b>)
</div>
<div  align="left" style="position:absolute; left:35px; top: 430px; width: 702px; height: 24px">
<input name="Foto" type="file" id="Foto" tabindex="<?php echo ++$TI;?>"/>
</div>


<!--INI_BOTONES-------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width:1000px; height: 26px;">
<input name="CmdB" type="button" id="CmdG" class="btm" 
<?php GOM($StrId);?>
onclick="fGuardar();"  
tabindex="<?php echo ++$TI;?>"/>

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

<input name="CmdB" type="button" id="CmdE" class="btm" 
value="Eliminar" onClick="fEliminar();"
<?php DIS($StrId);?>
tabindex="<?php echo ++$TI;?>" />

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

</div>
<!--FIN_BOTONES-------------------------------->


<input name="CmdImg" type="button" id="CmdImg"  
value="Fotos / Videos / Flayers" onClick="verIMG()"
style="left:35px; top: 462px; width: 171px; position:absolute">


<?php
	$IOK=1;
	$IMG="adjuntos/vacio.png";
	if(vbval($StrId)>0){
		$IOK=0;
		$FN=gs("pro_archivo","productos","id_pro=$StrId");
		if(strlen($FN)>0){
			$FX="adjuntos/".$FN;
			if(file_exists($FX)){
				$IMG=$FX;
				$IOK=1;
			}
		}
	}
?>

<?php if($IOK>0){?>
<div id="FA" class="s1" style="left: 748px; top: 133px; width: 456px; height: 543px; overflow:auto">
    <img src="<?php echo $IMG; ?>" >    
    <div class="s1" style="left: 460px; top: 1px; width: 15px; height: 15px; color: #00F; cursor: pointer;" 
    onClick="fEfoto()"><img src="img/el1.png" width="15" height="15">
    </div>
</div>
<?php }?>

<?php include("ocultos.php");?>
<input name="SYS_MSG" type="hidden" id="SYS_MSG" value="<?php echo $SYS_MSG;?>" />
<input name="SYS_FOC" type="hidden" id="SYS_FOC" value="<?php echo $SYS_FOC;?>" />
</form>
</div>
</div>
</body>
</html>
