Example #1
0
 def get(self):
     user = Authorization.isAuthenticated()
     if user:
         dateFrom = DateService.getFirstDateOfMonth().strftime('%m/%d/%Y')
         dateTo = DateService.getLastDateOfMonth().strftime('%m/%d/%Y')
         clients = ClientService.getAll()
         template_values = {
             'clients' : clients,
             'postUrl' : '/report',
             'dateFrom' : dateFrom,
             'dateTo' : dateTo
         }
         template = JINJA_ENVIRONMENT.get_template('partials/report.html')
         self.response.write(template.render(template_values))
     else:
         self.redirect('/')
Example #2
0
 def get(self, clientKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         monthStart = DateService.getFirstDateOfMonth().strftime('%m/%d/%Y')
         monthEnd = DateService.getLastDateOfMonth().strftime('%m/%d/%Y')
         try:
             radLineItemType = LineItemsClient.radLineItemType
         except:
             radLineItemType = 'irregular'
         try:
             dateFrom = LineItemsClient.dateFrom
             dateTo = LineItemsClient.dateTo
         except:
             dateFrom = monthStart
             dateTo = monthEnd
         try:
             viewDateFrom = LineItemsClient.viewDateFrom
             viewDateTo = LineItemsClient.viewDateTo
         except:
             viewDateFrom = monthStart
             viewDateTo = monthEnd
         try:
             serviceKeyUrlSafe = LineItemsClient.serviceKeyUrlSafe
         except:
             serviceKeyUrlSafe = ''
         services = ServiceService.getAll()
         client = ClientService.get(clientKeyUrlSafe)
         # lineItems = LineItemService.getAll(clientKeyUrlSafe)
         lineItems = LineItemService.getAllInRange(clientKeyUrlSafe, viewDateFrom, viewDateTo)
         template_values = {
             'services':services,
             'client' : client,
             'postUrl' : '/lineItem/client/' + clientKeyUrlSafe,
             'lineItems' : lineItems,
             'getUrl' : '/lineItem/client/' + clientKeyUrlSafe,
             'viewDateFrom' : viewDateFrom,
             'viewDateTo' : viewDateTo,
             'dateFrom' : dateFrom,
             'dateTo' : dateTo,
             'serviceKeyUrlSafe' : serviceKeyUrlSafe,
             'radLineItemType' : radLineItemType
         }
         template = JINJA_ENVIRONMENT.get_template('partials/lineItemClient.html')
         self.response.write(template.render(template_values))
     else:
         self.redirect('/')
Example #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('/')