ImpCuadrante Class Reference

Reimplementa los items de QTableWidget2 para que podamos programar cosas en ellos. More...

#include <cuadranteqtablewidget.h>

Inheritance diagram for ImpCuadrante:

PEmpresaBase

Public Member Functions

 ImpCuadrante (Company *emp)
 ~ImpCuadrante ()
void generar ()
bool buscaConflictos (QString idtrabajador, const QDate &date, QString horain, QString horafin)

Data Fields

QString mdb_idalmacen
QDate mdb_fechacuadrante
QString mdb_idcuadrante
QString m_html

Detailed Description

Reimplementa los items de QTableWidget2 para que podamos programar cosas en ellos.

Definition at line 87 of file cuadranteqtablewidget.h.


Constructor & Destructor Documentation

ImpCuadrante::ImpCuadrante ( Company emp  ) 

Parameters:
emp 
parent 

Definition at line 433 of file cuadranteqtablewidget.cpp.

References _depura().

00433                                        :  PEmpresaBase(emp) {
00434     _depura("ImpCuadrante::ImpCuadrante", 0);
00435     _depura("END ImpCuadrante::ImpCuadrante", 0);
00436 }

ImpCuadrante::~ImpCuadrante (  ) 

Definition at line 442 of file cuadranteqtablewidget.cpp.

References _depura().

00442                             {
00443     _depura("~ImpCuadrante", 0);
00444 }


Member Function Documentation

void ImpCuadrante::generar (  ) 

Parameters:
idalmacen 
data 

Disparamos los plugins.

Si hay conflictos con el trabajador.

Definition at line 452 of file cuadranteqtablewidget.cpp.

References _depura(), buscaConflictos(), postgresiface2::cargacursor(), PEmpresaBase::empresaBase(), cursor2::eof(), g_plugins, Plugins::lanza(), m_html, mdb_fechacuadrante, mdb_idalmacen, mdb_idcuadrante, mensajeInfo(), cursor2::siguienteregistro(), and cursor2::valor().

Referenced by CuadranteQTextDocument::pintaCuadrante().

00452                            {
00453     _depura("ImpCuadrante::generar", 0, mdb_idalmacen);
00454     cursor2 *cur = NULL;
00455     cursor2 *cur1 = NULL;
00456 
00458     int res = g_plugins->lanza("ImpCuadrante_generar", this);
00459     if (res != 0) {
00460         return;
00461     } // end if
00462 
00463     try {
00464         QString html = "";
00465         cur = empresaBase()->cargacursor("SELECT * FROM cuadrante, almacen WHERE cuadrante.idalmacen = almacen.idalmacen AND almacen.idalmacen="+mdb_idalmacen+" AND cuadrante.fechacuadrante ='" +mdb_fechacuadrante.toString("dd/MM/yyyy")+ "'");
00466         if (!cur) throw -1;
00467         if (!cur->eof()) {
00468             if (cur->valor("fiestacuadrante") == "t") {
00469                 html += "<table width=\"240\" height=\"300\" bgcolor=\"#999999\"><tr><td>";
00470             } else {
00471                 html += "<table width=\"240\" height=\"300\" bgcolor=\"#FFFFFF\"><tr><td>";
00472             }
00473             html += "<font size=\"2\" color=\"#660000\"><B>" + cur->valor("nomalmacen") + "</B>: " + mdb_fechacuadrante.toString("dd/MM/yyyy")+"</font><BR>";
00474             mdb_idcuadrante = cur->valor("idcuadrante");
00475         } // end if
00476 
00477         QString oldnomtipotrabajo = "";
00478 
00479         cur1 = empresaBase()->cargacursor("SELECT * FROM horario, trabajador, tipotrabajo WHERE horario.idtrabajador = trabajador.idtrabajador AND trabajador.idtipotrabajo = tipotrabajo.idtipotrabajo AND idcuadrante = "+mdb_idcuadrante +" ORDER BY nomtipotrabajo, nomtrabajador, horainhorario ");
00480         if (!cur1) throw -1;
00481         while (!cur1->eof()) {
00482 
00483 
00484             if (oldnomtipotrabajo != cur1->valor("nomtipotrabajo") ) {
00485                 html += "<font size=\"2\" color=\"#00FF00\" >" + cur1->valor("nomtipotrabajo") + ":</font><BR>";
00486                 oldnomtipotrabajo = cur1->valor("nomtipotrabajo");
00487             } // end if
00488 
00490             if (buscaConflictos(cur1->valor("idtrabajador"), mdb_fechacuadrante, cur1->valor("horainhorario").left(5), cur1->valor("horafinhorario").left(5))) {
00491                 html += "<font size=\"3\" color=\"#FF0000\">ERROR</FONT> ";
00492             }
00493 
00494             html += "<font size=\"3\" color=\"" + cur1->valor("colortipotrabajo") + "\">" + cur1->valor("nomtrabajador") + " " + cur1->valor("apellidostrabajador");
00495             html += " (" + cur1->valor("horainhorario").left(5) + "--" + cur1->valor("horafinhorario").left(5) + ") </font><BR>";
00496 
00497             cur1->siguienteregistro();
00498         } // end while
00499         delete cur1;
00500 
00501         if (cur->valor("comentcuadrante") != "") {
00502             html += "<HR><font size=\"2\" color=\"#000000\">" + cur->valor("comentcuadrante").replace("\n", "<BR>")+"</font>";
00503         } // end if
00504         delete cur;
00505 
00506         html += "</td></tr></table>";
00507 
00508 //        QLabel::setText(html);
00509         m_html = html;
00510         _depura("END ImpCuadrante::generar", 0);
00511     } catch (...) {
00512         mensajeInfo("Error en el pintado");
00513         if (cur) delete cur;
00514         if (cur1) delete cur1;
00515         return;
00516     } // end try
00517 }

bool ImpCuadrante::buscaConflictos ( QString  idtrabajador,
const QDate &  date,
QString  horain,
QString  horafin 
)

Parameters:
idtrabajador 
date 
horain 
horafin 
Returns:

Definition at line 528 of file cuadranteqtablewidget.cpp.

References _depura(), postgresiface2::cargacursor(), PEmpresaBase::empresaBase(), cursor2::eof(), FALSE, cursor2::numregistros(), and TRUE.

Referenced by generar().

00528                                                                                                            {
00529     _depura ("ImpCuadrante::buscaConflictos", 0);
00530     bool conflicto = FALSE;
00531     QString query = "SELECT * FROM horario NATURAL LEFT JOIN cuadrante  WHERE idtrabajador = " + idtrabajador + " AND NOT (( horafinhorario < '" + horain + "') OR (horainhorario > '" + horafin +"')) AND fechacuadrante = '" + date.toString("dd/MM/yyyy") + "'";
00532     cursor2 *cur = empresaBase()->cargacursor(query);
00533     if (cur) {
00534         if (cur->numregistros() > 1) {
00535             conflicto = TRUE;
00536         } // end if
00537         delete cur;
00538     }
00539 
00540     query = "SELECT * FROM ausencia WHERE idtrabajador = " + idtrabajador + " AND fechainausencia <= '" + date.toString("dd/MM/yyyy") + "' AND fechafinausencia >= '" + date.toString("dd/MM/yyyy") + "'";
00541     cur = empresaBase()->cargacursor(query);
00542     if (cur) {
00543         if (!cur->eof()) {
00544             conflicto = TRUE;
00545         } // end if
00546         delete cur;
00547     } // end if
00548 
00549     _depura ("END ImpCuadrante::buscaConflictos", 0);
00550     return conflicto;
00551 }


Field Documentation

QString ImpCuadrante::mdb_idalmacen

Definition at line 89 of file cuadranteqtablewidget.h.

Referenced by generar(), and CuadranteQTextDocument::pintaCuadrante().

QDate ImpCuadrante::mdb_fechacuadrante

Definition at line 90 of file cuadranteqtablewidget.h.

Referenced by generar(), and CuadranteQTextDocument::pintaCuadrante().

QString ImpCuadrante::mdb_idcuadrante

Definition at line 91 of file cuadranteqtablewidget.h.

Referenced by generar(), and CuadranteQTextDocument::pintaCuadrante().

QString ImpCuadrante::m_html

Definition at line 92 of file cuadranteqtablewidget.h.

Referenced by generar(), and CuadranteQTextDocument::pintaCuadrante().


The documentation for this class was generated from the following files:
Generated on Sat Dec 15 00:01:54 2007 for BulmaGes by  doxygen 1.5.1