Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
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
Ejemplo n.º 9
0
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
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
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
Ejemplo n.º 12
0
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