tickets.cpp

Go to the documentation of this file.
00001 #include <QWidget>
00002 #include <QPushButton>
00003 #include "tickets.h"
00004 #include "funcaux.h"
00005 #include "empresatpv.h"
00006 #include "ticket.h"
00007 
00008 
00009 
00010 Tickets::Tickets(EmpresaBase *emp, QWidget *parent) : QDialog(parent), PEmpresaBase(emp) {
00011     setupUi(this);
00012     EmpresaTPV *emp1 = (EmpresaTPV *) emp;
00013     Ticket *ticket;
00014     for (int i = 0; i < emp1->listaTickets()->size(); ++i) {
00015         ticket = emp1->listaTickets()->at(i);
00016         if (ticket->DBvalue("idtrabajador") == emp1->ticketActual()->DBvalue("idtrabajador")) {
00017                 QPushButton *toolbutton = new QPushButton( mui_frame);
00018                 toolbutton->setText(ticket->DBvalue("nomticket"));
00019         
00020                 QVBoxLayout *m_hboxLayout1 = mui_frame->findChild<QVBoxLayout *>("hboxLayout1");
00021                 if (!m_hboxLayout1) {
00022                 m_hboxLayout1 = new QVBoxLayout(mui_frame);
00023                 m_hboxLayout1->setSpacing(5);
00024                 m_hboxLayout1->setMargin(5);
00025                 m_hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
00026                 } // end if
00027                 m_hboxLayout1->addWidget(toolbutton);
00028                 connect(toolbutton,SIGNAL(pressed()), this, SLOT(ticketClicked()));
00029         } // end if
00030     }// end for
00031 }
00032 
00033 
00034 Tickets::~Tickets() {}
00035 
00036 void Tickets::ticketClicked() {
00037     EmpresaTPV *emp1 = (EmpresaTPV *) empresaBase();
00038         QPushButton *toolbutton = (QPushButton *) sender();
00039     Ticket *ticket;
00040     for (int i = 0; i < emp1->listaTickets()->size(); ++i) {
00041         ticket = emp1->listaTickets()->at(i);
00042 
00043         if (toolbutton->text() == ticket->DBvalue("nomticket") 
00044         && ticket->DBvalue("idtrabajador") == emp1->ticketActual()->DBvalue("idtrabajador")) {
00045                 ((EmpresaTPV *) empresaBase())->setTicketActual(ticket);
00046                 ticket->pintar();
00047         }// end if
00048     }// end for 
00049 
00050     done(0);
00051 }

Generated on Sat Dec 15 00:01:23 2007 for BulmaGes by  doxygen 1.5.1