Ejemplo n.º 1
0
 def delete(request):
     employeeKeyUrlSafe = request.get('employeeKeyUrlSafe')
     #delete all account manager relationships for employee
     accountManagers = AccountManagerService.getAll()
     for accountManager in accountManagers:
         if accountManager.employeeKeyUrlSafe == employeeKeyUrlSafe:
             accountManager.key.delete()
     employeeKey = EmployeeService.getEmployeeKey(employeeKeyUrlSafe)
     employeeKey.delete()
     time.sleep(sleepTime)
Ejemplo n.º 2
0
 def post(self):
     user = Authorization.isAuthenticated()
     if user:
         try:
             addNewEmployee = self.request.get('addNewEmployee')
             updateEmployee = self.request.get('updateEmployee')
             deleteEmployee = self.request.get('deleteEmployee')
             employeeAccountManagerSubmit = self.request.get('employeeAccountManagerSubmit')
             if addNewEmployee:
                 EmployeeService.saveNew(self.request)
             elif updateEmployee:
                 EmployeeService.update(self.request)
             elif deleteEmployee:
                 EmployeeService.delete(self.request)
             elif employeeAccountManagerSubmit:
                 AccountManagerService.update(self.request)
         except:
             logging.error("Employees.py => post")
         finally:
             self.redirect('/employees')
     else:
         self.redirect('/')
Ejemplo n.º 3
0
 def getAllInRangeForEmployee(employeeKeyUrlSafe, clients, viewDateFrom, viewDateTo):
     try:
         viewDateFrom = datetime.strptime(viewDateFrom, "%m/%d/%Y").date()
         viewDateTo = datetime.strptime(viewDateTo, "%m/%d/%Y").date()
         listLineItems = []
         accountManagers = AccountManagerService.getAllByEmployeeKeyUrlSafe(employeeKeyUrlSafe)
         for client in clients:
             for accountManager in accountManagers:
                 if client.key.urlsafe() == accountManager.clientKeyUrlSafe:
                     lineItems = LineItem.query(ancestor=client.key)
                     lineItems = lineItems.filter(
                         LineItem.dateOfService <= viewDateTo, LineItem.dateOfService >= viewDateFrom
                     )
                     listLineItems += lineItems.order(LineItem.dateOfService).fetch()
         return listLineItems
     except:
         logging.error("LineItemService.py => getAllInRang")
         return None