def project_month(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now( ) project = projects(request) project = project.filter(created_time__year=year, created_time__month=month) return project
def project_new_week(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now( ) project = projects(request) project = project.filter(id__in=ids, examined=2, created_time__range=([week_start, week_end])) return project
def project_examined(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now( ) project = models.Project.objects.all().filter(status=0) if request.user.is_admin: project = project.filter(department=request.user.department, examine=0) else: project = project.filter(examine=1) return project
def project_end_month(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now( ) project = projects(request) project = project.filter(id__in=ids, status=3, examined=2, update_time__year=year, update_time__month=month) return project
def task_end_week(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now() task = models.Task.objects.all() ids = [] task_users = models.TaskUser.objects.filter(user=request.user) for task_user in task_users: ids.append(task_user.task_id) ids = list(set(ids)) task = task.filter(id__in=ids, update_time__range=([week_start, week_end]), status=3) return task
def task_new_day(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now() task = models.Task.objects.all() ids = [] task_users = models.TaskUser.objects.filter(user=request.user) for task_user in task_users: ids.append(task_user.task_id) ids = list(set(ids)) task = task.filter(id__in=ids, created_time__year=year, created_time__month=month, created_time__day=day) return task
def project_table(): year, month, day, week_start, week_end, week_list, dayscount, now = time_now( ) project = models.Project.objects.all() data = [] for index in range(1, 13): count = project.filter(created_time__year=year, created_time__month=index).count() js = {'day': str(index) + "月", 'project': count} data.append(js) return data
def task_table(): year, month, day, week_start, week_end, week_list, dayscount, now = time_now() task = models.Task.objects.all() data = [] for index, week in enumerate(week_list): num = index + 1 week_day = now - dayscount + datetime.timedelta(days=num) count = task.filter(created_time__year=week_day.year, created_time__month=week_day.month, created_time__day=week_day.day).count() js = {'day': week, 'task': count} data.append(js) return data
def task_chartist(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now() task = taskes(request) js = [] for index, week in enumerate(week_list): num = index + 1 week_day = now - dayscount + datetime.timedelta(days=num) task_new = task.filter(created_time__year=week_day.year, created_time__month=week_day.month, created_time__day=week_day.day).count() task_end = task.filter(status=3, update_time__year=week_day.year, update_time__month=week_day.month, update_time__day=week_day.day).count() js.append({'period': week, 'Sales': task_new, 'Earning': task_end}) return js
def task_day(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now() task = models.Task.objects.all() ids = [] if request.user.is_admin: department_id = request.user.department_id projects = models.Project.objects.filter(department=department_id) for project in projects: taskes = models.Task.objects.filter(project=project) for taske in taskes: ids.append(taske.id) ids = list(set(ids)) task = task.filter(id__in=ids) task = task.filter(created_time__year=year, created_time__month=month, created_time__day=day) return task
def project_chartist(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now( ) js = [] project = projects(request) for index in range(1, 13): labels = str(index) + "月" series_one = project.filter(created_time__year=year, created_time__month=index).count() series_two = project.filter(status=3, update_time__year=year, update_time__month=index).count() js.append({ 'period': labels, 'Sales': series_one, 'Earning': series_two }) return js
def project_week(request): year, month, day, week_start, week_end, week_list, dayscount, now = time_now( ) project = projects(request) project = project.filter(created_time__range=([week_start, week_end])) return project