def CashAdvance(request,id): data = Department.objects.prefetch_related('Id_Number').get(Id_Number= id) employeeID = Employee.objects.get(Id_Number = id) dateApprove = None if(request.method == "POST"): form = Form(Id_Number = employeeID, Type = 'Cash Advance' , Date_Requested = datetime.today(),Date_Approved = dateApprove ,Status = 'Pending') form.save() print(form.pk) formPK = Form.objects.get(Form_ID = form.pk) cash_advance = Cash_Advance(Id_Number = employeeID, Cash_Amount = request.POST["Amount"], Reason = request.POST["Reason"], FormID = formPK) cash_advance.save() if (data.Status_Dept == "Faculty"): memo_cash_advance = Memo_Routing(Id_Number = employeeID, Type_Request = 'Cash Advance', Date_Faculty_Submitted = datetime.today(), FormID = formPK, Status = 'Pending') if (data.Status_Dept == "Chairman"): memo_cash_advance = Memo_Routing(Id_Number = employeeID, Type_Request = 'Cash Advance', Date_Faculty_Submitted = datetime.today(), FormID = formPK, Status = 'Pending',Date_Chairman_Approved=datetime.today()) if (data.Status_Dept == "Dean"): memo_cash_advance = Memo_Routing(Id_Number = employeeID, Type_Request = 'Cash Advance', Date_Faculty_Submitted = datetime.today(), FormID = formPK, Status = 'Pending',Date_Chairman_Approved=datetime.today(),Date_Dean_Approved=datetime.today()) memo_cash_advance.save() history = TransacHistory(Id_Number = employeeID, Transac_Type = 'Cash Advance', Type='Submitted', Date = datetime.today()) history.save() historyback = TransacHistoryBackUp(Id_Number = employeeID, Transac_Type = 'Cash Advance', Type='Submitted', Date = datetime.today()) historyback.save() return redirect("transachis", id = data.Id_Number.Id_Number) else: return render(request,"Cash Advance.html", {'data' : data})
def FileLeave(request,id): data = Department.objects.prefetch_related('Id_Number').get(Id_Number= id) employeeID = Employee.objects.get(Id_Number = id) dateApprove = None if request.method == 'POST': form = Form(Id_Number = employeeID, Type = 'File Leave' , Date_Requested = datetime.today(),Date_Approved = dateApprove ,Status = 'Pending') form.save() formPK = Form.objects.get(Form_ID = form.pk) tempStatus = request.POST.get('status') tempLeave = request.POST.get('typeofLeave') upload_file = request.FILES['document'] fileleave = Leave(Id_Number = employeeID, Employee_Status = tempStatus ,Typeof_Leave = tempLeave , Date_Start = request.POST["Date_Start"],Date_End = request.POST["Date_End"],Period_Days ='3',Reason = request.POST["Reasons"],Image = upload_file, FormID = formPK) fileleave.save() if (data.Status_Dept == "Faculty"): memo_fileleave = Memo_Routing(Id_Number = employeeID, Type_Request = 'File Leave', Date_Faculty_Submitted = datetime.today(), FormID = formPK, Status = 'Pending') if (data.Status_Dept == "Chairman"): memo_fileleave = Memo_Routing(Id_Number = employeeID, Type_Request = 'File Leave', Date_Faculty_Submitted = datetime.today(), FormID = formPK, Status = 'Pending',Date_Chairman_Approved=datetime.today()) if (data.Status_Dept == "Dean"): memo_fileleave = Memo_Routing(Id_Number = employeeID, Type_Request = 'File Leave', Date_Faculty_Submitted = datetime.today(), FormID = formPK, Status = 'Pending',Date_Chairman_Approved=datetime.today(),Date_Dean_Approved=datetime.today()) memo_fileleave.save() history = TransacHistory(Id_Number = employeeID, Transac_Type = 'File Leave', Type='Submitted', Date = datetime.today()) history.save() historyback = TransacHistoryBackUp(Id_Number = employeeID, Transac_Type = 'File Leave', Type='Submitted', Date = datetime.today()) historyback.save() return redirect("transachis", id = data.Id_Number.Id_Number) else: return render(request,"File a Leave.html", {'data' : data})
def RoomTransferTemporary(request, id): data = Department.objects.prefetch_related('Id_Number').get(Id_Number=id) employeeID = Employee.objects.get(Id_Number=id) if request.method == "POST": form = Form(Id_Number=employeeID, Type='RoomTransfer(Temporary)', Date_Requested=datetime.today(), Date_Approved=None, Status='Pending') form.save() formPK = Form.objects.get(Form_ID=form.pk) roomTransfer = Room_Transfer( Id_Number=employeeID, Type='RoomTransfer(Temporary)', Date_Notify=datetime.today(), Subject=request.POST["Subject"], Offer_Code=request.POST["Offer_Code"], Time_Day=request.POST["Time_Day"], Room_From=request.POST["Room_From"], Room_To=request.POST["Room_To"], Date_Effective=request.POST["Date_Effective"], Reason=request.POST["Reason"], FormID=formPK) roomTransfer.save() if (data.Status_Dept == "Faculty"): memo_roomTransfer = Memo_Routing( Id_Number=employeeID, Type_Request='RoomTransfer(Temporary)', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending') if (data.Status_Dept == "Chairman"): memo_roomTransfer = Memo_Routing( Id_Number=employeeID, Type_Request='RoomTransfer(Temporary)', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending', Date_Chairman_Approved=datetime.today()) if (data.Status_Dept == "Dean"): memo_roomTransfer = Memo_Routing( Id_Number=employeeID, Type_Request='RoomTransfer(Temporary)', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending', Date_Chairman_Approved=datetime.today(), Date_Dean_Approved=datetime.today()) memo_roomTransfer.save() history = TransacHistory(Id_Number=employeeID, Transac_Type='RoomTransfer(Temporary)', Type='Submitted', Date=datetime.today()) history.save() historyback = TransacHistoryBackUp( Id_Number=employeeID, Transac_Type='RoomTransfer(Temporary)', Type='Submitted', Date=datetime.today()) historyback.save() return redirect("transachis", id=data.Id_Number.Id_Number) else: return render(request, "Room Transfer - Temporary.html", {'data': data})
def MakeupClass(request, id): data = Department.objects.prefetch_related('Id_Number').get(Id_Number=id) employeeID = Employee.objects.get(Id_Number=id) dateApprove = None if request.method == 'POST': form = Form(Id_Number=employeeID, Type='Make-up Class', Date_Requested=datetime.today(), Date_Approved=dateApprove, Status='Pending') form.save() formPK = Form.objects.get(Form_ID=form.pk) if (request.POST.get('options') == "others"): makeupclass = Makeup_Class(Id_Number=employeeID, College=request.POST["college"], Reason=request.POST["Reason"], OfferCode=request.POST["offercode"], Date=datetime.today(), Time=request.POST["time"], Room=request.POST["room"], Date_Of=request.POST["dateOf"], FormID=formPK) makeupclass.save() if (data.Status_Dept == "Faculty"): memo_makeupclass = Memo_Routing( Id_Number=employeeID, Type_Request='Make-up Class', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending') if (data.Status_Dept == "Chairman"): memo_makeupclass = Memo_Routing( Id_Number=employeeID, Type_Request='Make-up Class', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending', Date_Chairman_Approved=datetime.today()) if (data.Status_Dept == "Dean"): memo_makeupclass = Memo_Routing( Id_Number=employeeID, Type_Request='Make-up Class', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending', Date_Chairman_Approved=datetime.today(), Date_Dean_Approved=datetime.today()) memo_makeupclass.save() history = TransacHistory(Id_Number=employeeID, Transac_Type='Make-up Class', Type='Submitted', Date=datetime.today()) history.save() historyback = TransacHistoryBackUp(Id_Number=employeeID, Transac_Type='Make-up Class', Type='Submitted', Date=datetime.today()) historyback.save() return redirect("transachis", id=data.Id_Number.Id_Number) else: makeupclass = Makeup_Class(Id_Number=employeeID, College=request.POST["college"], Reason=request.POST.get('options'), OfferCode=request.POST["offercode"], Date=datetime.today(), Time=request.POST["time"], Room=request.POST["room"], Date_Of=request.POST["dateOf"], FormID=formPK) makeupclass.save() if (data.Status_Dept == "Faculty"): memo_makeupclass = Memo_Routing( Id_Number=employeeID, Type_Request='Make-up Class', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending') if (data.Status_Dept == "Chairman"): memo_makeupclass = Memo_Routing( Id_Number=employeeID, Type_Request='Make-up Class', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending', Date_Chairman_Approved=datetime.today()) if (data.Status_Dept == "Dean"): memo_makeupclass = Memo_Routing( Id_Number=employeeID, Type_Request='Make-up Class', Date_Faculty_Submitted=datetime.today(), FormID=formPK, Status='Pending', Date_Chairman_Approved=datetime.today(), Date_Dean_Approved=datetime.today()) memo_makeupclass.save() history = TransacHistory(Id_Number=employeeID, Transac_Type='Make-up Class', Type='Submitted', Date=datetime.today()) history.save() historyback = TransacHistoryBackUp(Id_Number=employeeID, Transac_Type='Make-up Class', Type='Submitted', Date=datetime.today()) historyback.save() return redirect("transachis", id=data.Id_Number.Id_Number) else: return render(request, "makeup-class.html", {'data': data})