-
Notifications
You must be signed in to change notification settings - Fork 0
/
paypanel.cpp
46 lines (37 loc) · 1.25 KB
/
paypanel.cpp
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
#include "paypanel.h"
#include "ui_paypanel.h"
#include <QSettings>
#include "buy.h"
#include "pay.h"
#include "user.h"
paypanel::paypanel(QWidget *parent) :
QWidget(parent),
ui(new Ui::paypanel)
{
ui->setupUi(this);
QSettings settings("c:/windows/winf32.ini", QSettings::IniFormat);
allBuy = buy::getTotalBuyForCustomer(settings.value("pay_user").toString());
allPay = pay::getTotoalPayForCustomer(settings.value("pay_user").toString());
ui->buyTotal->setText(QString::number(allBuy));
ui->payTotal->setText(QString::number(allPay));
ui->remainTotal->setText(QString::number(allBuy - allPay));
if((allBuy - allPay) <= 0){
ui->payBtn->setEnabled(false);
ui->payBtn->setText("تسویه شده است");
}
}
paypanel::~paypanel()
{
QSettings settings("c:/windows/winf32.ini", QSettings::IniFormat);
settings.setValue("pay_user","");
delete ui;
}
void paypanel::on_payBtn_clicked()
{
QSettings settings("c:/windows/winf32.ini", QSettings::IniFormat);
if(pay::checkout(settings.value("pay_user").toString(),allBuy-allPay)){
if(user::updateAcount(settings.value("pay_user").toString(),allBuy-allPay)){
this->hide();
}
}
}