-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathall_trade_reports.cpp
More file actions
69 lines (51 loc) · 2.37 KB
/
all_trade_reports.cpp
File metadata and controls
69 lines (51 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "all_trade_reports.h"
#include "ui_all_trade_reports.h"
#include "read_file.h"
#include "mainwindow.h"
#include <QDir>
#include <QFile>
all_trade_reports::all_trade_reports(QWidget *parent) :
QDialog(parent),
ui(new Ui::all_trade_reports)
{
ui->setupUi(this);
ui->textBrowser->setFontPointSize(13);
}
all_trade_reports::~all_trade_reports()
{
delete ui;
}
void all_trade_reports::on_pushButton_clicked()
{
QString cat=ui->comboBox->currentText();
QFile file_name(QDir::currentPath()+"/"+cat+"/name.txt");
QFile file_entry(QDir::currentPath()+"/"+cat+"/entry.txt");
QFile file_close(QDir::currentPath()+"/"+cat+"/close.txt");
QFile file_vol(QDir::currentPath()+"/"+cat+"/vol_trade.txt");
file_name.open(QFile::ReadOnly);
file_entry.open(QFile::ReadOnly);
file_close.open(QFile::ReadOnly);
file_vol.open(QFile::ReadOnly);
while(!file_name.atEnd()){
QString entry=file_entry.readLine();
QString close=file_close.readLine();
double vol=file_vol.readLine().toDouble();
ui->textBrowser->append(" نام : " +file_name.readLine());
ui->textBrowser->append("قیمت ورود : "+entry);
ui->textBrowser->append("قیمت خروج : "+close);
ui->textBrowser->append("حجم معامله : "+QString::number(vol));
if(cat=="بورس ایران"){
ui->textBrowser->append("درصدی شما از این معامله سود (زیان) : "+QString::number((close.toDouble()/entry.toDouble()-1.01)*100)+" %");
ui->textBrowser->append("ریالی شما از این معامله سود (زیان) : "+QString::number((close.toDouble()/entry.toDouble()-1.01)*vol));
}
else{
ui->textBrowser->append("درصدی شما از این معامله سود (زیان) : "+QString::number((close.toDouble()/entry.toDouble()-1.001)*100)+" %");
ui->textBrowser->append("دلاری شما از این معامله سود (زیان) : "+QString::number((close.toDouble()/entry.toDouble()-1.001)*vol)+"$");
}
ui->textBrowser->append("---------------------------------------------------------------------------------------------------------------------------------------------");
}
file_entry.close();
file_name.close();
file_close.close();
file_vol.close();
}