115 lines
3.9 KiB
PHP
115 lines
3.9 KiB
PHP
|
|
<?php
|
|||
|
|
include("seguridad.php");
|
|||
|
|
include("functions.php");
|
|||
|
|
|
|||
|
|
if(!$usuario->tieneRol("4")
|
|||
|
|
&& !$usuario->tieneRol("1")){
|
|||
|
|
header("Location: aplicacion.php?e=permiso");
|
|||
|
|
exit;
|
|||
|
|
}
|
|||
|
|
include_once("Objects/Vacaciones.php");
|
|||
|
|
include_once("Objects/Empleado.php");
|
|||
|
|
include_once("Objects/Permisos.php");
|
|||
|
|
include_once("html/cabeceraPrint.php");
|
|||
|
|
$oid=$_GET['oid'];
|
|||
|
|
if($_POST['oid']!="") $oid=$_POST['oid'];
|
|||
|
|
|
|||
|
|
$mes_hoy=date("m");
|
|||
|
|
if($_GET['mes']!="") $mes_hoy=$_GET['mes'];
|
|||
|
|
if($_POST['mes']!="") $mes_hoy=$_POST['mes'];
|
|||
|
|
|
|||
|
|
$ano_hoy=date("Y");
|
|||
|
|
if($_GET['anio']!="") $ano_hoy=$_GET['anio'];
|
|||
|
|
if($_POST['anio']!="") $ano_hoy=$_POST['anio'];
|
|||
|
|
|
|||
|
|
$tipoSoli="v";
|
|||
|
|
if($_GET['tipo']!="") $tipoSoli=$_GET['tipo'];
|
|||
|
|
if($_POST['tipo']!="") $tipoSoli=$_POST['tipo'];
|
|||
|
|
|
|||
|
|
$empleado=new Empleado($usuario,$oid);
|
|||
|
|
$vacaciones=new Vacaciones($usuario,$empleado->getValor("oid"),$mes_hoy,$ano_hoy,$locale);
|
|||
|
|
$permisos=new Permisos($usuario,$empleado->getValor("oid"),$mes_hoy,$ano_hoy,$locale);
|
|||
|
|
$back="addSolicitudesEmpleado.php?oid=".$oid."&tipo=".$tipoSoli;
|
|||
|
|
switch ($_POST['action']) {
|
|||
|
|
case "crear":
|
|||
|
|
$ultimo_dia = verifica_long_mes($mes_hoy,$ano_hoy);
|
|||
|
|
// Recorremos todos los valores de los d<>as
|
|||
|
|
$dias=array();
|
|||
|
|
for($i=1;$i<=$ultimo_dia;$i++){
|
|||
|
|
if($_POST['d'.$i.'-'.$mes_hoy]=="on"){
|
|||
|
|
$dias[$i]="solicitud creada por RRHH";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
try{
|
|||
|
|
if($tipoSoli=="v"){
|
|||
|
|
$vacaciones->solicitar($dias);
|
|||
|
|
}elseif($tipoSoli=="p"){
|
|||
|
|
$permisos->solicitar($dias);
|
|||
|
|
} else{
|
|||
|
|
$tipo="error";
|
|||
|
|
$msg="error en la selección";
|
|||
|
|
}
|
|||
|
|
if($msg==""){
|
|||
|
|
$tipo="ok";
|
|||
|
|
$msg=$locale['290'];
|
|||
|
|
foreach($dias as $diaShow => $mensaje){
|
|||
|
|
$msg.=$diaShow." ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} catch (Exception $e){
|
|||
|
|
$tipo="error";
|
|||
|
|
$msg=$e->getMessage();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
if($msg!=""){
|
|||
|
|
echo "<div class=\"aviso ".$tipo."\">".$msg."</div>";
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
<style type="text/css">
|
|||
|
|
<!--
|
|||
|
|
.buttonSolicitud {font-size: 16px;
|
|||
|
|
background-image:url(css/vacaciones.gif);
|
|||
|
|
background-repeat:no-repeat;
|
|||
|
|
height:43px;
|
|||
|
|
padding-left:45px;
|
|||
|
|
font-weight:bold;
|
|||
|
|
}
|
|||
|
|
.buttonPermiso {font-size: 16px;
|
|||
|
|
background-image:url(css/permiso.gif);
|
|||
|
|
background-repeat:no-repeat;
|
|||
|
|
height:43px;
|
|||
|
|
padding-left:45px;
|
|||
|
|
font-weight:bold;
|
|||
|
|
}
|
|||
|
|
.buttonSolicitudActivo{
|
|||
|
|
background-color:#00CCFF;
|
|||
|
|
}
|
|||
|
|
-->
|
|||
|
|
</style>
|
|||
|
|
|
|||
|
|
<input type="button" class="buttonSolicitud <?php if($tipoSoli=="v") echo "buttonSolicitudActivo"; ?>" value="Crear vacaciones" onclick="irA('addSolicitudesEmpleado.php?oid=<?php echo $oid; ?>&tipo=v&mes=<?php echo $mes_hoy;?>&anio=<?php echo $ano_hoy;?>')"/>
|
|||
|
|
<input type="button" class="buttonPermiso <?php if($tipoSoli=="p") echo "buttonSolicitudActivo"; ?>" value="Crear permisos" onclick="irA('addSolicitudesEmpleado.php?oid=<?php echo $oid; ?>&tipo=p&mes=<?php echo $mes_hoy;?>&anio=<?php echo $ano_hoy;?>')"/><br />
|
|||
|
|
<input type="button" class="button" value="Cerrar" onclick="window.close();">
|
|||
|
|
<?php echo "<b>".$locale['413']."</b>".$empleado->getValor("nombre")." ".$empleado->getValor("apellidos"); ?>
|
|||
|
|
<form id="vacaciones" action="addSolicitudesEmpleado.php" method="post" name="vacaciones">
|
|||
|
|
<input type="hidden" name="mes" value="<?php echo $mes_hoy; ?>" />
|
|||
|
|
<input type="hidden" name="anio" value="<?php echo $ano_hoy; ?>" />
|
|||
|
|
<input type="hidden" name="oid" value="<?php echo $oid; ?>" />
|
|||
|
|
<input type="hidden" name="action" value="crear" />
|
|||
|
|
<input type="hidden" name="tipo" value="<?php echo $tipoSoli; ?>" />
|
|||
|
|
<?php
|
|||
|
|
$vacaciones=new Vacaciones($usuario,$empleado->getValor("oid"),$mes_hoy,$ano_hoy,$locale);
|
|||
|
|
$permisos=new Permisos($usuario,$empleado->getValor("oid"),$mes_hoy,$ano_hoy,$locale);
|
|||
|
|
include_once("ver_vacaciones.php");
|
|||
|
|
?>
|
|||
|
|
<input type="submit" class="button" value="<?php
|
|||
|
|
if($tipoSoli=="v")
|
|||
|
|
echo $locale['289'];
|
|||
|
|
else echo $locale['466']; ?>" />
|
|||
|
|
</form>
|
|||
|
|
<?php
|
|||
|
|
include_once("html/pie.php");
|
|||
|
|
?>
|