My FTC Wallet DIY\#2, report class
-
I have a different purpose accounts,There are a number of transmit and receive daily,I need to count the daily changes in accounts, including the payment amount and the number of payments. So I developed a simple report class.
I add reportview.h and reportview.cpp, Some of the code released. I intend to put them to use GridView to display, need to continue to improve . :)
void ReportView::showTotal()
{
float fTotal=0;
float iTotal=0;
int i=0;
QString addressname = “”;
QVector addresslist;
QVector totallist;
QVector timelist;
//accountReport from every address
for (i=0;i
{
fTotal+=transactionProxyModel->data(transactionProxyModel->index(i,4)).toFloat();
iTotal=transactionProxyModel->data(transactionProxyModel->index(i,4)).toFloat();
addressname=transactionProxyModel->data(transactionProxyModel->index(i,3)).toString();
int t = addresslist.indexOf(addressname);
if (t != -1)
{
totallist[t]=totallist.at(t)+iTotal;
timelist[t]=timelist.at(t)+1;
}
else
{
addresslist.append(addressname);
totallist.append(iTotal);
timelist.append(1);
}
}
totalnumslWidget->setText(“Date:”+dateWidget->currentText()+" Type:“+typeWidget->currentText()+” “+QObject::tr(”%1").arg(fTotal)+" FTC");
totaltimesWidget->setText(QObject::tr(“%1”).arg(i)+" times payment");
QString account = “”;
for (int i=0;i!=addresslist.size();++i)
{
account.append(addresslist.at(i)+" Total:“+QObject::tr(”%1").arg(totallist.at(i))+" “+QObject::tr(”%1").arg(timelist.at(i))+" times payment \n");
rptTotal->setText(account);
}
}
-
good work :)
When your code ist stable and working well, will you send in a pull request on Github?
If yes we could include it in the next wallet release
-
Yes, If I completed those new feature, I will submit to Github.
-
1) TransactionView , add Total, add new Date ranges for filter : Yesterday and LastWeek
2) Add ReportView , Total transaction records for each address
-
I will commit those code to GitHub ,at dev-0.8 .
change file:
\src\qt\walletview.h
\src\qt\walletview.cpp
\src\qt\walletframe.h
\src\qt\walletframe.cpp
\src\qt\walletstack.h
\src\qt\walletstack.cpp
\src\qt\bitcoingui.h
\src\qt\bitcoingui.cpp
\src\qt\transactionview.h
\src\qt\transactionview.cpp
\src\qt\bitcoin.qrc
\src\qt\locale\bitcoin_zh_CN.ts
add file:
\src\qt\reportview.h
\src\qt\reportview.cpp
\src\qt\res\icons\account-report.png
\src\qt\res\images\LOGO.png
-
Cheers Lizhi, good idea.
-
transactionview.cpp:
I add a QMenu ,“Trading Show this address” , It show this address all transaction record. This is more convenient, do not need to copy the address ^-^
I commit code to dev-0.8 in Github.