?> <div class="table-responsive"> <table id="datatable1" class="table table-striped table-hover"> <thead> <tr> <th>RUT</th> <th>Tipo Justificación</th> <th>Justificación</th> <th>Mes</th> <th>Duracion</th> <th>Estado</th> </tr> </thead> <tbody> <?php $query = "select * from licencia where idTrabajador='" . $_SESSION['rut_user'] . "' and fecha between '" . fecha_bd($_POST['start']) . "' and '" . fecha_bd($_POST['end']) . "'"; $result = mysql_query($query); $total = mysql_num_rows($result); if ($total >= 1) { while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row["idTrabajador"] . "</td>"; echo "<td>" . $row["tipoLicencia"] . "</td>"; echo "<td>" . $row["justificacion"] . "</td>"; echo "<td>" . mesLetras($row["fecha"]) . "</td>"; echo "<td>" . $row["duracion"] . " dias</td>"; echo "<td>" . $row["estado"] . "</td>"; echo "</tr>"; } } ?>
$telefono = $_POST['telefono']; $direccion = $_POST['direccion']; $cargo = $_POST['cargo']; $email = $_POST['email']; $carga = $_POST['carga']; $sexo = $_POST['sexo']; $fechanac = $_POST['fechanac']; $sueldo = borrarCompleto($_POST['sueldo']); $fechaingreso = date('Y') . "-" . date('m') . "-" . date('d'); $estado = "1"; $tmp_name = $_FILES['archivo']['tmp_name']; $nombre_file = $_FILES['archivo']['name']; $foto = str_replace('-', '', str_replace('.', '', $rut)) . ".png"; move_uploaded_file($_FILES['archivo']['tmp_name'], "../../img/usuarios/" . $foto); $fechaingreso = date('Y') . "-" . date('m') . "-" . date('d'); $csql = "insert into trabajador values ('{$rut}','{$nombre}','{$apellidop}','{$apellidom}','" . fecha_bd($fechanac) . "','{$fechaingreso}','{$sexo}','{$direccion}','{$email}','{$telefono}','{$sueldo}','{$carga}','{$cargo}','{$afp}','{$isapre}','{$contrato}','{$caja}','{$finiquito}','{$password}','{$estado}')"; mysql_query($csql); echo "<script>alert('Se ha ingresado un nuevo empleado');</script>"; } else { echo "<script>alert('No se ha podido subir la foto, verifique que sea gif, jpeg, png o jpg y que no pese más de 1MB.');</script>"; } } else { echo "<script>alert('El usuario ingresado ya existe.');</script>"; } } ?> <html lang="en"> <head> <title>PNKS Recurso Humano - Ingresar Empleado</title> <!-- BEGIN META -->
<?php include '../../../operaciones.php'; conectar(); apruebadeintrusos(); if ($_SESSION['cargo_user'] != "Administrador") { header('Location: ../../../login.php'); } if (isset($_POST['enviarm'])) { $rut = $_POST['rut']; $nombre = $_POST['nombre']; $materno = $_POST['materno']; $paterno = $_POST['paterno']; $nacimiento = fecha_bd($_POST['fechanac']); $sexo = $_POST['sexo']; $email = $_POST['email']; $direccion = $_POST['direccion']; $telefono = $_POST['telefono']; $carga = $_POST['carga']; $cargo = $_POST['cargo']; $afp = $_POST['afp']; $isapre = $_POST['isapre']; $contrato = $_POST['contrato']; $caja = $_POST['caja']; $finiquito = $_POST['finiquito']; $estado = $_POST['estado']; $sueldo = borrarCompleto($_POST['sueldo']); $csql = "update trabajador set nombre='{$nombre}',apellidoPaterno='{$paterno}',apellidoMaterno='{$materno}',fechaNacimiento='{$nacimiento}',sexo='{$sexo}',email='{$email}',direccion='{$direccion}',telefono='{$telefono}',cargaFamiliar='{$carga}',cargo='{$cargo}',afp='{$afp}',isapre='{$isapre}', contrato='{$contrato}',caja='{$caja}',finiquito='{$finiquito}',estado='{$estado}',sueldo='{$sueldo}' where rut='{$rut}'"; mysql_query($csql); echo "<script>alert('Los datos personales del RUT " . $_POST['rut'] . " han sido modificados');</script>"; echo "<script>window.location.href='actualizar.php';</script>";
} if ($_SESSION['cargo_user'] == "Empleado") { $sql_vac = "select * from estado_vacacion where nombre='" . date('Y') . "'"; $resul_vac = mysql_query($sql_vac); $datos_vac = mysql_fetch_array($resul_vac); $sql_trab = "select fechaIngreso from trabajador where rut='" . $_SESSION['rut_user'] . "'"; $resul_trab = mysql_query($sql_trab); $datos_trab = mysql_fetch_array($resul_trab); } else { header('Location: ../../../login.php'); } if (isset($_POST['enviarVacacion']) && (empty($_POST['end']) != true && empty($_POST['start']) != true && empty($_POST['motivo']) != true)) { $rut = $_SESSION['rut_user']; $inicio = fecha_bd($_POST['start']); $estado = $datos_vac['idEstadoVacacion']; $fin = fecha_bd($_POST['end']); $motivo = $_POST['motivo']; $fechaIngreso = date('Y') - fecha_ano($datos_trab['fechaIngreso']); if ($fechaIngreso < 1) { $tipoEmpleado = "Nuevo"; } else { if ($fechaIngreso < 5) { $tipoEmpleado = "Intermedio"; } else { $tipoEmpleado = "Antiguo"; } } $csql = "insert into solicitud_vacacion (idTrabajador,idEstadoVacacion,fechaInicio,fechaFin,tipoEmpleado,motivo,estado) values ('{$rut}','{$estado}','{$inicio}','{$fin}','{$tipoEmpleado}','{$motivo}','Pendiente')"; mysql_query($csql); echo "<script>alert('Se ha enviado la solicitud de vacaciones correctamente.');</script>"; }