基于Python和SQL server2012语言实现基本的银行业务系统详细代码

基于Python和SQL server2012语言实现基本的银行业务系统详细代码

#导入ADO接口模块


```python
import tkinter.messagebox as mb
from tkinter import  *
from PIL import Image,ImageTk
import time
import random
import pymssql
import win32com.client
import pandas
from tkinter import ttk
#连接服务器和数据库
cn = win32com.client.Dispatch('ADODB.Connection')
cnstr = 'Provider = SQLOLEDB.1;Integrated Security = SSPI;Data Source = DESKTOP-3U2FPNK'
cn.Open(cnstr,'sa','sa')
cn.Execute("USE Bank")
rs=win32com.client.Dispatch('ADODB.RecordSet')
rs.LockType=4
server = 'DESKTOP-3U2FPNK'
user ='sa'
userpassword ='sa'
database = 'Bank'
conn = pymssql.connect(server,user,userpassword,database)
cursor = conn.cursor()
class Admin(object):
    def __init__(self):
        # 声明两个变量
        self.sum = 2
        self.count=2
        self.m =2
        self.n=2
# 开户操作
    def K_H(self):
        rt = Tk()
        rt.geometry('300x600+300+150')
        rt.iconbitmap('f6.ico')
        rt.title('开户')
        iid =""
        iid2=""
        for i in range(6):
            iid += str(random.randrange(0,10))
        id = iid
        rs.LockType=4
        rs.Open('Account',cn)
        while not rs.EOF:
            if(str(rs.Fields(0).Value)).strip()==id:
                for i in range(6):
                    iid2 += str(random.randrange(0, 10))
                id = int(iid2)
            else:
                id = int(iid)
                break
        Lb1 = Label(rt,text='银行卡号:',font=('微软雅黑',10))
        Lb1.place(x=20,y=20)
        text1 = StringVar()
        e11 = Entry(rt,text=text1,state=DISABLED)
        e11.place(x=100,y=20)
        text1.set(id)
        Lb2 = Label(rt,text='身份证号:',font=('微软雅黑',10))
        Lb2.place(x=20,y=60)
        e12 = Entry(rt)
        e12.place(x=100,y=60)
        Lb3 = Label(rt,text='用户姓名',font=('微软雅黑',10))
        Lb3.place(x=20,y=100)
        e13 = Entry(rt)
        e13.place(x=100,y=100)
        Lb12 = Label(rt, text='用户性别', font=('微软雅黑', 10))
        Lb12.place(x=20, y=140)
        e22 = Entry(rt)
        e22.place(x=100, y=140)
        Lb4 = Label(rt, text='输入密码', font=('微软雅黑', 10))
        Lb4.place(x=20, y=180)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=180)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=220)
        e15 = Entry(rt,show='*')
        e15.place(x=100, y=220)
        Lb6 = Label(rt, text='电话号码:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=260)
        e16 = Entry(rt)
        e16.place(x=100, y=260)
        Lb7 = Label(rt, text='存款金额:', font=('微软雅黑', 10))
        Lb7.place(x=20, y=300)
        e17 = Entry(rt)
        e17.place(x=100, y=300)
        Lb27 = Label(rt, text='可透支度:', font=('微软雅黑', 10))
        Lb27.place(x=20, y=340)
        e27 = Entry(rt)
        e27.place(x=100, y=340)
        Lb8 = Label(rt, text='开户时间:', font=('微软雅黑', 10))
        Lb8.place(x=20, y=380)
        text2 = StringVar()
        e18 = Entry(rt,text=text2,state=DISABLED)
        text2.set(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time())))
        e18.place(x=100, y=380)
        Lb9 = Label(rt, text='银行卡类别:', font=('微软雅黑', 10))
        Lb9.place(x=20, y=420)
        e19 = Entry(rt)
        e19.place(x=100, y=420)
        Lb10 = Label(rt, text='银行编号:', font=('微软雅黑', 10))
        Lb10.place(x=20, y=460)
        e20 = Entry(rt)
        e20.place(x=100, y=460)
        Lb11 = Label(rt, text='银行卡状态:', font=('微软雅黑', 10))
        Lb11.place(x=20, y=500)
        e21 = Entry(rt)
        e21.place(x=100, y=500)
        def TiJiao():
            password1 = e14.get()
            password2 = e15.get()
            if password1 == password2:
                id=e11.get()
                identitycard = e12.get()
                name = str(e13.get())
                sex= e22.get()
                telephone = e16.get()
                balance = float(e17.get())
                overdratf = float(e27.get())
                regtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                typeid = int(e19.get())
                ibank = int(e20.get())
                status = int(e21.get())
                rs.AddNew()
                rs.Fields(0).Value = id
                rs.Fields(1).Value = name
                rs.Fields(2).Value = password1
                rs.Fields(3).Value = identitycard
                rs.Fields(4).Value = sex
                rs.Fields(5).Value = telephone
                rs.Fields(6).Value = balance
                rs.Fields(7).Value = overdratf
                rs.Fields(8).Value = regtime
                rs.Fields(9).Value = typeid
                rs.Fields(10).Value = ibank
                rs.Fields(11).Value = status
                rs.UpdateBatch()
                cn.Close()
                mb.showinfo('成功','添加成功!')
            elif self.sum == 0:
                mb.showwarning('失败', '注册失败')
                rt.destroy()
                Main().Admin_YG()
            else:
                mb.showwarning('失败', '密码不一致')
                e15.delete(0, 'end')
                e14.delete(0, 'end')
            self.sum -=1
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()
        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao)
        bt1.place(x=40, y=540)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=540)
#销户操作
    def X_H(self):
        rt = Tk()
        rt.title("销户")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x300+200+100')
        Lb1 = Label(rt,text='银行卡号:',font=('华文新魏',10),)
        Lb1.place(x=20,y=20)
        e11 = Entry(rt)
        e11.place(x=100,y=20)
        Lb2 = Label(rt,text = '用户姓名:',font=('华文新魏',10))
        Lb2.place(x=20,y=60)
        e12 = Entry(rt)
        e12.place(x=100,y=60)
        Lb3 = Label(rt,text='身份证号:',font=('华文新魏',10))
        Lb3.place(x=20,y=100)
        e13= Entry(rt)
        e13.place(x=100,y=100)
        Lb4 = Label(rt,text='输入密码:',font=('华文新魏',10))
        Lb4.place(x=20,y=140)
        e14 = Entry(rt,show='*')
        e14.place(x=100,y=140)
        Lb5 = Label(rt,text='确认密码:',font=('华文新魏',10))
        Lb5.place(x=20,y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt,text='是否删除:',font=('华文新魏',10))
        Lb6.place(x=20, y=220)
        v = StringVar()
        co = ttk.Combobox(rt,textvariable=v,width=10)
        co['values']=('是','否')
        co.set('选择')
        co.place(x=100, y=220)
        def TiJiao():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            if id=='' or name =='' or identitycard=='':
                mb.showwarning('失败','信息不能为空')
            else:
                cursor.execute(
                    "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s " % (id, name, identitycard,))
                Account = cursor.fetchone()
                if Account is None:
                    mb.showwarning('失败','输入信息有误!')
                    e11.delete(0,'end')
                    e12.delete(0, 'end')
                    e13.delete(0, 'end')
                else:
                    password1 = e14.get()
                    password2 = e15.get()
                    if password1 == password2:
                        cursor.execute("SELECT PASSWORD FROM Account WHERE ID = %s and NAME ='%s' and IDENTITYCARD =%s " % (
                        id, name, identitycard,))
                        password0 = cursor.fetchone()
                        password = ",".join(map(str, password0))  # 将得到的元祖装换为字符串,在将字符串变为整形元素
                        if password2 == password:
                            cursor.execute("SELECT STATUS FROM Account WHERE ID = %s and NAME ='%s' and IDENTITYCARD =%s " % (
                            id, name, identitycard,))
                            status1 = cursor.fetchone()
                            status = int(",".join(map(str, status1)))
                            if status == 0:
                             mb.showwarning('失败','卡已冻结!')
                            else:
                                cursor.execute(
                                    "SELECT STATUS FROM Account WHERE ID = %s and NAME ='%s' and IDENTITYCARD =%s " % (
                                    id, name, identitycard,))
                                status2 = cursor.fetchone()
                                status = int(",".join(map(str, status2)))
                                if status == 2:
                                 mb.showwarning('失败','卡已挂失!')
                                else:
                                    t = str(co.get())
                                    if t == '是':
                                        cursor.execute(
                                            "DELETE FROM Account Where ID=%s and Name ='%s' and password = %s and identitycard=%s" % (
                                            id, name, password, identitycard,))
                                        conn.commit()
                                        mb.showinfo('成功','注销成功!')
                                    else:
                                        mb.showwarning('失败',"销户失败!!!")
                        elif self.count == 0:
                            cursor.execute("UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                            conn.commit()
                            mb.showwarning('失败', '失败,卡已被冻结!')
                            rt.destroy()
                            Main().Admin_YG()
                        else:
                            mb.showwarning('失败', '密码错误')
                            e15.delete(0, 'end')
                            e14.delete(0, 'end')
                        self.count -= 1
                    elif self.sum == 0:
                        cursor.execute("UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                        conn.commit()
                        mb.showwarning('失败', '销户失败,已冻结!')
                        rt.destroy()
                        Main().Admin_YG()
                    else:
                        mb.showwarning('失败', '密码不一致')
                        e15.delete(0, 'end')
                        e14.delete(0, 'end')
                    self.sum -= 1

        def FANHUI():
            rt.destroy()
            Main().Admin_YG()
        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
#冻结操作
    def D_J(self):
        rt = Tk()
        rt.title("冻结")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x300+200+100')
        Lb1 = Label(rt, text='银行卡号:', font=('华文新魏', 10), )
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        Lb2 = Label(rt, text='用户姓名:', font=('华文新魏', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('华文新魏', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('华文新魏', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('华文新魏', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='是否冻结:', font=('华文新魏', 10))
        Lb6.place(x=20, y=220)
        v = StringVar()
        co = ttk.Combobox(rt, textvariable=v, width=10)
        co['values'] = ('是', '否')
        co.set('选择')
        co.place(x=100, y=220)

        def TiJiao():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            if id == '' or name == '' or identitycard == '':
                mb.showwarning('失败', '信息不能为空')
            else:
                cursor.execute(
                    "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s " % (
                    id, name, identitycard,))
                Account = cursor.fetchone()
                if Account is None:
                    mb.showwarning('失败', '输入信息有误!')
                    e11.delete(0, 'end')
                    e12.delete(0, 'end')
                    e13.delete(0, 'end')
                else:
                    password1 = e14.get()
                    password2 = e15.get()
                    if password1 == password2:
                        cursor.execute(
                            "SELECT PASSWORD FROM Account WHERE ID = %s and NAME ='%s' and IDENTITYCARD =%s " % (
                                id, name, identitycard,))
                        password0 = cursor.fetchone()
                        password = ",".join(map(str, password0))  # 将得到的元祖装换为字符串,在将字符串变为整形元素
                        if password2 == password:
                            cursor.execute(
                                "SELECT STATUS FROM Account WHERE ID = %s and NAME ='%s' and IDENTITYCARD =%s " % (
                                    id, name, identitycard,))
                            status1 = cursor.fetchone()
                            status = int(",".join(map(str, status1)))
                            if status == 0:
                                mb.showwarning('失败', '此卡已被冻结!')
                            else:
                                    t = str(co.get())
                                    if t == '是':
                                        cursor.execute(
                                            "UPDATE Account SET STATUS=0 Where ID=%s and Name ='%s' and password = %s and identitycard=%s" % (
                                                id, name, password, identitycard,))
                                        conn.commit()
                                        mb.showinfo('成功', '冻结成功!')
                                    else:
                                        mb.showwarning('失败', "冻结失败!!!")
                        elif self.count == 0:
                            cursor.execute("UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                            conn.commit()
                            mb.showwarning('失败', '失败,卡已被冻结!')
                            rt.destroy()
                            Main().Admin_YG()
                        else:
                            mb.showwarning('失败', '密码错误')
                            e15.delete(0, 'end')
                            e14.delete(0, 'end')
                        self.count -= 1
                    elif self.sum == 0:
                        cursor.execute("UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                        conn.commit()
                        mb.showwarning('失败', '已冻结!')
                        rt.destroy()
                        Main().Admin_YG()
                    else:
                        mb.showwarning('失败', '密码不一致')
                        e15.delete(0, 'end')
                        e14.delete(0, 'end')
                    self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
#解冻操作
    def J_D(self):
        rt = Tk()
        rt.title("解冻")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x300+200+100')
        Lb1 = Label(rt, text='银行卡号:', font=('华文新魏', 10), )
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        Lb2 = Label(rt, text='用户姓名:', font=('华文新魏', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('华文新魏', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('华文新魏', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('华文新魏', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='是否解冻:', font=('华文新魏', 10))
        Lb6.place(x=20, y=220)
        v = StringVar()
        co = ttk.Combobox(rt, textvariable=v, width=10)
        co['values'] = ('是', '否')
        co.set('选择')
        co.place(x=100, y=220)
        def TiJiao():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            if id == '' or name == '' or identitycard == '':
                mb.showwarning('失败', '信息不能为空')
            else:
                cursor.execute(
                    "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s " % (
                        id, name, identitycard,))
                Account = cursor.fetchone()
                if Account is None:
                    mb.showwarning('失败', '输入信息有误!')
                    e11.delete(0, 'end')
                    e12.delete(0, 'end')
                    e13.delete(0, 'end')
                else:
                    password1 = e14.get()
                    password2 = e15.get()
                    if password1 == password2:
                        cursor.execute(
                            "SELECT PASSWORD FROM Account WHERE ID = %s and NAME ='%s' and IDENTITYCARD =%s " % (
                                id, name, identitycard,))
                        password0 = cursor.fetchone()
                        password = ",".join(map(str, password0))  # 将得到的元祖装换为字符串,在将字符串变为整形元素
                        if password2 == password:
                            cursor.execute(
                                "SELECT STATUS FROM ACCOUNT WHERE ID=%s AND NAME='%s' AND IDENTITYCARD =%s" % (
                                id, name, identitycard,))
                            status0 = cursor.fetchone()
                            status = int(",".join(map(str, status0)))
                            if status == 1:
                                mb.showinfo('解冻','此卡正常无需解冻')
                            elif status == 2:
                               mb.showwarning('解冻',"此卡已挂失,不可操作")
                            else:
                                t = str(co.get())
                                if t == '是' :
                                    cursor.execute(
                                        "UPDATE Account SET STATUS = 1 WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD=%s AND PASSWORD=%s" % (
                                        id, name, identitycard, password2))
                                    conn.commit()
                                    mb.showinfo('解冻',"卡号为%s的卡已成功解封!!!" % (id,))
                                else:
                                    mb.showerror('解冻',"解冻失败,退出操作!!!")
                        elif self.count == 0:
                            cursor.execute(
                                "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                            conn.commit()
                            mb.showwarning('失败', '失败,卡已被冻结!')
                            rt.destroy()
                            Main().Admin_YG()
                        else:
                            mb.showwarning('失败', '密码错误')
                            e15.delete(0, 'end')
                            e14.delete(0, 'end')
                        self.count -= 1
                    elif self.sum == 0:
                        cursor.execute("UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                        conn.commit()
                        mb.showwarning('失败', '解冻失败!')
                        rt.destroy()
                        Main().Admin_YG()
                    else:
                        mb.showwarning('失败', '密码不一致')
                        e15.delete(0, 'end')
                        e14.delete(0, 'end')
                    self.sum -= 1

        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
#补卡操作
    def B_K(self):
        rt = Tk()
        rt.title("补卡")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x300+200+100')
        Lb1 = Label(rt, text='原银行卡号:', font=('华文新魏', 10), )
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        Lb2 = Label(rt, text='用户姓名:', font=('华文新魏', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('华文新魏', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('华文新魏', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('华文新魏', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='新银行卡号:', font=('华文新魏', 10))
        Lb6.place(x=20, y=220)
        v = StringVar()
        co = Entry(rt, textvariable=v,state=DISABLED)
        co.place(x=100, y=220)
        def TiJiao():
            id = e11.get()
            name = str(e12.get())
            identitycard =e13.get()
            if id=='' or name=='' or identitycard =='':
                mb.showerror('失败','信息不能为空')
            else:
                cursor.execute("SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s "%(id,name,identitycard,) )
                Account = cursor.fetchone()
                if Account is None:
                    mb.showerror('失败','没有该用户')
                    e11.delete(0,'end')
                    e12.delete(0, 'end')
                    e13.delete(0, 'end')
                else:
                    password1 =e14.get()
                    password2 = e15.get()
                    if password1 == password2:
                        cursor.execute(
                            "SELECT PASSWORD FROM ACCOUNT WHERE ID=%s AND NAME='%s' AND IDENTITYCARD =%s " % (
                            id, name, identitycard,))
                        password0 = cursor.fetchone()
                        password = ",".join(map(str, password0))
                        if password2 == password:
                            cursor.execute(
                                "SELECT STATUS FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s " % (
                                id, name, identitycard,))
                            status0 = cursor.fetchone()
                            status = int(",".join(map(str, status0)))
                            if status == 0:
                                mb.showerror('失败','此卡被冻结不可操作')
                            elif status == 1:
                                mb.showerror('失败','请先挂失!')
                            else:
                                iid = ""
                                iid2 = ""
                                for i in range(6):
                                    iid += str(random.randrange(0, 10))
                                id1 = iid
                                cn.Execute("USE Bank")
                                rs.Open('Account', cn)
                                while not rs.EOF:
                                    if (str(rs.Fields(0).Value)).strip() == id1:
                                        for i in range(6):
                                            iid2 += str(random.randrange(0, 10))
                                        id0 = int(iid2)
                                    else:
                                        id0 = int(id1)
                                    break
                                v.set(id0)
                                cursor.execute(
                                    "UPDATE Account SET ID = %s WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s " % (
                                    id0, id, name, identitycard,))
                                conn.commit()
                                mb.showinfo('成功',"卡号为:%s的卡补办成功,新卡号为%s,请牢记新卡号!!!" % (id, id0))
                                cursor.execute(
                                    "UPDATE Account SET STATUS = 1 WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                    id0, name, identitycard,))
                                conn.commit()
                                mb.showinfo('成功', "卡号为:%s的卡补办成功,新卡号为%s,请牢记新卡号!!!" % (id, id0))
                        elif self.count == 0:
                            cursor.execute(
                                "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                            conn.commit()
                            mb.showwarning('失败', '失败,卡已被冻结!')
                            rt.destroy()
                            Main().Admin_YG()
                        else:
                            mb.showwarning('失败', '密码错误')
                            e15.delete(0, 'end')
                            e14.delete(0, 'end')
                        self.count -= 1
                    elif self.sum == 0:
                        cursor.execute("UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结!')
                        rt.destroy()
                        Main().Admin_YG()
                    else:
                        mb.showwarning('失败', '密码不一致')
                        e15.delete(0, 'end')
                        e14.delete(0, 'end')
                    self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
#挂失操作
    def G_S(self):
        rt = Tk()
        rt.title("挂失")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x300+200+100')
        Lb1 = Label(rt, text='银行卡号:', font=('华文新魏', 10), )
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        Lb2 = Label(rt, text='用户姓名:', font=('华文新魏', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('华文新魏', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('华文新魏', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('华文新魏', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        def TiJiao():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            if id == '' or name =='' or identitycard=='':
                mb.showwarning('失败','信息不能为空!')
            else:
                cursor.execute("SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                id, name, identitycard,))
                Account = cursor.fetchone()
                if Account is None:
                    mb.showwarning('',"信息错误,请仔细核对信息!!!")
                    e11.delete(0,'end')
                    e12.delete(0,'end')
                    e13.delete(0,'end')
                else:
                    password0 = e14.get()
                    password1 =e15.get()
                    if password0 == password1:
                        cursor.execute(
                            "SELECT PASSWORD FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s " % (
                            id, name, identitycard,))
                        password2 = cursor.fetchone()
                        password = ",".join(map(str, password2))
                        if password1 == password:
                            cursor.execute(
                                "SELECT STATUS FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD =%s " % (
                                id, name, identitycard,))
                            status0 = cursor.fetchone()
                            status = int(",".join(map(str, status0)))
                            if status == 0:
                                mb.showerror('失败',"此卡已冻结,请解冻后操作!!!")
                            elif status == 2:
                                mb.showerror('失败',"此卡已经挂失,无需再次操作!!!")
                            else:
                                cursor.execute(
                                    "UPDATE Account SET STATUS = 2 WHERE ID = %s AND  NAME = '%s' AND IDENTITYCARD = %s " % (
                                    id, name, identitycard,))
                                conn.commit()
                                mb.showwarning('成功',"卡号为%s的卡挂失成功!!!!" % (id,))
                        elif self.count == 0:
                            cursor.execute(
                                "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                            conn.commit()
                            mb.showwarning('失败', '失败,卡已被冻结!')
                            rt.destroy()
                            Main().Admin_YG()
                        else:
                            mb.showwarning('失败', '密码错误')
                            e15.delete(0, 'end')
                            e14.delete(0, 'end')
                        self.count -= 1
                    elif self.sum == 0:
                        cursor.execute("UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s'" % (id, name,))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结!')
                        rt.destroy()
                        Main().Admin_YG()
                    else:
                        mb.showwarning('失败', '密码不一致')
                        e15.delete(0, 'end')
                        e14.delete(0, 'end')
                    self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
#改密操作
    def G_M(self):
        rt = Tk()
        rt.title("更改密码")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x300+200+100')
        Lb1 = Label(rt, text='银行卡号:', font=('华文新魏', 10), )
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        Lb2 = Label(rt, text='用户姓名:', font=('华文新魏', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('华文新魏', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('华文新魏', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('华文新魏', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        def tijiao():
            id = e11.get()
            name = str(e12.get())
            identitycard=e13.get()
            if id =='' or name=='' or identitycard=='':
                mb.showwarning('失败','输入信息为空!')
            else:
                cursor.execute("SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s "%(id,name,identitycard,))
                Account = cursor.fetchone()
                if Account is None :
                    mb.showwarning('失败',"用户信息错误,请核对后重新输入!!!")
                else:
                    password0 = e14.get()
                    password1 = e15.get()
                    if password0 == password1:
                        cursor.execute("SELECT PASSWORD FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s  "%(id,name,identitycard,))
                        password2 = cursor.fetchone()
                        password = ",".join(map(str,password2))
                        if password  == password1:
                            cursor.execute("SELECT STATUS FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s "%(id,name,identitycard,))
                            status0 = cursor.fetchone()
                            status = int(",".join(map(str,status0)))
                            if status == 0:
                                mb.showwarning('失败',"此卡已冻结,不可操作!!!")
                            elif status == 2:
                                mb.showwarning('失败',"此卡已挂失,不可操作")
                            else:
                                ru = Tk()
                                ru.iconbitmap('f6.ico')
                                ru.title('新密码')
                                ru.geometry('300x200+200+300')
                                Lb6 = Label(ru,text='输入新密码:',font=('华文新魏', 10))
                                Lb6.place(x=20,y=40)
                                e16 = Entry(ru,show='*')
                                e16.place(x=100,y=40)
                                Lb7 = Label(ru,text='请确定新密码:',font=('华文新魏',10))
                                Lb7.place(x=20,y=80)
                                e17 = Entry(ru,show='*')
                                e17.place(x=100,y=80)
                                Lb8 = Label(ru,text='是否确定:',font=('华文新魏',10))
                                Lb8.place(x=20,y=120)
                                v = StringVar()
                                co = ttk.Combobox(ru,textvariable=v,width=10)
                                co['values']=('是','否')
                                co.place(x=100,y=120)
                                def tj():
                                    password3=e16.get()
                                    password4=e17.get()
                                    if password3 == password4:
                                        t = co.get()
                                        if t =='是':
                                            cursor.execute(
                                                "UPDATE Account SET PASSWORD = %s WHERE ID = %s AND NAME='%s' AND IDENTITYCARD = %s " % (
                                                password3, id, name, identitycard,))
                                            conn.commit()
                                            mb.showinfo('成功',"卡号为%s的卡,密码已更改完成,请牢记新密码!!!" % (id))
                                        else:
                                           mb.showerror('失败','操作已取消')
                                    elif self.m == 0:
                                        mb.showwarning('失败','改密失败')
                                    else:
                                        mb.showerror('失败','两次密码不一致')
                                def Fh():
                                    ru.destroy()
                                    Admin().G_M()
                                bt1 = Button(ru, text='提交', width=10, fg='#38B0DE', command=tj)
                                bt1.place(x=40, y=160)
                                bt2 = Button(ru, text='返回', width=10, fg='#38B0DE', command=Fh)
                                bt2.place(x=160, y=160)
                        elif self.count == 0:
                            cursor.execute(
                                "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard,))
                            conn.commit()
                            mb.showerror('失败',"密码错误次数过多,卡号为%s 的卡已经冻结,不能继续操作!" % (id,))
                            rt.destroy()
                            Main().Admin_YG()
                        else:
                            mb.showerror('失败','密码错误')
                            e15.delete(0,'end')
                            e14.delete(0, 'end')
                        self.count -= 1
                    elif self.sum ==0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard,))
                        conn.commit()
                        mb.showerror('失败',"密码错误次数过多,卡号为%s 的卡已经冻结,不能继续操作!" % (id,))
                    else :
                        mb.showerror('失败', '输入密码不一致')
                        e15.delete(0, 'end')
                        e14.delete(0, 'end')
                    self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt3 = Button(rt, text='提交', width=10, fg='#38B0DE', command=tijiao)
        bt3.place(x=40, y=220)
        bt4 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt4.place(x=160, y=220)
#改电话号码
    def G_T(self):
        rt = Tk()
        rt.title("更改电话号码")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x350+200+100')
        Lb1 = Label(rt, text='银行卡号:', font=('华文新魏', 10), )
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        Lb2 = Label(rt, text='用户姓名:', font=('华文新魏', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('华文新魏', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('华文新魏', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('华文新魏', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt,text='电话号码:',font=('华文新魏', 10))
        Lb6.place(x=20,y=220)
        e16 = Entry(rt)
        e16.place(x=100,y=220)
        Lb6 = Label(rt, text='是否更改:', font=('华文新魏', 10))
        Lb6.place(x=20, y=260)
        v = StringVar()
        co = ttk.Combobox(rt, textvariable=v, width=10)
        co['values'] = ('是', '否')
        co.place(x=100, y=260)
        def tijiao():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            if id=='' or name == '' or identitycard=='':
                mb.showerror('错误','输入信息不能为空!')
            else:
                cursor.execute("SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s "%(id,name,identitycard,))
                Account = cursor.fetchone()
                if Account is None:
                    mb.showwarning('错误',"用户信息错误,请核对后输入!!!")
                else :
                    password0 = e14.get()
                    password1 = e15.get()
                    if password0 == password1:
                        cursor.execute("SELECT PASSWORD FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s"%(id,name,identitycard,))
                        password2 = cursor.fetchone()
                        password = ",".join(map(str,password2))
                        if password == password1:
                            cursor.execute("SELECT STATUS FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s "%(id,name,identitycard,))
                            status0 = cursor.fetchone()
                            status =int(",".join(map(str,status0)))
                            if status == 0:
                                mb.showerror('错误',"此卡已冻结,不可操作!!!")
                            elif status == 2:
                                mb.showerror('失败',"此卡已挂失,不可操作!!!")
                            else:
                                t = co.get()
                                if t == '是':
                                    telephon1 = e16.get()
                                    cursor.execute("UPDATE Account SET TELEPHONE = %s WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s "%(telephon1,id,name,identitycard,))
                                    conn.commit()
                                    mb.showinfo('成功',"卡号为%s的电话号码修改成功,新电话号码为:%s"%(id,telephon1,))
                                else:
                                    mb.showerror('失败',"变更失败!!!")
                        elif self.count == 0:
                            cursor.execute(
                                "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                    id, name, identitycard,))
                            conn.commit()
                            mb.showerror('失败', "密码错误次数过多,卡号为%s 的卡已经冻结,不能继续操作!" % (id,))
                            rt.destroy()
                            Main().Admin_YG()
                        else:
                            mb.showerror('失败', '密码错误')
                            e15.delete(0, 'end')
                            e14.delete(0, 'end')
                        self.count -= 1
                    elif self.sum == 0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard,))
                        conn.commit()
                        mb.showerror('失败', "密码错误次数过多,卡号为%s 的卡已经冻结,不能继续操作!" % (id,))
                    else:
                        mb.showerror('失败', '输入密码不一致')
                        e15.delete(0, 'end')
                        e14.delete(0, 'end')
                    self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt3 = Button(rt, text='提交', width=10, fg='#38B0DE', command=tijiao)
        bt3.place(x=40, y=300)
        bt4 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt4.place(x=160, y=300)
#查询余额
    def C_X_ye(self):
        rt = Tk()
        rt.geometry('300x300+200+100')
        rt.title('查询')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='银行卡号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        tst = StringVar()
        e16 = Entry(rt,text= tst,state=DISABLED)
        e16.place(x=100, y=220)

        def TiJiao2():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误', '信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            cursor.execute("SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s "%(id,name,identitycard,))
                            balance0 = cursor.fetchone()
                            balance = float(",".join(map(str,balance0)))
                            tst.set( balance)
                            cursor.execute("SELECT OVERDRAFT FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s "%(id,name,identitycard,))
                            overdraft0 = cursor.fetchone()
                            overdraft = float(",".join(map(str,overdraft0)))
                            cursor.execute("SELECT Actype.name FROM Account join Actype on Account.typeid = Actype.typeid WHERE ID=%s AND Account.NAME='%s' AND IDENTITYCARD=%s" % (id, name, identitycard,))
                            Actype0 = cursor.fetchone()
                            actype = ",".join(map(str,Actype0))
                            mb.showinfo('查询',"尊敬的%s您好!,您的余额有%s,可透支度为%s,卡类型为%s"%(name,balance,overdraft,actype,))
                    elif self.count == 0:
                            cursor.execute(
                                "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                    id, name, identitycard))
                            conn.commit()
                            mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败', '两次密码不一致')
                    e14.delete(0, 'end')
                    e15.delete(0, 'end')
                self.sum -= 1

        def FANHUI():
                rt.destroy()
                Main().Admin_PT()
        def DAYING():
            id=int(e11.get())
            sql = pandas.read_sql(
                'SELECT acchistory.id as 记录编号 ,Acchistory.TIME as 交易时间,Acchistory.ACCTION as 业务种类,Acchistory.MONEY as 变动金额,Acchistory.ACCID as 账号,ibank.NAME as 银行名称 FROM Acchistory join Account on Acchistory.ACCID=Account.ID join Ibank on Account.IBANKID=Ibank.IBANKID WHERE Account.ID =%s ' % (
                    id)
                , con=conn)
            sql.to_csv(r'E:/作业/Python/课设/账单信息.csv')
            pandas.DataFrame(sql).to_excel(r'E:/作业/Python/课设/账单信息.xlsx')
            mb.showinfo('打印成功', '文件已打印')
        bt1 = Button(rt, text='提交',  fg='#38B0DE', command=TiJiao2)
        bt1.place(x=20, y=260)
        bt2 = Button(rt, text='返回',  fg='#38B0DE', command=FANHUI)
        bt2.place(x=120, y=260)
        bt3 = Button(rt, text='打印账单', fg='#38B0DE',command=DAYING)
        bt3.place(x=220, y=260)
#存款
    def C_X_ye1(self):
        rt = Tk()
        rt.geometry('300x300+200+100')
        rt.title('查询')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='银行卡号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        tst = StringVar()
        e16 = Entry(rt,text= tst,state=DISABLED)
        e16.place(x=100, y=220)

        def TiJiao2():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误', '信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            cursor.execute("SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s "%(id,name,identitycard,))
                            balance0 = cursor.fetchone()
                            balance = float(",".join(map(str,balance0)))
                            tst.set( balance)
                            cursor.execute("SELECT OVERDRAFT FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s "%(id,name,identitycard,))
                            overdraft0 = cursor.fetchone()
                            overdraft = float(",".join(map(str,overdraft0)))
                            cursor.execute("SELECT Actype.name FROM Account join Actype on Account.typeid = Actype.typeid WHERE ID=%s AND Account.NAME='%s' AND IDENTITYCARD=%s" % (id, name, identitycard,))
                            Actype0 = cursor.fetchone()
                            actype = ",".join(map(str,Actype0))
                            mb.showinfo('查询',"尊敬的%s您好!,您的余额有%s,可透支度为%s,卡类型为%s"%(name,balance,overdraft,actype,))
                    elif self.count == 0:
                            cursor.execute(
                                "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                    id, name, identitycard))
                            conn.commit()
                            mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败', '两次密码不一致')
                    e14.delete(0, 'end')
                    e15.delete(0, 'end')
                self.sum -= 1

        def FANHUI():
                rt.destroy()
                Main().Admin_YG()
        def DAYING():
            id=int(e11.get())
            sql = pandas.read_sql(
                'SELECT acchistory.id as 记录编号 ,Acchistory.TIME as 交易时间,Acchistory.ACCTION as 业务种类,Acchistory.MONEY as 变动金额,Acchistory.ACCID as 账号,ibank.NAME as 银行名称 FROM Acchistory join Account on Acchistory.ACCID=Account.ID join Ibank on Account.IBANKID=Ibank.IBANKID WHERE Account.ID =%s ' % (
                    id)
                , con=conn)
            sql.to_csv(r'E:/作业/Python/课设/账单信息.csv')
            pandas.DataFrame(sql).to_excel(r'E:/作业/Python/课设/账单信息.xlsx')
            mb.showinfo('打印成功', '文件已打印')
        bt1 = Button(rt, text='提交',  fg='#38B0DE', command=TiJiao2)
        bt1.place(x=20, y=260)
        bt2 = Button(rt, text='返回',  fg='#38B0DE', command=FANHUI)
        bt2.place(x=120, y=260)
        bt3 = Button(rt, text='打印账单', fg='#38B0DE',command=DAYING)
        bt3.place(x=220, y=260)
    def C_K(self):
        rt = Tk()
        rt.geometry('300x300+200+100')
        rt.title('存款')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='银行卡号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='存款金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        e16 = Entry(rt)
        e16.place(x=100, y=220)
        def TiJiao2():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            money = float(e16.get())
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误', '信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            cursor.execute("UPDATE Account SET BALANCE = BALANCE + %s WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s"%(money,id,name,identitycard,))
                            conn.commit()
                            time1 = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
                            acction = '存款'
                            cursor.execute("INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)"%(time1,id,acction,money,))
                            conn.commit()
                            cursor.execute("SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (id, name, identitycard))
                            balance1 = cursor.fetchone()
                            balance2 = float(",".join(map(str, balance1)))
                            mb.showinfo('成功',"卡号为:%s 的卡已成功存款%s元,余额%s元"%(id,money,balance2,))
                    elif self.count == 0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败', '两次密码不一致')
                    e14.delete(0, 'end')
                    e15.delete(0, 'end')
                self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_PT()
        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao2)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
    def C_K1(self):
        rt = Tk()
        rt.geometry('300x300+200+100')
        rt.title('存款')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='银行卡号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='存款金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        e16 = Entry(rt)
        e16.place(x=100, y=220)
        def TiJiao2():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            money = float(e16.get())
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误', '信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            cursor.execute("UPDATE Account SET BALANCE = BALANCE + %s WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s"%(money,id,name,identitycard,))
                            conn.commit()
                            time1 = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
                            acction = '存款'
                            cursor.execute("INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)"%(time1,id,acction,money,))
                            conn.commit()
                            cursor.execute("SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (id, name, identitycard))
                            balance1 = cursor.fetchone()
                            balance2 = float(",".join(map(str, balance1)))
                            mb.showinfo('成功',"卡号为:%s 的卡已成功存款%s元,余额%s元"%(id,money,balance2,))
                    elif self.count == 0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败', '两次密码不一致')
                    e14.delete(0, 'end')
                    e15.delete(0, 'end')
                self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()
        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao2)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
#取款

    def Q_K(self):
        rt = Tk()
        rt.geometry('300x300+200+100')
        rt.title('取款')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt,text='银行卡号:',font=('微软雅黑', 10))
        Lb1.place(x=20,y=20)
        e11 = Entry(rt)
        e11.place(x=100,y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt,show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt,show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='取款金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        e16 = Entry(rt)
        e16.place(x=100, y=220)
        def Tijiao():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            money = float(e16.get())
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误','信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            cursor.execute(
                                "SELECT TYPEID FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                    id, name, identitycard))
                            TYPEID0 = cursor.fetchone()
                            TYPEID = int(",".join(map(str, TYPEID0)))
                            # 1是储蓄卡,2是信用卡
                            if TYPEID == 1:
                                cursor.execute(
                                    "SELECT BALANCE FROM Account WHERE ID=%s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                        id, name, identitycard))
                                balance0 = cursor.fetchone()
                                balance = float(",".join(map(str, balance0)))
                                if money <= balance:
                                    cursor.execute(
                                        "UPDATE Account SET BALANCE=BALANCE - %s WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                            money, id, name, identitycard))
                                    conn.commit()
                                    time1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                    acction = '取款'
                                    cursor.execute(
                                        "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                            time1, id, acction, money,))
                                    conn.commit()
                                    cursor.execute(
                                        "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                            id, name, identitycard))
                                    balance1 = cursor.fetchone()
                                    balance2 = float(",".join(map(str, balance1)))
                                    mb.showinfo('成功取款', '此卡余额%s' % (balance2))
                                else:
                                    mb.showwarning('错误', '此卡余额不足')
                            # 信用卡
                            else:
                                cursor.execute(
                                    "SELECT BALANCE,OVERDRAFT FROM Account WHERE  ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                        id, name, identitycard))
                                t = cursor.fetchone()
                                y = t[0] + t[1]
                                if money <= y:
                                    cursor.execute(
                                        "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                            id, name, identitycard))
                                    ye0 = cursor.fetchone()
                                    ye = float(",".join(map(str, ye0)))
                                    # 余额足够,不用透支度
                                    if money <= ye:
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE = BALANCE - %s WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                money, id, name, identitycard))
                                        conn.commit()
                                        time2 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                        acction1 = '取款'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                                time2, id, acction1, money,))
                                        conn.commit()
                                        cursor.execute(
                                            "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                                id, name, identitycard))
                                        balance3 = cursor.fetchone()
                                        balance4 = float(",".join(map(str, balance3)))
                                        mb.showinfo('成功取款', '此卡余额%s' % (balance4))
                                    # 余额不足,用透支度
                                    else:
                                        money1 = money-ye
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE = 0 WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                id, name, identitycard))
                                        conn.commit()
                                        cursor.execute(
                                            "UPDATE Account SET OVERDRAFT= OVERDRAFT-%s WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                money1,id, name, identitycard))
                                        conn.commit()
                                        time3 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                        acction4 = '取款'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                                time3, id, acction4, money,))
                                        conn.commit()
                                        cursor.execute(
                                            "SELECT OVERDRAFT FROM ACCOUNT WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                id, name, identitycard))
                                        e1 = cursor.fetchone()
                                        e = float(",".join(map(str, e1)))
                                        mb.showinfo('成功取款', '此卡余额0.00元,可透支度剩余%s元' % (e))
                                else:
                                    mb.showwarning('错误', '余额不足')
                    elif self.count == 0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败','两次密码不一致')
                    e14.delete(0,'end')
                    e15.delete(0, 'end')
                self.sum -= 1
        def FANHUI():
            rt.destroy()
            Main().Admin_PT()
        bt1 = Button(rt, text='提交',width=10,fg='#38B0DE',command=Tijiao)
        bt1.place(x=40,y=260)
        bt2=  Button(rt, text='返回',width=10,fg='#38B0DE',command=FANHUI)
        bt2.place(x=160, y=260)

    def Q_K1(self):
        rt = Tk()
        rt.geometry('300x300+200+100')
        rt.title('取款')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='银行卡号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='取款金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        e16 = Entry(rt)
        e16.place(x=100, y=220)

        def Tijiao():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            money = float(e16.get())
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误', '信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            cursor.execute(
                                "SELECT TYPEID FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                    id, name, identitycard))
                            TYPEID0 = cursor.fetchone()
                            TYPEID = int(",".join(map(str, TYPEID0)))
                            # 1是储蓄卡,2是信用卡
                            if TYPEID == 1:
                                cursor.execute(
                                    "SELECT BALANCE FROM Account WHERE ID=%s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                        id, name, identitycard))
                                balance0 = cursor.fetchone()
                                balance = float(",".join(map(str, balance0)))
                                if money <= balance:
                                    cursor.execute(
                                        "UPDATE Account SET BALANCE=BALANCE - %s WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                            money, id, name, identitycard))
                                    conn.commit()
                                    time1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                    acction = '取款'
                                    cursor.execute(
                                        "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                            time1, id, acction, money,))
                                    conn.commit()
                                    cursor.execute(
                                        "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                            id, name, identitycard))
                                    balance1 = cursor.fetchone()
                                    balance2 = float(",".join(map(str, balance1)))
                                    mb.showinfo('成功取款', '此卡余额%s' % (balance2))
                                else:
                                    mb.showwarning('错误', '此卡余额不足')
                            # 信用卡
                            else:
                                cursor.execute(
                                    "SELECT BALANCE,OVERDRAFT FROM Account WHERE  ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                        id, name, identitycard))
                                t = cursor.fetchone()
                                y = t[0] + t[1]
                                if money <= y:
                                    cursor.execute(
                                        "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                            id, name, identitycard))
                                    ye0 = cursor.fetchone()
                                    ye = float(",".join(map(str, ye0)))
                                    # 余额足够,不用透支度
                                    if money <= ye:
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE = BALANCE - %s WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                money, id, name, identitycard))
                                        conn.commit()
                                        time2 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                        acction1 = '取款'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                                time2, id, acction1, money,))
                                        conn.commit()
                                        cursor.execute(
                                            "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                                id, name, identitycard))
                                        balance3 = cursor.fetchone()
                                        balance4 = float(",".join(map(str, balance3)))
                                        mb.showinfo('成功取款', '此卡余额%s' % (balance4))
                                    # 余额不足,用透支度
                                    else:
                                        money1 = money - ye
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE = 0 WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                id, name, identitycard))
                                        conn.commit()
                                        cursor.execute(
                                            "UPDATE Account SET OVERDRAFT= OVERDRAFT-%s WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                money1, id, name, identitycard))
                                        conn.commit()
                                        time3 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                        acction4 = '取款'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                                time3, id, acction4, money,))
                                        conn.commit()
                                        cursor.execute(
                                            "SELECT OVERDRAFT FROM ACCOUNT WHERE ID=%s AND NAME='%s' AND IDENTITYCARD = %s" % (
                                                id, name, identitycard))
                                        e1 = cursor.fetchone()
                                        e = float(",".join(map(str, e1)))
                                        mb.showinfo('成功取款', '此卡余额0.00元,可透支度剩余%s元' % (e))
                                else:
                                    mb.showwarning('错误', '余额不足')
                    elif self.count == 0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败', '两次密码不一致')
                    e14.delete(0, 'end')
                    e15.delete(0, 'end')
                self.sum -= 1

        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=Tijiao)
        bt1.place(x=40, y=260)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=260)
#转账
    def Z_Z(self):
        rt = Tk()
        rt.geometry('300x340+200+100')
        rt.title('转账')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='银行卡号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='转账金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        e16 = Entry(rt)
        e16.place(x=100, y=220)
        Lb7 = Label(rt, text='转账账户:', font=('微软雅黑', 10))
        Lb7.place(x=20, y=260)
        e17 = Entry(rt)
        e17.place(x=100, y=260)
        def TiJiao2():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误', '信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            id1 = e17.get()
                            if id1 == id:
                                mb.showwarning('失败',"不可以自己给自己转账!!!")
                            else:
                                cursor.execute("SELECT * FROM Account WHERE ID=%s" % (id1))
                                Account1 = cursor.fetchone()
                                if Account1 is None:
                                    mb.showwarning('失败',"没有该账户!!!")
                                else:
                                    jine = float(e16.get())
                                    cursor.execute(
                                        "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                        id, name, identitycard))
                                    balance0 = cursor.fetchone()
                                    balance = float(",".join(map(str, balance0)))
                                    if jine <= balance:
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE=BALANCE-%s WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                            jine, id, name, identitycard))
                                        conn.commit()
                                        time1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                        acction = '转出'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                            time1, id, acction, jine))
                                        conn.commit()
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE=BALANCE + %s WHERE id=%s" % (jine, id1))
                                        conn.commit()
                                        acction1 = '转入'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                            time1, id1, acction1, jine))
                                        conn.commit()
                                        mb.showinfo('成功',"你已成功向账户为:%s转入%s元" % (id1, jine))
                                    else:
                                        mb.showwarning('失败',"余额不足!!!")
                    elif self.count == 0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败', '两次密码不一致')
                    e14.delete(0, 'end')
                    e15.delete(0, 'end')
                self.sum -= 1

        def FANHUI():
            rt.destroy()
            Main().Admin_PT()
        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao2)
        bt1.place(x=40, y=300)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=300)
    def Z_Z1(self):
        rt = Tk()
        rt.geometry('300x340+200+100')
        rt.title('转账')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='银行卡号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='账户姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='输入密码:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        e14 = Entry(rt, show='*')
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='确认密码:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt, show='*')
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='转账金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        e16 = Entry(rt)
        e16.place(x=100, y=220)
        Lb7 = Label(rt, text='转账账户:', font=('微软雅黑', 10))
        Lb7.place(x=20, y=260)
        e17 = Entry(rt)
        e17.place(x=100, y=260)
        def TiJiao2():
            id = e11.get()
            name = str(e12.get())
            identitycard = e13.get()
            cursor.execute(
                "SELECT * FROM Account WHERE ID = %s AND NAME = '%s' AND IDENTITYCARD = %s" % (id, name, identitycard,))
            Account = cursor.fetchone()
            if Account is None:
                mb.showwarning('错误', '信息错误重新输入!')
                e11.delete(0, 'end')
                e12.delete(0, 'end')
                e13.delete(0, 'end')
            else:
                password1 = e14.get()
                password2 = e15.get()
                if password1 == password2:
                    cursor.execute(
                        "SELECT PASSWORD FROM Account WHERE ID =%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    passwordo = cursor.fetchone()
                    password = ",".join(map(str, passwordo))
                    if password == password2:
                        cursor.execute(
                            "SELECT STATUS FROM Account WHERE ID=%s AND NAME = '%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        status0 = cursor.fetchone()
                        status = int(",".join(map(str, status0)))
                        if status == 0:
                            mb.showwarning('错误', '此卡冻结')
                        elif status == 2:
                            mb.showwarning('错误', '此卡已挂失')
                        else:
                            id1 = e17.get()
                            if id1 == id:
                                mb.showwarning('失败',"不可以自己给自己转账!!!")
                            else:
                                cursor.execute("SELECT * FROM Account WHERE ID=%s" % (id1))
                                Account1 = cursor.fetchone()
                                if Account1 is None:
                                    mb.showwarning('失败',"没有该账户!!!")
                                else:
                                    jine = float(e16.get())
                                    cursor.execute(
                                        "SELECT BALANCE FROM Account WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                        id, name, identitycard))
                                    balance0 = cursor.fetchone()
                                    balance = float(",".join(map(str, balance0)))
                                    if jine <= balance:
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE=BALANCE-%s WHERE ID=%s AND NAME='%s' AND IDENTITYCARD=%s" % (
                                            jine, id, name, identitycard))
                                        conn.commit()
                                        time1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                                        acction = '转出'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                            time1, id, acction, jine))
                                        conn.commit()
                                        cursor.execute(
                                            "UPDATE Account SET BALANCE=BALANCE + %s WHERE id=%s" % (jine, id1))
                                        conn.commit()
                                        acction1 = '转入'
                                        cursor.execute(
                                            "INSERT INTO Acchistory(time,accid,acction,money) VALUES('%s',%s,'%s',%s)" % (
                                            time1, id1, acction1, jine))
                                        conn.commit()
                                        mb.showinfo('成功',"你已成功向账户为:%s转入%s元" % (id1, jine))
                                    else:
                                        mb.showwarning('失败',"余额不足!!!")
                    elif self.count == 0:
                        cursor.execute(
                            "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                                id, name, identitycard))
                        conn.commit()
                        mb.showwarning('失败', '此卡已冻结')
                    else:
                        mb.showwarning('失败', '密码错误')
                        e14.delete(0, 'end')
                        e15.delete(0, 'end')
                    self.count -= 1
                elif self.sum == 0:
                    cursor.execute(
                        "UPDATE Account SET STATUS = 0 WHERE ID = %s AND NAME ='%s' AND IDENTITYCARD = %s" % (
                            id, name, identitycard))
                    conn.commit()
                    mb.showwarning('失败', '此卡已冻结')
                else:
                    mb.showwarning('失败', '两次密码不一致')
                    e14.delete(0, 'end')
                    e15.delete(0, 'end')
                self.sum -= 1

        def FANHUI():
            rt.destroy()
            Main().Admin_YG()
        bt1 = Button(rt, text='提交', width=10, fg='#38B0DE', command=TiJiao2)
        bt1.place(x=40, y=300)
        bt2 = Button(rt, text='返回', width=10, fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=300)
#贷款
    def D_K(self):
        rt = Tk()
        rt.geometry('300x350+200+100')
        rt.title('贷款')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='记录编号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='贷款姓名:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        e12 = Entry(rt)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='身份证号:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        e13 = Entry(rt)
        e13.place(x=100, y=100)
        Lb4 = Label(rt, text='起始时间:', font=('微软雅黑', 10))
        Lb4.place(x=20, y=140)
        text1 = StringVar()
        e14 = Entry(rt,text=text1,state=DISABLED)
        text1.set(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time())))
        e14.place(x=100, y=140)
        Lb5 = Label(rt, text='结束时间:', font=('微软雅黑', 10))
        Lb5.place(x=20, y=180)
        e15 = Entry(rt)
        e15.place(x=100, y=180)
        Lb6 = Label(rt, text='贷款金额:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=220)
        e16 = Entry(rt)
        e16.place(x=100, y=220)
        cursor.execute("SELECT VALUE FROM Interest")
        value = cursor.fetchone()
        loaninterestid = float(",".join(map(str, value)))
        Lb6 = Label(rt, text='贷款利率:', font=('微软雅黑', 10))
        Lb6.place(x=20, y=260)
        tst = StringVar()
        e17 = Entry(rt, text=tst, state=DISABLED)
        tst.set(loaninterestid)
        e17.place(x=100, y=260)
        def tijiao():
            id =e11.get()
            if id =='':
                mb.showerror('失败','记录编号不能为空!')
            else:
                name = str(e12.get())
                identitycard = e13.get()
                begintime = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
                endtime= e15.get()
                loanmoney = int(e16.get())
                cursor.execute("SELECT VALUE FROM Interest")
                value = cursor.fetchone()
                loaninterestid = float(",".join(map(str,value)))
                cursor.execute("INSERT INTO Loan(id,name,identitycard,begintime,endtime,loanmoney,loaninterestid) VALUES('%s','%s','%s','%s','%s','%s','%s')"%(id,name,identitycard,begintime,endtime,loanmoney,loaninterestid))
                conn.commit()
                cursor.execute("SELECT DATEDIFF(dy,begintime,endtime) FROM Loan WHERE ID=%s"%(id))
                day = cursor.fetchone()
                loandays =int(",".join(map(str,day)))
                refundmoney = loandays * loaninterestid * loanmoney + loanmoney
                status = 0
                cursor.execute("DELETE Loan WHERE id=%s"%(id))
                conn.commit()
                cursor.execute("insert into Loan values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')"%(id,name,identitycard,begintime,endtime,loanmoney,loaninterestid,refundmoney,loandays,status))
                conn.commit()
                mb.showinfo('成功',"你已贷款%s元,需还款%s元,利率为%s,共%s天"%(loanmoney,refundmoney,loaninterestid,loandays))
        def Fanhui():
            rt.destroy()
            Main().Admin_YG()
        def DAYI():
            sql = pandas.read_sql('SELECT * FROM Loan', con=conn)
            sql.to_csv(r'E:/作业/Python/课设/贷款信息.csv')
            pandas.DataFrame(sql).to_excel(r'E:/作业/Python/课设/贷款信息.xlsx')
            mb.showinfo('成功','打印成功')
        bt1 = Button(rt, text='提交', fg='#38B0DE', command=tijiao)
        bt1.place(x=20, y=300)
        bt2 = Button(rt, text='返回', fg='#38B0DE', command=Fanhui)
        bt2.place(x=120, y=300)
        bt3 = Button(rt, text='打印账单', fg='#38B0DE', command=DAYI)
        bt3.place(x=220, y=300)
#还款
    def H_K(self):
        rt = Tk()
        rt.geometry('300x320+200+100')
        rt.title('还款')
        rt.iconbitmap('f6.ico')
        Lb1 = Label(rt, text='记录编号:', font=('微软雅黑', 10))
        Lb1.place(x=20, y=20)
        e11 = Entry(rt)
        e11.place(x=100, y=20)
        e11.focus_set()
        Lb2 = Label(rt, text='还款金额:', font=('微软雅黑', 10))
        Lb2.place(x=20, y=60)
        t1=StringVar()
        e12 = Entry(rt,text=t1,state=DISABLED)
        e12.place(x=100, y=60)
        Lb3 = Label(rt, text='是否还款:', font=('微软雅黑', 10))
        Lb3.place(x=20, y=100)
        v = StringVar()
        co = ttk.Combobox(rt, textvariable=v, width=10)
        co['values'] = ('是', '否')
        co.place(x=100, y=100)
        def tijiao():
            id = e11.get()
            if id=='':
                mb.showerror('错误','信息为空!')
            else:
                cursor.execute("SELECt * FROM LOAN WHERE ID=%s"%(id))
                loan = cursor.fetchone()
                if loan is None:
                   mb.showerror('错误',"此人没有贷款!!!")
                else:
                   cursor.execute("SELECT REFUNDMONEY FROM LOAN WHERE ID=%s"%(id))
                   refundmoney0 = cursor.fetchone()
                   refundmoney = float(",".join(map(str,refundmoney0)))
                   t1.set(refundmoney)
                   t = co.get()
                   if t == '是':
                        cursor.execute("DELETE Loan WHERE id = %s"%(id))
                        conn.commit()
                        mb.showinfo('成功',"还款成功!!!")
                   else:
                       mb.showerror('失败',"还款失败!!!")
        def FANHUI():
            rt.destroy()
            Main().Admin_YG()

        bt1 = Button(rt, text='提交', fg='#38B0DE', command=tijiao)
        bt1.place(x=40, y=140)
        bt2 = Button(rt, text='返回', fg='#38B0DE', command=FANHUI)
        bt2.place(x=160, y=140)
#添加系统操作用户表
    def Add_a(self):
        rt = Tk()
        rt.title("银行信息")
        rt.iconbitmap('f6.ico')
        rt.geometry('230x280+600+200')
        Lb0 = Label(rt,text='添加员工信息',font=('宋体',12),fg='#8F8FBD')
        Lb0.grid(row=0,column=1,columnspan=3)
        L1 = Label(rt,text = '员工编号:')
        L1.grid(row=2,column=1)
        t1 = Entry(rt)
        t1.focus_set()
        t1.grid(row=2,column=2)
        s1 = str(t1.get())
        L2=Label(rt,text='职工姓名:')
        L2.grid(row=4,column=1)
        t2 = Entry(rt)
        s2 = str(t2.get())
        t2.grid(row = 4,column=2)
        L3 = Label(rt,text='用户密码:')
        L3.grid(row=6,column=1)
        t3 = Entry(rt)
        t3 .grid(row = 6,column=2)
        password = str(t3.get())
        L4 = Label(rt,text="确认密码:")
        L4.grid(row=8,column=1)
        t4 = Entry(rt)
        t4.grid(row=8,column=2)
        password1 = str(t4.get())
        L5 = Label(rt,text='身份证号:')
        L5.grid(row=10,column=1)
        t5 = Entry(rt)
        t5.grid (row=10,column = 2)
        identitycard=str(t5.get())
        L6 = Label(rt,text='性别:')
        L6.grid(row=12,column=1)
        t6=Entry(rt)
        t6.grid(row=12,column=2)
        sex = str(t6.get())
        L7 = Label(rt,text='开户行编号:')
        L7.grid(row=14,column=1)
        t7=Entry(rt)
        t7.grid(row=14,column=2)
        ibankid=str(t7.get())
        L8 = Label(rt,text='用户类别:')
        L8.grid(row=16,column=1)
        t8 = Entry(rt)
        t8.grid(row=16,column=2)
        type= str(t8.get())
        L9 = Label(rt,text='状态:')
        L9.grid(row=18,column=1)
        t9 = Entry(rt)
        t9.grid(row=18,column=2)
        status = str(t9.get())
        def bt1():
            s1 = str(t1.get())
            s2 = str(t2.get())
            password = str(t3.get())
            password1 = str(t4.get())
            identitycard = str(t5.get())
            sex = str(t6.get())
            ibankid = str(t7.get())
            type = str(t8.get())
            status = str(t9.get())
            cursor.execute("SELECT * FROM Admin WHERE AID='%s'"%(s1))
            T = cursor.fetchone()
            if T is None:
                if s1 =='' or s2==''or password=='' or identitycard=='' or sex=='' or ibankid=='' or type=='' or status=='':
                    mb.showerror('注册', '信息为空不可添加!!')
                else:
                 if password1 == password:
                    cursor.execute("INSERT INTO Admin VALUES('%s','%s','%s','%s','%s','%s','%s','%s')" % (s1, s2, password, identitycard, sex, ibankid, type, status,))
                    conn.commit()
                    mb.showinfo('注册', '成功注册!')
                    rt.destroy()
                    Main().Admin_RT()
                 else:
                    mb.showerror('注册', '输入的两次密码不一致,注册失败!!')
                    t3.delete(0, 'end')
                    t4.delete(0, 'end')
            else:
                mb.showerror('注册', '已有该用户!')
                t1.delete(0,'end')
        def bt2():
            rt.destroy()
            Main().Admin_RT()
        bt1 = Button(rt,text='提交',width=5,fg='#38B0DE',command=bt1)
        bt1.place(x=40,y=240)
        bt2 = Button(rt, text='取消', width=5, fg='#38B0DE',command=bt2)
        bt2.place(x=140,y=240)
        rt.mainloop()
#改变用户信息
#登录
class Main(object):
    def get_image(self,filename,width,height):
        im = Image.open(filename).resize((width,height))
        return ImageTk.PhotoImage(im)
    def dellu(self):
        def uptime():
            global TimeLabel
            L3["text"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
            rt.after(100, uptime)
        rt = Tk()
        rt.title("银行信息")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x200+400+200')
        #rt['bg'] = '#999999'
        pho = Main().get_image('11.jpg',300,90)
        txplb=Label(rt,image=pho)
        txplb.grid(row=2,column=1,columnspan=3)
        L1= Label(rt,text = '账 户:')
        L1.grid(row = 4,column=1)
        L2 = Label(rt, text='密 码:')
        L2.grid(row=6, column=1)
        T1 = Entry(rt,)
        T1.focus_set()
        T1.grid(row=4,column=2)
        T2 = Entry(rt,show='*')
        T2.grid(row=6, column=2)
        L3 = Label(rt,text = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time())),font=('楷体',10),fg = 'green')
        L3.grid(row=8, column=2, columnspan=1)

        def sayhi(ev):
            T2.focus_set()
            T2.grid(row=6, column=2)
        def Qk():
            T1.delete(0,'end')
            T1.grid(row=4, column=2)
            T1.focus_set()
            T2.delete(0,'end')
            T2.grid(row=6, column=2)
        def Dl():
            t1 = str(T1.get())
            t2 = T2.get()
            cursor.execute("SELECT * FROM Account WHERE ID='%s' AND PASSWORD='%s'"%(t1,t2))
            T = cursor.fetchone()
            cursor.execute("SELECT * FROM Admin WHERE AID = '%s' AND APASSWORD ='%s'"%(t1,t2))
            A = cursor.fetchone()

            if T is None and A is None:
                mb.showerror('登录','账号或密码错误!')
            elif T is None and A is not None:
                cursor.execute("SELECT Type FROM Admin WHERE AID = %s AND APASSWORD ='%s'" % (t1, t2))
                type1 = cursor.fetchone()
                type = int(",".join(map(str,type1)))
                cursor.execute("SELECT Status FROM Admin WHERE AID = %s AND APASSWORD ='%s'" % (t1, t2))
                status0 = cursor.fetchone()
                status = int(",".join(map(str, status0)))
                if type == 3:
                    mb.showinfo('登录','尊敬的管理员用户:'+A[1]+'您好!欢迎使用!')
                    rt.destroy()
                    Main().Admin_RT()
                else:
                    if status == 2:
                        mb.showerror('登录', '尊敬的用户您的账户已冻结!')
                    else:
                        mb.showinfo('登录','尊敬的操作用户:'+A[1]+'您好!欢迎使用!')
                        rt.destroy()
                        Main().Admin_YG()
            elif T is not None and A is None:
                mb.showinfo('登录', '尊敬的用户:' + T[1] + '您好!欢迎使用!')
                rt.destroy()
                Main().Admin_PT()
        bt1 = Button(rt,text='登录',fg='blue',command = Dl)
        bt1.grid(row=4,column=3,padx=5,pady=5)
        bt2 = Button(rt, text='清空', fg='blue',command=Qk)
        bt2.grid(row=6, column=3,padx=5,pady=5)
        rt.bind("<Return>",sayhi)
        rt.after(100, uptime)
        rt.mainloop()
    def Admin_RT(self):
        def uptime():
            global TimeLabel
            Lb4["text"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
            rt.after(100, uptime)
        global ph
        rt = Tk()
        rt.title("欢迎使用!")
        rt.iconbitmap('f6.ico')
        rt.geometry('600x400+200+100')
        Lb1 =Label(rt,text ='',bg='white',width=15,height=600)
        Lb1.place(x=0,y=0)
        Lb2 = Label(rt,text='',bg='white',width=400,height=3)
        Lb2.place(x=100,y=0)
        Lb3 = Label(rt,text='',bg='#CDCDCD',width=885,height=597)
        Lb3.place(x=95,y=30)
        Lb4 = Label(Lb2,text=time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time())),fg='#38B0DE',bg='white',font=('宋体',12),width=40,height=3)
        Lb4.place(x=-90,y=-15)
        Lb5 = Label(Lb2, text='Taday is ' + time.strftime("%A", time.localtime(time.time()))+', Welcome to use', fg='#38B0DE',bg='white', font=('宋体', 12), width=40, height=3)
        Lb5.place(x=190, y=-15)
        text2='功能介绍:'
        text3  = '管理员可以管理员工的添加、删除、员工信息的查看修改等,还可以更改银行的利率。'
        Lb7 = Label(Lb3,text='',width=74,height=22)
        Lb7.place(x=-2,y=-2)
        Lb8 = Label(Lb7,text=text2,font=('楷书',15))
        Lb8.place(x=2,y=2)
        Lb9 = Label(Lb7,text=text3,font=('微软雅黑',10))
        Lb9.place(x=10,y=30)
        def bt1():
            Lb7 = Label(Lb3, text='', width=74, height=22)
            Lb7.place(x=-2, y=-2)
            Lb10=Label(Lb3,text='员工编号:',font=('微软雅黑',10))
            Lb10.place(x=140,y=30)
            t1 = Entry(Lb3)
            t1.focus_set()
            t1.place(x=230,y=30)
            def bt8():
                t1.delete(0, 'end')
            def bt6():
                s1 = str(t1.get())
                cursor.execute("SELECT * FROM Admin WHERE AID = %s"%(s1))
                T = cursor.fetchone()
                if T is None:
                    mb.showinfo('可以添加', 'come on')
                    rt.destroy()
                    Admin().Add_a()
                else:
                    mb.showerror('添加失败', '已有该用户!')
            def bt7():
                text2 = '功能介绍:'
                text3 = '管理员可以管理员工的添加、删除、员工信息的查看修改等,还可以更改银行的利率。'
                Lb7 = Label(Lb3, text='', width=74, height=22)
                Lb7.place(x=-2, y=-2)
                Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
                Lb8.place(x=2, y=2)
                Lb9 = Label(Lb7, text=text3, font=('微软雅黑', 10))
                Lb9.place(x=10, y=30)
            bt6 = Button(Lb7,text='提交',width=5,fg='#38B0DE',command=bt6)
            bt6.place(x=140,y=70)
            bt7 = Button(Lb7, text='取消', width=5, fg='#38B0DE',command=bt7)
            bt7.place(x=240, y=70)
            bt8 = Button(Lb7, text='清空', width=5, fg='#38B0DE',command=bt8)
            bt8.place(x=340, y=70)
        def bt2():
            text2 = '员工信息:'
            Lb7 = Label(Lb3, text='', width=74, height=22)
            Lb7.place(x=-2, y=-2)
            Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
            Lb8.place(x=2, y=2)
            Lb9 = Label(Lb7, text='职工编号查询:', font=('微软雅黑', 10))
            Lb9.place(x=120, y=42)
            t1 = Entry(Lb7,width = 15)
            t1.place(x=220,y=42)
            Lb16 = Label(Lb7, text='职工姓名查询:', font=('微软雅黑', 10))
            Lb16.place(x=120, y=82)
            t2 = Entry(Lb7,width=15)
            t2.place(x=220,y=82)
            Lb10 = Label(Lb7,text='',width=400,height=300)
            Lb10.place(x=0,y=122)
            def bt9():
                Lb11=Label(Lb10,text='员工编号:' ,font=('微软雅黑', 10))
                Lb11.place(x=120,y=20)
                Lb12 = Label(Lb10, text='员工姓名:', font=('微软雅黑', 10))
                Lb12.place(x=120, y=60)
                Lb13 = Label(Lb10, text='身份证号:', font=('微软雅黑', 10))
                Lb13.place(x=120, y=100)
                Lb14 = Label(Lb10, text='员工性别:', font=('微软雅黑', 10))
                Lb14.place(x=120, y=140)
                Lb15 = Label(Lb10, text='所在银行:', font=('微软雅黑', 10))
                Lb15.place(x=120, y=180)
                s1 = str(t1.get())
                cursor.execute("select Aid,AName,Aidentitycard,asex,name from Admin join Ibank On Admin.IBANKID=Ibank.IBANKID WHERE Aid='%s'"%(s1))
                T = cursor.fetchall()
                if len(T)==0:
                    mb.showwarning('查询失败', '没有该用户!')
                else:
                    txt1 = StringVar()
                    e1 = Entry(Lb10,textvariable=txt1,state=DISABLED)
                    txt1.set(T[0][0])
                    e1.place(x=220,y=20)
                    txt2 = StringVar()
                    e2 = Entry(Lb10, textvariable=txt2, state=DISABLED)
                    txt2.set(T[0][1])
                    e2.place(x=220, y=60)
                    txt3 = StringVar()
                    e3 = Entry(Lb10, textvariable=txt3, state=DISABLED)
                    txt3.set(T[0][2])
                    e3.place(x=220, y=100)
                    txt4 = StringVar()
                    e4 = Entry(Lb10, textvariable=txt4, state=DISABLED)
                    txt4.set(T[0][3])
                    e4.place(x=220, y=140)
                    txt5 = StringVar()
                    e5 = Entry(Lb10, textvariable=txt5, state=DISABLED)
                    txt5.set(T[0][4])
                    e5.place(x=220, y=180)
                    def bt11():
                        text2 = '功能介绍:'
                        text3 = '管理员可以管理员工的添加、删除、员工信息的查看修改等,还可以更改银行的利率。'
                        Lb7 = Label(Lb3, text='', width=74, height=22)
                        Lb7.place(x=-2, y=-2)
                        Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
                        Lb8.place(x=2, y=2)
                        Lb9 = Label(Lb7, text=text3, font=('微软雅黑', 10))
                        Lb9.place(x=10, y=30)
                    bt11 = Button(Lb10, text='返回', width=10, fg='#38B0DE', command=bt11)
                    bt11.place(x=200, y=210)
            def bt10():
                    s2 = str(t2.get())
                    cursor.execute("select Aid,AName,Aidentitycard,asex,name from Admin join Ibank On Admin.IBANKID=Ibank.IBANKID WHERE AName='%s'" % (s2))
                    T = cursor.fetchall()
                    if len(T)==0:
                        mb.showwarning('查询失败', '没有该用户!')
                    else:
                        manfra = Label(Lb10)
                        manfra.place(x=80,y=50)
                        manfra.columnconfigure(1, minsize=5)
                        manfra.columnconfigure(2, minsize=50)
                        manfra.columnconfigure(3, minsize=30)
                        Label(manfra, text='员工编号',
                              font=('微软雅黑', 9, 'normal'), bd=2,
                              relief=SOLID).grid(row=1, column=1)
                        Label(manfra, text='员工姓名',
                              font=('微软雅黑', 9, 'normal'), bd=2,
                              relief=SOLID).grid(row=1, column=2, sticky=N + E + S + W)
                        Label(manfra, text='身份证号',
                              font=('微软雅黑', 9), bd=1,
                              relief=SOLID).grid(row=1, column=3, sticky=N + E + S + W)
                        Label(manfra, text='员工性别',
                              font=('微软雅黑', 9), bd=1,
                              relief=SOLID).grid(row=1, column=4, sticky=N + E + S + W)
                        Label(manfra, text='所在银行',
                              font=('微软雅黑', 9), bd=1,
                              relief=SOLID).grid(row=1, column=5, sticky=N + E + S + W)
                        rn = 2
                        for x in T:
                            cn = 0
                            Label(manfra, text=str(rn - 1),
                                  font=('微软雅黑', 9, 'bold'), bd=1,
                                  relief=SOLID).grid(row=rn, column=cn, sticky=N + E + S + W)
                            for a in x:
                                cn += 1
                                Label(manfra, text=str(a),
                                      font=('微软雅黑', 9), bd=1,
                                      relief=SOLID).grid(row=rn, column=cn, sticky=N + E + S + W)
                            rn += 1
                    def bt12():
                        text2 = '功能介绍:'
                        text3 = '管理员可以管理员工的添加、删除、员工信息的查看修改等,还可以更改银行的利率。'
                        Lb7 = Label(Lb3, text='', width=74, height=22)
                        Lb7.place(x=-2, y=-2)
                        Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
                        Lb8.place(x=2, y=2)
                        Lb9 = Label(Lb7, text=text3, font=('微软雅黑', 10))
                        Lb9.place(x=10, y=30)
                    bt12 = Button(Lb10, text='返回', width=10, fg='#38B0DE', command=bt12)
                    bt12.place(x=200, y=210)
            bt9 = Button(Lb7, text='查询', width=5, fg='#38B0DE', command=bt9)
            bt9.place(x=340, y=36)
            bt10 = Button(Lb7, text='查询', width=5, fg='#38B0DE', command=bt10)
            bt10.place(x=340, y=76)
        def bt3():
            text2 = '员工信息:'
            Lb7 = Label(Lb3, text='', width=74, height=22)
            Lb7.place(x=-2, y=-2)
            Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
            Lb8.place(x=2, y=2)
            cursor.execute(
                "select Aid,AName,Aidentitycard,asex,name from Admin join Ibank On Admin.IBANKID=Ibank.IBANKID ")
            T = cursor.fetchall()
            if len(T)==0:
                mb.showwarning('查询失败', '没有该用户!')
            else:
                manfra = Label(Lb7)
                manfra.place(x=80, y=40)
                manfra.columnconfigure(1, minsize=5)
                manfra.columnconfigure(2, minsize=50)
                manfra.columnconfigure(3, minsize=30)
                Label(manfra, text='员工编号',
                      font=('微软雅黑', 9, 'normal'), bd=2,
                      relief=SOLID).grid(row=1, column=1)
                Label(manfra, text='员工姓名',
                      font=('微软雅黑', 9, 'normal'), bd=2,
                      relief=SOLID).grid(row=1, column=2, sticky=N + E + S + W)
                Label(manfra, text='身份证号',
                      font=('微软雅黑', 9), bd=1,
                      relief=SOLID).grid(row=1, column=3, sticky=N + E + S + W)
                Label(manfra, text='员工性别',
                      font=('微软雅黑', 9), bd=1,
                      relief=SOLID).grid(row=1, column=4, sticky=N + E + S + W)
                Label(manfra, text='所在银行',
                      font=('微软雅黑', 9), bd=1,
                      relief=SOLID).grid(row=1, column=5, sticky=N + E + S + W)
                rn = 2
                for x in T:
                    cn = 0
                    Label(manfra, text=str(rn - 1),
                          font=('微软雅黑', 9, 'bold'), bd=1,
                          relief=SOLID).grid(row=rn, column=cn, sticky=N + E + S + W)
                    for a in x:
                        cn += 1
                        Label(manfra, text=str(a),
                              font=('微软雅黑', 9), bd=1,
                              relief=SOLID).grid(row=rn, column=cn, sticky=N + E + S + W)
                    rn += 1
                def DY():
                    sql = pandas.read_sql('select * from Admin', con=conn)
                    sql.to_csv(r'E:/作业/Python/课设/员工信息.csv')
                    pandas.DataFrame(sql).to_excel(r'E:/作业/Python/课设/员工信息.xlsx')
                    mb.showinfo('打印成功', '文件已打印')
            bt = Button(Lb7, text='打印CSV', fg='#38B0DE',command=DY)
            bt.place(x=200, y=340)
        def bt4():
            Lb7 = Label(Lb3, text='', width=74, height=22)
            Lb7.place(x=-2, y=-2)
            Lb8 = Label(Lb7, text='员工编号:', font=('楷书', 15))
            Lb8.place(x=100, y=2)
            e1 = Entry(Lb7)
            e1.place(x=220,y=2)
            Lb9 = Label(Lb7,text='',width = 74,height=18)
            Lb9.place(x=-2,y=40)
            Lb19 = Label(Lb9, text='员工编号:', font=('微软雅黑', 10))
            Lb19.place(x=140, y=12)
            txt2 = StringVar()
            e2 = Entry(Lb9, text=txt2, state=DISABLED)
            e2.place(x=220, y=12)
            Lb20 = Label(Lb9, text='员工姓名:', font=('微软雅黑', 10))
            Lb20.place(x=140, y=42)
            txt3 = StringVar()
            e3 = Entry(Lb9,text=txt3)
            e3.place(x=220, y=42)
            Lb21 = Label(Lb9, text='员工密码:', font=('微软雅黑', 10))
            Lb21.place(x=140, y=72)
            txt4 = StringVar()
            e4 = Entry(Lb9,text=txt4)
            e4.place(x=220, y=72)
            Lb22 = Label(Lb9, text='身份证号:', font=('微软雅黑', 10))
            Lb22.place(x=140, y=102)
            txt5 = StringVar()
            e5 = Entry(Lb9,text=txt5)
            e5.place(x=220, y=102)
            Lb23 = Label(Lb9, text='员工性别:', font=('微软雅黑', 10))
            Lb23.place(x=140, y=132)
            txt6 = StringVar()
            e6 = Entry(Lb9,text=txt6)
            e6.place(x=220, y=132)
            Lb24 = Label(Lb9, text='银行编号:', font=('微软雅黑', 10))
            Lb24.place(x=140, y=162)
            txt7 = StringVar()
            e7 = Entry(Lb9,text=txt7)
            e7.place(x=220, y=162)
            Lb25 = Label(Lb9, text='员工类别:', font=('微软雅黑', 10))
            Lb25.place(x=140, y=192)
            txt8 = StringVar()
            e8 = Entry(Lb9,text=txt8)
            e8.place(x=220, y=192)
            Lb26 = Label(Lb9, text='员工状态:', font=('微软雅黑', 10))
            Lb26.place(x=140, y=222)
            txt9 = StringVar()
            e9 = Entry(Lb9,text=txt9)
            e9.place(x=220, y=222)
            def bt16():
                text2 = '功能介绍:'
                text3 = '管理员可以管理员工的添加、删除、员工信息的查看修改等,还可以更改银行的利率。'
                Lb7 = Label(Lb3, text='', width=74, height=22)
                Lb7.place(x=-2, y=-2)
                Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
                Lb8.place(x=2, y=2)
                Lb9 = Label(Lb7, text=text3, font=('微软雅黑', 10))
                Lb9.place(x=10, y=30)
            def bt14():
                aid=str(e1.get())
                cursor.execute("SELECT * FROM Admin WHERE AID = '%s'"%(aid))
                T = cursor.fetchone()
                if T is None:
                    mb.showwarning('查询失败','没有该用户')
                else:
                    txt2.set(T[0])
                    txt3.set(T[1])
                    txt4.set(T[2])
                    txt5.set(T[3])
                    txt6.set(T[4])
                    txt7.set(T[5])
                    txt8.set(T[6])
                    txt9.set(T[7])
            def bt15():
                Aid = str(e2.get())
                Aname = str(e3.get())
                Apssword=str(e4.get())
                Aidentitycard= str(e5.get())
                Asex=str(e6.get())
                Ibankid=str(e7.get())
                Type=str(e8.get())
                Status=str(e9.get())
                cursor.execute("UPDATE Admin SET Aname='%s',Apassword='%s',Aidentitycard='%s', Asex='%s',Ibankid='%s',Type='%s',Status='%s' WHERE Aid='%s'"%(Aname,Apssword,Aidentitycard,Asex,Ibankid,Type,Status,Aid))
                conn.commit()
                mb.showinfo('成功','修改成功')
            bt14 = Button(Lb7,text='查询',fg='#38B0DE',width=10,command=bt14)
            bt14.place(x=380,y=0)
            bt15 = Button(Lb7,text='提交',fg='#38B0DE',command=bt15)
            bt15.place(x=180,y=320)
            bt16 = Button(Lb7, text='取消', fg='#38B0DE',command=bt16)
            bt16.place(x=280, y=320)
        def bt5():
            Lb7 = Label(Lb3, text='', width=74, height=22)
            Lb7.place(x=-2, y=-2)
            Lb8 = Label(Lb7, text='员工编号:', font=('楷书', 15))
            Lb8.place(x=100, y=2)
            e1 = Entry(Lb7)
            e1.place(x=220, y=2)
            Lb9 = Label(Lb7, text='', width=74, height=18)
            Lb9.place(x=-2, y=40)
            Lb19 = Label(Lb9, text='员工编号:', font=('微软雅黑', 10))
            Lb19.place(x=140, y=12)
            txt2 = StringVar()
            e2 = Entry(Lb9, text=txt2, state=DISABLED)
            e2.place(x=220, y=12)
            Lb20 = Label(Lb9, text='员工姓名:', font=('微软雅黑', 10))
            Lb20.place(x=140, y=42)
            txt3 = StringVar()
            e3 = Entry(Lb9, text=txt3)
            e3.place(x=220, y=42)
            Lb21 = Label(Lb9, text='员工密码:', font=('微软雅黑', 10))
            Lb21.place(x=140, y=72)
            txt4 = StringVar()
            e4 = Entry(Lb9, text=txt4)
            e4.place(x=220, y=72)
            Lb22 = Label(Lb9, text='身份证号:', font=('微软雅黑', 10))
            Lb22.place(x=140, y=102)
            txt5 = StringVar()
            e5 = Entry(Lb9, text=txt5)
            e5.place(x=220, y=102)
            Lb23 = Label(Lb9, text='员工性别:', font=('微软雅黑', 10))
            Lb23.place(x=140, y=132)
            txt6 = StringVar()
            e6 = Entry(Lb9, text=txt6)
            e6.place(x=220, y=132)
            Lb24 = Label(Lb9, text='银行编号:', font=('微软雅黑', 10))
            Lb24.place(x=140, y=162)
            txt7 = StringVar()
            e7 = Entry(Lb9, text=txt7)
            e7.place(x=220, y=162)
            Lb25 = Label(Lb9, text='员工类别:', font=('微软雅黑', 10))
            Lb25.place(x=140, y=192)
            txt8 = StringVar()
            e8 = Entry(Lb9, text=txt8)
            e8.place(x=220, y=192)
            Lb26 = Label(Lb9, text='员工状态:', font=('微软雅黑', 10))
            Lb26.place(x=140, y=222)
            txt9 = StringVar()
            e9 = Entry(Lb9, text=txt9)
            e9.place(x=220, y=222)

            def bt16():
                text2 = '功能介绍:'
                text3 = '管理员可以管理员工的添加、删除、员工信息的查看修改等,还可以更改银行的利率。'
                Lb7 = Label(Lb3, text='', width=74, height=22)
                Lb7.place(x=-2, y=-2)
                Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
                Lb8.place(x=2, y=2)
                Lb9 = Label(Lb7, text=text3, font=('微软雅黑', 10))
                Lb9.place(x=10, y=30)

            def bt14():
                aid = str(e1.get())
                cursor.execute("SELECT * FROM Admin WHERE AID = '%s'" % (aid))
                T = cursor.fetchone()
                if T is None:
                    mb.showwarning('查询失败', '没有该用户')
                else:
                    txt2.set(T[0])
                    txt3.set(T[1])
                    txt4.set(T[2])
                    txt5.set(T[3])
                    txt6.set(T[4])
                    txt7.set(T[5])
                    txt8.set(T[6])
                    txt9.set(T[7])

            def bt15():
                Aid = str(e2.get())
                cursor.execute("DELETE Admin  WHERE Aid='%s'" % ( Aid))
                conn.commit()
                mb.showinfo('成功', '删除成功')
                txt2.set('')
                txt3.set('')
                txt4.set('')
                txt5.set('')
                txt6.set('')
                txt7.set('')
                txt8.set('')
                txt9.set('')
            bt14 = Button(Lb7, text='查询', fg='#38B0DE', width=10, command=bt14)
            bt14.place(x=380, y=0)
            bt15 = Button(Lb7, text='提交', fg='#38B0DE', command=bt15)
            bt15.place(x=180, y=320)
            bt16 = Button(Lb7, text='取消', fg='#38B0DE', command=bt16)
            bt16.place(x=280, y=320)
        def bt7():
            rt.destroy()
            Main().dellu()
        def bt8():
            Lb7 = Label(Lb3, text='', width=74, height=22)
            Lb7.place(x=-2, y=-2)
            Lb8 = Label(Lb7, text='银行利率:', font=('楷书', 15))
            Lb8.place(x=80, y=150)
            txt = StringVar()
            e1 = Entry(Lb7,text=txt)
            e1.place(x=180, y=150)
            def bt():
                cursor.execute("select value from INTERest ")
                T = cursor.fetchall()
                if T is None:
                    mb.showwarning('查询失败','没有定义利率')
                else:
                    txt.set(T[0][0])
                    e1.focus_set()
                    mb.showinfo('成功', '查询利率成功')
            def bt3():
                text2 = '功能介绍:'
                text3 = '管理员可以管理员工的添加、删除、员工信息的查看修改等,还可以更改银行的利率。'
                Lb7 = Label(Lb3, text='', width=74, height=22)
                Lb7.place(x=-2, y=-2)
                Lb8 = Label(Lb7, text=text2, font=('楷书', 15))
                Lb8.place(x=2, y=2)
                Lb9 = Label(Lb7, text=text3, font=('微软雅黑', 10))
                Lb9.place(x=10, y=30)
            def bt2():
                t1 = float(e1.get())
                cursor.execute("UPDATE Interest SET Value=%s"%(t1))
                conn.commit()
                cursor.execute("UPDATE actype SET interestid=%s" % (t1))
                conn.commit()
                mb.showinfo('成功', '利率改变成功')
            bt = Button(Lb7,text='查看', fg='#38B0DE', width=5,command=bt)
            bt.place(x=340,y=145)
            bt2= Button(Lb7,text ='提交',fg='#38B0DE',command=bt2)
            bt2.place(x=180,y=220)
            bt3=Button(Lb7,text='返回',fg='#38B0DE',command=bt3)
            bt3.place(x=280,y=220)
        bt1 = Button(Lb1,text='添加员工',width=10,fg='#38B0DE',command=bt1)
        bt1.place(x=5,y=120)
        bt2 = Button(Lb1, text='查询员工', width=10, fg='#38B0DE',command=bt2)
        bt2.place(x=5, y=160)
        bt6 = Button(Lb1, text='显示员工', width=10, fg='#38B0DE',command= bt3)
        bt6.place(x=5, y=200)
        bt3 = Button(Lb1, text='修改员工', width=10, fg='#38B0DE',command=bt4)
        bt3.place(x=5, y=240)
        bt4 = Button(Lb1, text='删除员工', width=10, fg='#38B0DE',command = bt5)
        bt4.place(x=5, y=280)
        bt5 = Button(Lb1, text='改变利率', width=10, fg='#38B0DE',command=bt8)
        bt5.place(x=5, y=320)
        bt = Button(Lb1, text='返回登录', width=10, fg='#38B0DE',command=bt7)
        bt.place(x=5,y=360)
        rt.after(100, uptime)
    def Admin_PT(self):
        global pho1
        def uptime():
            global TimeLabel
            Lb1["text"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
            rt.after(100, uptime)
        rt = Tk()
        rt.title("ATM机界面")
        rt.iconbitmap('f6.ico')
        rt.geometry('300x400+300+100')
        Lb1 = Label(rt,bg="#38B0DE",width=300,height=-1)
        Lb1.pack()
        pho1 = Main().get_image('12.gif', 300, 200)
        Lb2 = Label(rt,image=pho1)
        Lb2.pack()
        Lb3 = Label(rt,bg='#CDCDCD',width=300,height=13)
        Lb3.pack()
        def Back_Z():
            rt.destroy()
            Main().dellu()
        def QUKUAN():
            rt.destroy()
            Admin().Q_K()
        def CUNKUAN():
            rt.destroy()
            Admin().C_K()
        def CHAXUNYUE():
            rt.destroy()
            Admin().C_X_ye()
        def ZHUANZHANG():
            rt.destroy()
            Admin().Z_Z()
        bt1 = Button(Lb3,text='取款',width=10,fg='#38B0DE',command=QUKUAN)
        bt1.place(x=20,y=20)
        bt2 = Button(Lb3, text='存款',width=10,fg='#38B0DE',command=CUNKUAN)
        bt2.place(x=200, y=20)
        bt3 = Button(Lb3, text='转账',width=10,fg='#38B0DE',command = ZHUANZHANG)
        bt3.place(x=20, y=60)
        bt4 = Button(Lb3, text='查询',width=10,fg='#38B0DE',command=CHAXUNYUE)
        bt4.place(x=200, y=60)
        bt5 = Button(Lb3, text='返回',width=10,fg='#38B0DE',command=Back_Z)
        bt5.place(x=110,y=100)
        rt.after(100, uptime)
    def Admin_YG(self):
        global pho2
        def uptime():
            global TimeLabel
            Lb5["text"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
            rt.after(100, uptime)
        rt = Tk()
        rt.title('员工操作')
        rt.iconbitmap('f6.ico')
        rt.geometry('600x430+150+200')
        Lb1 = Label(rt,text='',width=600,height=30,bg='#38B0DE')
        Lb1.place(x=0,y=0)
        Lb5 = Label(Lb1,text=time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time())),font=('楷体',16),bg='#38B0DE')
        Lb5.place(x=200,y=0)
        Lb2 = Label(rt,text='',width=100,height=430)
        Lb2.place(x=0,y=30)
        pho2 = Main().get_image('12.gif',400,350)
        Lb3 =Label(rt,image=pho2,width=400,height=430,)
        Lb3.place(x=100,y=30)
        Lb4 = Label(rt,width=100,height=430)
        Lb4.place(x=500,y=30)
        def bt1():
            rt.destroy()
            Admin().K_H()
        def XIAOHU():
            rt.destroy()
            Admin().X_H()
        def DONGJIE():
            rt.destroy()
            Admin().D_J()
        def JIEDONG():
            rt.destroy()
            Admin().J_D()
        def BUKA():
            rt.destroy()
            Admin().B_K()
        def GUASHI():
            rt.destroy()
            Admin().G_S()
        def GAIMI():
            rt.destroy()
            Admin().G_M()
        def GDHH():
            rt.destroy()
            Admin().G_T()
        def CX():
            rt.destroy()
            Admin().C_X_ye1()
        def QK():
            rt.destroy()
            Admin().Q_K1()
        def CUNKUAN():
            rt.destroy()
            Admin().C_K1()
        def ZHUANZHANG():
            rt.destroy()
            Admin().Z_Z1()
        def DAIKUAN():
            rt.destroy()
            Admin().D_K()
        def HUANKUAN():
            rt.destroy()
            Admin().H_K()
        bt1 = Button(Lb2,text='开户',width=10,fg='#38B0DE',command=bt1)
        bt1.place(x=10,y=40)
        bt2 = Button(Lb2, text='冻结', width=10, fg='#38B0DE',command=DONGJIE)
        bt2.place(x=10, y=90)
        bt3 = Button(Lb2, text='补卡', width=10, fg='#38B0DE',command=BUKA)
        bt3.place(x=10, y=140)
        bt4 = Button(Lb2, text='改密', width=10, fg='#38B0DE',command=GAIMI)
        bt4.place(x=10, y=190)
        bt5 = Button(Lb2, text='查询', width=10, fg='#38B0DE',command=CX)
        bt5.place(x=10, y=240)
        bt6 = Button(Lb2, text='取款', width=10, fg='#38B0DE',command=QK)
        bt6.place(x=10, y=290)
        bt7 = Button(Lb2, text='贷款', width=10, fg='#38B0DE',command=DAIKUAN)
        bt7.place(x=10, y=340)
        bt8 = Button(Lb4, text='销户', width=10, fg='#38B0DE',command=XIAOHU)
        bt8.place(x=10, y=40)
        bt9 = Button(Lb4, text='解冻', width=10, fg='#38B0DE',command=JIEDONG)
        bt9.place(x=10, y=90)
        bt10 = Button(Lb4, text='挂失', width=10, fg='#38B0DE',command = GUASHI)
        bt10.place(x=10, y=140)
        bt11= Button(Lb4, text='改电话号码', width=10, fg='#38B0DE',command=GDHH)
        bt11.place(x=10, y=190)
        bt12= Button(Lb4, text='存款', width=10, fg='#38B0DE',command=CUNKUAN)
        bt12.place(x=10, y=240)
        bt13 = Button(Lb4, text='转账', width=10, fg='#38B0DE',command=ZHUANZHANG)
        bt13.place(x=10, y=290)
        bt14= Button(Lb4, text='还款', width=10, fg='#38B0DE',command=HUANKUAN)
        bt14.place(x=10, y=340)
        rt.after(100, uptime)
#登录界面
Main().dellu()
#开户
#Admin().K_H()
#冻结
#Admin().D_J()
#销户
#Admin().X_H()
#解冻
#Admin().J_D()
#补卡
#Admin().B_K()
#挂失
#Admin().G_S()
#改密
#Admin().G_M()
#改电话号码
#Admin().G_T()
#查询余额
#Admin().C_X_ye()
#存款
#Admin().C_K()
#取款
#Admin().Q_K()
#转账
#Admin().Z_Z()
#贷款
#Admin().D_K()
#还款
#Admin().H_K()
#打印流水
#Admin().D_Y()
#改利率
#Admin().G_L()
#添加系统操作用户表
#Admin().Add_a()
#删除
#Admin().Delete_a()

  • 3
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值