Se empieza a adaptar Ofertas

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@94 e2b1556b-49f8-d141-9351-52d6861a72d9
This commit is contained in:
roberto 2011-06-09 17:50:51 +00:00
parent 3c250ef425
commit 6432bd0f44
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
* 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(){
$bd = new BD();
$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. "left join tecnologia as T on (T.oid = CPT.id_tecnologia) ";
$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);
if (mysql_num_rows($resultado) != 0) {
$this->tecnologias = null;
@ -85,7 +84,7 @@
}
//Insertamos en la BD
$consulta = "INSERT INTO capacidades ($inserto) VALUES ($valores)";
$consulta = "INSERT INTO capacidades ($inserto) VALUES ($valores)";
//echo $consulta;
$bd = new BD();
if(!$bd->execQuery($consulta)){
@ -107,12 +106,11 @@
*/
private function addTecnologia($id_tecnologia,$meses){
$id_capacidad = $this->campos["id"];
$id_perfil_tecnico = $this->campos["id_perfil_tecnico"];
if(!in_array($id_tecnologia, $this->tecnologias)){
if(($id_tecnologia>0) && (!in_array($id_tecnologia, $this->tecnologias))){
$consulta = "DELETE FROM capacidades_perfil_tecnologias where id_capacidad='$id_capacidad' and id_tecnologia='$id_tecnologia'";
$bd = new BD();
$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;
$bd = new BD();
if($bd->execQuery($consulta)){

View File

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

View File

@ -1092,6 +1092,28 @@ class Pedido {
exit;
}
}
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_once("Objects/ListaOfertas.php");
include_once("Objects/Oferta.php");
include_once("Objects/Pedido.php");
include_once("Objects/HTML.php");
$html = new HTML($locale);
@ -45,6 +46,7 @@ if (!empty($_POST)) {
}
*/
if ($_POST['action'] == "add") {
// Comprobamos campos obligatorios
if (empty($solicitud)) {
$errores[] = "1";
@ -80,8 +82,17 @@ if (!empty($_POST)) {
$msg = "No se ha podido agregar la oferta";
$tipo = "error";
} else {
$oferta = $listaOfertas->buscarOferta($idOferta);
header("Location: oferta.php?idOferta=" . $idOferta . "&msg=1");
$pedido = new Pedido($solicitud,$usuario);
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/>";
rellena_desplegable_pedidos_estado("solicitud", "130", array($solicitud));
rellena_desplegable_pedidos_estado("solicitud", "130, 140", array($solicitud));
echo " </td>";
@ -130,4 +141,4 @@ echo '<input type="reset" value="' . $locale['res'] . '" class="button"></td>';
echo "</tr></table>";
echo "</form>";
include_once("html/pie.php");
?>
?>

View File

@ -160,8 +160,8 @@ function rellena_desplegable_pedidos_estado($nombre, $estado, $seleccionadas) {
include LOCALE . LOCALESET . "lenguaje.php";
echo '<select multiple name="' . $nombre . '[]">';
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 ($seleccionadas[0] == "")
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['Solicitudes012'] = "ESTADO SOLICITUD";
$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:
@ -581,7 +587,7 @@ $locale['1021'] = "Fecha";
$locale['1022'] = "Prioridad";
$locale['1023'] = "Cliente";
$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['1026'] = "Duraci&oacute;n (meses)";
$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=="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=="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>

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=="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=="150") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=150".$variablesExtra; ?>"><?php echo nombre_estado_pedido("150"); ?></a></li>
</ul>
</div>
<div style="float:left;padding-top:11px;">
<!--div style="float:left;padding-top:11px;">
<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=="50") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=50".$variablesExtra; ?>"><?php echo nombre_estado_pedido("50"); ?></a></li>
</ul>
</div>
</div-->
<div style="height: 35px; border-bottom:1px solid #CCC"></div>
<div style="clear:both;"></div>
<?php

View File

@ -1,10 +1,20 @@
<?php
include_once("Objects/Oferta.php");
include_once("Objects/Pedido.php");
include_once("Objects/Candidato.php");
include_once("seguridad.php");
$usuario = $_SESSION['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("Objects/Administracion.php");
@ -94,7 +104,7 @@ if (($oferta->getValor("estado") == 110) || ($oferta->getValor("estado") == 120)
echo $html->menuOfertas($usuario, "gestionar");
?>
<h2><?php echo $oferta->getValor("nombre"); ?></h2>
<h2><?php echo $oferta->getValor("referencia") ." - ". $oferta->getValor("nombre_solicitud")?></h2>
<?php
// Comprobamos mensajes que pueden llegar hasta aqui
@ -112,21 +122,52 @@ echo $mensaje;
?>
<div class="encabezado"><?php echo $locale['Solicitudes005']?></div>
<table width="100%">
<tr><td>
<table width="100%">
<tr>
<td class="nombre"><?php echo $locale['5106']; ?></td>
<td><?php echo $oferta->getValor("referencia"); ?></td>
<td class="sinborde">
<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>
<td class="nombre"><?php echo $locale['1025']; ?></td>
<td><?php echo $oferta->getValor("nombre_solicitud"); ?></td>
<td colspan="3" class="sinborde">
<span class="resaltado"><?php echo $locale['135']; ?></span>&nbsp;<?php echo nl2br($oferta->getValor("observaciones")); ?>
</td>
</tr>
</table>
<div class="encabezado"><?php echo $locale['Ofertas004']?></div>
<table width="100%">
<tr>
<td class="nombre"><?php echo $locale['132']; ?></td>
<td><?php echo $oferta->getValor("nombre_estado"); ?>
<td class="sinborde">
<span class="resaltado"><?php echo $locale['132']; ?></span>
<?php echo $oferta->getValor("nombre_estado"); ?>
<div id="obsCambioEst" class="obsCambioEst">
<form id="formCambEst" action="oferta.php?idOferta=<?php echo $oferta->getValor("oid"); ?>&action=cambEstObs" method="post" >
<input type="hidden" name="action" value="cambEstObs" />
@ -149,17 +190,22 @@ echo $mensaje;
?>
</td>
</tr>
<tr>
<td class="nombre"><?php echo $locale['5107']; ?></td>
<td><?php echo nl2br($oferta->getValor("nombre_candidato")); ?></td>
</tr>
</table>
<tr>
<td class="nombre"><?php echo $locale['135']; ?></td>
<td><?php echo nl2br($oferta->getValor("observaciones")); ?></td>
</tr>
</table>
</td></tr>
<div class="encabezado"><?php echo $locale['Ofertas005']?></div>
<table width="100%">
<tr><td>
<table width="100%">
<tr>
<td>
REQUISITOS SOLICITUD
</td>
<td>
DETALLES CANDIDATO
</td>
</tr>
</table>
</td></tr>
</table>
<br/>