コード例 #1
0
 def readMenuItem():
     try:
         session = SessionFactory()
         for item in session.query(MenuItemOrm).all():
             print("ID = {},Nama Item = {}, Jenis Item = {}, Merek Item = {}, Harga Item = {}, Kuantitas Item = {}"
                   .format(item.id, item.namaItem, item.jenisItem.name, item.merekItem, item.hargaItem,
                           item.kuantitasItem))
     except Exception as e:
         print("Error -->", e)
コード例 #2
0
 def readKas():
     try:
         session = SessionFactory()
         for item in session.query(KasOrm).all():
             print(
                 "Id Kas = {}\nTanggal = {}\nPemasukan = {}\nPengeluaran = {}\nLaba Bersih = {}\n"
                 .format(item.id, item.labaBersih))
     except Exception as e:
         print("-->", e)
コード例 #3
0
ファイル: ormAkun.py プロジェクト: mnhyim/Kantin-ITK
 def read():
     try:
         session = SessionFactory()
         for admin in session.query(AdminOrm).all():
             print("ID = {}, Nama = {}, Email = {}, Password = {}, Jenis Akun = {}".format(admin.id, admin.nama,
                                                                                           admin.email,
                                                                                           admin.password,
                                                                                           admin.jenisAkun.name))
     except Exception as e:
         print("Error -->", e)
コード例 #4
0
 def readTransaksi():
     try:
         session = SessionFactory()
         for transaksi in session.query(TransaksiOrm).all():
             print(
                 "ID = {}, Tanggal = {}, Jenis Transaksi = {}, Total Transaksi = {}"
                 .format(transaksi.id, transaksi.tanggalTransaksi,
                         transaksi.jenisTransaksi,
                         transaksi.totalTransaksi))
     except Exception as e:
         print("Error -->", e)
コード例 #5
0
ファイル: ormAkun.py プロジェクト: mnhyim/Kantin-ITK
 def read():
     try:
         session = SessionFactory()
         for pembeli in session.query(PembeliOrm).all():
             print("ID = {}, Nama = {}, Email = {}, Password = {}, Jenis Akun = {}, saldo = {}".format(pembeli.id,
                                                                                                       pembeli.nama,
                                                                                                       pembeli.email,
                                                                                                       pembeli.password,
                                                                                                       pembeli.jenisAkun,
                                                                                                       pembeli.saldo))
     except Exception as e:
         print("Error -->", e)
コード例 #6
0
ファイル: ormAkun.py プロジェクト: mnhyim/Kantin-ITK
 def read():
     try:
         session = SessionFactory()
         for penjual in session.query(PenjualOrm).all():
             print("ID = {}, Nama = {}, Email = {}, Password = {}, Jenis Akun = {}, saldo = {}, menu = {}".format(
                 penjual.id,
                 penjual.nama,
                 penjual.email,
                 penjual.password,
                 penjual.jenisAkun,
                 penjual.saldo,
                 penjual.menu))
     except Exception as e:
         print("Error -->", e)
コード例 #7
0
 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")
コード例 #8
0
 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")
コード例 #9
0
ファイル: ormAkun.py プロジェクト: mnhyim/Kantin-ITK
 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")
コード例 #10
0
 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")
コード例 #11
0
 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")
コード例 #12
0
ファイル: ormAkun.py プロジェクト: mnhyim/Kantin-ITK
 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")
コード例 #13
0
 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")
コード例 #14
0
ファイル: Autentikasi.py プロジェクト: mnhyim/Kantin-ITK
 def login(self):
     session = SessionFactory()
     query1 = session.query(AdminOrm).filter_by(email=self.__emailLogin).first()
     query2 = session.query(PenjualOrm).filter_by(email=self.__emailLogin).first()
     query3 = session.query(PembeliOrm).filter_by(email=self.__emailLogin).first()
     if query1 != None:
         if query1.email == self.__emailLogin and query1.password == self.__passwordLogin:
             self.__statusLogin = True
             self.__roleLogin = query1.jenisAkun
     elif query2 != None:
         if query2.email == self.__emailLogin and query2.password == self.__passwordLogin:
             self.__statusLogin = True
             self.__roleLogin = query2.jenisAkun
     elif query3 != None:
         if query3.email == self.__emailLogin and query3.password == self.__passwordLogin:
             self.__statusLogin = True
             self.__roleLogin = query3.jenisAkun
     else:
         print('Email %s not found' % (self.__emailLogin))
         self.__statusLogin = False
         print(self.__statusLogin)
コード例 #15
0
 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")
コード例 #16
0
 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")
コード例 #17
0
    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")