zlist.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by J. M. Estopa Rey                                *
00003  *   pepma@telefonica.net                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <QLineEdit>
00022 #include <QTextStream>
00023 #include <QFileDialog>
00024 #include <QCheckBox>
00025 #include <QMessageBox>
00026 
00027 #include "zlist.h"
00028 #include "zview.h"
00029 #include "company.h"
00030 #include "funcaux.h"
00031 #include "plugins.h"
00032 
00033 
00034 
00035 
00037 
00043 ZList::ZList(Company *comp, QWidget *parent, Qt::WFlags flag)
00044         : Listado(comp, parent, flag) {
00045     _depura("ZList::ZList(2)", 0);
00046     setupUi(this);
00047     setAttribute(Qt::WA_DeleteOnClose);
00049     int res = g_plugins->lanza("ZList_ZList", this);
00050     if (res != 0)
00051         return;
00052     mui_list->setEmpresaBase(comp);
00053     setSubForm(mui_list);
00054 
00055     mui_list->setDBTableName("z");
00056     mui_list->setDBCampoId("idz");
00057     mui_list->addSHeader("idz", DBCampo::DBint, DBCampo::DBNotNull | DBCampo::DBPrimaryKey, SHeader::DBNoView | SHeader::DBNoWrite, tr("ID Z"));
00058     mui_list->addSHeader("fechaz", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone | SHeader::DBNoWrite, tr("Fecha"));
00059     mui_list->addSHeader("horaz", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone | SHeader::DBNoWrite, tr("Hora"));
00060     mui_list->addSHeader("nomalmacen", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone | SHeader::DBNoWrite, tr("Almacen"));
00061     mui_list->addSHeader("totalz", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone | SHeader::DBNoWrite, tr("Total"));
00062     mui_list->addSHeader("numtickets", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone | SHeader::DBNoWrite, tr("Tickets"));
00063     mui_list->addSHeader("idalmacen", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone | SHeader::DBNoWrite, tr("Id. almacen"));
00064 
00065     mui_list->setinsercion(FALSE);
00066     mui_list->setDelete(FALSE);
00067     mui_list->setSortingEnabled(TRUE);
00068 
00069     presentar();
00070     m_idz = "";
00071     empresaBase()->meteWindow(windowTitle(), this);
00072     hideBusqueda();
00074     trataPermisos("almacen");
00075     _depura("END ZList::ZList(2)", 0);
00076 }
00077 
00078 
00080 
00082 ZList::~ZList() {
00083     _depura("ZList::~ZList", 0);
00084     _depura("END ZList::~ZList", 0);
00085 }
00086 
00087 
00089 
00092 QString ZList::idalmacen() {
00093     _depura("ZList::idalmacenk", 0);
00094     _depura("END ZList::idalmacenk", 0);
00095     return m_idz;
00096 }
00097 
00098 
00100 
00103 void ZList::setEmpresaBase(Company *comp) {
00104     _depura("ZList::setEmpresaBase", 0);
00105     PEmpresaBase::setEmpresaBase(comp);
00106     mui_list->setEmpresaBase(comp);
00107     _depura("END ZList::setEmpresaBase", 0);
00108 }
00109 
00110 
00112 
00114 void ZList::crear() {
00115     _depura("ZList::crear", 0);
00116 /*
00117     ZView *alm = new ZView((Company *)empresaBase(), 0);
00118     empresaBase()->pWorkspace()->addWindow(alm);
00119     alm->show();
00120 */
00121     _depura("END ZList::crear", 0);
00122 }
00123 
00124 
00126 
00128 void ZList::presentar() {
00129     _depura("ZList::presentar", 0);
00130 
00132     mui_list->cargar("SELECT * FROM z NATURAL LEFT JOIN almacen");
00133 
00134     _depura("END ZList::presentar", 0);
00135 }
00136 
00137 
00139 
00142 QString ZList::generaFiltro() {
00143     _depura("ZList::generaFiltro", 0);
00145     QString filtro = "";
00146 
00147     return (filtro);
00148     _depura("END ZList::generaFiltro", 0);
00149 }
00150 
00151 
00153 
00156 void ZList::editar(int row) {
00157     _depura("ZList::editar", 0);
00158 
00159     try {
00160         m_idz = mui_list->DBvalue(QString("idz"), row);
00161 
00162         if (modoEdicion()) {
00163             ZView *alm = new ZView((Company *)empresaBase(), 0);
00164             empresaBase()->pWorkspace()->addWindow(alm);
00165             alm->show();
00166             alm->cargar(m_idz);
00167         } else {
00168             emit(selected(m_idz));
00169         } // end if
00170         _depura("END ZList::editar", 0);
00171     } catch (...) {
00172         mensajeInfo(tr("Error al editar el almacen"));
00173     } // end try
00174 
00175 }
00176 
00177 
00179 
00181 void ZList::imprimir() {
00182     _depura("ZList::imprimir", 0);
00183     mui_list->imprimirPDF(tr("Almacenes"));
00184     _depura("END ZList::imprimir", 0);
00185 }
00186 
00187 
00189 
00192 void ZList::borrar() {
00193     _depura("ZList::borrar", 0);
00194 /*
00195     int a = mui_list->currentRow();
00196     if (a < 0) {
00197         mensajeInfo(tr("Debe seleccionar una linea"));
00198         return;
00199     } // end if
00200     try {
00201         m_idz = mui_list->DBvalue(QString("idalmacen"));
00202         if (modoEdicion()) {
00203             ZView *alm = new ZView((Company *)empresaBase(), 0);
00204             empresaBase()->pWorkspace()->addWindow(alm);
00205 //            alm->show();
00206             alm->cargar(m_idz);
00207             alm->on_mui_borrar_clicked();
00208             alm->close();
00209 
00210         } // end if
00211         presentar();
00212     } catch (...) {
00213         mensajeInfo(tr("Error al borrar el almacen"));
00214     } // end try
00215 */
00216     _depura("END ZList::borrar", 0);
00217 }
00218 
00219 
00220 

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