-
Notifications
You must be signed in to change notification settings - Fork 0
/
page_blt.cpp
199 lines (165 loc) · 7.39 KB
/
page_blt.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#include "form.h"
#include "ui_form.h"
#include "QPdfWriter"
#include "pdf_dok.h"
#include "qrencode.h"
#include "pdf_dds.h"
#include "pdf_add.h"
#include "pdf_sppd_dds.h"
#include "pdf4.h"
#include "mainwindow.h"
// =======================================================================================
#include "QDebug"
#include <QFile>
#include <QDate>
#include <QSqlDatabase>
#include <QFile>
#include <QString>
#include <QDir>
#include <QSqlQuery>
#include <QTableWidget>
#include <QAbstractItemView>
#include <QClipboard>
#include <QDate>
#include <QDateEdit>
#include <QDateTime>
#include <QTime>
#include <QKeyEvent>
#include <QSignalMapper>
#include <QtCore>
#include <QPixmap>
#include <QAbstractButton>
#include <QRadioButton>
#include <QString>
#include <QPainter>
#include <QUrl>
void Form::on_toolButton_blt_clicked()
{
boderToolbar(5);
ui->stackedWidget->setCurrentIndex(5);
sembunyi_subMenu();
memuatData_twRealisasiblt("");
menu="6";
ui->comboBox->setCurrentIndex(0);
ui->comboBox_nmKampung->setCurrentIndex(0);
qInfo() << "Nilai Menu untuk ====" << menu;
}
void Form::memuatData_twRealisasiblt(QString id_kamp){
header_twRealisasiblt();
while(ui->tableWidget_realisasi_blt->rowCount()>0)// untuk Hilangkan Tambahan jika button di klik ulang
{ui->tableWidget_realisasi_blt->removeRow(0);}
double pagu_blt=0;
double tot_cair_blt=0;
double sisa_blt=0;
QSqlQuery query;
QString cmd = "SELECT pmk_yhk.blt.nama_kampung,pmk_yhk.blt.nama_distrik,pmk_yhk.blt.id_dis, pmk_yhk.blt.id_k,pmk_yhk.blt.pagu,"
"SUM ( pmk_yhk.blt_cair.jml_cair_blt ) AS total_pencairan, pmk_yhk.blt.pagu - SUM ( pmk_yhk.blt_cair.jml_cair_blt ) AS sisa_dana "
" FROM "
" pmk_yhk.blt"
" LEFT JOIN pmk_yhk.blt_cair ON pmk_yhk.blt.id_k = pmk_yhk.blt_cair.id_kam "
" GROUP BY "
" pmk_yhk.blt.nama_kampung,"
"pmk_yhk.blt.nama_distrik,"
"pmk_yhk.blt.id_dis,"
"pmk_yhk.blt.id_k"
" ORDER BY "
"pmk_yhk.blt.id_k";
QString cmd_ = "SELECT pmk_yhk.blt.nama_kampung,pmk_yhk.blt.nama_distrik,pmk_yhk.blt.id_dis, pmk_yhk.blt.id_k,pmk_yhk.blt.pagu,"
"SUM ( pmk_yhk.blt_cair.jml_cair_blt ) AS total_pencairan, pmk_yhk.blt.pagu - SUM ( pmk_yhk.blt_cair.jml_cair_blt ) AS sisa_dana "
" FROM "
" pmk_yhk.blt"
" LEFT JOIN pmk_yhk.blt_cair ON pmk_yhk.blt.id_k = pmk_yhk.blt_cair.id_kam "
" WHERE pmk_yhk.blt.id_k = :id "
" GROUP BY "
" pmk_yhk.blt.nama_kampung,"
"pmk_yhk.blt.nama_distrik,"
"pmk_yhk.blt.id_dis,"
"pmk_yhk.blt.id_k"
" ORDER BY "
"pmk_yhk.blt.id_k";
if(id_kamp != ""){cmd = cmd_;}
//if(s_id_kamp==""){cmd =" SELECT * FROM pmk_yhk.t_real ORDER BY id_real ASC, pmk_yhk.t_real.id_real LIMIT 40 ";}
query.prepare(cmd);
query.bindValue(":id",id_kamp);
//query.bindValue(":id",s_id_kamp);
bool ok = exec(query);
if(!ok){QMessageBox::information(this,"Error...!!!","Gagal Memuat data realisasi"); return;}
int i=0;
while (query.next()) {
//int i = ui->tableWidget_realisasi_blt->rowCount();
ui->tableWidget_realisasi_blt->insertRow(i);
QTableWidgetItem *nm_kampung_ = new QTableWidgetItem;
QTableWidgetItem *nm_distrik_ = new QTableWidgetItem;
QTableWidgetItem *id_dis_ = new QTableWidgetItem;
QTableWidgetItem *id_kam_ = new QTableWidgetItem;
QTableWidgetItem *pagu_ = new QTableWidgetItem;
QTableWidgetItem *tot_cair_ = new QTableWidgetItem;
QTableWidgetItem *sisa_dana_ = new QTableWidgetItem;
nm_kampung_->setText(query.value(0).toString()); //nama_kampung
nm_distrik_->setText(query.value(1).toString()); //Nama Distrik
id_dis_->setText(query.value(2).toString()); //Id Distrik
id_kam_->setText(query.value(3).toString()); //id Kampung
QString pagu_s = query.value(4).toString();
double pagu_d = pagu_s.toDouble();
QString pagu_ss = indo.toCurrencyString(pagu_d, "Rp ");
QString tot_cair_s = query.value(5).toString();
double tot_cair_d = tot_cair_s.toDouble();
QString tot_cair_ss = indo.toCurrencyString(tot_cair_d, "Rp ");
double realisasi_blt = pagu_d - tot_cair_d;
QString sisa_dana_s = query.value(6).toString();
//double sisa_dana_d = sisa_dana_s.toDouble();
QString sisa_dana_ss = indo.toCurrencyString(realisasi_blt, "Rp ");
pagu_->setText(pagu_ss);
tot_cair_->setText(tot_cair_ss); //total Pencairan
sisa_dana_->setText(sisa_dana_ss); //Sisa Dana
nm_kampung_->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
nm_distrik_->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
id_dis_->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
id_kam_->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
pagu_->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
tot_cair_->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
sisa_dana_->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
//ui->tableWidget_realisasi_blt->setCellWidget(i,0,rb);
ui->tableWidget_realisasi_blt->setItem(i,2,nm_kampung_);
ui->tableWidget_realisasi_blt->setItem(i,1,nm_distrik_);
ui->tableWidget_realisasi_blt->setItem(i,6,id_dis_);
ui->tableWidget_realisasi_blt->setItem(i,0,id_kam_);
ui->tableWidget_realisasi_blt->setItem(i,3,pagu_);
ui->tableWidget_realisasi_blt->setItem(i,5,tot_cair_);
ui->tableWidget_realisasi_blt->setItem(i,4,sisa_dana_);
i++;
pagu_blt += pagu_d;
tot_cair_blt += tot_cair_d;
}
sisa_blt = pagu_blt - tot_cair_blt;
QString pagu_blt_ss = indo.toCurrencyString(pagu_blt, "Rp ");
QString tot_cair_d_ss = indo.toCurrencyString(tot_cair_blt, "Rp ");
QString realisasi_blt_ss = indo.toCurrencyString(sisa_blt, "Rp ");
ui->lineEdit_pagu_blt->setText(pagu_blt_ss);
ui->lineEdit_realisasi_blt->setText(tot_cair_d_ss);
ui->lineEdit_sisa_blt->setText(realisasi_blt_ss);
}
void Form::header_twRealisasiblt() // Header table widget 6
{
QStringList headerWidget;
ui->tableWidget_realisasi_blt->setColumnCount(7);
headerWidget <<"id" <<"Nama Distrik"<<"Nama Kampung" <<"Pagu Anggaran " <<"Sisa Anggaran "<<"Realisasi " <<"id Distrik";
ui->tableWidget_realisasi_blt->setHorizontalHeaderLabels(headerWidget);
ui->tableWidget_realisasi_blt->horizontalHeader()->setStretchLastSection(true);
ui->tableWidget_realisasi_blt->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget_realisasi_blt->setColumnWidth(0,8);
ui->tableWidget_realisasi_blt->setColumnHidden(0,true);
ui->tableWidget_realisasi_blt->setColumnWidth(1,140);
ui->tableWidget_realisasi_blt->setColumnWidth(2,150);
ui->tableWidget_realisasi_blt->setColumnHidden(6,true);
ui->tableWidget_realisasi_blt->setColumnWidth(3,120);
ui->tableWidget_realisasi_blt->setColumnWidth(4,120);
ui->tableWidget_realisasi_blt->setColumnWidth(5,120);
//ui->tableWidget_realisasi_blt->setColumnWidth(6,120);
}
void Form::on_toolButton_tmbRealblt_clicked()
{
}
void Form::on_toolButton_cetakPdfblt_clicked()
{
}