⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lxaccountstmtview.cc

📁 LxBank是一个基于Qt/X的家庭储蓄应用程序
💻 CC
字号:
// ****************************************************************************// // LxBank - home-banking for Linux using the HBCI standard// // Author: Franz Zimmermann                                   83043 Bad Aibling// // Copyright (C) 2002-2003 Franz Zimmermann  -  arafang@users.sourceforge.net// // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 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 General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.// // ***************************************************************************//// ***************************************************************************// /*! \file    \brief LxAccountStmtView: Main Window for LxBank*/ // ***************************************************************************//// $Name:  $//// $State: Exp $//// $Log: LxAccountStmtView.cc,v $// Revision 1.5  2003/03/04 01:20:44  arafang// Disable the update button in class LxAccountStmtView if no account is open.//// Revision 1.4  2003/02/08 15:25:21  franz// Mail address changed.//// Revision 1.3  2003/02/08 11:45:19  franz// Money transfer (single mode) works.//// Revision 1.2  2003/01/26 23:09:41  franz// LxAccountSelectDialog: New method to delete accounts (remove).// Class LxAccountStmtPrint adapted to new account statement view layout.// Account update implemented.//// Revision 1.1  2003/01/18 15:36:09  franz// New class LxAccountStmtView implemented.////#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <qlayout.h>#include <qstringlist.h> #include <qregexp.h> #include <qpushbutton.h> #include <qlistview.h> // #include <qptrlist.h>// #include <stream.h>// #include <math.h>#include "LxAccountStmtView.h"LxAccountStmtView::LxAccountStmtView( QWidget *parent, const char *name )  : QWidget( parent, name ), account(0){  // View of account statements  vLayout = new QVBoxLayout( this, 5 );  accList = new QListView (this, "accountStmList");  accList->setAllColumnsShowFocus ( TRUE );   accList->setSelectionMode ( QListView::Extended );  accList->setShowSortIndicator ( TRUE );   accList->font().setWeight( QFont::Bold );  accList->font().setBold( TRUE );  accList->font().setPointSize ( 10 );  int column1, column2, column3, column4, column5, column6, column7, column8;  column1 = accList->addColumn ( tr("Date"), 75 );  column2 = accList->addColumn ( tr("Valuta"), 75 );  column3 = accList->addColumn ( tr("Institute"), 75 );  column4 = accList->addColumn ( tr("Account"), 95 );  column5 = accList->addColumn ( tr("Code"), 50 );  column6 = accList->addColumn ( tr("Description"), 250 );  column7 = accList->addColumn ( tr("S-soll/H-haben"), 125 );  column8 = accList->addColumn ( tr("Balance"), 125 );  accList->setColumnAlignment ( column7, AlignRight );  accList->setColumnAlignment ( column8, AlignRight );  accList->setItemMargin ( 5 );  accList->setMinimumWidth ( 75+75+75+95+50+250+125+125+18 );  accList->setMinimumHeight ( 580 );  vLayout->addWidget (accList);  accUpdateButton = new QPushButton (tr("Update"), this, "UpdateButton");  vLayout->addWidget (accUpdateButton);  accUpdateButton->setEnabled(FALSE);  // setup signals  connect( accUpdateButton, SIGNAL(clicked( )),	   this, SLOT(updateAccount( )) );}void LxAccountStmtView::updateAccount ( ){//   cerr << "LxAccountStmtView::updateAccount: Account update requested!" << endl;  if ( account ){    account->updateBalanceAndAccStmt ( );  }}void LxAccountStmtView::updateAccountStmtView( AccountStmtList &az ){//   cerr << "LxAccountStmtView::updateAccountStmtView: Update of account data view requested!" << endl;  accList->clear ();  if ( !az.isEmpty () ){    QDate date;    QString datum, valuta, umsatz, saldo;    double val, valabs;    LxAccountStmt *accStmtItem;    LxAccountListViewItem *item;    for (accStmtItem = az.first(); accStmtItem != 0; accStmtItem = az.next()){      // Auszugs-Datum      date = accStmtItem->getDatum();      if ( date.year() == 1900 ){	// invalid date	datum = "00.00.00";      }else{	datum.sprintf ("%02d.%02d.%02d", date.day(), date.month(), date.year()%100);      }      // Valuta      date = accStmtItem->getValuta();      if ( date.year() == 1900 ){	// invalid date	valuta = "00.00.00";      }else{	valuta.sprintf ("%02d.%02d.%02d", date.day(), date.month(), date.year() % 100);      }            // Umsatz      val = accStmtItem->getUmsatz();      valabs = fabs(val);      umsatz.sprintf("%.2f%c", valabs, (val < 0.0 ? 'S' : 'H'));      umsatz.replace(QRegExp("\\."), ",");      // Saldo      val = accStmtItem->getSaldo();      saldo.sprintf("%.2fEUR", val);      saldo.replace(QRegExp("\\."), ",");      item = new LxAccountListViewItem( accList,					datum,                                     // date					accStmtItem->getDatumSortKey(),					valuta,	                                   // valuta date					accStmtItem->getValutaSortKey(),					accStmtItem->getOtherBank(),               // other institut					accStmtItem->getOtherBankSortKey(),					accStmtItem->getOtherAccountId(),          // other institut id					accStmtItem->getOtherAccountIdSortKey(),					accStmtItem->getCode(),                    // code					accStmtItem->getCodeSortKey(),					accStmtItem->getBuchungsText(),	           // transaction text					umsatz,                                    // transaction value					accStmtItem->getUmsatzSortKey(),					accStmtItem->getUmsatz(),					saldo,                                     // balance					accStmtItem->getSaldoSortKey(),					accStmtItem->getSaldo() );    }    accList->setSorting ( 0 );  }  emit accountStmtViewChanged ( accList );}void LxAccountStmtView::setAccount ( LxAccount* acc){  account = acc;  if ( account ){    accUpdateButton->setEnabled(TRUE);  }else{    accUpdateButton->setEnabled(FALSE);  }}AccListVItemList * LxAccountStmtView::getSelectedItems(  ) {  if ( !accList )    return 0;  // Create the list  QList<LxAccountListViewItem> *lst = new QList<LxAccountListViewItem>;  lst->setAutoDelete( FALSE );  // Create an iterator and give the listview as argument  QListViewItemIterator it( accList );  LxAccountListViewItem *accItem;  // iterate through all items of the listview  for ( ; it.current(); ++it ) {    accItem = (LxAccountListViewItem *)(it.current());    if ( accItem->isSelected() )      lst->append( accItem );  }    return lst;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -