busquedaformapago.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 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 "qcombobox2.h"
00022 
00023 #include "busquedaformapago.h"
00024 
00025 
00030 
00031 
00034 BusquedaFormaPago::BusquedaFormaPago(QWidget *parent)
00035         : QComboBox2(parent) {
00036     _depura("BusquedaFormaPago::BusquedaFormaPago", 0);
00037     m_cursorcombo = NULL;
00038     connect(this, SIGNAL(activated(int)), this, SLOT(m_activated(int)));
00039     _depura("END BusquedaFormaPago::BusquedaFormaPago", 0);
00040 }
00041 
00042 
00047 BusquedaFormaPago::~BusquedaFormaPago() {
00048     _depura("BusquedaFormaPago::~BusquedaFormaPago", 0);
00049     if (m_cursorcombo != NULL)
00050         delete m_cursorcombo;
00051     _depura("END BusquedaFormaPago::~BusquedaFormaPago", 0);
00052 }
00053 
00054 
00060 
00061 
00065 void BusquedaFormaPago::setidforma_pago(QString idforma_pago) {
00066     _depura("BusquedaFormaPago::setidforma_pago", 0);
00067     if (m_cursorcombo != NULL)
00068         delete m_cursorcombo;
00069     m_cursorcombo = empresaBase()->cargacursor("SELECT * FROM forma_pago");
00070     if (!m_cursorcombo) return;
00071     int i = 0;
00072     int i1 = 0;
00073     clear();
00074     addItem("--");
00075     while (!m_cursorcombo->eof()) {
00076         i ++;
00077         if (m_cursorcombo->valor("idforma_pago") == idforma_pago)
00078             i1 = i;
00079         addItem(m_cursorcombo->valor("descforma_pago"));
00080         m_cursorcombo->siguienteregistro();
00081     } // end while
00082     setCurrentIndex(i1);
00083     _depura("END BusquedaFormaPago::setidforma_pago", 0);
00084 }
00085 
00086 
00088 
00091 void BusquedaFormaPago::setValorCampo(QString idforma_pago) {
00092     _depura("BusquedaFormaPago::setValorCampo", 0);
00093         setidforma_pago(idforma_pago);
00094     _depura("END BusquedaFormaPago::setValorCampo", 0);
00095 }
00096 
00097 
00099 
00103 void BusquedaFormaPago::setIdCliente(QString idcliente) {
00104     _depura("BusquedaFormaPago::setIdCliente", 0, idcliente);
00105 
00106 
00108     if (idcliente == "") {
00109         _depura("END BusquedaFormaPago::setIdCliente", 0, "idcliente invalido");
00110         return;
00111     } // end if
00112 
00113     cursor2 *cur = empresaBase()->cargacursor("SELECT idforma_pago FROM cliente WHERE idcliente = " + idcliente);
00114 
00115     if (!cur->eof()) {
00116         setidforma_pago(cur->valor("idforma_pago"));
00117     } // end if
00118     delete cur;
00119     _depura("END BusquedaFormaPago::setIdCliente", 0);
00120 }
00121 
00122 
00124 
00128 void BusquedaFormaPago::setIdProveedor(QString idproveedor) {
00129     _depura("BusquedaFormaPago::setIdProveedor", 0, idproveedor);
00130 
00132     if (idproveedor == "")
00133         return;
00134 
00135     cursor2 * cur = empresaBase()->cargacursor("SELECT idforma_pago FROM proveedor WHERE idproveedor="+idproveedor);
00136 
00137     if (!cur->eof()) {
00138         setidforma_pago(cur->valor("idforma_pago"));
00139     } // end if
00140     delete cur;
00141     _depura("END BusquedaFormaPago::setIdProveedor", 0);
00142 }
00143 
00144 
00146 
00149 void BusquedaFormaPago::m_activated(int index) {
00150     _depura("BusquedaFormaPago::m_activated", 0);
00151     if (index > 0) {
00152         emit(valueChanged(m_cursorcombo->valor("idforma_pago", index - 1)));
00153     } else {
00154         emit(valueChanged(""));
00155     } // end if
00156     _depura("END BusquedaFormaPago::m_activated", 0);
00157 }
00158 
00159 
00165 QString BusquedaFormaPago::idforma_pago() {
00166     _depura("BusquedaFormaPago::idforma_pago", 0);
00167     _depura("END BusquedaFormaPago::idforma_pago", 0);
00168     if (!m_cursorcombo) return "0";
00169     return (m_cursorcombo->valor("idforma_pago", currentIndex() - 1));
00170 }
00171 
00172 
00178 QString BusquedaFormaPago::valorCampo() {
00179     return idforma_pago();
00180 }
00181 
00182 

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