<?PHP
////++++++++++++++++ CONFIGURACIÓN DE PARAMETROS ESTANTAR EN PLATAFORMA ++++++++++++++++////

////Conexiones y tiempos de ejecución
$VpnEn=$_GET["VPN"] or $VpnEn=$_POST["VPN"];
$LtEn=$_GET["LT"] or $LtEn=$_POST["LT"];
ini_set('max_execution_time', $LtEn);
include ("Conections/$VpnEn.php");

$Cve_Modulo = "CMOD201506100138";

///Arrastra Variables Fijas
$UsuEn=$_POST['UsuKP'] or $UsuEn=$_GET['UsuKP'];
$TokEn=$_POST["TokenKP"] or $TokEn=$_GET["TokenKP"];
$IDSeEn=$_POST["IdDAcce"] or $IDSeEn=$_GET["IdDAcce"];
$CtaSesionEn=$_POST['CtaSKP'] or $CtaSesionEn=$_GET['CtaSKP'];


	/////////Identificar personalización 1 
		$sqlP1 = mysql_query("select * from wms_personaliza1 where ID='1'");
		if (mysql_numrows($sqlP1)==0) echo "";
		else{
		$registroP1=mysql_fetch_array($sqlP1);
		}
		if (mysql_numrows($sqlP1)>0)
		{
		$BBackg=$registroP1["BODY_BACKGROUND_IMG"];
		}
	
	/////////Identificar personalización 2
		$sqlP2 = mysql_query("select * from wms_personaliza2 where ID='1'");
		if (mysql_numrows($sqlP2)==0) echo "";
		else{
		$registroP2=mysql_fetch_array($sqlP2);
		}
		if (mysql_numrows($sqlP2)>0)
		{
		$Titulo=$registroP2["TITULO_PAGINAS"];
		}
		
	/////////Identificar personalización 3
		$sqlP3 = mysql_query("select * from wms_personaliza3 where ID='1'");
		if (mysql_numrows($sqlP3)==0) echo "";
		else{
		$registroP3=mysql_fetch_array($sqlP3);
		}
		if (mysql_numrows($sqlP3)>0)
		{
		$FuTi_Form=$registroP3["FUENTE_TITULOFORMULARIO"];
		$TaTi_Form=$registroP3["TAMANO_TITULOFORMULARIO"];
		$BgTi_Form=$registroP3["COLOR_TITULOFORMULARIO"];
		$FuCu_Form=$registroP3["FUENTE_FORMULARIO"];
		$TaCu_Form=$registroP3["TAMANO_FORMULARIO"];
		$BgCu_Form=$registroP3["COLOR_FORMULARIO"];
		$FonTi_Form=$registroP3["BG_TABLATITULO"];
		$FonCi_Form=$registroP3["BG_TABLACUERPO"];
		$FonSe_Form=$registroP3["BG_TABLASEPARACION"];
		$Borde_Form=$registroP3["BORDER_CAMPO"];
		$CamDe_Form=$registroP3["BG_CAMPODESHABILITADO"];
		$ClaBtn=$registroP3["CLASE_BOTON"];
		}
		
	/////////Identificar personalización 4
		$sqlP4 = mysql_query("select * from wms_personaliza4 where ID='1'");
		if (mysql_numrows($sqlP4)==0) echo "";
		else{
		$registroP4=mysql_fetch_array($sqlP4);
		}
		if (mysql_numrows($sqlP4)>0)
		{
		$Bord_Tabl=$registroP4["BG_BORDE"];
		$Fond_Tabl=$registroP4["BG_FONDOGRALTABLA"];
		$BgF1_Tabl=$registroP4["BG_FILA_1"];
		$BgF2_Tabl=$registroP4["BG_FILA_2"];
		$FTit_Tabl=$registroP4["FUENTE_TABLATITULO"];
		$TTit_Tabl=$registroP4["TAMANO_FUENTETABLATITULO"];
		$CFTi_Tabl=$registroP4["COLOR_FUENTETABLATITULO"];
		$FEnc_Tabl=$registroP4["FUENTE_TABLAENCA"];
		$TEnc_Tabl=$registroP4["TAMANO_FUENTETABLAENCA"];
		$CEnc_Tabl=$registroP4["COLOR_FUENTETABLAENCA"];
		$FCue_Tabl=$registroP4["FUENTE_TABLACUER"];
		$TCue_Tabl=$registroP4["TAMANO_FUENTETABLACUER"];
		$CCue_Tabl=$registroP4["COLOR_FUENTETABLACUER"];
		}		
		
	/////////Identificar configuracion 1
		$sqlC1 = mysql_query("select * from wms_configura1 where ID='1'");
		if (mysql_numrows($sqlC1)==0) echo "";
		else{
		$registroC1=mysql_fetch_array($sqlC1);
		}
		if (mysql_numrows($sqlC1)>0)
		{
		$TimeInac=$registroC1["TIEMPO_INACTIVIDAD"];
		}
		
	/////////Identifica si el token aun esta vigente
		$ExtAño = substr($TokEn, -28, 4);    // devuelve el año
		$ExtDia = substr($TokEn, -7, 2);    // devuelve el mes
		$ExtMes = substr($TokEn, -14, 2);    // devuelve el día
		$FechTok=$ExtDia."/".$ExtMes."/".$ExtAño;
		$FechAct=$PreTo4=date("d/m/Y");
		
		if ($FechTok<>$FechAct)
		{
			echo "<script>alert('La sesión del Token de seguridad ha caducado.\\nFavor de iniciar sesion nuevamente.');</script>";
			echo "<META HTTP-EQUIV=Refresh CONTENT='0; URL=LogOff_Force.php?USUkp=$UsuEn&IdDeAcc=$IDSeEn'>";
		}
		else
		{ ///Inicia IF Sesion Token
		
	/////////Identificar permisos de acceso 1
		$sqlPA1 = mysql_query("select * from tabla_usuarios where USUARION='$UsuEn'");
		if (mysql_numrows($sqlPA1)==0) 
		{
			echo "<script>alert('CODIGO: LOGSYS#00001\\nEl Usuario en sesión ha sido truncado por inexistencia.'); </script>";
			echo "<META HTTP-EQUIV=Refresh CONTENT='0; URL=LogIn.php'>";
		}
		else
		{ ///Inicia IF Permiso de Acceso 1
		
	/////////Identificar permisos de acceso 2
		$sqlPA2 = mysql_query("select * from wms_configurapermisosnivelmodulo where USUARIO='$UsuEn' AND CVE_MODULO='$Cve_Modulo'");
		if (mysql_numrows($sqlPA2)==0) 
		{
			echo "<META HTTP-EQUIV=Refresh CONTENT='0; URL=SinPermisos.php?UsuKP=$UsuEn&IdDAcce=$IDSeEn&TokenKP=$TokEn&CtaSKP=$CtaSesionEn&VPN=$VpnEn&LT=$LtEn&Cve_ModuloKP=$Cve_Modulo'>";
		}
		else
		{ ///Inicia IF Permiso de Acceso 2
	
	/////////Identificar permisos de acceso 3 - Acreditación de Sesión Activa	
		$sqlPA3 = mysql_query("select * from tabla_controlsesiones where USUARIO='$UsuEn'");
		if (mysql_numrows($sqlPA3)==0) 
		{
		echo "<META HTTP-EQUIV=Refresh CONTENT='0; URL=LogOff_ReLogIn.php?UsuKP=$UsuEn&IdDAcce=$IDSeEn&TokenKP=$TokEn&CtaSKP=$CtaSesionEn&VPN=$VpnEn&LT=$LtEn&' target='_parent'>";
		}
		else
		{ ///Inicia IF Permiso de Acceso 3
		
		//////HORA y FECHA/////
			$Hora=time();
			$HoraOK=date("H:i:s",$Hora);
			$Fecha=date("Y/m/d");
			
			//////Identificar la Cuenta y la Bodega
			$sqlCR1 = mysql_query("select * from wms_configura_altacuentas where NOMBRE_CUENTA='$CtaSesionEn'");
			if (mysql_numrows($sqlCR1)==0) echo "";
			else{
			$registroCR1=mysql_fetch_array($sqlCR1);
			}
			if (mysql_numrows($sqlCR1)>0)
			{
			$CveBodCR1=$registroCR1["CVE_BODEGA"];	
			$CveCueCR1=$registroCR1["CVE_CUENTA"];
			}
			
				$sqlCR2 = mysql_query("select * from wms_configura_altabodega where CVE_BODEGA='$CveBodCR1'");
				if (mysql_numrows($sqlCR2)==0) echo "";
				else{
				$registroCR2=mysql_fetch_array($sqlCR2);
				}
				if (mysql_numrows($sqlCR2)>0)
				{
				$NomBodCR2=$registroCR2["NOMBRE_BODEGA"];
				}
			
			//////Consultar el Registro Seleccionado
			$IDBDEn=$_GET['IdBD'] or $IDBDEn=$_POST['IdBD'];
			$CveDesEn=$_GET['CveDesBD'] or $CveDesEn=$_POST['CveDesBD'];
			
			$sqlCR1 = mysql_query("select * from tabla_destinosclientes WHERE CVE_CUENTA='$CveCueCR1' AND CVE_DESTINO='$CveDesEn'");
			if (mysql_numrows($sqlCR1)==0) echo "CASA";
			else{
			$registroCR1=mysql_fetch_array($sqlCR1);
			}
			if (mysql_numrows($sqlCR1)>0)
			{
			$Nom_CR1=$registroCR1["NOMBRE"];
			$Rfc_CR1=$registroCR1["RFC"];
			$Cal_CR1=$registroCR1["CALLE"];
			$Num_CR1=$registroCR1["NO"];
			$Col_CR1=$registroCR1["COLONIA"];
			$Cop_CR1=$registroCR1["CP"];
			$Ciu_CR1=$registroCR1["CIUDAD"];
			$Edo_CR1=$registroCR1["ESTADO"];
			$Pai_CR1=$registroCR1["PAIS"];
			$Tel_CR1=$registroCR1["TELEFONO"];
			$Mai_CR1=$registroCR1["EMAIL"];
			$ConDir = $Cal_CR1.", ".$Num_CR1.", ".$Col_CR1.", ".$Cop_CR1.", ".$Ciu_CR1.", ".$Edo_CR1.", ".$Pai_CR1;
			$DirMapEn = $Cal_CR1.", ".$Col_CR1.", ".$Ciu_CR1.", ".$Edo_CR1.", ".$Pai_CR1;
			}

////++++++++++++++ FIN CONFIGURACIÓN DE PARAMETROS ESTANTAR EN PLATAFORMA ++++++++++++++////
?>
<!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" />
<?PHP echo"<link rel='stylesheet' href='cssBtn/style_Btns.css'>"; ?>
<script language='javascript' src="popcalendar.js"></script>
<link rel="shortcut icon" href="../WMS_Resources/images/favicon.ico">
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<link href="screen.css" rel="stylesheet" type ="text/css" />
<script type="text/javascript">
  function initialize(address) {
	var geoCoder = new google.maps.Geocoder(address)
	var request = {address:address};
	geoCoder.geocode(request, function(result, status){
		var latlng = new google.maps.LatLng(result[0].geometry.location.lat(), result[0].geometry.location.lng());
		var myOptions = {
		  zoom: 15,
		  center: latlng,
		  mapTypeId: google.maps.MapTypeId.ROADMAP
		};
        var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
		var marker = new google.maps.Marker({position:latlng,map:map,title:'Destino'});
	})
  }
</script>

<script>
    $(document).ready(function(){
        initialize($('#address').val());
    })
</script>

<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0px; padding: 0px;}
  #map_canvas {
      /*width:529px;*/
      /*height:400px;*/
	  width:95%;
      height:400px;
  }
</style>

<title><?PHP echo $Titulo; ?></title>
<style type="text/css">
body {
	background-image: url(../WMS_Resources/images/MainBkgr/<?PHP echo $BBackg; ?>);
}

.Clase_TipoLetraTitulos {
	font-family: <?PHP echo $FuTi_Form; ?>;
	font-size:<?PHP echo $TaTi_Form; ?>px;
	color:<?PHP echo $BgTi_Form; ?>;
}
.Clase_TipoLetra {
	font-family: <?PHP echo $FuCu_Form; ?>;
	font-size:<?PHP echo $TaCu_Form; ?>px;
	color:<?PHP echo $BgCu_Form; ?>;
}
.Clase_INPUT_Text {
	border: 1px solid <?PHP echo $Borde_Form; ?>;
	background: #FFFFFF;
	COLOR: #000000;
	FONT-FAMILY: Arial, Helvetica, sans-serif;
	FONT-SIZE: 12px;
	}

</style>
</head>
<body>

<!-- Inicia Cuerpo de la Interfaz Gráfica -->
<Br><Br><Br><Br>
<?PHP
include ("Banners.php");
?>
<div align="center">
<div align="center">
    <form id="Visual" name="Visual" method="post" action="">
      <table width="874" border="0" style="border-collapse: collapse" bgcolor="<?PHP echo $FonTi_Form; ?>">
        <tr>
          <td height="30" colspan="5" align="left"><span class="Clase_TipoLetraTitulos">&nbsp;&nbsp;||  GEOLOCALIZACI&Oacute;N DEL DESTINO ||</span></td>
      </tr>
        <tr>
          <td colspan="5" bgcolor="<?PHP echo $FonSe_Form; ?>"><span class="Estilo8">.</span></td>
        </tr>
        <tr>
          <td colspan="5" bgcolor="<?PHP echo $FonCi_Form; ?>">.</td>
        </tr>
        <tr>
          <td width="106" bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;Bodega:</div></td>
        <td width="322" bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left"><input name="txt_CveBodega" type="text" disabled="disabled" required="required" class="textoINPUT" id="txt_CveBodega" style="background-color:<?PHP echo $CamDe_Form; ?>" onkeypress='return numerico (event)' value="<?PHP echo $CveBodCR1; ?>" size="2"/><input name="txt_NomBodega" type="text" disabled="disabled" class="textoINPUT" id="txt_NomBodega" style="background-color:<?PHP echo $CamDe_Form; ?>" value="<?PHP echo $NomBodCR2; ?>" size="30" /><input type="button" disabled="disabled" style="WIDTH: 27px; HEIGHT: 20px;text-align:center; font-weight: bold;" Value="..." name="..." onClick="javascript:otra_ventana('2-RegistroPasilloPOPUP_BODEGA.php?UsuKP=<?PHP echo $UsuEn; ?>&IdDAcce=<?PHP echo $IDSeEn; ?>&TokenKP=<?PHP echo $TokEn; ?>&CtaSKP=<?PHP echo $CtaSesionEn; ?>&VPN=<?PHP echo $VpnEn; ?>&LT=<?PHP echo $LtEn; ?>')";></div></td>
        <td width="15" bgcolor="<?PHP echo $FonCi_Form; ?>">&nbsp;</td>
        <td width="87" bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;Cuenta:</div></td>
        <td width="322" bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left"><input name="txt_CveCuen" type="text" disabled="disabled" required="required" class="textoINPUT" id="txt_CveCuen" style="background-color:<?PHP echo $CamDe_Form; ?>" value="<?PHP echo $CveCueCR1; ?>" size="2"/><input name="txt_NomCuenta" type="text" disabled="disabled" class="textoINPUT" id="txt_NomCuenta" style="background-color:<?PHP echo $CamDe_Form; ?>" value="<?PHP echo $CtaSesionEn; ?>" size="30" /><input type="button" disabled="disabled" style="WIDTH: 27px; HEIGHT: 20px;text-align:center; font-weight: bold;" value="..." name="...4" onclick="javascript:otra_ventana('5-RegistroUbicacionPOPUP_CUENTAS.php?UsuKP=<?PHP echo $UsuEn; ?>&amp;IdDAcce=<?PHP echo $IDSeEn; ?>&amp;TokenKP=<?PHP echo $TokEn; ?>&amp;CtaSKP=<?PHP echo $CtaSesionEn; ?>&amp;VPN=<?PHP echo $VpnEn; ?>&amp;LT=<?PHP echo $LtEn; ?>')"; />
        </div></td>
        </tr>
        <tr>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;Cve.Destino:</div></td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left">
            <input name="txt_SKU" type="text" required="required" class="textoINPUT" id="txt_SKU" value="<?PHP echo $CveDesEn; ?>" size="37" disabled="disabled"/>
          </div></td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>">&nbsp;</td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;Rfc:</div></td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left">
            <input name="txt_SKUAlt" type="text" class="textoINPUT" id="txt_SKUAlt" value="<?PHP echo $Rfc_CR1; ?>" size="37" disabled="disabled"/>
          </div></td>
        </tr>
        <tr>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;Nombre:*</div></td>
          <td colspan="4" bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left">
            <input name="txt_Desc" type="text" required="required" class="textoINPUT" id="txt_Desc" value="<?PHP echo $Num_CR1; ?>" size="99" disabled="disabled"/>
          </div></td>
        </tr>
        <tr>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;Direcci&oacute;n:</div></td>
          <td colspan="4" bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left">
            <input name="txt_Desc2" type="text" disabled="disabled" required="required" class="textoINPUT" id="txt_Desc2" value="<?PHP echo $ConDir; ?>" size="99" />
          </div></td>
        </tr>
        <tr>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;Tel&eacute;fono:</div></td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left">
            <input name="txt_DUN14" type="text" class="textoINPUT" id="txt_DUN14" value="<?PHP echo $Tel_CR1; ?>" size="37" disabled="disabled"/>
          </div></td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>">&nbsp;</td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left" class="Clase_TipoLetra">&nbsp;&nbsp;E-mail:</div></td>
          <td bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="left">
            <input name="txt_Identi" type="text"class="textoINPUT" id="txt_Identi" value="<?PHP echo $Mai_CR1; ?>" size="37" disabled="disabled"/>
          </div></td>
        </tr>
        <tr>
          <td colspan="5" bgcolor="<?PHP echo $FonCi_Form; ?>"><input name="UsuKP" / type="text" id="UsuKP"  style='visibility:hidden' value="<?PHP echo $UsuEn; ?>" size="3" />
          <input name="TokenKP" / type="text" id="TokenKP"  style='visibility:hidden' value="<?PHP echo $TokEn; ?>" size="3" />
          <input name="IdDAcce" / type="text" id="IdDAcce"  style='visibility:hidden' value="<?PHP echo $IDSeEn; ?>" size="3" />
          <input name="CtaSKP" / type="text" id="CtaSKP"  style='visibility:hidden' value="<?PHP echo $CtaSesionEn; ?>" size="3" />
          <input name="VPN" / type="text" id="VPN"  style='visibility:hidden' value="<?PHP echo $VpnEn; ?>" size="3" />
          <input name="LT" / type="text" id="LT"  style='visibility:hidden' value="<?PHP echo $LtEn; ?>" size="3" /></td>
        </tr>
        <tr>
          <td colspan="5" bgcolor="<?PHP echo $FonSe_Form; ?>">.</td>
        </tr>
        <tr>
          <td colspan="5" bgcolor="<?PHP echo $FonCi_Form; ?>"><div align="center"><input type="button" class="button" style="height:25px; width:80px" value="Cerrar" onClick="window.close();">
          </div></td>
        </tr>
        <tr>
          <td height="20" colspan="5" bgcolor="<?PHP echo $FonTi_Form; ?>" align="right">.</td>
        </tr>
      </table>
  </form>
</div>
<Br>

<input id="address" type="hidden"
		value="<?PHP echo $DirMapEn; ?>" />
<div id="map_canvas"></div>

</div>
<Br><Br><Br>

<!-- Termina Cuerpo de la Interfaz Gráfica -->

<?PHP
} ///Termina IF Permiso de Acceso 3
} ///Termina IF Permiso de Acceso 2
} ///Termina IF Permiso de Acceso 1
} ///Termina IF Sesion del Token
?>
</body>
</html>