-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsure_duzenleme.cpp
85 lines (78 loc) · 2.8 KB
/
sure_duzenleme.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "sure_duzenleme.h"
#include "ui_sure_duzenleme.h"
QTableWidgetItem *itm;
int row;
int column;
QString dateConst;
Sure_Duzenleme::Sure_Duzenleme(QWidget *parent, QTableWidgetItem *item, double time, int quantity, QString date, QList<QTableWidget*> *twList) :
QDialog(parent),
ui(new Ui::Sure_Duzenleme)
{
ui->setupUi(this);
ui->label->setText("Barkod : " + item->text());
ui->doubleSpinBox->setValue(time);
QSqlQuery query;
row = twList->indexOf(item->tableWidget());
column = item->column();
dateConst = date;
query.exec("select aciklama from aciklama where row = " + QString::number(row)
+ " and column = " + QString::number(column)
+ " and tarih = '" + date + "'");
query.next();
ui->plainTextEdit->setPlainText(query.value(0).toString());
ui->spinBox->setValue(quantity);
itm = item;
}
Sure_Duzenleme::~Sure_Duzenleme()
{
delete ui;
}
void Sure_Duzenleme::on_pushButton_clicked()
{
QSqlQuery query;
QSqlQuery qry;
query.exec("update parca set time = " + QString::number(ui->doubleSpinBox->value()) + ", quantity = " + QString::number(ui->spinBox->value()) + " where barcode = '" + itm->text() + "'");
itm->tableWidget()->setColumnWidth(itm->column(), 364 * ui->doubleSpinBox->value() / 225);
query.exec("select aciklama from aciklama where row = " + QString::number(row) + " and column = " + QString::number(column) + " and tarih = '" + dateConst + "'");
query.next();
if(query.value(0).toString().isEmpty())
{
if(!ui->plainTextEdit->toPlainText().isEmpty())
{
qry.prepare("insert into aciklama values(:row,:column,:aciklama,:tarih)");
qry.bindValue(":row", row);
qry.bindValue(":column", column);
qry.bindValue(":aciklama", ui->plainTextEdit->toPlainText());
qry.bindValue(":tarih", dateConst);
qry.exec();
}
}
else
{
if(ui->plainTextEdit->toPlainText().isEmpty())
{
qry.exec("update aciklama set aciklama = '"
+ QString(" ")
+ "' where row = "
+ QString::number(row)
+ " and column = "
+ QString::number(column)
+ " and tarih = '"
+ dateConst
+ "'");
}
else
{
qry.exec("update aciklama set aciklama = '"
+ ui->plainTextEdit->toPlainText()
+ "' where row = "
+ QString::number(row)
+ " and column = "
+ QString::number(column)
+ " and tarih = '"
+ dateConst
+ "'");
}
}
this->deleteLater();
}