def Tupdate(self): try: SimpanPinjamORM.updateSimpanPinjam(self.idG.text(), self.nama.text(), self.tanggal.text(), self.simpan.text(), self.pinjam.text()) msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("Data Telah Terupdate") msg.setWindowTitle("Berhasil, Selamat") s = msg.exec_() except Exception as e: msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("Data Gagal Input") msg.setInformativeText(f"KESALAHAN : {e}") msg.setWindowTitle("Gagal") s = msg.exec_()
def isiTable(self): query = SimpanPinjamORM.dataSijam() self.table.setRowCount(len(query)) for row in range(len(query)): self.table.setItem(row, 0, QTableWidgetItem(str(query[row].id_nasabah))) self.table.setItem(row, 1, QTableWidgetItem(query[row].nama_nasabah)) self.table.setItem(row, 2, QTableWidgetItem(query[row].tanggal)) self.table.setItem(row, 3, QTableWidgetItem(query[row].jumlah_simpan)) self.table.setItem(row, 4, QTableWidgetItem(query[row].jumlah_pinjam))
def create_table(self): print("isitable") self.table = QTableWidget(self) # self.table.cellClicked.connect(self.cek) self.table.setColumnCount(5) self.table.setHorizontalHeaderLabels(["ID","NAMA","Tanggal","Simpan","Pinjam"]) query = SimpanPinjamORM.showSijam() print(len(query)) self.table.setRowCount(len(query)) for row in range(len(query)): self.table.setItem(row,0,QTableWidgetItem(str(query[row].id_nasabah))) self.table.setItem(row,1,QTableWidgetItem(query[row].nama_nasabah)) self.table.setItem(row,2,QTableWidgetItem(query[row].tanggal)) self.table.setItem(row, 3, QTableWidgetItem(str(query[row].jumlah_simpan))) self.table.setItem(row, 4,QTableWidgetItem(str(query[row].jumlah_pinjam))) self.table.setFixedSize(830,430) self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
def submit_btn(self): try: x = SimpanPinjamORM(self.nama.text(), self.tanggal.text(), self.jumlahsimpan.text(), 0) msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("Data Telah Disimpan") msg.setWindowTitle("Berhasil") s = msg.exec_() # self.clear_btn() except Exception as e: msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("Data Gagal Input") msg.setInformativeText(f"KESALAHAN : {e}") msg.setWindowTitle("Gagal") s = msg.exec_()
def hapus(self): if self.lastClick != None: SimpanPinjamORM.delSijam(self.lastClick) self.isiTable() else: pass
def insertNasabah(self): x = SimpanPinjamORM(self.__nama_nasabah, self.__tanggal, self.__jumlah_simpan, self.__jumlah_pinjam)