示例#1
0
 def get(self):
     user = Authorization.isAuthenticated()
     if user:
         clients = ClientService.getAll()
         template_values = {
             'clients' : clients,
         }
         template = JINJA_ENVIRONMENT.get_template('partials/lineItem.html')
         self.response.write(template.render(template_values))
     else:
         self.redirect('/')
示例#2
0
 def update(request):
     employeeKeyUrlSafe = request.get("employeeKeyUrlSafe")
     accounts = AccountManagerService.getAll()
     # first delete all accounts associated with this employee
     for account in accounts:
         if account.employeeKeyUrlSafe == employeeKeyUrlSafe:
             accountKey = account.key
             accountKey.delete()
     # then add all accounts to be associated with this employee
     clients = ClientService.getAll()
     for client in clients:
         for i in range(len(clients)):
             currentClientKeyUrlSafe = request.get("client" + str(i))
             if currentClientKeyUrlSafe == client.key.urlsafe():
                 account = AccountManager()
                 account.clientKeyUrlSafe = client.key.urlsafe()
                 account.employeeKeyUrlSafe = employeeKeyUrlSafe
                 account.put()
     time.sleep(sleepTime)
示例#3
0
 def get(self, employeeKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         try:
             dateFrom = CalendarDetail.dateFrom
         except:
             dateFrom = DateService.getFirstDateOfMonth().strftime('%m/%d/%Y')
         try:
             dateTo = CalendarDetail.dateTo
         except:
             dateTo = DateService.getLastDateOfMonth().strftime('%m/%d/%Y')
         employee = EmployeeService.get(employeeKeyUrlSafe)
         clients = ClientService.getAll()
         lineItems = LineItemService.getAllInRangeForEmployee(employeeKeyUrlSafe, clients, dateFrom, dateTo)
         if lineItems == None:
             lineItems = []
         lineItemDates = []
         for lineItem in lineItems:
             if lineItem.dateOfService not in lineItemDates:
                 lineItemDates.append(lineItem.dateOfService)
         calendarLineItemViewModels = []
         for lineItemDate in lineItemDates:
             lineItemServices = []
             for lineItem in lineItems:
                 if lineItem.dateOfService == lineItemDate:
                     lineItemServices.append(lineItem.service)
             calendarLineItemViewModel = CalendarLineItem(lineItemDate, lineItemServices)
             calendarLineItemViewModels.append(calendarLineItemViewModel)
         template_values = {
             'dateFrom' : dateFrom,
             'dateTo' : dateTo,
             'employee' : employee,
             'calendarLineItemViewModels' : calendarLineItemViewModels
         }
         template = JINJA_ENVIRONMENT.get_template('partials/calendarDetail.html')
         self.response.write(template.render(template_values))
     else:
         self.redirect('/')