cuentaview.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002 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 "cuentaview.h"
00022 #include "empresa.h"
00023 
00024 
00026 
00031 CuentaView::CuentaView(Empresa  *emp, QWidget *parent, Qt::WFlags fl)
00032         : FichaBc(emp, parent, fl) {
00033     _depura("CuentaView::CuentaView", 0);
00034     setAttribute(Qt::WA_DeleteOnClose);
00035     setupUi(this);
00036 
00037     setTitleName(tr("Cuenta"));
00039     setDBTableName("cuenta");
00040     setDBCampoId("idcuenta");
00041 
00042     addDBCampo("idcuenta", DBCampo::DBint, DBCampo::DBPrimaryKey, tr("ID cuenta"));
00043     addDBCampo("codigo", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Codigo cuenta"));
00044     addDBCampo("descripcion", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Descripcion"));
00045     addDBCampo("padre", DBCampo::DBboolean  , DBCampo::DBNothing, tr("Padre"));
00046     addDBCampo("imputacion", DBCampo::DBboolean , DBCampo::DBNothing, tr("Imputacion"));
00047     addDBCampo("bloqueada", DBCampo::DBboolean , DBCampo::DBNothing, tr("Bloqueada"));
00048     addDBCampo("nodebe", DBCampo::DBboolean , DBCampo::DBNothing, tr("NoDebe"));
00049     addDBCampo("nohaber", DBCampo::DBboolean , DBCampo::DBNothing, tr("NoHaber"));
00050     addDBCampo("regularizacion", DBCampo::DBboolean , DBCampo::DBNothing, tr("Regularizacion"));
00051     addDBCampo("tipocuenta", DBCampo::DBint , DBCampo::DBNothing, tr("Tipo de Cuenta"));
00052     addDBCampo("debe", DBCampo::DBnumeric , DBCampo::DBNoSave, tr("Debe"));
00053     addDBCampo("haber", DBCampo::DBnumeric , DBCampo::DBNoSave, tr("Haber"));
00054     addDBCampo("idc_coste", DBCampo::DBint, DBCampo::DBNothing, tr("Centro de coste por defecto"));
00055     addDBCampo("nombreent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Entidad de la cuenta"));
00056     addDBCampo("cifent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("CIF de la cuenta"));
00057     addDBCampo("cpent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("CP de la cuenta"));
00058     addDBCampo("telent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Telefono de la cuenta"));
00059     addDBCampo("coment_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Comentarios de la cuenta"));
00060     addDBCampo("bancoent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Banco de la cuenta"));
00061     addDBCampo("webent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Web de la cuenta"));
00062     addDBCampo("emailent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("E-Mail de la cuenta"));
00063     addDBCampo("dirent_cuenta", DBCampo::DBvarchar, DBCampo::DBNothing, tr("Direccion de la cuenta"));
00064 
00065     mui_padre->setEmpresaBase(empresaBase());
00066     mui_idc_coste->setEmpresaBase(empresaBase());
00067 
00069     mui_tipocuenta_1->setValorCampo("1");
00070     mui_tipocuenta_2->setValorCampo("2");
00071     mui_tipocuenta_3->setValorCampo("3");
00072     mui_tipocuenta_4->setValorCampo("4");
00073     mui_tipocuenta_5->setValorCampo("5");
00074     mui_tipocuenta_0->setValorCampo("0");
00075 
00076     mui_idprovincia->setEmpresaBase(empresaBase());
00077     dialogChanges_cargaInicial();
00078     empresaBase()->meteWindow(windowTitle(), this);
00079     _depura("END CuentaView::CuentaView", 0);
00080 }
00081 
00082 
00084 
00086 CuentaView::~CuentaView() {
00087     _depura("CuentaView::~CuentaView", 0);
00088     _depura("END CuentaView::~CuentaView", 0);
00089 }
00090 
00091 
00093 
00097 int CuentaView::nuevacuenta(QString codpadre) {
00098     _depura("CuentaView::nuevacuenta", 0);
00099 
00103     QString cpadreaux;
00104     QString query;
00105     query = "SELECT * FROM cuenta WHERE padre = id_cuenta('" +codpadre+ "') ORDER BY codigo DESC";
00106     cursor2 *cur = empresaBase()->cargacursor(query);
00107     if (!cur->eof()) {
00108         long int valor = cur->valor("codigo").toLong();
00109         valor ++;
00110         cpadreaux.setNum(valor);
00111         mui_codigo->setText(cpadreaux);
00113         int tipocuenta = cur->valor("tipocuenta").toInt();
00114         switch (tipocuenta) {
00115         case 0:
00116             mui_tipocuenta_0->setChecked(TRUE);
00117             break;
00118         case 1:
00119             mui_tipocuenta_1->setChecked(TRUE);
00120             break;
00121         case 2:
00122             mui_tipocuenta_2->setChecked(TRUE);
00123             break;
00124         case 3:
00125             mui_tipocuenta_3->setChecked(TRUE);
00126             break;
00127         case 4:
00128             mui_tipocuenta_4->setChecked(TRUE);
00129             break;
00130         case 5:
00131             mui_tipocuenta_5->setChecked(TRUE);
00132             break;
00133         } // end switch
00134     } else {
00135         QString codint = codpadre;
00136         while (codint.length() < ((Empresa *)empresaBase())->numdigitosempresa() - 1) {
00137             codint = codint + "0";
00138         } // end while
00139         codint = codint+"0";
00140         mui_codigo->setText(codint);
00141     }
00142     delete cur;
00144     mui_padre->setcodigocuenta(codpadre);
00145     _depura("END CuentaView::nuevacuenta", 0);
00146     return 0;
00147 }
00148 
00149 
00150 

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