00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 }
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 }
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 }
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 }
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 }
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