busquedatipoiva.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Tomeu Borras Riera                              *
00003  *   tborras@conetxia.com                                                  *
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 "busquedatipoiva.h"
00022 #include "articulolist.h"
00023 #include "company.h"
00024 #include "funcaux.h"
00025 
00026 
00034 BusquedaTipoIva::BusquedaTipoIva(QWidget *parent)
00035         : QComboBox2(parent) {
00036     _depura("BusquedaTipoIva::BusquedaTipoIva", 0);
00037     m_cursorcombo = NULL;
00038     connect(this, SIGNAL(activated(int)), this, SLOT(m_activated(int)));
00039     _depura("END BusquedaTipoIva::BusquedaTipoIva", 0);
00040 }
00041 
00042 
00047 BusquedaTipoIva::~BusquedaTipoIva() {
00048     _depura("BusquedaTipoIva::~BusquedaTipoIva", 0);
00049     if (m_cursorcombo != NULL) {
00050         delete m_cursorcombo;
00051     } // end if
00052     _depura("END BusquedaTipoIva::~BusquedaTipoIva", 0);
00053 }
00054 
00055 
00064 void BusquedaTipoIva::setidtipo_iva(QString idtipo_iva) {
00065     _depura("BusquedaTipoIva::setidtipo_iva", 0);
00066     if (m_cursorcombo != NULL) {
00067         delete m_cursorcombo;
00068     } // end if
00069     m_cursorcombo = empresaBase()->cargacursor("SELECT * FROM tipo_iva");
00071     if (m_cursorcombo == NULL) return;
00072     int i = 0;
00073     int i1 = 0;
00074     clear();
00075     addItem("--");
00076     while (!m_cursorcombo->eof()) {
00077         i ++;
00078         if (m_cursorcombo->valor("idtipo_iva") == idtipo_iva) {
00079             i1 = i;
00080         } // end if
00081         addItem(m_cursorcombo->valor("desctipo_iva"));
00082         m_cursorcombo->siguienteregistro();
00083     } // end while
00084     setCurrentIndex(i1);
00085     _depura("END BusquedaTipoIva::setidtipo_iva", 0);
00086 }
00087 
00088 
00090 
00093 void BusquedaTipoIva::setValorCampo(QString idtipo_iva) {
00094     _depura("BusquedaTipoIva::setValorCampo", 0);
00095     setidtipo_iva(idtipo_iva);
00096     _depura("END BusquedaTipoIva::setValorCampo", 0);
00097 }
00098 
00099 
00105 QString BusquedaTipoIva::idtipo_iva() {
00106     _depura("BusquedaTipoIva::idtipo_iva", 0);
00107     _depura("END BusquedaTipoIva::idtipo_iva", 0);
00109     if (!m_cursorcombo) return "0";
00110     return m_cursorcombo->valor("idtipo_iva", currentIndex() - 1);
00111 }
00112 
00118 QString BusquedaTipoIva::valorCampo() {
00119     _depura("BusquedaTipoIva::valorCampo", 0);
00120     return idtipo_iva();
00121     _depura("END BusquedaTipoIva::valorCampo", 0);
00122 }
00123 
00124 
00130 void BusquedaTipoIva::m_activated(int index) {
00131     _depura("BusquedaTipoIva::m_activated", 0);
00132     if (index > 0) {
00133         emit(valueChanged(m_cursorcombo->valor("idtipo_iva", index - 1)));
00134     } else {
00135         emit(valueChanged(""));
00136     } // end if
00137     _depura("END BusquedaTipoIva::m_activated", 0);
00138 }
00139 
00140 
00141 
00143 
00151 BusquedaTipoIVADelegate::BusquedaTipoIVADelegate(QWidget *parent)
00152         : QComboBox2(parent) {
00153     _depura("BusquedaTipoIVADelegate::BusquedaTipoIVADelegate", 0);
00154     m_cursorcombo = NULL;
00155     setSizeAdjustPolicy(QComboBox::AdjustToContents);
00156     connect(this, SIGNAL(activated(int)), this, SLOT(m_activated(int)));
00157     _depura("END BusquedaTipoIVADelegate::BusquedaTipoIVADelegate", 0);
00158 }
00159 
00160 
00165 BusquedaTipoIVADelegate::~BusquedaTipoIVADelegate() {
00166     _depura("BusquedaTipoIVADelegate::~BusquedaTipoIVADelegate", 0);
00167     if (m_cursorcombo != NULL) {
00168         delete m_cursorcombo;
00169     } // end if
00170     _depura("END BusquedaTipoIVADelegate::~BusquedaTipoIVADelegate", 0);
00171 }
00172 
00173 
00181 void BusquedaTipoIVADelegate::set(const QString &cod) {
00182     _depura("BusquedaTipoIVADelegate::set", 0);
00183     int index = 0;
00184     QString codigo = cod;
00185 
00186     if (m_cursorcombo != NULL) {
00187         delete m_cursorcombo;
00188     } // end if
00189 
00190     m_cursorcombo = empresaBase()->cargacursor("SELECT desctipo_iva FROM tipo_iva ");
00192     if (!m_cursorcombo) return;
00193 
00194     clear();
00195     while (!m_cursorcombo->eof()) {
00196         addItem(m_cursorcombo->valor("desctipo_iva"));
00197         m_cursorcombo->siguienteregistro();
00198         if (m_cursorcombo->valor("desctipo_iva") == cod)
00199         index = m_cursorcombo->regactual();
00200     } // end while
00201     setEditText(cod);
00202     setCurrentIndex(index);
00203 
00204     _depura("END BusquedaTipoIVADelegate::set", 0);
00205 }
00206 

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