def clear_csv(self, name): if name == 'HR': check = show_warning(1) if check == True: ClearHR() RunSetup(self) # Setup a new admin account since database empty if name == 'Pay': check = show_warning(2) if check == True: ClearPay() RefreshStatus(self) RefreshStic(self) Payroll.test() if name == 'Inv': check = show_warning(3) if check == True: ClearInv() RefreshStatus(self) RefreshStic(self) if name == 'Cash': check = show_warning(4) if check == True: ClearCash() RefreshStatus(self) RefreshStic(self) if name == 'ALL': check = show_warning(5) if check == True: ClearCash() ClearInv() ClearPay() ClearHR() RunSetup(self) # Setup a new admin account since database empty
def Complete_Shift(self): index=self.PayrollManagement.ListBox.curselection() if index==(): ShiftError() return else: ID= index[0] Modules.PayrollMGMTdisplay.CompleteShift(self, ID) Payroll.test()
def test_set_manager(self): # Arrange manager = Payroll.Manager() # Act employee = Payroll.Employee() employee.set_manager(manager) # Assert self.assertEqual(manager, employee.get_manager())
def Create(self): self.statrow = self.row(border=3, bg='grey', weights=[1,0]) self.tryrow = self.row() self.statrow.user = self.la(text='Logged In: '+Modules.Check.loggeduser, fg='#404040') self.statrow.status = self.la(text='Status: '+Modules.Check.shiftstat, fg='#404040') self.statrow.time = self.la(text='', fg='#404040') tick(self.statrow.time) shift_up(self.statrow.status) Payroll.test() self.statrow.version = self.la(text=Modules.Check.version, fg='#404040') self.endrow() self.statrow.logout = self.bu(text='Logout', command=Callable(Nav_Logout, self), width=15, padx=5, bg='#d94444') self.endrow() self.protocol("WM_DELETE_WINDOW", Callable(Nav_Logout, self))
def test_add_hours_worked(self): pass # AAA # Arrange hours_worked = 60 payroll_pin = 1234 manager = Payroll.Manager() manager.set_payroll_pin(payroll_pin) # Act employee = Payroll.Employee() employee.set_manager(manager) employee.add_hours_worked(60, payroll_pin) # Assert self.assertEqual(hours_worked, employee.get_hours_worked())
def test_pay_without_overtime(self): pass # AAA # Arrange pay_rate = 40 hours_worked = 20 payroll_pin = 1234 manager = Payroll.Manager() manager.set_payroll_pin(payroll_pin) # Act employee = Payroll.Employee() employee.set_pay_rate(pay_rate) employee.set_manager(manager) employee.add_hours_worked(hours_worked, payroll_pin) # Assert self.assertEqual(pay_rate * hours_worked, employee.pay()) self.assertEqual(0, employee.get_hours_worked())
def test_init(self): # AAA # Arrange # Act employee = Payroll.Employee() # Assert self.assertEqual("", employee.get_name()) self.assertEqual(0, employee.get_pay_rate()) self.assertEqual(0, employee.get_hours_worked())
def test_set_name(self): # AAA # Arrange name = "Eric" # Act employee = Payroll.Employee() employee.set_name(name) # Assert self.assertEqual(name, employee.get_name())
def test_set_pay_rate(self): pass # AAA # Arrange pay_rate = 40 # Act employee = Payroll.Employee() employee.set_pay_rate(pay_rate) # Assert self.assertEqual(pay_rate, employee.get_pay_rate())
def Nav_Payroll(self): if Modules.Check.openwindow != 'Start / End Shift': if Modules.Check.BUSY == False: DestroyWindow(self) Payroll.Create(self) self.title('Doru\'s No Frills - Start / End Shift') Modules.Check.openwindow = "Start / End Shift" self.menu.cash.config(state='active', relief='raised') self.menu.inventory.config(state='active', relief='raised') if Modules.Check.userlevel == '1': self.menu.employment.config(state='active', relief='raised') self.menu.reports.config(state='active', relief='raised') self.menu.cp.config(state='active', relief='sunken') else: Modules.Check.BusyAlert(self) else: Modules.Check.InstanceAlert(self)
""" Method for handling global variables saved in a JSON file """ import json from UserData import * import Payroll as pr # Declare variables that can be accessed anywhere ud = UserData() salesFile = None timecardsFile = None emp_access = None employees = pr.load_employees() Anchor = '' class GlobalVariables: # Path to the file FILE = "JSON/Global.json" # Empty Initialization def __init__(self): return # Open method used for initially importing global variables def open(self): # Open the json file specifying utf-8 just in case json_file = open(self.FILE, "r") # Check to see if the file has something in it or return prematurely