<html>
<head>
<title>EDITAR SERVICIO</title>
<script type="text/javascript"> 
function VentanaClose(){ 
   
}
function GuardarServicio(){
var idj = document.getElementById("idj").value;
var ids = document.getElementById("ids").value;
var nom = document.getElementById("noms").value;
var abrev = document.getElementById("abrevs").value;
document.location="editarjefaturadpto.php?nom="+nom+"&abrev="+abrev+"&idj="+idj+"&ids="+ids;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="../styles/Style.css">
</head>
<body>
<?php
include("../bd/sql_variables.php");
$db_conexion= mysql_connect("$sql_host", "$sql_usuario", "$sql_pass") or die(header ("No Disponible Servidor de Base de Datos"));
mysql_select_db("$sql_db");



$error=3;

if(isset($_GET['nom']) && isset($_GET['abrev']) && isset($_GET['idj']) && isset($_GET['ids']) ){
$nom=$_GET['nom'];
$abrev=$_GET['abrev'];
$idj=$_GET['idj'];
$ids=$_GET['ids'];
$error=0;
	if($idj!=0 && $ids!=0){	
	$sql="update tb_servicio set j_abrev=upper('$abrev'), j_desc=upper('$nom') where j_id='$idj' and s_id='$ids'";
	$result = mysql_query($sql);
	}else{
	$error=1;
	}
}
if(isset($_GET['ids']) && isset($_GET['idj'])){
$idj = $_GET['idj'];
$ids = $_GET['ids'];
$sql="select s_abrev as abrev, s_desc as nom from tb_servicio where j_id='$idj' and s_id='$ids'";
$result = mysql_query($sql);
	while ($row= mysql_fetch_array($result)){
		$abrev=$row['abrev'];
		$nom=$row['nom'];
	}
}
$cadena = $cadena."<br><table align='center' class='TableDiseno'>";
$cadena = $cadena."<tr><td align='center' colspan='2' width='450' height='40' class='LlenarTablaGareaTitulo'><b>EDITAR SERVICIO</b></td></tr>";
$cadena = $cadena."<tr><td class ='FacetDataTextC' colspan='2' align='center'><font color='red'><b>";
if($error==1){
$cadena = $cadena." No se modifico correctamente";
}elseif($error==0){
echo "<script type='text/javascript'>window.opener.location.reload(); window.close();</script>";
}

$cadena = $cadena."</b></font></td></tr>";
$cadena = $cadena."<tr><td class ='FacetDataTextC' align='left' width='120' >Nombre Servicio</td><td class ='FacetDataTextC'><input type='text' name='noms' id='noms' value='$nom' size='50'></td></tr>";
$cadena = $cadena."<tr><td class ='FacetDataTextC' align='left' >Abreviatura</td><td class ='FacetDataTextC'><input type='text' name='abrevs' id='abrevs' value='$abrev' size='15'></td></tr>";
$cadena = $cadena."<tr><td align='center' colspan='2'><input type='hidden' id='idj' name='idj' value='".$idj."'><input type='hidden' id='ids' name='ids' value='".$ids."'><input type='button' value='Guardar' onClick='GuardarServicio()'><input type='button' value='Cerrar'></td></tr>";
$cadena = $cadena."</table>";
echo $cadena;
?>
</body>
</html>
