Exemple #1
0
def emp_info_enter_manual(request):

    try:
        request.session["employee"]
        request.session["clock"]
        request.session["shift"]
        request.session["position"]

    except:
        request.session["employee"] = ""
        request.session["clock"] = 0
        request.session["shift"] = ""
        request.session["position"] = ""

    if request.POST:

        request.session["employee"] = request.POST.get("employee")
        request.session["clock"] = request.POST.get("clock")
        request.session["shift"] = request.POST.get("shift")
        request.session["position"] = request.POST.get("position")
        #return render(request,"test99_1.html",{'test':tmp2})
        return emp_info_update_batch(request)

    else:
        form = emp_info_form()
    args = {}
    args.update(csrf(request))
    args['form'] = form
    #return render(request,'emp_info_enter_form.html',{'args':args})

    #rlist = emp_list_display()
    #request.session["login_tech"] = "none"
    return render(request, 'emp_info_enter_form.html', {'args': args})
def emp_info_update_status(request,index):
	info_index = index
	request.session["index"] = index
	db, cur = db_set(request)
	sql = "SELECT Employee FROM tkb_employee_matrix WHERE Id ='%s'" %(info_index)
	cur.execute(sql)
	tmp = cur.fetchall()
	tmp2 = tmp[0]
	emp = tmp2[0]
	
	aql = "SELECT * FROM tkb_employee WHERE Employee ='%s'" %(emp)
	cur.execute(aql)
	ump = cur.fetchall()
	ump2 = ump[0]
	
	request.session["employee_old"] = emp

	if request.POST:

		request.session["employee"] = request.POST.get("employee")
		request.session["clock"] = request.POST.get("clock")
		request.session["shift"] = request.POST.get("shift")
		request.session["position"] = request.POST.get("position")
	
		return emp_info_update_change(request)
		
	else:
		form = emp_info_form()
	args = {}
	args.update(csrf(request))
	args['form'] = form
	return render(request,'emp_info_update_form.html',{'ump2':ump2,'args':args})