plugintarifas.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 <stdio.h>
00022 
00023 #include "plugintarifas.h"
00024 #include "company.h"
00025 #include "funcaux.h"
00026 #include "busquedatarifa.h"
00027 #include "listltarifaview.h"
00028 #include "tarifalistview.h"
00029 
00030 
00032 
00034 myplugin1::myplugin1() : PEmpresaBase() {
00035     _depura("myplugin1::myplugin1", 0);
00036     _depura("END myplugin1::myplugin1", 0);
00037 }
00038 
00039 
00041 
00043 myplugin1::~myplugin1() {
00044     _depura("myplugin1::~myplugin1", 0);
00045     _depura("END myplugin1::~myplugin1", 0);
00046 }
00047 
00048 
00050 
00052 void myplugin1::elslot() {
00053     _depura("myplugin1::elslot", 0);
00054     TarifaListView *tar = new TarifaListView(((Company *)empresaBase()), NULL);
00055     empresaBase()->m_pWorkspace->addWindow(tar);
00056     tar->show();
00057     _depura("END myplugin1::elslot", 0);
00058 }
00059 
00060 
00062 
00065 void myplugin1::inicializa(Bulmafact *bges) {
00066     _depura("myplugin1::inicializa", 0);
00068     m_bges = bges;
00069     setEmpresaBase(bges->getcompany());
00070    
00071     QAction *planCuentas = new QAction(tr("&Tarifas"), 0);
00072     planCuentas->setStatusTip(tr("Tarifas"));
00073     planCuentas->setWhatsThis(tr("Tarifas"));
00074     bges->menuArticulos->addSeparator();
00075     bges->menuArticulos->addAction(planCuentas);
00076     connect(planCuentas, SIGNAL(activated()), this, SLOT(elslot()));
00077     _depura("END myplugin1::inicializa", 0);
00078 }
00079 
00080 
00082 
00086 int entryPoint(Bulmafact *bges) {
00087     _depura("Punto de Entrada del plugin de Tarifas\n", 0);
00088     myplugin1 *plug = new myplugin1();
00089     plug->inicializa(bges);
00090     return 0;
00091 }
00092 
00093 
00095 
00099 int ClienteView_ClienteView(ClienteView *cli) {
00100     _depura("dentro del plugin", 0);
00101 
00102     cli->addDBCampo("idtarifa", DBCampo::DBint, DBCampo::DBNothing, QApplication::translate("Identificador", "plugintarifas"));
00103 
00104     QHBoxLayout *hboxLayout160 = new QHBoxLayout();
00105     hboxLayout160->setSpacing(2);
00106     hboxLayout160->setMargin(0);
00107     hboxLayout160->setObjectName(QString::fromUtf8("hboxLayout16"));
00108 
00109     QLabel *textLabel2_9_26 = new QLabel(cli->m_frameplugin);
00110     textLabel2_9_26->setObjectName(QString::fromUtf8("textLabel2_9_2"));
00111     hboxLayout160->addWidget(textLabel2_9_26);
00112     textLabel2_9_26->setText("Tarifa");
00113 
00114     BusquedaTarifa *bus = new BusquedaTarifa(cli->m_frameplugin);
00115     bus->setObjectName(QString::fromUtf8("mui_idtarifa"));
00116     bus->setEmpresaBase(cli->empresaBase());
00117     bus->setidtarifa("");
00118     hboxLayout160->addWidget(bus);
00119 
00120     cli->vboxLayout2->addLayout(hboxLayout160);
00121     return 0;
00122 }
00123 
00124 
00125 
00127 
00131 int ArticuloView_ArticuloView(ArticuloView *art) {
00132     _depura("ArticuloView_ArticuloView", 0);
00133     ListLTarifaView *l = new ListLTarifaView(art);
00134     l->setObjectName(QString::fromUtf8("ltarifas"));
00135     l->setEmpresaBase( art->empresaBase());
00136     l->cargar("0");
00137     art->mui_tab->addTab(l, "Tarifas");
00138     _depura("END ArticuloView_ArticuloView", 0);
00139     return 0;
00140 }
00141 
00142 
00144 
00148 int ArticuloView_cargar(ArticuloView *art) {
00149     _depura("ArticuloView_cargar", 0);
00150     ListLTarifaView *l = art->findChild<ListLTarifaView *>("ltarifas");
00151     l->cargar(art->DBvalue("idarticulo"));
00152     _depura("END ArticuloView_cargar", 0);
00153     return 0;
00154 }
00155 
00156 
00158 
00162 int ArticuloView_guardar_post(ArticuloView *art) {
00163     _depura("ArticuloView_guardar_post", 0);
00164     try {
00165         ListLTarifaView *l = art->findChild<ListLTarifaView *>("ltarifas");
00166         l->setColumnValue("idarticulo", art->DBvalue("idarticulo"));
00167         l->guardar();
00168         return 0;
00169     } catch (...) {
00170         _depura("Hubo un error al guardar las tarifas", 2);
00171         return 0;
00172     }
00173 }
00174 
00175 
00177 
00181 int ArticuloView_borrar(ArticuloView *art) {
00182     _depura("ArticuloView_borrar", 0);
00183     try {
00184         ListLTarifaView *l = art->findChild<ListLTarifaView *>("ltarifas");
00185         l->borrar();
00186         return 0;
00187     } catch (...) {
00188         _depura("Hubo un error al borrar las tarifas", 0);
00189         throw -1;
00190     }
00191 }
00192 

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