Beispiel #1
0
 def commit_ok(self):
     if self.lock.get() < 0 or self.stock.get() < 0 or self.barrel.get() < 0:
         messagebox.showerror("commit error","please check you input to confim there is not empty")
         return
     try:
         errorstr = ""
         search_sql = "select user_id from person where user_name = '%s' and priot = %d;"%(self.user_name,self.priot)
         self.conn = mydb.Commission().getConn()
         self.cursor = self.conn.cursor()
         self.cursor.execute(search_sql)
         self.user_id = self.cursor.fetchone()
         now = datetime.datetime.now()
         time_str = "%s/%s/%s"%(now.year,now.month,now.day)
         self.info = [self.user_id[0],self.user_name,time_str,"hdkdajlk",self.lock.get(),self.stock.get(),self.barrel.get()]
         insert_sql = "insert into sales values(%d,'%s','%s','%s',%d,%d,%d);"%(self.info[0],self.info[1],self.info[2],self.info[3],self.info[4],self.info[5],self.info[6])
         #print(insert_sql)
         self.cursor.execute(insert_sql)
         self.conn.commit()
         mydb.Commission().getCommission()
         messagebox.showinfo("success","ok")
     except pymysql.Error as e:
         self.conn.rollback()
         print(e)
     finally:
         self.conn.close()
         self.destroy()
Beispiel #2
0
 def look_sales_year(self):
     comm =  mydb.Commission()
     res = list(comm.get_manager_search_month(2))
     show_sale = showmanagersales.show_salary()
     if res is None:
         messagebox.showerror("Error","data is none")
         return
     id_name = comm.get_id_to_name()
     num = [0,"","",0,0,0,0]
     num[1] = res[0][1][:4]
     id1 = res[0][0]
     for r in res:
         if id1 == r[0] and num[1] == r[1][:4]:
             #index = r[0]
             num[2] = id_name[r[0]-1][1]
             num[1] = r[1][:4]
             num[3] += r[2]
             num[4] += r[3]
             num[5] += r[4]
             num[6] += r[5]
         else:
             num[0] += 1
             show_sale.showSalaryData(num)
             num[1] = r[1][:4]
             num[2] = id_name[r[0]-1][1]
             num[3] = r[2]
             num[4] = r[3]
             num[5] = r[4]
             num[6] = r[5]
     num[0] += 1
     show_sale.showSalaryData(num)
Beispiel #3
0
 def login(self):
     time_start = time.time()
     lp = LineProfiler()
     self.comm = mydb.Commission()
     self.userinfo = [self.name.get(), self.v.get(), self.password.get()]
     lp_wrapper = lp(self.comm.login)
     lp_wrapper(self.userinfo)
     lp.print_stats()
     time_finish = time.time()
     print("login function over ,elapse", time_finish - time_start)
     #self.comm.login(self.userinfo)
     self.destroy()
Beispiel #4
0
 def ok(self):
     name = self.name.get()
     comm = mydb.Commission()
     user_id = list(comm.get_id_from_name(name))[0]
     res = comm.get_records_form_id(user_id)
     num = [0, "", name, 0, 0, 0, 0., 0.]
     sh = showsearch.show_salary()
     for r in res:
         num[0] += 1
         num[1] = r[0]
         num[3:] = r[1:]
         sh.showSearchData(num)
Beispiel #5
0
 def look_sales_month(self):
     comm = mydb.Commission()
     res = list(comm.get_user_search_month([self.user_name, self.priot]))
     show_sale = showsales.show_sale()
     if res is None:
         messagebox.showerror("Error", "data is none")
         return
     num = [0, "", 0, 0, 0]
     for r in res:
         num[0] += 1
         num[1:] = r
         show_sale.showData(num)
Beispiel #6
0
 def look_salary_month(self):
     comm = mydb.Commission()
     res = list(comm.get_user_search_month([self.user_name, self.priot]))
     show_salary = showsalary.show_salary()
     if res is None:
         messagebox.showerror("Error", "data is none")
         return
     num = [0, "", 0, 0, 0, 0.]
     for r in res:
         num[0] += 1
         num[1] = r[0]
         num[2:] = r[1:]
         show_salary.showSalaryData(num)
Beispiel #7
0
 def look_sales_month(self):
     comm =  mydb.Commission()
     res = list(comm.get_manager_search_month(1))
     show_sale = showmanagersales.show_salary()
     if res is None:
         messagebox.showerror("Error","data is none")
         return
     id_name = comm.get_id_to_name()
     num = [0,"","",0,0,0,0]
     for r in res:
         name = id_name[r[0]-1][1]
         num[2] = name
         num[1] = r[1]
         num[0] += 1
         num[3:] = r[2:6]
         show_sale.showSalaryData(num)
Beispiel #8
0
 def look_sales_year(self):
     comm = mydb.Commission()
     res = list(comm.get_user_search_month([self.user_name, self.priot]))
     show_sale = showsales.show_sale()
     if res is None:
         messagebox.showerror("Error", "data is none")
         return
     num = [1, "", 0, 0, 0]
     num[1] = res[0][0][:4]
     for r in res:
         if num[1] == r[0][:4]:
             num[2] += r[1]
             num[3] += r[2]
             num[4] += r[3]
         else:
             show_sale.showData(num)
             num[0] += 1
             num[1] = r[0][:4]
             num[2:] = r[1:]
     show_sale.showData(num)
Beispiel #9
0
 def ok(self):
     if self.name.get()=="" or self.password.get()=="" or self.comfirm_pass.get()=="" or self.age.get()=="" or self.tele.get()=="" or self.addr.get()=="":
         messagebox.showerror("regist error","please check you input to confirm there is not empty")
         return
     if self.password.get() != self.comfirm_pass.get():
         messagebox.showerror("regist error","password is not right")
         return
     try:
         errstr = ""
         if len(str(int(self.tele.get()))) != 11:
             errstr += "please confirm the number of telephon is 11;"
         if len(self.name.get()) > 8:
             errstr += "the length of name is outof 8;"
         if len(self.addr.get()) > 20:
             errstr += "the length of addr is outof 20;"
         if int(self.age.get()) < 0 and int(self.age.get()) > 70:
             errstr += "the num of age is less than 0 or more than 70;"
         self.userinfo = [str(self.name.get()),int(self.tele.get()),str(self.addr.get()),int(self.age.get()),int(self.v.get()),str(self.password.get())]
         self.comm = mydb.Commission()
         self.comm.addUser(self.userinfo)
     except:
         messagebox.showinfo("Error","please check you input;"+errstr)
         return
     self.destroy()