Se empieza a adaptar Ofertas

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk@94 e2b1556b-49f8-d141-9351-52d6861a72d9
This commit is contained in:
roberto 2011-06-09 17:50:51 +00:00
parent ba3aa423b7
commit 6fb8870ddb
9 changed files with 122 additions and 42 deletions

View File

@ -41,16 +41,15 @@
/** /**
* Devuelve una lista de tecnolog<EFBFBD>as asociadas a la capacidad * Devuelve una lista de tecnolog<EFBFBD>as asociadas a la capacidad
* OJO ESTA TABLA TAMBIEN GUARDA EL ID_PERFIL_TECNICO POR SI EN UN FUTURO, SE REQUIERE QUE UNA CAPACIDAD TENGA VARIOS PERFILES TECNICOS * (LO QUITAMOS)OJO ESTA TABLA TAMBIEN GUARDA EL ID_PERFIL_TECNICO POR SI EN UN FUTURO, SE REQUIERE QUE UNA CAPACIDAD TENGA VARIOS PERFILES TECNICOS
*/ */
private function _getTecnologias(){ private function _getTecnologias(){
$bd = new BD(); $bd = new BD();
$consulta = ""; $consulta = "";
$consulta = "SELECT CPT.id_capacidad, CPT.id_perfil_tecnico, CPT.id_tecnologia, CPT.meses, T.id "; $consulta = "SELECT CPT.id_capacidad, CPT.id_tecnologia, CPT.meses, T.id ";
$consulta = $consulta. "FROM capacidades_perfil_tecnologias as CPT "; $consulta = $consulta. "FROM capacidades_perfil_tecnologias as CPT ";
$consulta = $consulta. "left join tecnologia as T on (T.oid = CPT.id_tecnologia) "; $consulta = $consulta. "left join tecnologia as T on (T.oid = CPT.id_tecnologia) ";
$consulta = $consulta. "where CPT.id_capacidad = ". $this->campos["id"]; $consulta = $consulta. "where CPT.id_capacidad = ". $this->campos["id"];
// $consulta = $consulta. " and CPT.id_perfil_tecnico = ". $this->campos["id_perfil_tecnico"];
$resultado = $bd->execQuery($consulta); $resultado = $bd->execQuery($consulta);
if (mysql_num_rows($resultado) != 0) { if (mysql_num_rows($resultado) != 0) {
$this->tecnologias = null; $this->tecnologias = null;
@ -85,7 +84,7 @@
} }
//Insertamos en la BD //Insertamos en la BD
$consulta = "INSERT INTO capacidades ($inserto) VALUES ($valores)"; $consulta = "INSERT INTO capacidades ($inserto) VALUES ($valores)";
//echo $consulta; //echo $consulta;
$bd = new BD(); $bd = new BD();
if(!$bd->execQuery($consulta)){ if(!$bd->execQuery($consulta)){
@ -107,12 +106,11 @@
*/ */
private function addTecnologia($id_tecnologia,$meses){ private function addTecnologia($id_tecnologia,$meses){
$id_capacidad = $this->campos["id"]; $id_capacidad = $this->campos["id"];
$id_perfil_tecnico = $this->campos["id_perfil_tecnico"]; if(($id_tecnologia>0) && (!in_array($id_tecnologia, $this->tecnologias))){
if(!in_array($id_tecnologia, $this->tecnologias)){
$consulta = "DELETE FROM capacidades_perfil_tecnologias where id_capacidad='$id_capacidad' and id_tecnologia='$id_tecnologia'"; $consulta = "DELETE FROM capacidades_perfil_tecnologias where id_capacidad='$id_capacidad' and id_tecnologia='$id_tecnologia'";
$bd = new BD(); $bd = new BD();
$bd->execQuery($consulta); $bd->execQuery($consulta);
$consulta = "INSERT INTO capacidades_perfil_tecnologias (id_capacidad, id_perfil_tecnico, id_tecnologia, meses) VALUES('$id_capacidad', '$id_perfil_tecnico', '$id_tecnologia', '$meses')"; $consulta = "INSERT INTO capacidades_perfil_tecnologias (id_capacidad, id_tecnologia, meses) VALUES('$id_capacidad', '$id_tecnologia', '$meses')";
//echo $consulta; //echo $consulta;
$bd = new BD(); $bd = new BD();
if($bd->execQuery($consulta)){ if($bd->execQuery($consulta)){

View File

@ -102,7 +102,7 @@ class ListaOfertas {
// Calculamos el id // Calculamos el id
$referencia = $this->calculaReferencia($campos["pedido"]); $referencia = $this->calculaReferencia($campos["pedido"]);
$inserto = "fecha, referencia"; $inserto = "fecha, referencia";
$fecha = "'" . date("Y-m-d") . "'"; $fecha = "'" . date("Y-m-d H:i:s") . "'";
$valores = "$fecha, $referencia"; $valores = "$fecha, $referencia";
// Procesamos los datos // Procesamos los datos
foreach ($campos as $key => $value) { foreach ($campos as $key => $value) {

View File

@ -1093,6 +1093,28 @@ class Pedido {
} }
} }
function setOfertaElaborada() {
$resultado = false;
$estado = $this->getValor("estado");
switch ($estado) {
case 120;
case 140;
case 150: $resultado=true;
break;
case 110;
case 130: $consulta = "UPDATE pedidos SET estado=140 where oid='".$this->getValor("oid")."'";
$bd = new BD();
return $bd->execQuery($consulta);
break;
default: $resultado=false;
break;
}
return $resultado;
}
} }
?> ?>

View File

@ -4,6 +4,7 @@ include("seguridad.php");
include("functions.php"); include("functions.php");
include_once("Objects/ListaOfertas.php"); include_once("Objects/ListaOfertas.php");
include_once("Objects/Oferta.php"); include_once("Objects/Oferta.php");
include_once("Objects/Pedido.php");
include_once("Objects/HTML.php"); include_once("Objects/HTML.php");
$html = new HTML($locale); $html = new HTML($locale);
@ -45,6 +46,7 @@ if (!empty($_POST)) {
} }
*/ */
if ($_POST['action'] == "add") { if ($_POST['action'] == "add") {
// Comprobamos campos obligatorios // Comprobamos campos obligatorios
if (empty($solicitud)) { if (empty($solicitud)) {
$errores[] = "1"; $errores[] = "1";
@ -80,8 +82,17 @@ if (!empty($_POST)) {
$msg = "No se ha podido agregar la oferta"; $msg = "No se ha podido agregar la oferta";
$tipo = "error"; $tipo = "error";
} else { } else {
$oferta = $listaOfertas->buscarOferta($idOferta); $pedido = new Pedido($solicitud,$usuario);
header("Location: oferta.php?idOferta=" . $idOferta . "&msg=1"); if ($pedido->setOfertaElaborada()) {
$oferta = $listaOfertas->buscarOferta($idOferta);
header("Location: oferta.php?idOferta=" . $idOferta . "&msg=1");
}
else {
// Se he producido un fallo al cambiar de estado la solicitud
$errores[] = "0";
$msg = "Se he producido un fallo al cambiar de estado la solicitud";
$tipo = "error";
}
} }
} }
} }
@ -111,7 +122,7 @@ if (in_array("1", $errores))
echo ">" . $locale['1025'] . ":<br/>"; echo ">" . $locale['1025'] . ":<br/>";
rellena_desplegable_pedidos_estado("solicitud", "130", array($solicitud)); rellena_desplegable_pedidos_estado("solicitud", "130, 140", array($solicitud));
echo " </td>"; echo " </td>";

View File

@ -160,8 +160,8 @@ function rellena_desplegable_pedidos_estado($nombre, $estado, $seleccionadas) {
include LOCALE . LOCALESET . "lenguaje.php"; include LOCALE . LOCALESET . "lenguaje.php";
echo '<select multiple name="' . $nombre . '[]">'; echo '<select multiple name="' . $nombre . '[]">';
if ($link = conectar()) { if ($link = conectar()) {
$consulta = "select * from pedidos where estado = '$estado' order by prioridad DESC"; $consulta = "select * from pedidos where estado in ($estado) order by prioridad DESC";
//echo $consulta;
if ($resultado = consultar($consulta, $link)) { if ($resultado = consultar($consulta, $link)) {
if ($seleccionadas[0] == "") if ($seleccionadas[0] == "")
echo '<option value="" selected>' . $locale['ns'] . '</option>'; echo '<option value="" selected>' . $locale['ns'] . '</option>';

View File

@ -178,6 +178,12 @@ $locale['Solicitudes010'] = "Compruebe n&uacute;mero de personas";
$locale['Solicitudes011'] = "Compruebe duraci&oacute;n"; $locale['Solicitudes011'] = "Compruebe duraci&oacute;n";
$locale['Solicitudes012'] = "ESTADO SOLICITUD"; $locale['Solicitudes012'] = "ESTADO SOLICITUD";
$locale['Solicitudes013'] = "LISTA DE OFERTAS"; $locale['Solicitudes013'] = "LISTA DE OFERTAS";
$locale['Ofertas001'] = "N&uacute;mero de Oferta:";
$locale['Ofertas002'] = "DNI candidato:";
$locale['Ofertas003'] = "Nombre y apellidos:";
$locale['Ofertas004'] = "ESTADO OFERTA";
$locale['Ofertas005'] = "GRADO DE CONCORDANCIA";
$locale['Ofertas006'] = "Ver ficha candidato";
//Historial: //Historial:
@ -581,7 +587,7 @@ $locale['1021'] = "Fecha";
$locale['1022'] = "Prioridad"; $locale['1022'] = "Prioridad";
$locale['1023'] = "Cliente"; $locale['1023'] = "Cliente";
$locale['1024'] = "N&uacute;mero<br>de personas"; $locale['1024'] = "N&uacute;mero<br>de personas";
$locale['1024_1'] = "N&uacute;mero de personas"; $locale['1024_1'] = "N&uacute;mero de recursos";
$locale['1025'] = "Solicitud de oferta"; $locale['1025'] = "Solicitud de oferta";
$locale['1026'] = "Duraci&oacute;n (meses)"; $locale['1026'] = "Duraci&oacute;n (meses)";
$locale['1027'] = "Gerente:"; $locale['1027'] = "Gerente:";

View File

@ -44,10 +44,6 @@ if (isset($variablesExtra)) {
<li class="<?php if ($tipoPedidos=="523") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=523".$variablesExtra; ?>"><?php echo nombre_estado("523"); ?></a></li> <li class="<?php if ($tipoPedidos=="523") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=523".$variablesExtra; ?>"><?php echo nombre_estado("523"); ?></a></li>
<li class="<?php if ($tipoPedidos=="530") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=530".$variablesExtra; ?>"><?php echo nombre_estado("530"); ?></a></li> <li class="<?php if ($tipoPedidos=="530") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=530".$variablesExtra; ?>"><?php echo nombre_estado("530"); ?></a></li>
</ul>
</div>
<div style="float:left;padding-top:11px;">
<ul id="tabnav">
<li class="<?php if ($tipoPedidos=="540") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=540".$variablesExtra; ?>"><?php echo nombre_estado("540"); ?></a></li> <li class="<?php if ($tipoPedidos=="540") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=540".$variablesExtra; ?>"><?php echo nombre_estado("540"); ?></a></li>
<li class="<?php if ($tipoPedidos=="550") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=550".$variablesExtra; ?>"><?php echo nombre_estado("550"); ?></a></li> <li class="<?php if ($tipoPedidos=="550") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=550".$variablesExtra; ?>"><?php echo nombre_estado("550"); ?></a></li>
<li class="<?php if ($tipoPedidos=="560") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=560".$variablesExtra; ?>"><?php echo nombre_estado("560"); ?></a></li> <li class="<?php if ($tipoPedidos=="560") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=560".$variablesExtra; ?>"><?php echo nombre_estado("560"); ?></a></li>

View File

@ -37,14 +37,15 @@ if (!isset($variablesExtra)) $variablesExtra = "";
<li class="<?php if ($tipoPedidos=="120") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=120".$variablesExtra; ?>"><?php echo nombre_estado_pedido("120"); ?></a></li> <li class="<?php if ($tipoPedidos=="120") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=120".$variablesExtra; ?>"><?php echo nombre_estado_pedido("120"); ?></a></li>
<li class="<?php if ($tipoPedidos=="130") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=130".$variablesExtra; ?>"><?php echo nombre_estado_pedido("130"); ?></a></li> <li class="<?php if ($tipoPedidos=="130") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=130".$variablesExtra; ?>"><?php echo nombre_estado_pedido("130"); ?></a></li>
<li class="<?php if ($tipoPedidos=="140") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=140".$variablesExtra; ?>"><?php echo nombre_estado_pedido("140"); ?></a></li> <li class="<?php if ($tipoPedidos=="140") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=140".$variablesExtra; ?>"><?php echo nombre_estado_pedido("140"); ?></a></li>
<li class="<?php if ($tipoPedidos=="150") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=150".$variablesExtra; ?>"><?php echo nombre_estado_pedido("150"); ?></a></li>
</ul> </ul>
</div> </div>
<div style="float:left;padding-top:11px;"> <!--div style="float:left;padding-top:11px;">
<ul id="tabnav"> <ul id="tabnav">
<li class="<?php if ($tipoPedidos=="40") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=40".$variablesExtra; ?>"><?php echo nombre_estado_pedido("40"); ?></a></li> <li class="<?php if ($tipoPedidos=="40") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=40".$variablesExtra; ?>"><?php echo nombre_estado_pedido("40"); ?></a></li>
<li class="<?php if ($tipoPedidos=="50") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=50".$variablesExtra; ?>"><?php echo nombre_estado_pedido("50"); ?></a></li> <li class="<?php if ($tipoPedidos=="50") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=50".$variablesExtra; ?>"><?php echo nombre_estado_pedido("50"); ?></a></li>
</ul> </ul>
</div> </div-->
<div style="height: 35px; border-bottom:1px solid #CCC"></div> <div style="height: 35px; border-bottom:1px solid #CCC"></div>
<div style="clear:both;"></div> <div style="clear:both;"></div>
<?php <?php

View File

@ -1,9 +1,19 @@
<?php <?php
include_once("Objects/Oferta.php"); include_once("Objects/Oferta.php");
include_once("Objects/Pedido.php");
include_once("Objects/Candidato.php");
include_once("seguridad.php"); include_once("seguridad.php");
$usuario = $_SESSION['usuario']; $usuario = $_SESSION['usuario'];
$oferta = new Oferta($idOferta, $usuario); $oferta = new Oferta($idOferta, $usuario);
//Cargamos la solicitud
$idPedido = $oferta->getValor("pedido");
$pedido = new Pedido($idPedido, $usuario);
//Cargamos el candidato
$candidato = null;
$idCandidato = $oferta->getValor("candidato");
if (!empty($idCandidato))
$candidato = new Candidato($usuario, $idCandidato);
include_once("html/cabecera.php"); include_once("html/cabecera.php");
include_once("Objects/Administracion.php"); include_once("Objects/Administracion.php");
@ -94,7 +104,7 @@ if (($oferta->getValor("estado") == 110) || ($oferta->getValor("estado") == 120)
echo $html->menuOfertas($usuario, "gestionar"); echo $html->menuOfertas($usuario, "gestionar");
?> ?>
<h2><?php echo $oferta->getValor("nombre"); ?></h2> <h2><?php echo $oferta->getValor("referencia") ." - ". $oferta->getValor("nombre_solicitud")?></h2>
<?php <?php
// Comprobamos mensajes que pueden llegar hasta aqui // Comprobamos mensajes que pueden llegar hasta aqui
@ -112,21 +122,52 @@ echo $mensaje;
?> ?>
<div class="encabezado"><?php echo $locale['Solicitudes005']?></div>
<table width="100%"> <table width="100%">
<tr><td>
<table width="100%">
<tr> <tr>
<td class="nombre"><?php echo $locale['5106']; ?></td> <td class="sinborde">
<td><?php echo $oferta->getValor("referencia"); ?></td> <span class="resaltado"><?php echo $locale['1010']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo ver_fecha_larga($oferta->getValor("fecha")); ?><br/>
<span class="resaltado"><?php echo $locale['Solicitudes001']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("num_solicitud_cliente"); ?><br/>
<span class="resaltado"><?php echo $locale['1043_1']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("denominacion_cliente"); ?><br/>
<span class="resaltado"><?php echo $locale['1024_1']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("empleados"); ?><br/>
</td>
<td class="sinborde">
<span class="resaltado"><?php echo $locale['Ofertas002']; ?></span>&nbsp;&nbsp;&nbsp;
<?php
if (!empty($candidato))
echo $candidato->getValor("dni");
?><br/>
<span class="resaltado"><?php echo $locale['Ofertas003']; ?></span>&nbsp;&nbsp;&nbsp;
<?php
if (!empty($candidato))
echo $candidato->getValor("nombre") ." ". $candidato->getValor("apellidos");
?><br/>
<span class="resaltado"><?php echo $locale['132']; ?></span>&nbsp;&nbsp;&nbsp;
<?php
if (!empty($candidato))
echo $candidato->getValor("nombre_estado");
?><br/>
<span class="resaltado"><?php echo $locale['Ofertas006']; ?></span>
</td>
<td>
//FOTO
</td>
</tr> </tr>
<tr> <tr>
<td class="nombre"><?php echo $locale['1025']; ?></td> <td colspan="3" class="sinborde">
<td><?php echo $oferta->getValor("nombre_solicitud"); ?></td> <span class="resaltado"><?php echo $locale['135']; ?></span>&nbsp;<?php echo nl2br($oferta->getValor("observaciones")); ?>
</td>
</tr> </tr>
</table>
<div class="encabezado"><?php echo $locale['Ofertas004']?></div>
<table width="100%">
<tr> <tr>
<td class="nombre"><?php echo $locale['132']; ?></td> <td class="sinborde">
<td><?php echo $oferta->getValor("nombre_estado"); ?> <span class="resaltado"><?php echo $locale['132']; ?></span>
<?php echo $oferta->getValor("nombre_estado"); ?>
<div id="obsCambioEst" class="obsCambioEst"> <div id="obsCambioEst" class="obsCambioEst">
<form id="formCambEst" action="oferta.php?idOferta=<?php echo $oferta->getValor("oid"); ?>&action=cambEstObs" method="post" > <form id="formCambEst" action="oferta.php?idOferta=<?php echo $oferta->getValor("oid"); ?>&action=cambEstObs" method="post" >
<input type="hidden" name="action" value="cambEstObs" /> <input type="hidden" name="action" value="cambEstObs" />
@ -149,17 +190,22 @@ echo $mensaje;
?> ?>
</td> </td>
</tr> </tr>
<tr> </table>
<td class="nombre"><?php echo $locale['5107']; ?></td>
<td><?php echo nl2br($oferta->getValor("nombre_candidato")); ?></td>
</tr>
<tr> <div class="encabezado"><?php echo $locale['Ofertas005']?></div>
<td class="nombre"><?php echo $locale['135']; ?></td> <table width="100%">
<td><?php echo nl2br($oferta->getValor("observaciones")); ?></td> <tr><td>
</tr> <table width="100%">
</table> <tr>
</td></tr> <td>
REQUISITOS SOLICITUD
</td>
<td>
DETALLES CANDIDATO
</td>
</tr>
</table>
</td></tr>
</table> </table>
<br/> <br/>