company.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by J. M. Torres Rigo                               *
00003  *   joanmi@bulma.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 <Qt>
00022 #include <QObject>
00023 #include <qnamespace.h>
00024 #include <QFile>
00025 #include <QTextStream>
00026 #include <QDomDocument>
00027 
00028 #include "stdio.h"
00029 
00030 #include "abreempresaview.h"
00031 #include "albaranclientelist.h"
00032 #include "albaranclienteview.h"
00033 #include "albaranesproveedor.h"
00034 #include "albaranproveedorview.h"
00035 #include "articulolist.h"
00036 #include "articuloview.h"
00037 #include "clienteview.h"
00038 #include "clientslist.h"
00039 #include "cobroslist.h"
00040 #include "cobroview.h"
00041 #include "company.h"
00042 #include "facturapview.h"
00043 #include "facturaslist.h"
00044 #include "facturasplist.h"
00045 #include "facturaview.h"
00046 #include "familiasview.h"
00047 #include "fpagoview.h"
00048 #include "funcaux.h"
00049 #include "listalmacenview.h"
00050 #include "listconfiguracionview.h"
00051 #include "listseriefacturaview.h"
00052 #include "pagoslist.h"
00053 #include "pagoview.h"
00054 #include "pedidoclienteview.h"
00055 #include "pedidoproveedorview.h"
00056 #include "pedidosclientelist.h"
00057 #include "pedidosproveedorlist.h"
00058 #include "plugins.h"
00059 #include "presupuestolist.h"
00060 #include "presupuestoview.h"
00061 #include "provedit.h"
00062 #include "providerslist.h"
00063 #include "tiposarticuloview.h"
00064 #include "trabajadorview.h"
00065 #include "bancoview.h"
00066 #include "listtipoivaview.h"
00067 #include "listtasaivaview.h"
00068 #include "bulmafact.h"
00069 
00070 
00076 Company::Company(Bulmafact *bges) : EmpresaBase() {
00077     _depura("Company::Company", 0);
00078     m_bulmafact = bges;
00079     _depura("END Company::Company", 0);
00080 }
00081 
00082 
00084 
00086 Company::~Company() {
00087     _depura("Company::~Company", 0);
00088 
00090     guardaConf();
00091 
00093     m_listventanas->vaciarCompleto();
00094     _depura("END Company::~Company", 0);
00095 }
00096 
00097 
00106 void Company::createMainWindows(Splash *splash) {
00107     _depura("Company::createMainWindows", 0);
00110     _depura("Company::createMainWindows inicializamos m_articleslist", 1);
00111     splash->mensaje(QApplication::translate("Company", "Inicializando listado de articulos"));
00112     splash->setBarraProgreso(7);
00113     m_progressbar->setValue(0);
00115     m_bulmafact->actionListado_de_Articulos->setEnabled(FALSE);
00116     m_bulmafact->actionNuevo_Articulo->setEnabled(FALSE);
00117     m_bulmafact->actionGestion_Familias->setEnabled(FALSE);
00118     m_bulmafact->actionGestion_Tipos_Articulo->setEnabled(FALSE);
00119 
00120     if (has_table_privilege("articulo", "SELECT")) {
00121         m_articleslist = new ArticuloList(this);
00122         m_pWorkspace->addWindow(m_articleslist);
00123         m_articleslist->hide();
00124         m_bulmafact->actionListado_de_Articulos->setEnabled(TRUE);
00125         m_bulmafact->actionNuevo_Articulo->setEnabled(TRUE);
00126         m_bulmafact->actionGestion_Familias->setEnabled(TRUE);
00127         m_bulmafact->actionGestion_Tipos_Articulo->setEnabled(TRUE);
00128     } // end if
00129 
00131     _depura("Company::createMainWindows inicializamos m_providerslist", 1);
00132     splash->mensaje(QApplication::translate("Company","Inicializando listado de proveedores"));
00133     splash->setBarraProgreso(10);
00134     m_progressbar->setValue(8);
00136     m_bulmafact->actionListado_Clientes->setEnabled(FALSE);
00137     m_bulmafact->actionNuevo_Cliente->setEnabled(FALSE);
00138 
00139     if (has_table_privilege("cliente", "SELECT")) {
00140         m_clientsList = new ClientsList(this);
00141         m_pWorkspace->addWindow(m_clientsList);
00142         m_clientsList->hide();
00143         m_bulmafact->actionListado_Clientes->setEnabled(TRUE);
00144         m_bulmafact->actionNuevo_Cliente->setEnabled(TRUE);
00145     } // end if
00146 
00148     _depura("Company::createMainWindows inicializamos m_clientesList", 1);
00149     splash->mensaje(QApplication::translate("Company","Inicializando listado de clientes"));
00150     splash->setBarraProgreso(16);
00151     m_progressbar->setValue(16);
00153     m_bulmafact->actionListado_Proveedores->setEnabled(FALSE);
00154     m_bulmafact->actionNuevo_Proveedor->setEnabled(FALSE);
00155 
00156     if (has_table_privilege("proveedor", "SELECT")) {
00157         m_providerslist = new ProveedorList(this);
00158         m_pWorkspace->addWindow(m_providerslist);
00159         m_providerslist->hide();
00160         m_bulmafact->actionListado_Proveedores->setEnabled(TRUE);
00161         m_bulmafact->actionNuevo_Proveedor->setEnabled(TRUE);
00162     } // end if
00163 
00165     _depura("Company::createMainWindows inicializamos m_presupuestosList", 1);
00166     splash->mensaje(QApplication::translate("Company","Inicializando listado de presupuestos a clientes"));
00167     splash->setBarraProgreso(32);
00168     m_progressbar->setValue(32);
00170     m_bulmafact->actionListado_Presupuestos->setEnabled(FALSE);
00171     m_bulmafact->actionNuevo_Presupuesto->setEnabled(FALSE);
00172 
00173     if (has_table_privilege("presupuesto", "SELECT")) {
00174         m_presupuestosList = new PresupuestoList(this);
00175         m_pWorkspace->addWindow(m_presupuestosList);
00176         m_presupuestosList->hide();
00177         m_bulmafact->actionListado_Presupuestos->setEnabled(TRUE);
00178         m_bulmafact->actionNuevo_Presupuesto->setEnabled(TRUE);
00179     } // end if
00180 
00182     _depura("Company::createMainWindows inicializamos m_pedidosclienteList", 1);
00183     splash->mensaje(QApplication::translate("Company","Inicializando listado de pedidos de clientes"));
00184     splash->setBarraProgreso(40);
00185     m_progressbar->setValue(40);
00187     m_bulmafact->actionListado_Pedidos_Cliente->setEnabled(FALSE);
00188     m_bulmafact->actionNuevo_Pedido_Cliente->setEnabled(FALSE);
00189 
00190     if (has_table_privilege("pedidocliente", "SELECT")) {
00191         m_pedidosclienteList = new PedidosClienteList(this);
00192         m_pWorkspace->addWindow(m_pedidosclienteList);
00193         m_pedidosclienteList->hide();
00194         m_bulmafact->actionListado_Pedidos_Cliente->setEnabled(TRUE);
00195         m_bulmafact->actionNuevo_Pedido_Cliente->setEnabled(TRUE);
00196     } // end if
00197 
00199     _depura("Company::createMainWindows inicializamos m_clientDelivNotesList", 1);
00200     splash->mensaje(QApplication::translate("Company","Inicializando listado de albaranes a clientes"));
00201     splash->setBarraProgreso(48);
00202     m_progressbar->setValue(48);
00204     m_bulmafact->actionListado_Albaranes_Cliente->setEnabled(FALSE);
00205     m_bulmafact->actionNuevo_Albaran_Cliente->setEnabled(FALSE);
00206 
00207     if (has_table_privilege("albaran", "SELECT")) {
00208         m_clientDelivNotesList = new AlbaranClienteList(this);
00209         m_pWorkspace->addWindow(m_clientDelivNotesList);
00210         m_clientDelivNotesList->hide();
00211         m_bulmafact->actionListado_Albaranes_Cliente->setEnabled(TRUE);
00212         m_bulmafact->actionNuevo_Albaran_Cliente->setEnabled(TRUE);
00213     } // end if
00214 
00216     _depura("Company::createMainWindows inicializamos m_facturasList", 0);
00217     splash->mensaje(QApplication::translate("Company","Inicializando listado de facturas"));
00218     splash->setBarraProgreso(56);
00219     m_progressbar->setValue(56);
00221     m_bulmafact->actionListado_Facturas_Cliente->setEnabled(FALSE);
00222     m_bulmafact->actionNueva_Factura_Cliente->setEnabled(FALSE);
00223 
00224     if (has_table_privilege("factura", "SELECT")) {
00225         m_facturasList = new FacturasList(this);
00226         m_pWorkspace->addWindow(m_facturasList);
00227         m_facturasList->hide();
00228         m_bulmafact->actionListado_Facturas_Cliente->setEnabled(TRUE);
00229         m_bulmafact->actionNueva_Factura_Cliente->setEnabled(TRUE);
00230     } // end if
00231 
00233     _depura("Company::createMainWindows inicializamos m_cobrosList", 1);
00234     splash->mensaje(QApplication::translate("Company","Inicializando listado de cobros"));
00235     splash->setBarraProgreso(64);
00236     m_progressbar->setValue(64);
00238     m_bulmafact->actionListado_de_Cobros->setEnabled(FALSE);
00239     m_bulmafact->actionNuevo_Cobro->setEnabled(FALSE);
00240 
00241     if (has_table_privilege("cobro", "SELECT")) {
00242         m_cobrosList = new CobrosList(this);
00243         m_pWorkspace->addWindow(m_cobrosList);
00244         m_cobrosList->hide();
00245         m_bulmafact->actionListado_de_Cobros->setEnabled(TRUE);
00246         m_bulmafact->actionNuevo_Cobro->setEnabled(TRUE);
00247     } // end if
00248 
00250     _depura("Company::createMainWindows inicializamos m_pedidosproveedorlist", 1);
00251     splash->mensaje(QApplication::translate("Company","Inicializando listado de pedidos a proveedores"));
00252     splash->setBarraProgreso(72);
00253     m_progressbar->setValue(72);
00255     m_bulmafact->actionListado_Pedidos_Proveedor->setEnabled(FALSE);
00256     m_bulmafact->actionNuevo_Pedido_Proveedor->setEnabled(FALSE);
00257 
00258     if (has_table_privilege("pedidoproveedor", "SELECT")) {
00259         m_pedidosproveedorList = new PedidosProveedorList(this);
00260         m_pWorkspace->addWindow(m_pedidosproveedorList);
00261         m_pedidosproveedorList->hide();
00262         m_bulmafact->actionListado_Pedidos_Proveedor->setEnabled(TRUE);
00263         m_bulmafact->actionNuevo_Pedido_Proveedor->setEnabled(TRUE);
00264     } // end if
00265 
00267     _depura("Company::createMainWindows inicializamos m_albaranesproveedorlist", 1);
00268     splash->mensaje(QApplication::translate("Company","Inicializando listado de albaranes de proveedores"));
00269     splash->setBarraProgreso(80);
00270     m_progressbar->setValue(80);
00272     m_bulmafact->actionListado_Albaranes_Proveedor->setEnabled(FALSE);
00273     m_bulmafact->actionNuevo_Albaran_Proveedor->setEnabled(FALSE);
00274 
00275     if (has_table_privilege("albaranp", "SELECT")) {
00276         m_albaranesproveedor = new AlbaranesProveedor(this);
00277         m_pWorkspace->addWindow(m_albaranesproveedor);
00278         m_albaranesproveedor->hide();
00279         m_bulmafact->actionListado_Albaranes_Proveedor->setEnabled(TRUE);
00280         m_bulmafact->actionNuevo_Albaran_Proveedor->setEnabled(TRUE);
00281     } // end if
00282 
00284     _depura("Company::createMainWindows inicializamos m_facturasproveedorlist", 1);
00285     splash->mensaje(QApplication::translate("Company","Inicializando listado de facturas de proveedores"));
00286     splash->setBarraProgreso(88);
00287     m_progressbar->setValue(88);
00289     m_bulmafact->actionListado_Facturas_Proveedor->setEnabled(FALSE);
00290     m_bulmafact->actionNueva_Factura_Proveedor->setEnabled(FALSE);
00291 
00292     if (has_table_privilege("facturap", "SELECT")) {
00293         m_facturasproveedorlist = new FacturasProveedorList(this);
00294         m_pWorkspace->addWindow(m_facturasproveedorlist);
00295         m_facturasproveedorlist->hide();
00296         m_bulmafact->actionListado_Facturas_Proveedor->setEnabled(TRUE);
00297         m_bulmafact->actionNueva_Factura_Proveedor->setEnabled(TRUE);
00298     } // end if
00299 
00301     _depura("Company::createMainWindows inicializamos m_pagosList", 1);
00302     splash->mensaje(QApplication::translate("Company","Inicializando listado de pagos"));
00303     splash->setBarraProgreso(96);
00304     m_progressbar->setValue(96);
00305 
00307     m_bulmafact->actionListado_de_Pagos->setEnabled(FALSE);
00308     m_bulmafact->actionNuevo_Pago->setEnabled(FALSE);
00309 
00310     if (has_table_privilege("pago", "SELECT")) {
00311         m_pagosList = new PagosList(this);
00312         m_pWorkspace->addWindow(m_pagosList);
00313         m_pagosList->hide();
00314         m_bulmafact->actionListado_de_Pagos->setEnabled(TRUE);
00315         m_bulmafact->actionNuevo_Pago->setEnabled(TRUE);
00316     } // end if
00317 
00319     m_bulmafact->actionTasaIVA->setEnabled(FALSE);
00320     m_bulmafact->actionTipoIVA->setEnabled(FALSE);
00321 
00322     if (has_table_privilege("tipo_iva", "SELECT")) {
00323         m_bulmafact->actionTasaIVA->setEnabled(TRUE);
00324         m_bulmafact->actionTipoIVA->setEnabled(TRUE);
00325     } // end if
00326 
00328     m_bulmafact->actionPaises->setEnabled(FALSE);
00329 
00330     if (has_table_privilege("pais", "SELECT")) {
00331         m_bulmafact->actionPaises->setEnabled(TRUE);
00332     } // end if
00333 
00335     m_bulmafact->actionTrabajadores->setEnabled(FALSE);
00336 
00337     if (has_table_privilege("trabajador", "SELECT")) {
00338         m_bulmafact->actionTrabajadores->setEnabled(TRUE);
00339     } // end if
00340 
00342     m_bulmafact->actionFormas_de_Pago->setEnabled(FALSE);
00343 
00344     if (has_table_privilege("forma_pago", "SELECT")) {
00345         m_bulmafact->actionFormas_de_Pago->setEnabled(TRUE);
00346     } // end if
00347 
00349     m_bulmafact->actionSeries_de_Factura->setEnabled(FALSE);
00350 
00351     if (has_table_privilege("serie_factura", "SELECT")) {
00352         m_bulmafact->actionSeries_de_Factura->setEnabled(TRUE);
00353     } // end if
00354 
00356     m_bulmafact->actionBancos->setEnabled(FALSE);
00357 
00358     if (has_table_privilege("banco", "SELECT")) {
00359         m_bulmafact->actionBancos->setEnabled(TRUE);
00360     } // end if
00361 
00363     m_bulmafact->actionAlmacenes->setEnabled(FALSE);
00364 
00365     if (has_table_privilege("almacen", "SELECT")) {
00366         m_bulmafact->actionAlmacenes->setEnabled(TRUE);
00367     } // end if
00368 
00370     m_progressbar->setValue(100);
00371 
00373     int res = g_plugins->lanza("Company_createMainWindows_Post", this);
00374     if (res != 0) {
00375         return;
00376     } // end if
00377 
00378     cargaConf();
00379 
00381     m_bulmafact->statusBar()->showMessage(nameDB(), 2000);
00382     m_bulmafact->setWindowTitle(QApplication::translate("Company", "Facturacion GPL") + " :: " + nameDB());
00383 
00384     _depura("END Company::createMainWindows", 0);
00385 }
00386 
00387 
00393 void Company::viewCobrosList() {
00394     _depura("Company::viewCobrosList", 0);
00395     m_cobrosList->show();
00396     m_cobrosList->parentWidget()->raise();
00397     m_pWorkspace->setActiveWindow(m_cobrosList);
00398     _depura("END Company::viewCobrosList", 0);
00399 }
00400 
00401 
00407 void Company::viewPagosList() {
00408     _depura("Company::viewPagosList", 0);
00409     m_pagosList->show();
00410     m_pagosList->parentWidget()->raise();
00411     m_pWorkspace->setActiveWindow(m_pagosList);
00412     _depura("END Company::viewPagosList", 0);
00413 }
00414 
00415 
00421 void Company::listproviders() {
00422     _depura("Company::listproviders", 0);
00423     m_providerslist->show();
00424     m_providerslist->parentWidget()->raise();
00425     m_pWorkspace->setActiveWindow(m_providerslist);
00426     _depura("END Company::listproviders", 0);
00427 }
00428 
00429 
00435 void Company::listClients() {
00436     _depura("Company::listClients", 0);
00437     m_clientsList->show();
00438     m_clientsList->parentWidget()->raise();
00439     m_pWorkspace->setActiveWindow(m_clientsList);
00440     _depura("END Company::listClients", 0);
00441 }
00442 
00443 
00449 void Company::listarticles() {
00450     _depura("Company::listarticles", 0);
00451     m_articleslist->show();
00452     m_articleslist->parentWidget()->raise();
00453     m_pWorkspace->setActiveWindow(m_articleslist);
00454     _depura("END Company::listarticles", 0);
00455 }
00456 
00457 
00464 void Company::refreshArticles() {
00465     _depura("Company::refreshArticles", 0);
00466     if (m_articleslist != NULL)
00467         m_articleslist->presentar();
00468     _depura("END Company::refreshArticles", 0);
00469 }
00470 
00471 
00479 ClienteView *Company::newClienteView() {
00480     _depura("Company::newClienteView", 0);
00482     ClienteView *bud;
00483     if (g_plugins->lanza("Company_newClienteView", this, (void **)&bud))
00484         return bud;
00485     bud = new ClienteView(this, 0);
00486     _depura("END Company::newClienteView", 0);
00487     return bud;
00488 }
00489 
00490 
00497 void Company::s_newClienteView() {
00498     _depura("Company::s_newClienteView", 0);
00499     ClienteView *bud = newClienteView();
00500     m_pWorkspace->addWindow(bud);
00501     bud->pintar();
00502     bud->show();
00503     _depura("END Company::s_newClienteView", 0);
00504 }
00505 
00506 
00514 ProveedorView *Company::newProveedorView() {
00515     _depura("Company::newProveedorView",0);
00517     ProveedorView *bud;
00518     if (g_plugins->lanza("Company_newProveedorView", this, (void **)&bud))
00519         return bud;
00520     bud = new ProveedorView(this, 0);
00521     _depura("END Company::newProveedorView",0);
00522     return bud;
00523 }
00524 
00525 
00532 void Company::s_newProveedorView() {
00533     _depura("Company::s_newProveedorView", 0);
00534     ProveedorView *bud = newProveedorView();
00535     m_pWorkspace->addWindow(bud);
00536     bud->show();
00537     _depura("END Company::s_newProveedorView", 0);
00538 }
00539 
00540 
00550 FacturaProveedorView *Company::newFacturaProveedorView() {
00551     _depura("Company::newFacturaProveedorView", 0);
00553     FacturaProveedorView *bud;
00554     if (g_plugins->lanza("Company_newFacturaProveedorView", this, (void **)&bud))
00555         return bud;
00556     bud = new FacturaProveedorView(this, 0);
00557     _depura("END Company::newFacturaProveedorView", 0);
00558     return bud;
00559 }
00560 
00561 
00568 void Company::s_newFacturaPro() {
00569     FacturaProveedorView *bud = newFacturaProveedorView();
00570     m_pWorkspace->addWindow(bud);
00571     bud->inicializar();
00572     bud->show();
00573     _depura("END Company::s_newFacturaPro", 0);
00574 }
00575 
00576 
00586 CobroView *Company::newCobroView() {
00587     _depura("Company::newCobroView", 0);
00588     CobroView *bud;
00589     if (g_plugins->lanza("Company_newCobroView", this, (void **)&bud))
00590         return bud;
00591     bud = new CobroView(this, 0);
00592     _depura("END Company::newCobroView", 0);
00593     return bud;
00594 }
00595 
00596 
00603 void Company::s_newCobroView() {
00604     _depura("Company::s_newCobroView", 0);
00605     CobroView *bud = newCobroView();
00606     m_pWorkspace->addWindow(bud);
00607     bud->show();
00608     _depura("END Company::s_newCobroView", 0);
00609 }
00610 
00611 
00615 
00616 
00618 void Company::s_newAlbaranPro() {
00619     _depura ("Company::s_newAlbaranPro", 0);
00620     AlbaranProveedorView *bud = new AlbaranProveedorView(this, 0);
00621     m_pWorkspace->addWindow(bud);
00622     bud->inicializar();
00623     bud->show();
00624     _depura ("END Company::s_newAlbaranPro", 0);
00625 }
00626 
00627 
00631 
00632 
00634 void Company::s_newPedidoPro() {
00635     _depura ("Company::s_newPedidoPro", 0);
00636     PedidoProveedorView *ppv = new PedidoProveedorView(this, 0);
00637     m_pWorkspace->addWindow(ppv);
00638     ppv->pintar();
00639     ppv->show();
00640     _depura ("END Company::s_newPedidoPro", 0);
00641 }
00642 
00643 
00649 void Company::lAlbaranesProveedor() {
00650     _depura("Company::lAlbaranesProveedor", 0);
00651     m_albaranesproveedor->show();
00652     m_albaranesproveedor->parentWidget()->raise();
00653     m_pWorkspace->setActiveWindow(m_albaranesproveedor);
00654     _depura("END Company::lAlbaranesProveedor", 0);
00655 }
00656 
00657 
00663 void Company::s_listPedidosCli() {
00664     _depura("Company::s_listPedidosCli", 0);
00665     m_pedidosclienteList->show();
00666     m_pedidosclienteList->parentWidget()->raise();
00667     m_pWorkspace->setActiveWindow(m_pedidosclienteList);
00668     _depura("END Company::s_listPedidosCli", 0);
00669 }
00670 
00671 
00677 void Company::s_listPedidosPro() {
00678     _depura("Company::s_listPedidosPro", 0);
00679     m_pedidosproveedorList->show();
00680     m_pedidosproveedorList->parentWidget()->raise();
00681     m_pWorkspace->setActiveWindow(m_pedidosproveedorList);
00682     _depura("END Company::s_listPedidosPro", 0);
00683 }
00684 
00685 
00691 void Company::s_listFacturasCli() {
00692     _depura("Company::s_listFacturasCli", 0);
00693     m_facturasList->show();
00694     m_facturasList->parentWidget()->raise();
00695     m_pWorkspace->setActiveWindow(m_facturasList);
00696     _depura("END Company::s_listFacturasCli", 0);
00697 }
00698 
00699 
00705 void Company::s_listFacturasPro() {
00706     _depura("Company::s_listFacturasPro", 0);
00707     m_facturasproveedorlist->show();
00708     m_facturasproveedorlist->parentWidget()->raise();
00709     m_pWorkspace->setActiveWindow(m_facturasproveedorlist);
00710     _depura("END Company::s_listFacturasPro", 0);
00711 }
00712 
00713 
00719 void Company::listBudgets() {
00720     _depura("Company::listBudgets", 0);
00721     m_presupuestosList->show();
00722     m_presupuestosList->parentWidget()->raise();
00723     m_pWorkspace->setActiveWindow(m_presupuestosList);
00724     _depura("END Company::listBudgets", 0);
00725 }
00726 
00727 
00735 PresupuestoView *Company::nuevoPresupuestoView() {
00736     _depura("Company::nuevoPresupuesto", 0);
00738     PresupuestoView *bud;
00739     if (g_plugins->lanza("Company_nuevoPresupuesto", this, (void **)&bud))
00740         return bud;
00741     bud = new PresupuestoView(this, 0);
00742     _depura("END Company::nuevoPresupuesto", 0);
00743     return bud;
00744 }
00745 
00746 
00754 PedidoProveedorView *Company::nuevoPedidoProveedorView() {
00755     _depura("Company::nuevoPedidoProveedor", 0);
00757     PedidoProveedorView *bud;
00758     if (g_plugins->lanza("Company_nuevoPedidoProveedor", this, (void **)&bud))
00759         return bud;
00760     bud = new PedidoProveedorView(this, 0);
00761     _depura("END Company::nuevoPedidoProveedor", 0);
00762     return bud;
00763 }
00764 
00765 
00772 void Company::s_newPresupuestoCli() {
00773     _depura("Company::s_newPresupuestoCli", 0);
00775     if (g_plugins->lanza("Company_s_newPresupuestoCli", this))
00776         return;
00777     PresupuestoView *bud = nuevoPresupuestoView();
00778     m_pWorkspace->addWindow(bud);
00779     bud->inicializar();
00780     bud->show();
00781     _depura("END Company::s_newPresupuestoCli", 0);
00782 }
00783 
00784 
00792 FacturaView *Company::newFacturaView() {
00793     _depura("Company::newFacturaView", 0);
00795     FacturaView *bud;
00796     if (g_plugins->lanza("Company_newFacturaView", this, (void **)&bud))
00797         return bud;
00798     bud = new FacturaView(this, 0);
00799     _depura("END Company::newFacturaView", 0);
00800     return bud;
00801 }
00802 
00803 
00810 void Company::s_newFacturaCli() {
00811     _depura("Company::s_newFacturaCli", 0);
00813     if (g_plugins->lanza("Company_s_newFacturaCli", this))
00814         return;
00815     FacturaView *bud = newFacturaView();
00816     m_pWorkspace->addWindow(bud);
00817     bud->inicializar();
00818     bud->pintar();
00819     bud->show();
00820     _depura("END Company::s_newFacturaCli", 0);
00821 }
00822 
00823 
00830 void Company::refreshPresupuestos() {
00831     _depura("Company::refreshPresupuestos", 0);
00832     m_presupuestosList->presentar();
00833     _depura("END Company::refreshPresupuestos", 0);
00834 }
00835 
00836 
00843 void Company::refreshFacturas() {
00844     _depura("Company::refreshFacturas", 0);
00845     if (m_facturasList != NULL)
00846         m_facturasList->presentar();
00847     _depura("END Company::refreshFacturas", 0);
00848 }
00849 
00850 
00857 void Company::refreshFacturasProveedor() {
00858     _depura("Company::refreshFacturasProveedor", 0);
00859     if (m_facturasproveedorlist != NULL)
00860         m_facturasproveedorlist->presentar();
00861     _depura("END Company::refreshFacturasProveedor", 0);
00862 
00863 }
00864 
00865 
00868 
00869 
00871 void Company::listClientDelivNotes() {
00872     _depura("Company::listClientDelivNotes", 0);
00873     m_clientDelivNotesList->show();
00874     m_clientDelivNotesList->parentWidget()->raise();
00875     m_pWorkspace->setActiveWindow(m_clientDelivNotesList);
00876     _depura("END Company::listClientDelivNotes", 0);
00877 }
00878 
00879 
00882 
00883 
00885 void Company::newClientDelivNote() {
00886     _depura("Company::newClientDelivNote", 0);
00887     AlbaranClienteView *cDelivNote = new AlbaranClienteView(this, 0);
00888     m_pWorkspace->addWindow(cDelivNote);
00889     cDelivNote->showMaximized();
00890     _depura("END Company::newClientDelivNote", 0);
00891 }
00892 
00893 
00898 
00899 
00901 void Company::refreshClientDelivNotes() {
00902     _depura("Company::refreshClientDelivNotes", 0);
00903     if (m_clientDelivNotesList != NULL)
00904         m_clientDelivNotesList->presentar();
00905     _depura("END Company::refreshClientDelivNotes", 0);
00906 }
00907 
00908 
00915 void Company::refreshAlbaranesCliente() {
00916     _depura("Company::refreshAlbaranesCliente", 0);
00917     if (m_clientDelivNotesList != NULL)
00918         m_clientDelivNotesList->presentar();
00919     _depura("Company::refreshAlbaranesCliente", 0);
00920 }
00921 
00922 
00929 void Company::refreshAlbaranesProveedor() {
00930     _depura("Company::refreshAlbaranesProveedor", 0);
00931     if (m_albaranesproveedor != NULL)
00932         m_albaranesproveedor->presentar();
00933     _depura("END Company::refreshAlbaranesProveedor", 0);
00934 }
00935 
00936 
00941 void Company::refreshClientes() {
00942     _depura("Company::refreshClientes", 0);
00943     if (m_clientsList != NULL)
00944         m_clientsList->presentar();
00945     _depura("END Company::refreshClientes", 0);
00946 }
00947 
00948 
00953 void Company::refreshProveedores() {
00954     _depura("Company::refreshProveedores", 0);
00955     if (m_providerslist != NULL)
00956         m_providerslist->presentar();
00957     _depura("END Company::refreshProveedores", 0);
00958 }
00959 
00960 
00964 
00965 
00967 void Company::newPedidoCliente() {
00968     _depura("Company::newPedidoCliente", 0);
00969     PedidoClienteView *bud = new PedidoClienteView(this, 0);
00970     m_pWorkspace->addWindow(bud);
00971     bud->show();
00972     _depura("END Company::newPedidoCliente", 0);
00973 }
00974 
00975 
00982 void Company::refreshCobrosCliente() {
00983     _depura("Company::refreshCobrosCliente", 0);
00984     if (m_cobrosList != NULL)
00985         m_cobrosList->presentar();
00986     _depura("END Company::refreshCobrosCliente", 0);
00987 }
00988 
00989 
00996 void Company::refreshPedidosCliente() {
00997     _depura("Company::refreshPedidosCliente", 0);
00998     if (m_pedidosclienteList != NULL)
00999         m_pedidosclienteList->presentar();
01000     _depura("END Company::refreshPedidosCliente", 0);
01001 }
01002 
01003 
01010 void Company::refreshPedidosProveedor() {
01011     _depura("Company::refreshPedidosProveedor", 0);
01012     if (m_pedidosproveedorList != NULL)
01013         m_pedidosproveedorList->presentar();
01014     _depura("END Company::refreshPedidosProveedor", 0);
01015 }
01016 
01017 
01020 
01021 
01023 void Company::s_FPago() {
01024     _depura("Company::s_FPago", 0);
01025     FPagoView *f = new FPagoView(this, NULL);
01026     m_pWorkspace->addWindow(f);
01027     f->show();
01028     _depura("END Company::s_FPago", 0);
01029 }
01030 
01031 
01034 
01035 
01037 void Company::s_trabajadores() {
01038     _depura("Company::s_trabajadores", 0);
01039     TrabajadorView *t = new TrabajadorView(this, NULL);
01040     m_pWorkspace->addWindow(t);
01041     t->show();
01042     _depura("END Company::s_trabajadores", 0);
01043 }
01044 
01045 
01048 
01049 
01051 void Company::s_bancos() {
01052     _depura("Company::s_bancos", 0);
01053     BancoView *t = new BancoView(this, NULL);
01054     m_pWorkspace->addWindow(t);
01055     t->show();
01056     _depura("END Company::s_bancos", 0);
01057 }
01058 
01059 
01062 
01063 
01065 void Company::s_seriesFactura() {
01066     _depura("Company::s_seriesFactura", 0);
01067     ListSerieFacturaView *lser = new ListSerieFacturaView(this, 0);
01068     m_pWorkspace->addWindow( lser);
01069     lser->show();
01070     _depura("END Company::s_seriesFactura", 0);
01071 }
01072 
01073 
01081 ArticuloView *Company::newArticuloView() {
01082     _depura("Company::newArticuloView", 0);
01084     ArticuloView *bud;
01085     if (g_plugins->lanza("Company_newArticuloView", this, (void **)&bud))
01086         return bud;
01087     bud = new ArticuloView(this, 0);
01088     _depura("END Company::newArticuloView", 0);
01089     return bud;
01090 }
01091 
01092 
01098 void Company::s_newArticulo() {
01099     _depura("Company::s_newArticulo", 0);
01100     ArticuloView *art = newArticuloView();
01101     m_pWorkspace->addWindow(art);
01102     art->show();
01103     art->setFocus();
01104     _depura("END Company::s_newArticulo", 0);
01105 }
01106 
01107 
01115 AlbaranClienteView *Company::newAlbaranClienteView() {
01116     _depura("Company::newAlbaranClienteView", 0);
01118     AlbaranClienteView *bud;
01119     if (g_plugins->lanza("Company_newAlbaranClienteView", this, (void **)&bud))
01120         return bud;
01121     bud = new AlbaranClienteView(this, 0);
01122     _depura("END Company::newAlbaranClienteView", 0);
01123     return bud;
01124 }
01125 
01126 
01132 void Company::s_newAlbaranClienteView() {
01133     _depura("Company::s_newAlbaranClienteView", 0);
01134     AlbaranClienteView *bud = newAlbaranClienteView();
01135     m_pWorkspace->addWindow(bud);
01136     bud->inicializar();
01137     bud->pintar();
01138     bud->show();
01139     _depura("END Company::s_newAlbaranClienteView", 0);
01140 
01141 }
01142 
01143 
01151 AlbaranProveedorView *Company::newAlbaranProveedorView() {
01152     _depura("Company::newAlbaranProveedorView", 0);
01154     AlbaranProveedorView *bud;
01155     if (g_plugins->lanza("Company_newAlbaranProveedorView", this, (void **)&bud))
01156         return bud;
01157     bud = new AlbaranProveedorView(this, 0);
01158     _depura("END Company::newAlbaranProveedorView", 0);
01159     return bud;
01160 }
01161 
01162 
01168 void Company::s_newAlbaranProveedorView() {
01169     _depura("Company::s_newAlbaranProveedorView", 0);
01170     AlbaranProveedorView *bud = newAlbaranProveedorView();
01171     m_pWorkspace->addWindow(bud);
01172     bud->pintar();
01173     bud->show();
01174     _depura("END Company::s_newAlbaranProveedorView", 0);
01175 }
01176 
01177 
01185 PedidoClienteView *Company::newPedidoClienteView() {
01186     _depura("Company::newPedidoClienteView", 0);
01188     PedidoClienteView *bud;
01189     if (g_plugins->lanza("Company_newPedidoClienteView", this, (void **)&bud))
01190         return bud;
01191     bud = new PedidoClienteView(this, 0);
01192     _depura("END Company::newPedidoClienteView", 0);
01193     return bud;
01194 }
01195 
01196 
01202 void Company::s_newPedidoClienteView() {
01203     _depura("Company::s_newPedidoClienteView", 0);
01204     PedidoClienteView *bud = newPedidoClienteView();
01205     m_pWorkspace->addWindow(bud);
01206     bud->inicializar();
01207     bud->pintar();
01208     bud->show();
01209     _depura("END Company::s_newPedidoClienteView", 0);
01210 }
01211 
01212 
01218 void Company::s_newPedidoProveedorView() {
01219     _depura("Company::s_newPedidoProveedorView", 0);
01220     PedidoProveedorView *bud = nuevoPedidoProveedorView();
01221     m_pWorkspace->addWindow(bud);
01222     bud->pintar();
01223     bud->show();
01224     _depura("END Company::s_newPedidoProveedorView", 0);
01225 }
01226 
01227 
01233 void Company::s_almacenes() {
01234     _depura("Company::s_almacenes", 0);
01236     if (g_plugins->lanza("Company_s_almacenes", this))
01237         return;
01238     ListAlmacenView *lser = new ListAlmacenView(this, 0);
01239     m_pWorkspace->addWindow(lser);
01240     lser->show();
01241     _depura("END_Company::s_almacenes", 0);
01242 }
01243 
01244 
01249 void Company::s_newListConfiguracionView() {
01250     _depura("Company::s_newListConfiguracionView", 0);
01251     ListConfiguracionView *lser = new ListConfiguracionView(this, 0);
01252     m_pWorkspace->addWindow(lser);
01253     lser->show();
01254     _depura("END Company::s_newListConfiguracionView", 0);
01255 }
01256 
01257 
01265 PagoView *Company::newPagoView() {
01266     _depura("Company::newPagoView", 0);
01268     PagoView *bud;
01269     if (g_plugins->lanza("Company_newPagoView", this, (void **)&bud))
01270         return bud;
01271     bud = new PagoView(this, 0);
01272     _depura("END Company::newPagoView", 0);
01273     return bud;
01274 }
01275 
01276 
01282 void Company::s_newPagoView() {
01283     _depura("Company::s_newPagoView", 0);
01284     PagoView *pag = newPagoView();
01285     m_pWorkspace->addWindow(pag);
01286     pag->show();
01287     _depura("END Company::s_newPagoView", 0);
01288 }
01289 
01290 
01300 TipoArticuloList *Company::newTipoArticuloList(QWidget *parent, bool modoConsulta) {
01301     _depura("Company::newTipoArticuloList", 0);
01303     TipoArticuloList *bud;
01304     if (g_plugins->lanza("Company_newTipoArticuloList", this, (void **)&bud))
01305         return bud;
01306     bud = new TipoArticuloList(this, parent, modoConsulta);
01307     _depura("END Company::newTipoArticuloList", 0);
01308     return bud;
01309 }
01310 
01311 
01317 void Company::s_newTipoArticuloList() {
01318     _depura("Company::s_newTipoArticuloList", 0);
01319     TipoArticuloList *pag = newTipoArticuloList();
01320     m_pWorkspace->addWindow(pag);
01321     pag->show();
01322     _depura("END Company::s_newTipoArticuloList", 0);
01323 }
01324 
01325 
01335 FamiliasView *Company::newfamiliasview(QWidget *parent, bool modoConsulta) {
01336     _depura("Company::newfamiliasview", 0);
01338     FamiliasView *bud;
01339     if (g_plugins->lanza("Company_newfamiliasview", this, (void **)&bud))
01340         return bud;
01341     bud = new FamiliasView(this, parent, modoConsulta);
01342     _depura("END Company::newfamiliasview", 0);
01343     return bud;
01344 }
01345 
01346 
01352 void Company::s_newfamiliasview() {
01353     _depura("Company::s_newfamiliasview", 0);
01354     FamiliasView *pag = newfamiliasview();
01355     m_pWorkspace->addWindow(pag);
01356     pag->show();
01357     _depura("END Company::s_newfamiliasview", 0);
01358 }
01359 
01360 
01365 void Company::s_TipoIVAView() {
01366     _depura("Company::s_TipoIVAView", 0);
01367     ListTipoIVAView *pag = new ListTipoIVAView(this, 0);
01368     m_pWorkspace->addWindow(pag);
01369     pag->show();
01370     _depura("END Company::s_TipoIVAView", 0);
01371 }
01372 
01373 
01378 void Company::s_TasaIVAView() {
01379     _depura("Company::s_TasaIVAView", 0);
01380     ListTasaIVAView *pag = new ListTasaIVAView(this, 0);
01381     m_pWorkspace->addWindow(pag);
01382     pag->show();
01383     _depura("END Company::s_TasaIVAView", 0);
01384 }
01385 
01386 
01388 
01391 FacturasProveedorList * Company::facturasProveedorList() {
01392     _depura("Company::facturasProveedorList", 0);
01393     _depura("END Company::facturasProveedorList", 0);
01394     return m_facturasproveedorlist;
01395 }
01396 
01397 
01399 
01402 PresupuestoList * Company::presupuestoList() {
01403     _depura("Company::presupuestoList", 0);
01404     _depura("END Company::presupuestoList", 0);
01405     return m_presupuestosList;
01406 }
01407 
01408 
01409 
01410 
01411 
01413 
01415 void Company::guardaConf() {
01416     _depura("Company::guardaConf", 0);
01417     QFile file(confpr->valor(CONF_DIR_USER) + "bulmafact_" + nameDB() + ".cfn");
01419     if (file.open(QIODevice::WriteOnly)) {
01420         QTextStream stream(&file);
01421         stream << "<CONFIG>\n";
01422         stream << "\t<PRINCIPAL>\n";
01423         stream << "\t\t\t<X>" + QString::number(m_bulmafact->x()) + "</X>\n";
01424         stream << "\t\t\t<Y>" + QString::number(m_bulmafact->y()) + "</Y>\n";
01425         stream << "\t\t\t<WIDTH>" + QString::number(m_bulmafact->width()) + "</WIDTH>\n";
01426         stream << "\t\t\t<HEIGHT>" + QString::number(m_bulmafact->height()) + "</HEIGHT>\n";
01427         stream << "\t\t\t<INDEXADOR>" + (m_bulmafact->actionIndexador->isChecked() ? QString("TRUE") : QString("FALSE")) + "</INDEXADOR>\n";
01428         stream << "\t</PRINCIPAL>\n";
01429 
01430 
01431         for (int i = 0; i < m_listventanas->numVentanas(); i++) {
01432         QObject *obj = m_listventanas->ventana(i);
01433                 QWidget *wid = (QWidget *) obj;
01434         stream << "\t<VENTANA>\n";
01435         stream << "\t\t<VNAME>" + obj->objectName() + "</VNAME>\n";
01436         stream << "\t\t<VX>" + QString::number(wid->parentWidget()->x()) + "</VX>\n";
01437         stream << "\t\t<VY>" + QString::number(wid->parentWidget()->y()) + "</VY>\n";
01438         stream << "\t\t<VWIDTH>" + QString::number(wid->width()) + "</VWIDTH>\n";
01439         stream << "\t\t<VHEIGHT>" + QString::number(wid->height()) + "</VHEIGHT>\n";
01440         stream << "\t\t<VVISIBLE>" + (wid->isVisible() ? QString("TRUE") : QString("FALSE")) + "</VVISIBLE>\n";
01441         stream << "\t\t<VMAXIMIZED>" + (wid->isMaximized() ? QString("TRUE") : QString("FALSE")) + "</VMAXIMIZED>\n";
01442         stream << "\t\t<VACTIVEWINDOW>" + (m_bulmafact->workspace()->activeWindow() == wid ? QString("TRUE") : QString("FALSE")) + "</VACTIVEWINDOW>";
01443         stream << "\t</VENTANA>\n";
01444     } // end for
01445 
01446         stream << "</CONFIG>\n";
01447         file.close();
01448     } // end if
01449     _depura("END Company::guardaConf", 0);
01450 }
01451 
01452 
01454 
01457 void Company::cargaConf() {
01458     _depura("Company::cargaConf", 0);
01459     QFile file(confpr->valor(CONF_DIR_USER) + "bulmafact_" + nameDB() + ".cfn");
01460     QDomDocument doc("mydocument");
01461     if (!file.open(QIODevice::ReadOnly))
01462         return;
01463     if (!doc.setContent(&file)) {
01464         file.close();
01465         return;
01466     }
01467     file.close();
01468 
01469     // print out the element names of all elements that are direct children
01470     // of the outermost element.
01471     QDomElement docElem = doc.documentElement();
01472     QDomElement principal = docElem.firstChildElement("PRINCIPAL");
01474     QString nx = principal.firstChildElement("X").toElement().text();
01475 
01477     QString ny = principal.firstChildElement("Y").toElement().text();
01478 
01480     QString nwidth = principal.firstChildElement("WIDTH").toElement().text();
01481 
01483     QString nheight = principal.firstChildElement("HEIGHT").toElement().text();
01484 
01486     m_bulmafact->setGeometry(nx.toInt(), ny.toInt(), nwidth.toInt(), nheight.toInt());
01487 
01489     QString indexador = principal.firstChildElement("INDEXADOR").toElement().text();
01490     if (indexador == "TRUE") {
01491     s_indexadorCambiaEstado(TRUE);
01492     m_bulmafact->actionIndexador->setChecked(TRUE);
01493     } else {
01494     s_indexadorCambiaEstado(FALSE);
01495     m_bulmafact->actionIndexador->setChecked(FALSE);
01496     } // end if
01497 
01499    QWidget *activewindow = NULL;
01500    QDomNodeList nodos = docElem.elementsByTagName("VENTANA");
01501         for (int i = 0; i < nodos.count(); i++) {
01502             QDomNode ventana = nodos.item(i);
01503             QDomElement e1 = ventana.toElement(); 
01504             if( !e1.isNull() ) { 
01505              QString vname = e1.firstChildElement("VNAME").toElement().text();
01506             for (int j = 0; j < m_listventanas->numVentanas(); j++) {
01507                 QObject *obj = m_listventanas->ventana(j);
01508                 QWidget *wid = (QWidget *) obj;
01509                 if (obj->objectName() == vname) {
01510                     QString vx = e1.firstChildElement("VX").toElement().text();
01511                     QString vy = e1.firstChildElement("VY").toElement().text();
01512                     QString vwidth = e1.firstChildElement("VWIDTH").toElement().text();
01513                     QString vheight = e1.firstChildElement("VHEIGHT").toElement().text();
01514                     QString vvisible = e1.firstChildElement("VVISIBLE").toElement().text();
01515                     QString vmaximized = e1.firstChildElement("VMAXIMIZED").toElement().text();
01516                     QString vactivewindow = e1.firstChildElement("VACTIVEWINDOW").toElement().text();
01518                     wid->resize(vwidth.toInt(), vheight.toInt());
01519                     wid->parentWidget()->move(vx.toInt(), vy.toInt());
01520                     if ( vvisible == "TRUE") {
01521                         wid->showNormal();
01522                     } // end if
01523                     if ( vmaximized == "TRUE") {
01524                         wid->showMaximized();
01525                     }
01526                     if ( vactivewindow == "TRUE") {
01527                         activewindow = wid;
01528                     }
01529                 } // end if
01530             } // end for
01531             } // end if
01532         } // end for
01534     if (activewindow)
01535         m_bulmafact->workspace()->setActiveWindow(activewindow);
01536     _depura("END Company::cargaConf", 0);
01537 }

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