/***************************************************************************
 *   Copyright (C) 2009 by Docteur Pierre-Marie Desombre.   *
 *   pm.desombre@medsyn.fr  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 3 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef DEPENSEDIALOG_H
#define DEPENSEDIALOG_H

#include <QtGui>
#include <QtCore>
#include <QtSql>

#include "ui_depensedialog.h"
#include "utilisateurdialog.h"
#include "../../common/configure/utilisateur.h"
#include "../parametrages/parametrages.h"

class depensedialog : public QWidget,public Ui::DepenseDialog
{
  Q_OBJECT

public:
  depensedialog();
  ~depensedialog();
  parametrages *m_parametres;
  utilisateurpref *m_utildialogdep;
  utilisateur     *m_u;
  //QSqlDatabase   m_db1;
  QSqlDatabase   m_accountancyDb;
  QSqlTableModel *m_model;
  QSqlTableModel *m_modele;
  QStringList m_depensespourcentages;
  int m_id;
  int m_idusr;
  //int iduser;
  int m_id_usr;
  int m_compte;
  QString m_loginpref;
  QString m_login;
  QStringList m_listelogin;
  
protected :
  void remplirdepensesini();
 // void altertable();

signals:


protected slots:
  void enregistredepense();
  //void voirdepenses();
  void effacer();
  void rafraichir();
  void valide();
  void messagebox();
  void whatsthismode();
  void remplirComboUtilisateurs();
  void showToolTip(int);

private :
  QString m_user;
  QHash<QString,QString> m_hashCompte;
  double m_solde_initial;
  QMultiMap<int,QString> m_typeMap , m_spendingsMap;

};

#endif
