importContaplus.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Tomeu Borras                                    *
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 <QToolButton>
00022 #include <QFile>
00023 #include <QLineEdit>
00024 #include <QCheckBox>
00025 #include <QFileDialog>
00026 #include <QProgressBar>
00027 #include <QTextBrowser>
00028 
00029 #include "importContaplus.h"
00030 #include "pgimportfiles.h"
00031 #include "busquedafecha.h"
00032 
00033 
00034 QProgressBar *progress;
00035 QTextEdit *mensajes;
00036 QString mensajein = "";
00037 
00038 
00040 
00044 void importContaplus::alerta(int a, int b) {
00045     _depura("importContaplus::alerta", 0);
00046     fprintf(stderr, "mensaje publicado");
00047     progress->setRange(a, b);
00048     _depura("END importContaplus::alerta", 0);
00049 }
00050 
00051 
00053 
00056 void importContaplus::mensajeria(QString mensaje) {
00057     _depura("importContaplus::mensajeria", 0);
00058     mensajein += mensaje;
00059     mensajes->setText(mensajein);
00060     mensajes->ensureCursorVisible();
00061     _depura("END importContaplus::mensajeria", 0);
00062 }
00063 
00064 
00066 
00071 importContaplus::importContaplus(postgresiface2 *con, QWidget *parent, Qt::WFlags f = 0)
00072         : QDialog(parent, f), pgimportfiles(con) {
00073     _depura("importContaplus::importContaplus", 0);
00074     setupUi(this);
00075 
00077     QObject::connect(pushButton33, SIGNAL(clicked()), this, SLOT(botonImportar()));
00078     QObject::connect(pushButton33_2, SIGNAL(clicked()), this, SLOT(botonExportar()));
00079     QObject::connect(pushButtonF_X, SIGNAL(clicked()), this, SLOT(close()));
00080     QObject::connect(toolButton1_2, SIGNAL(clicked()), this, SLOT(botonBuscarDiario()));
00081     QObject::connect(toolButton1, SIGNAL(clicked()), this, SLOT(botonBuscarSubCta()));
00082     QObject::connect(toolButton1_5, SIGNAL(clicked()), this, SLOT(botonBuscarXML()));
00083 
00084     progress = m_progressbar;
00085     mensajes = m_mensajes;
00086     conexionbase = con;
00087     _depura("END importContaplus::importContaplus", 0);
00088 }
00089 
00090 
00092 
00094 importContaplus::~importContaplus() {
00095     _depura("importContaplus::~importContaplus", 0);
00096     _depura("END importContaplus::~importContaplus", 0);
00097 }
00098 
00099 
00100 
00102 
00104 void importContaplus::botonBuscarXML() {
00105     _depura("importContaplus::botonBuscarXML", 0);
00106     m_XML->setText(QFileDialog::getSaveFileName(this, tr("Guardar archivo"), confpr->valor(CONF_DIR_USER), tr("Contaplus (*.xml)")));
00107     ;
00108     _depura("END importContaplus::botonBuscarXML", 0);
00109 }
00110 
00111 
00113 
00115 void importContaplus::botonBuscarSubCta() {
00116     _depura("importContaplus::botonBuscarSubCta", 0);
00117     m_subCta->setText(QFileDialog::getSaveFileName(this, tr("Guardar archivo"), confpr->valor(CONF_DIR_USER), tr("Contaplus (*.txt)")));
00118     ;
00119     _depura("END importContaplus::botonBuscarSubCta", 0);
00120 }
00121 
00122 
00124 
00126 void importContaplus::botonBuscarDiario() {
00127     _depura("importContaplus::botonBuscarDiario", 0);
00128     m_diario->setText(QFileDialog::getSaveFileName(this, tr("Guardar archivo"), confpr->valor(CONF_DIR_USER), tr("Contaplus (*.txt)")));
00129     ;
00130     _depura("END importContaplus::botonBuscarDiario", 0);
00131 }
00132 
00133 
00135 
00137 void importContaplus::botonImportar() {
00138     _depura("importContaplus::botonImportar", 0);
00139     QString finicial = m_fechainicial->text();
00140     QString ffinal = m_fechafinal->text();
00141     if (m_subCta->text() != "") {
00142         QFile filecont(m_subCta->text());
00143         QFile fileasie(m_diario->text());
00144         filecont.open(QIODevice::ReadOnly);
00145         fileasie.open(QIODevice::ReadOnly);
00146         setFInicial(finicial);
00147         setFFinal(ffinal);
00148         if (m_test->isChecked()) {
00149             setModoTest();
00150         } // end if
00151         contaplus2Bulmages(filecont, fileasie);
00152         filecont.close();
00153         fileasie.close();
00154     } else {
00155         QFile filexml(m_XML->text());
00156         filexml.open(QIODevice::ReadOnly);
00157         XML2Bulmages(filexml);
00158         filexml.close();
00159     } // end if
00160     mensajein = "";
00161     _depura("END importContaplus::botonImportar", 0);
00162 }
00163 
00164 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00175 void importContaplus::botonExportar() {
00176     _depura("importContaplus::botonExportar", 0);
00177 
00179     QString finicial = m_fechainicial->text();
00180     QString ffinal = m_fechafinal->text();
00181 
00182     setFInicial(finicial);
00183     setFFinal(ffinal);
00184     if (m_test->isChecked()) {
00185         setModoTest();
00186     } // end if
00187     if (m_subCta->text() != "") {
00188         QFile filecont(m_subCta->text());
00189         QFile fileasie(m_diario->text());
00190         filecont.open(QIODevice::WriteOnly);
00191         fileasie.open(QIODevice::WriteOnly);
00192         bulmages2Contaplus(filecont, fileasie);
00193         filecont.close();
00194         fileasie.close();
00195     } // end if
00196     if (m_XML->text() != "") {
00197         QFile filexml(m_XML->text());
00198         filexml.open(QIODevice::WriteOnly);
00199         bulmages2XML(filexml);
00200         filexml.close();
00201     } // end if
00202     mensajein = "";
00203     _depura("END importContaplus::botonExportar", 0);
00204 }
00205 

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