def cutbill(self):
     #print('shit')
     for car in self.carlist:
         database = Database()
         rfid = database.tagtonumber(car)
         #print(car)
         database.cutbill(rfid)
示例#2
0
def billingdata():
    database = Database('parking1')
    if current_user.username == 'Admin':
        table = tabulate(database.viwebilladmin(), tablefmt='html')
        return render_template("billingdata.html", table=table)
    else:
        table = tabulate(database.viewbill(current_user.username),
                         tablefmt='html')
        return render_template("billingdata.html", table=table)
示例#3
0
def searchbill():
    if current_user.username == 'Admin':
        if request.method == 'POST':

            database = Database('parking1')
            data = (request.form["rfid"])

            table = tabulate(database.viewbill(data), tablefmt='html')
            return render_template("billingdata.html", table=table)
示例#4
0
def addbill():
    if current_user.username == 'Admin':
        if request.method == 'POST':
            rfid = request.form.get('rfid')
            amount = request.form.get('amount')
            tag = request.form.get('tag')
            database = Database('parking1')
            database.addbill(rfid, tag, int(amount))
            table = tabulate(database.viwebilladmin(), tablefmt='html')
            return render_template("parkingdata.html", table=table)
        else:
            return render_template('addbill.html')
    else:
        return "<h1>You Dont Have Permission to access Here</h1>"
示例#5
0
def getdata():
    if request.method == 'POST':
        rfid = request.form.get('rfid')
        inout = request.form.get('inout')
        pwd = request.form.get('pwd')
        a = request.form.get('parking')
        if pwd == 'lolhaha':

            database = Database(a)
            database.carinout(rfid, inout)
            if inout == 'out':
                print('got to out')
                database.cutbill(rfid)
            #database.viewbill(rfid)
            b = database.viewbill(rfid)
            Car_Number = b[0][0]
            Balance = b[0][1]
            print(Car_Number, Balance)
            return jsonify(car_number=Car_Number, balance=Balance)
            '''
            if inout == 'in':
                carcounter.carin(rfid)
            elif inout == 'out':
                carcounter.carout(rfid)
            else:
                pass
            '''
        else:
            return '''<h1>BUUUUUUUU BUU DESU WA</h1><img src="https://vignette.wikia.nocookie.net/love-live/images/2/27/LLSS_S1Ep1_250.png/revision/latest/scale-to-width-down/800?cb=20160703203036" alt="BUUUUUUUU BUUU DESU WA">'''

    return '''<form method="POST">
示例#6
0
def parkingdata():
    table = []
    parking_names = []
    database = Database('parking1')
    if current_user.username == 'Admin':
        temp_dict = database.viewadmin()
        for i in temp_dict:
            table.append(tabulate(temp_dict[i], tablefmt='html'))
            parking_names.append(i)
        return render_template("parkingdata.html",
                               table=zip(parking_names, table))
    else:
        temp_dict = database.view(current_user.username)
        for i in temp_dict:
            table.append(tabulate(temp_dict[i], tablefmt='html'))
            parking_names.append(i)
        return render_template("parkingdata.html",
                               table=zip(parking_names, table))
示例#7
0
def searchdata():
    if current_user.username == 'Admin':
        #a=Database('parking1')
        if request.method == 'POST':
            table = []
            parking_names = []
            data = (request.form["rfid"])
            database = Database('parking1')
            temp_dict = database.view(data)
            for i in temp_dict:
                table.append(tabulate(temp_dict[i], tablefmt='html'))
                parking_names.append(i)
            return render_template("parkingdata.html",
                                   table=zip(parking_names, table))
            #table = tabulate(request.form["rfid"].search(), tablefmt='html')
            #return render_template("parkingdata.html",table=table)
        return "aaa"
    else:
        return "<h1>You Dont Have Permission to access Here</h1>"
 def carin(self, rfid):
     database = Database()
     self.carlist.append(rfid)
 def carout(self, rfid):
     database = Database()
     self.carlist.remove(rfid)