Exemplo n.º 1
0
 def get(self, lineItemKeyUrlSafe,clientKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         # pets = PetService.getPets(clientPhone)
         LineItemService.delete(lineItemKeyUrlSafe)
         self.redirect('/lineItem/client/' + clientKeyUrlSafe)
     else:
         self.redirect('/')
Exemplo n.º 2
0
 def post(self, lineItemKeyUrlSafe, clientKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         try:
             LineItemService.update(lineItemKeyUrlSafe, self.request)
             pass
             # ClientService.update(clientKeyUrlSafe, self.request)
             # client = ClientService.getClient(clientKeyUrlSafe)
             #
             # pets = PetService.getPetsFromClient(client)
             # clientService = ClientService(self.request)
             # clientService.update(client, pets)
         except:
             logging.error(
                 "ClientEdit.py => post(self, clientKeyUrlSafe) => an exception was thrown trying to retrieve and update Client"
             )
         finally:
             self.redirect("/lineItem/client/" + clientKeyUrlSafe)
     else:
         self.redirect("/")
Exemplo n.º 3
0
 def post(self, clientKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         try:
             LineItemsClient.dateFrom = self.request.get('dateFrom')
             LineItemsClient.dateTo = self.request.get('dateTo')
             LineItemsClient.viewDateFrom = self.request.get('viewDateFrom')
             LineItemsClient.viewDateTo = self.request.get('viewDateTo')
             LineItemsClient.serviceKeyUrlSafe = self.request.get('serviceKeyUrlSafe')
             LineItemsClient.radLineItemType = self.request.get('radLineItemType')
             postButton = self.request.get('postButton')
             postButtonNonRegular = self.request.get('postButtonNonRegular')
             if postButton:
                 LineItemService.addAllInRange(clientKeyUrlSafe, self.request)
             if postButtonNonRegular:
                 LineItemService.addAllInList(clientKeyUrlSafe, self.request)
         except:
             logging.error("LineItemClient.py => post(self, clientKeyUrlSafe)")
         finally:
             self.redirect('/lineItem/client/' + clientKeyUrlSafe)
     else:
         self.redirect('/')
Exemplo n.º 4
0
 def get(self, lineItemKeyUrlSafe, clientKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         client = ClientService.get(clientKeyUrlSafe)
         lineItem = LineItemService.get(lineItemKeyUrlSafe)
         services = ServiceService.getAll()
         template_values = {
             "client": client,
             "lineItem": lineItem,
             "services": services,
             "postURL": "/lineItemUpdate/" + lineItemKeyUrlSafe + "/client/" + clientKeyUrlSafe,
         }
         template = JINJA_ENVIRONMENT.get_template("partials/lineItemUpdate.html")
         self.response.write(template.render(template_values))
     else:
         self.redirect("/")
Exemplo n.º 5
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('/')
Exemplo n.º 6
0
    def post(self):
        user = Authorization.isAuthenticated()
        if user:
            dateFrom = self.request.get('dateFrom')
            dateTo = self.request.get('dateTo')
            clientKeyUrlSafe = self.request.get("clientKeyUrlSafe")
            client = ClientService.get(clientKeyUrlSafe)
            clientName = client.primaryFirstName + " " + client.primaryLastName
            lineItems = LineItemService.getAllInRange(clientKeyUrlSafe, dateFrom, dateTo)
            today = datetime.now().strftime('%m/%d/%Y')
            clientAddressLine1 = client.primaryAddress
            clientAddressLine2 = client.primaryCity + ", " + client.primaryState + " " + client.primaryZip
            tax = 7.77
            subtotal = 0
            for lineItem in lineItems:
                subtotal += lineItem.service.servicePrice
            total = subtotal * (1 + (7.77/100))
            template_values = {
                'lineItems' : lineItems,
                'subtotal': subtotal,
                'tax' : tax,
                'total':total,
                'today': today,
                'clientAddressLine1': clientAddressLine1,
                'clientAddressLine2' : clientAddressLine2,
                'clientName' : clientName
            }
            template = JINJA_ENVIRONMENT.get_template('partials/reportPrint.html')
            self.response.write(template.render(template_values))

            # ClientService.update(clientKeyUrlSafe, self.request)
            # client = ClientService.getClient(clientKeyUrlSafe)
            #
            # pets = PetService.getPetsFromClient(client)
            # clientService = ClientService(self.request)
            # clientService.update(client, pets)
        else:
            self.redirect('/report')
Exemplo n.º 7
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('/')