示例#1
0
def leavespage (request):
    user = request.user
    if request.GET.has_key ("viewfor") and request.user.is_staff:
        user = User.objects.get (id = request.GET.get ("viewfor"))
    this_year = datetime.datetime.today().year
    cl, total_cl, sl, total_sl, el, total_el, ml, zl = Leave.counts_of_user (user, this_year)
    trackrecord = Leave.track_record_of_user (user, this_year)
    allusers = User.objects.all ()

    return render (request, "leaves.html", locals())
示例#2
0
def applyleave (request):
    if request.method == "POST":
        leaveform = LeaveForm (request.POST)
        if leaveform.is_valid ():
            from_ = leaveform.cleaned_data["from_"]
            to = leaveform.cleaned_data["to"]
            Leave.apply (request.user, leaveform.cleaned_data["leave_type"], leaveform.cleaned_data["partial"], from_, to, leaveform.cleaned_data["reason"])
            return HttpResponseRedirect ("/leaves/?applied=true")
    else:
        leaveform = LeaveForm ()
    return render (request, "apply.html", locals())
示例#3
0
def leavespage(request):
    user = request.user
    if request.GET.has_key("viewfor") and request.user.is_staff:
        user = User.objects.get(id=request.GET.get("viewfor"))
    this_year = datetime.datetime.today().year
    cl, total_cl, sl, total_sl, el, total_el, ml, zl = Leave.counts_of_user(
        user, this_year)
    trackrecord = Leave.track_record_of_user(user, this_year)
    allusers = User.objects.all()

    return render(request, "leaves.html", locals())
示例#4
0
def applyleave(request):
    if request.method == "POST":
        leaveform = LeaveForm(request.POST)
        if leaveform.is_valid():
            from_ = leaveform.cleaned_data["from_"]
            to = leaveform.cleaned_data["to"]
            Leave.apply(request.user, leaveform.cleaned_data["leave_type"],
                        leaveform.cleaned_data["partial"], from_, to,
                        leaveform.cleaned_data["reason"])
            return HttpResponseRedirect("/leaves/?applied=true")
    else:
        leaveform = LeaveForm()
    return render(request, "apply.html", locals())
示例#5
0
文件: su.py 项目: pleomax00/wigzohrms
def filealeave (request):
    employees = User.objects.all ()
    if request.method == "POST":
        leaveform = LeaveForm (request.POST)
        u = User.objects.get (id = request.POST.get ("employee"))
        if leaveform.is_valid ():
            from_ = leaveform.cleaned_data["from_"]
            to = leaveform.cleaned_data["to"]
            Leave.apply (u, leaveform.cleaned_data["leave_type"], leaveform.cleaned_data["partial"], from_, to, leaveform.cleaned_data["reason"])

            return HttpResponseRedirect ("/su/?created=true")
    else:
        leaveform = LeaveForm ()
    return render (request, "filealeave.html", locals())
示例#6
0
文件: su.py 项目: pleomax00/wigzohrms
def leaveaction (request, leaveid, action):
    #print userid, action
    leave = Leave.byId (leaveid)
    if leave is None:
        return HttpResponseRedirect ("/su/?action=nosuchleave")
    leave.approve (request.user, action)
    return HttpResponseRedirect ("/su/?action=done")
示例#7
0
文件: su.py 项目: pleomax00/wigzohrms
def removeleave (request, leaveid):
    #print userid, action
    print request.META
    leave = Leave.byId (leaveid)
    if leave is None:
        return HttpResponseRedirect ("/su/?action=nosuchleave")
    leave.delete ()
    return HttpResponseRedirect (request.GET.get ("next", "/"))
示例#8
0
文件: su.py 项目: pleomax00/wigzohrms
def superuser (request):
    all_requests = Leave.get_pending ()
    mydepts = get_departments (request.user)

    pending_requests = []
    for r in all_requests:
        if r.user.userprofile.department in mydepts or request.user.is_superuser:
            pending_requests.append (r)

    return render (request, "superuser.html", locals())
示例#9
0
def indexpage (request):
    #profile = request.
    this_year = datetime.datetime.today().year
    cl, total_cl, sl, total_sl, el, total_el, ml, zl = Leave.counts_of_user (request.user, this_year)

    upcomingbday = UserProfile.upcoming_birthdays()
    upcomingholidays = Holiday.upcoming ()
    reporting_managers = request.user.userprofile.get_all_managers

    return render (request, "index.html", locals())
示例#10
0
def indexpage(request):
    #profile = request.
    this_year = datetime.datetime.today().year
    cl, total_cl, sl, total_sl, el, total_el, ml, zl = Leave.counts_of_user(
        request.user, this_year)

    upcomingbday = UserProfile.upcoming_birthdays()
    upcomingholidays = Holiday.upcoming()
    reporting_managers = request.user.userprofile.get_all_managers

    return render(request, "index.html", locals())