<?php
 
session_start();
include("DMMYSQLG.php");
include("DF80000.php");
include("DF30000.inc");


include("DFJQUERY.inc");
include("DFSELMAN.inc");
if(isset($_POST["m1"])){
	include("DSA2000.php");
}
?>
<?php
 
if($_POST['ra_reg']==""){ 
	echo 'SELECCIONE REGISTRO';
	echo '<meta content="1; url=DZ30000_PR.php"  HTTP-EQUIV="REFRESH">';
	exit();
}
$dt_empres=mysqli_fetch_array(mysqli_query($con ,"select * from dxempres where cla_emp=$_POST['ra_reg']"));
$cvdm = intval($dt_empres['cve_delmun']);
$cves = intval($dt_empres['cve_estado']);
$cvep = intval($dt_empres['cve_pais']);
//Consulta Datos Del/Mun
$dt_delmun = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM dxdelmun where cve_delmun = $cvdm"));
//Consulta Datos Estado 
$dt_estado = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM dxestado where cve_estado = $cves"));
$dt_paises = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM dxpaises where cve_pais = $cvep"));
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
 
<script language="javascript">
$(document).ready(function() {
	$.ajaxSetup({
		  type: "POST",
		  url: getAjaxSource(),
		  async:false
	});
	getCountries();
	getStates(document.getElementById('tcve_pais').value);
	getDelMuns(document.getElementById('tcve_pais').value,document.getElementById('tcve_estado').value);
	setDefaults();
	setActions();
});


function setDefaults(){
	var objPaises= new SelectManager('paises');
	var objEstados=new SelectManager('estados');
	var objDelMun=new SelectManager('delMun');
	var lpais=document.getElementById('tcve_pais').value;
	var lestado=document.getElementById('tcve_estado').value;
	var ldelmun=document.getElementById('tcve_delmun').value;
	objPaises.selectOption({value:lpais});
	objEstados.selectOption({value:lestado});
	objDelMun.selectOption({value:ldelmun});
}

function getAjaxSource(){
	return 'DZ30000_MO-SRV.php';
}

function getCountries(){
	var objPais= new SelectManager('paises');
	var objEstados= new SelectManager('estados');
	var objDelMun= new SelectManager('delMun');
	objEstados.dropOptions(1,objEstados.getLength());
	objDelMun.dropOptions(1,objDelMun.getLength());
	$.post(getAjaxSource(),
		{ getCountries: '34' },
		function(datos) {
			objPais.clearOptions();
			objPais.addOptions(eval(datos));
		}
	);
	
}

function getStates(country){
	var objEstados= new SelectManager('estados');
	var objDelMun= new SelectManager('delMun');
	//var objColCiu= new SelectManager('colCiu');
	
	objDelMun.dropOptions(1,objDelMun.getLength());
	//objColCiu.dropOptions(1,objColCiu.getLength());
	$.post(
		getAjaxSource(),
		{
		getStates:'',codPais:country},
		function(datos) {
			objEstados.clearOptions();
			objEstados.addOptions(eval(datos));
		}//termina funcion tratado datos
	);//termina post
}

function getDelMuns(country,state){
	var objDelMun= new SelectManager('delMun');
	//var objColCiu= new SelectManager('colCiu');
	
	//objColCiu.dropOptions(1,objColCiu.getLength());
	$.post(
		getAjaxSource(),
		{
		getDelMun:'',codPais:country,codEstado:state},
		function(datos) {
			objDelMun.clearOptions();
			objDelMun.addOptions(eval(datos));
		}//termina funcion tratado datos
	);//termina post
}

function getColCius(country,state,delMun){
	var objColCiu= new SelectManager('colCiu');
	$.post(
		getAjaxSource(),
		{
		getColCiu:'',codPais:country,codEstado:state,codDelMun:delMun},
		function(datos) {
			objColCiu.clearOptions();
			objColCiu.addOptions(eval(datos));
		}//termina funcion tratado datos
	);//termina post
}
function setActions(){
	$('#paises').change(function(){
		var objPais= new SelectManager('paises');
		var lpais=document.getElementById('tcve_pais');
		var lestado=document.getElementById('tcve_estado');
		var ldelmun=document.getElementById('tcve_delmun');
		
		lpais.value=objPais.getSelectedValue();
		lestado.value='';
		ldelmun.value='';
		getStates(lpais.value);
	});
	
	$('#estados').change(function(){
		var objEstado= new SelectManager('estados');
		var lpais=document.getElementById('tcve_pais');
		var lestado=document.getElementById('tcve_estado');
		var ldelmun=document.getElementById('tcve_delmun');
		
		lestado.value=objEstado.getSelectedValue();
		ldelmun.value='';
		getDelMuns(lpais.value,lestado.value);
	
	});

	$('#delMun').change(function(){
		var objDelMun= new SelectManager('delMun');
		var lpais=document.getElementById('tcve_pais');
		var lestado=document.getElementById('tcve_estado');
		var ldelmun=document.getElementById('tcve_delmun');
		
		ldelmun.value=objDelMun.getSelectedValue();
		//getDelMuns(lpais.value,lestado.value,ldelmun.value);
	});

}


//Termina en Carga 
</script>
<body>
<form name="frm1" action="" method="post" >
<p>
  <input name="ra_reg" type="hidden" id="ra_reg" readonly value="<?php
 echo $_POST['ra_reg']?>" />
</p>
<table width="818" border="0" align="center">
  <tr>
    <th align = center colspan=6 class=\"titulo\">MODIFICA EMPRESA</th>
  </tr>
  <tr class=tragre>
    <td width="167" class="thcons"><div align="left">Siglas:</div></td>
    <td colspan="5" class="thcons">
      <div align="left">
        <input name="tsiglas" type="text" id="tsiglas" value="<?php
 echo $dt_empres["siglas"];?>" size="100"  />
        </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Razon Social:</div></td>
    <td colspan="5" class="thcons">
      <div align="left">
        <input name="tnom_emp" type="text" id="tnom_emp" value="<?php
 echo $dt_empres["nom_emp"];?>" size="100"  />
        </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Giro Comercial: </div></td>
    <td colspan="5" class="thcons">
      <div align="left">
        <input name="tgiro" type="text" id="tgiro" value="<?php
 echo $dt_empres["giro"];?>" size="100"  />
        </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Calle:</div></td>
    <td width="149" class="thcons">
      <div align="left">
        <input name="tcalle" type="text" id="tcalle" value="<?php
 echo $dt_empres["calle"];?>" />
        </div></td>
    <td width="131" class="thcons"><div align="left">No.Ext:</div></td>
    <td width="144" class="thcons"><div align="left">
      <input name="tno_ext" type="text" id="tno_ext"  value="<?php
 echo $dt_empres["no_ext"];?>" />
    </div></td>
    <td width="43" class="thcons"><div align="left">No.Int:</div></td>
    <td width="144" class="thcons"><div align="left">
      <input name="tno_int" type="text" id="tno_int" value="<?php
 echo $dt_empres["no_int"];?>" />
    </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Entre Calle:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="tentre_call" type="text" id="tentre_call"  value="<?php
 echo $dt_empres["entre_call"];?>" />
        </div></td>
    <td class="thcons"><div align="left">Y:</div></td>
    <td colspan="3" class="thcons"><div align="left">
      <input name="ty_calle" type="text" id="ty_calle" value="<?php
 echo $dt_empres["y_calle"];?>" />
    </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Telefono:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="ttelefono01" type="text" id="ttelefono01" value="<?php
 echo $dt_empres["telefono01"];?>" />
        </div></td>
    <td class="thcons"><div align="left">Fax:</div></td>
    <td class="thcons"><div align="left">
      <input name="tfax01" type="text" id="tfax01"  value="<?php
 echo $dt_empres["fax01"];?>"/>
    </div></td>
    <td class="thcons"><div align="left">E-mail:</div></td>
    <td class="thcons"><div align="left">
      <input name="temail01" type="text" id="temail01"  value="<?php
 echo $dt_empres["email01"];?>"/>
    </div></td>
  </tr>
  
  <tr class=tragre>
    <td class="thcons"><div align="left">Pais:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="tcve_pais" type="hidden" id="tcve_pais" value="<?php
 echo $cvep;?>" />
        <select name="paises" id="paises">
        </select>
        </div></td>
    <td class="thcons"><div align="left">Ciudad/Estado:</div></td>
    <td colspan="3" class="thcons">
      <div align="left">
        <input name="tcve_estado" type="hidden" id="tcve_estado"  value="<?php
 echo $cves;?>"/>
        <select name="estados" id="estados">
        </select>
        </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Delegacion/Municipio:</div></td>
    <td colspan="5" class="thcons">
      <div align="left">
        <input name="tcve_delmun" type="hidden" id="tcve_delmun" value="<?php
 echo $cvdm;?>"/>
        <select name="delMun" id="delMun">
          </select>
      </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Colonia:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="tdes_col" type="text" id="tdes_col" value="<?php
 echo $dt_empres["des_col"];?>" />
      </div></td>
    <td class="thcons"><div align="left">Codigo Postal:</div></td>
    <td colspan="3" class="thcons">
      <div align="left">
        <input name="tcod_pos" type="text" id="tcod_pos"  value="<?php
 echo $dt_empres["cod_pos"];?>"/>
        </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">R.F.C:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="trfc" type="text" id="trfc" value="<?php
 echo $dt_empres["rfc"];?>"/>
        </div></td>
    <td class="thcons"><div align="left">Camara:</div></td>
    <td colspan="3" class="thcons">
      <div align="left">
        <input name="tcamara" type="text" id="tcamara" value="<?php
 echo $dt_empres["camara"];?>"/>
        </div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">I.M.S.S:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="timss" type="text" id="timss" value="<?php
 echo $dt_empres["imss"];?>"/>
        </div></td>
    <td class="thcons"><div align="left">Fecha de Alta:</div></td>
    <td colspan="3" class="thcons">
      <div align="left">
        <input name="tfec_alta" type="text" id="tfec_alta" readonly value="<?php
 echo chfecha($dt_empres["fec_alta"],'Y-m-d','d/m/Y');?>"/>
        <input name="bot" id="bot" type="image" value=" ... " src="logos/cal4.jpg"/>
   <script type="text/javascript">
  	Calendar.setup(
    	{
      		inputField  : "tfec_alta",        // ID of the input field
      		ifFormat    : "%d/%m/%Y",    // the date format
      		button      : "bot"      // ID of the button
    	}
  	);
   </script>
		</div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Infonavit:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="tinfonavit" type="text" id="tinfonavit" value="<?php
 echo $dt_empres["infonavit"];?>"/>
        </div></td>
    <td class="thcons"><div align="left">Fecha de Baja:</div></td>
    <td colspan="3" class="thcons">
      <div align="left">
        <input name="tfec_baja" type="text" id="tfec_baja" readonly value="<?php
 echo chfecha($dt_empres["fec_baja"],'Y-m-d','d/m/Y');?>"/>
        <input name="bot1" id="bot1" type="image" value=" ... " src="logos/cal4.jpg"/>
   <script type="text/javascript">
  	Calendar.setup(
    	{
      		inputField  : "tfec_baja",        // ID of the input field
      		ifFormat    : "%d/%m/%Y",    // the date format
      		button      : "bot1"      // ID of the button
    	}
  	);
   </script>
		</div></td>
  </tr>
  <tr class=tragre>
    <td class="thcons"><div align="left">Afore:</div></td>
    <td class="thcons">
      <div align="left">
        <input name="tafore" type="text" id="tafore" value="<?php
 echo $dt_empres["afore"];?>"/>
        </div></td>
    <td class="thcons"><div align="left">Notas:</div></td>
    <td colspan="3" class="thcons">
      <div align="left">
        <input name="tnotas" type="text" id="tnotas" value="<?php
 echo $dt_empres["notas"];?>"/>
        </div></td>
  </tr>
  <tr>
    <th align = center colspan=6 class=\"titulo\">DATOS REPRESENTANTE LEGAL
        </div></th>
  </tr>
  <tr class=tragre>
    <td bordercolor="#000000" style="#FFFFEA">Nombre:</td>
    <td bordercolor="#000000" style="#FFFFEA"><input name="tnom_repleg" type="text" id="tnom_repleg" value="<?php
 echo $dt_empres["nom_repleg"];?>"/></td>
    <td bordercolor="#000000" style="#FFFFEA">Apellido Paterno:</td>
    <td colspan="3" bordercolor="#000000" style="#FFFFEA"><input name="tapp_repleg" type="text" id="tapp_repleg"  value="<?php
 echo $dt_empres["app_repleg"];?>"></td>
  </tr>
  <tr class=tragre>
    <td bordercolor="#000000" style="#FFFFEA">Apellido Materno: </td>
    <td bordercolor="#000000" style="#FFFFEA"><input name="tapm_repleg" type="text" id="tapm_repleg"  value="<?php
 echo $dt_empres["apm_repleg"];?>"></td>
    <td bordercolor="#000000" style="#FFFFEA">R.F.C:</td>
    <td colspan="3" bordercolor="#000000" style="#FFFFEA"><input name="trfc_repleg" type="text" id="trfc_repleg"  value="<?php
 echo $dt_empres["rfc_repleg"];?>"/></td>
    </tr>
  <tr class=tragre>
    <td bordercolor="#000000" style="#FFFFEA">Curp:</td>
    <td colspan="5" bordercolor="#000000" style="#FFFFEA"><input name="tcurp_repleg" type="text" id="tcurp_repleg" value="<?php
 echo $dt_empres["curp_repleg"];?>" /></td>
  </tr>
  <tr>
    <th align = center colspan=6 class=\"titulo\">INFORMACION  BASE DE DATOS
        </div></th>
  </tr>
  <tr class=tragre>
    <td class="inputcodigo">Nombre Base De Datos:</td>
    <td class="inputcodigo"><input name="tdbname1" type="text" id="tdbname1" readonly value="<?php
 echo $dt_empres["dbname1"];?>"/></td>
    <td class="inputcodigo">&nbsp;</td>
    <td colspan="3" class="inputcodigo">&nbsp;</td>
  </tr>
  <tr class=tragre>
    <td class="inputcodigo">Nombre Usuario:</td>
    <td class="inputcodigo"><input name="tdbuser1" type="text" id="tdbuser1" readonly value="<?php
 echo $dt_empres["dbuser1"];?>"/></td>
    <td class="inputcodigo">Contrase&ntilde;a:</td>
    <td colspan="3" class="inputcodigo"><input name="tdbpass1" type="password" id="tdbpass1" readonly value="<?php
 echo $dt_empres["dbpass1"];?>"/></td>
  </tr>
  <tr class=tragre>
    <td colspan="6"><div align="center">
      <div align="center">
        <input name="bo_modd" type="button" id="bo_modd" onClick="openpage('DZ30000_MC.php','_self')" value="Modificar"/ >
        &nbsp;
        <input name="bo_reg" type="button" id="bo_reg" value="Regresar" onClick="openpage('DZ30000_PR.php','_self')"/ >
    </div>    </tr>
</table>
</form>
</body>
</html>
