예제 #1
0
 def getAllInRange(clientKeyUrlSafe, viewDateFrom, viewDateTo):
     try:
         viewDateFrom = datetime.strptime(viewDateFrom, "%m/%d/%Y").date()
         viewDateTo = datetime.strptime(viewDateTo, "%m/%d/%Y").date()
         clientKey = ClientService.getClientKey(clientKeyUrlSafe)
         lineItems = LineItem.query(ancestor=clientKey)
         lineItems = lineItems.filter(LineItem.dateOfService <= viewDateTo, LineItem.dateOfService >= viewDateFrom)
         lineItems = lineItems.order(LineItem.dateOfService).fetch()
         return lineItems
     except:
         logging.error("LineItemService.py => getAllInRang")
         return None
예제 #2
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
예제 #3
0
 def getAll(clientKeyUrlSafe):
     clientKey = ClientService.getClientKey(clientKeyUrlSafe)
     lineItems = LineItem.query(ancestor=clientKey).order(LineItem.dateOfService).fetch()
     return lineItems
예제 #4
0
 def add(clientKey, service, dateOfService):
     lineItem = LineItem(parent=clientKey)
     lineItem.dateOfService = dateOfService
     lineItem.service = service
     lineItem.put()