Beispiel #1
0
def utilization(request):
    year, month = getmonthyear(request)
    kwargs = {"year": year,
              "month": month}

    theteam = request.GET.get("team")
    teamselection = group_for_team(theteam) if theteam else MARKET_CHOICES_LIST
    utlztn, dates = ActivityEntry.utilization_last_12_months(teamselection, **kwargs)
    activity_data = ActivityEntry.activity_volumes_last_12_months(teamselection, activity=request.GET.get("activity"))
    team = MARKET_CHOICES_MAP.get(request.GET["team"]) \
           if request.GET.get("team") else "All teams"
    if not team:
        raise Http404
    return render_to_response(
        "industrial_engineering_utilization.html",
        {
            "teams": MARKET_CHOICES,
            "team": team,
            "year": year,
            "months": generate_month_box(id="month"),
            "months2": generate_month_box(id="activity-month"),
            "selected_month": month,
            "selected_team": request.GET["team"] if request.GET.get("team") else "AD",
            "current": " %s/%s" % (year,month),
            "utlztn": utlztn[datetime(year=year,month=month,day=1)],
            "utlztn_all": utlztn,
            "dates": [date.strftime("%B") for date in dates],
            "activities": Activity.objects.all(),
            "activity_data": activity_data,
        },
        RequestContext(request)
    )
Beispiel #2
0
def utilization(request):
    year, month = getmonthyear(request)
    kwargs = {"year": year, "month": month}

    theteam = request.GET.get("team")
    teamselection = group_for_team(theteam) if theteam else MARKET_CHOICES_LIST
    utlztn, dates = ActivityEntry.utilization_last_12_months(
        teamselection, **kwargs)
    activity_data = ActivityEntry.activity_volumes_last_12_months(
        teamselection, activity=request.GET.get("activity"))
    team = MARKET_CHOICES_MAP.get(request.GET["team"]) \
           if request.GET.get("team") else "All teams"
    if not team:
        raise Http404
    return render_to_response(
        "industrial_engineering_utilization.html", {
            "teams": MARKET_CHOICES,
            "team": team,
            "year": year,
            "months": generate_month_box(id="month"),
            "months2": generate_month_box(id="activity-month"),
            "selected_month": month,
            "selected_team":
            request.GET["team"] if request.GET.get("team") else "AD",
            "current": " %s/%s" % (year, month),
            "utlztn": utlztn[datetime(year=year, month=month, day=1)],
            "utlztn_all": utlztn,
            "dates": [date.strftime("%B") for date in dates],
            "activities": Activity.objects.all(),
            "activity_data": activity_data,
        }, RequestContext(request))
Beispiel #3
0
def reporting(request):
    '''Base reporting hub
    Generates all the select boxes and pre-filled text fields.
    '''
    user = Tbluser.objects.get(id=request.session.get("user_id"))
    return render_to_response(
        "reporting.html",
        {
            "employee_box": generate_employee_box(user),
            "yearbox_hol": datetime.datetime.now().year,
            "monthbox_hol": generate_month_box("monthbox_hol"),
            "monthbox_ot": generate_month_box("monthbox_ot"),
            "monthbox_hr": generate_month_box("monthbox_hr"),
        },
        RequestContext(request))
Beispiel #4
0
def costbuckets(request):
    year, month = getmonthyear(request)
    kwargs = {"year": year,
              "month": month}
    if request.GET.get("team"):
        cbb = ActivityEntry.costbucket_count(group_for_team(request.GET["team"]), **kwargs)
    else:
        cbb = ActivityEntry.costbucket_count(MARKET_CHOICES_LIST, **kwargs)
    team = MARKET_CHOICES_MAP.get(request.GET["team"]) \
           if request.GET.get("team") else "All teams"
    if not team:
        raise Http404
    return render_to_response(
        "industrial_engineering_reports.html",
        {
            "teams": MARKET_CHOICES,
            "team": team,
            "year": year,
            "months": generate_month_box(id="month"),
            "selected_month": month,
            "selected_team": request.GET["team"] if request.GET.get("team") else "AD",
            "costbuckets": cbb,
            "current": " %s/%s" % (year, month)
        },
        RequestContext(request)
    )
Beispiel #5
0
def reporting(request): # pragma: no cover
    '''Base reporting hub
    Generates all the select boxes and pre-filled text fields.
    '''
    user = Tbluser.objects.get(id=request.session.get("user_id"))
    return render_to_response(
        "reporting.html",
        {
            "employee_box": generate_employee_box(user),
            "yearbox_hol": datetime.datetime.now().year,
            "monthbox_hol": generate_month_box("monthbox_hol"),
            "monthbox_ot": generate_month_box("monthbox_ot"),
            "monthbox_hr": generate_month_box("monthbox_hr"),
            "monthbox_all": generate_month_box("monthbox_all"),
            "teambox_all": generate_select(MARKET_CHOICES, id="teambox_all"),
        },
        RequestContext(request))
Beispiel #6
0
def costbuckets(request):
    year, month = getmonthyear(request)
    kwargs = {"year": year, "month": month}
    if request.GET.get("team"):
        cbb = ActivityEntry.costbucket_count(
            group_for_team(request.GET["team"]), **kwargs)
    else:
        cbb = ActivityEntry.costbucket_count(MARKET_CHOICES_LIST, **kwargs)
    team = MARKET_CHOICES_MAP.get(request.GET["team"]) \
           if request.GET.get("team") else "All teams"
    if not team:
        raise Http404
    return render_to_response(
        "industrial_engineering_reports.html", {
            "teams": MARKET_CHOICES,
            "team": team,
            "year": year,
            "months": generate_month_box(id="month"),
            "selected_month": month,
            "selected_team":
            request.GET["team"] if request.GET.get("team") else "AD",
            "costbuckets": cbb,
            "current": " %s/%s" % (year, month)
        }, RequestContext(request))