Ejemplo n.º 1
0
 def karyawanMenu(self):
     while True:
         try:
             View.printKmenu(self.namaUser)
             jawab = input('Jawab : ')
             if jawab == '1':
                 View.clear()
                 self.history()
                 print()
             elif jawab == '2':
                 View.clear()
                 self.showBarang()
                 print()
             elif jawab == '3':
                 View.clear()
                 self.ambilBarang()
                 print()
             elif jawab == '4':
                 View.clear()
                 self.tambahStokBarang()
                 print()
             elif jawab == '5':
                 View.clear()
                 self.tambahBarang()
                 print()
             elif jawab == '6':
                 return self.close()
             else:
                 View.clear()
                 View.jawabFalse()
         except KeyboardInterrupt:
             View.interrupt()
             break
Ejemplo n.º 2
0
    def tambahStokBarang(self):
        self.showBarang()
        while True:
            try:
                tempJawab = []
                jawabID = int(input("\nMasukkan id yang mau di ambil : "))
                query = ('SELECT ID_Barang FROM barang')
                for x in self.fetchalll(query):
                    tempJawab.append(x[0])
                if jawabID in tempJawab:
                    jawabStok = int(
                        input("Masukkan stock yang mau di ambil : "))
                    if jawabStok <= 0:
                        View.inputZero()
                    else:
                        sql = """
                        Select Jumlah_Barang
                        FROM barang
                        WHERE ID_Barang = {}
                        """.format(jawabID)
                        res = self.fetchone(sql)
                        for x in res:
                            jumlahStok = x + jawabStok
                            sql = """
                            UPDATE barang
                            SET Jumlah_Barang = {}
                            WHERE ID_Barang = {}
                            """.format(jumlahStok, jawabID)
                            self.fetchone(sql)

                            sql = """SELECT Satuan FROM barang
                            WHERE ID_Barang = {}""".format(jawabID)
                            res = self.fetchone(sql)
                            for y in res:
                                satuan = y

                            sql = """INSERT INTO history (PersonID,
                            BarangID, Keterangan, Jumlah, Satuan, Tanggal)
                            VALUES (%s, %s, %s, %s, %s, %s)"""
                            val = (self.UserID, jawabID, "Input", jawabStok,
                                   satuan, datetime.now())
                            self.inputDB(sql, val)
                            View.done()
                        break
                else:
                    View.jawabFalse()
            except KeyboardInterrupt:
                View.interrupt()
                break
            except:
                View.inputError()
Ejemplo n.º 3
0
 def ownerMenu(self):
     while True:
         try:
             View.printOmenu(self.namaUser)
             jawab = input('Jawab : ')
             if jawab == '1':
                 View.clear()
                 print("Menambah Karyawan")
                 self.createKaryawan()
                 print()
             elif jawab == '2':
                 View.clear()
                 self.showKaryawan()
                 print()
             elif jawab == '3':
                 View.clear()
                 self.deleteKaryawan()
                 print()
             elif jawab == '4':
                 View.clear()
                 self.history()
                 print()
             elif jawab == '5':
                 View.clear()
                 self.showBarang()
                 print()
             elif jawab == '6':
                 View.clear()
                 self.ambilBarang()
                 print()
             elif jawab == '7':
                 View.clear()
                 self.tambahStokBarang()
                 print()
             elif jawab == '8':
                 View.clear()
                 self.tambahBarang()
                 print()
             elif jawab == '9':
                 return self.close()
             else:
                 View.clear()
                 View.jawabFalse()
         except KeyboardInterrupt:
             View.interrupt()
             break