def deleteMenuItem(x): try: session = SessionFactory() session.query(MenuItemOrm).filter_by(id=x).delete() session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Delete Berhasil")
def insert(self): try: session = SessionFactory() session.add(AdminOrm(self.nama, self.email, self.password, self.jenisAkun)) session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Insert Berhasil")
def deleteKas(id): try: session = SessionFactory() session.query(KasOrm).filter_by(id=id).delete() session.commit() session.close() except Exception as e: print("-->", e) else: print("Hapus Berhasil")
def insertMenuItem(self, ): try: session = SessionFactory() menuItemOrm = MenuItemOrm(self.getNamaItem(), self.getJenisItem(), self.getMerekItem(), self.getHargaItem(), self.getKuantitasItem()) session.add(menuItemOrm) session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Insert Berhasil")
def insertKas(self): try: session = SessionFactory() kasOrm = KasOrm(self.getTglKas(), self.getPemasukan(), self.getPengeluaran(), self.hitungLabaBersih()) session.add(kasOrm) session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Insert Berhasil")
def update(x): try: dNama = input("Masukkan Nama Baru: ") session = SessionFactory() session.query(AdminOrm).filter_by(id=x).update({ AdminOrm.nama: dNama }, synchronize_session=False) session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Update Berhasil")
def insertTransaksi(self): try: session = SessionFactory() trsOrm = TransaksiOrm(self.getTanggalTransaksi(), self.getJenisTransaksi(), self.getTotalTransaksi()) session.add(trsOrm) session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Insert Berhasil")
def updateTransaksi(x): try: dTotal = input("Masukkan Total Transaksi Baru: ") session = SessionFactory() session.query(TransaksiOrm).filter_by(id=x).update( { TransaksiOrm.tanggalTransaksi: datetime.now().date(), TransaksiOrm.totalTransaksi: dTotal }, synchronize_session=False) session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Update Berhasil")
def updateKas(id): try: newPemasukan = input("Masukkan Jumlah Pemasukan: ") newPengeluaran = input("Masukkan Jumlah Pengeluaran: ") session = SessionFactory() session.query(KasOrm).filter_by(id=id).update( { KasOrm.pemasukan: newPemasukan, KasOrm.pengeluaran: newPengeluaran }, synchronize_session=False) session.commit() session.close() except Exception as e: print("-->", e) else: print("Update Berhasil")
def updateMenuItem(x): try: dNama = input("Masukkan Nama Baru: ") djenisItem = int(input("Masukkan Jenis Item Baru (1/2): ")) dmerekItem = input("Masukkan Merek Item Baru: ") dhargaItem = input("Masukkan Harga Item Baru: ") dkuantitasItem = input("Masukkan Kuantitas Item Baru: ") session = SessionFactory() session.query(MenuItemOrm).filter_by(id=x).update({ MenuItemOrm.namaItem: dNama, MenuItemOrm.jenisItem: JenisItem(djenisItem), MenuItemOrm.merekItem: dmerekItem, MenuItemOrm.hargaItem: dhargaItem, MenuItemOrm.kuantitasItem: dkuantitasItem }, synchronize_session=False) session.commit() session.close() except Exception as e: print("Error -->", e) else: print("Update Berhasil")