def homew(request, id, p_id): if request.session.has_key('uid'): uid = request.session['uid'] if int(uid) == int(id): cdvor_w = models.Cdvorweekly.objects.all().filter(emp_id=id) cdvorw = cdvor_w.order_by('-p_id') cdvor_w = cdvor_w.filter(p_id=p_id) status = cdvor_w.values('status')[0]['status'] f = 0 if status == "COMPLETED WITH ERRORS" or status == "PENDING": f = 1 supdetails = models.Supervisor.objects.all().values( 'name', 'contact', 'email').filter(dept='N') cdvorwlogs = models.Cdvorwlogs.objects.all().filter( p_id=p_id).order_by('-log_id') if cdvor_w: return render( request, 'engineer/cdvor/cdvorweeklyrep.html', { 'cdvorwlogs': cdvorwlogs, 'supdetails': supdetails, 'cdvor_w': cdvor_w, 'id': id, 'cdvorw': cdvorw, 'f': f }) else: return routebackcdvord(request, id) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def cdvorw(request, id): if request.session.has_key('uid'): uid = request.session['uid'] if int(uid) == int(id): cdvor_w = models.Cdvorweekly.objects.all() cdvor_w = cdvor_w.values('p_id', 'date', 'time', 'status', 'ps_5v', 'ps_12v', 'ps_28v', 'outside_temp', 'sideband_frequency', 'remarks') cdvor_w = cdvor_w.filter(emp_id=id) cdvorw = cdvor_w.order_by('-p_id') cdvor_w = cdvor_w.filter(date=date.today()) supdetails = models.Supervisor.objects.all() supdetails = supdetails.values('name', 'contact', 'email').filter(dept='N') cdvorwlogs = models.Cdvorwlogs.objects.all() cdvorwlogs = cdvorwlogs.filter( date=date.today()).order_by('-log_id') if cdvor_w: return render( request, 'engineer/cdvor/cdvorweeklyrep.html', { 'cdvorwlogs': cdvorwlogs, 'supdetails': supdetails, 'cdvor_w': cdvor_w, 'id': id, 'cdvorw': cdvorw }) else: messages.add_message( request, 30, 'You cannot make changes to pending report!') return routebackcdvord(request, id) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def cdvormrep(request, id): cursor = connection.cursor() if request.session.has_key('uid'): temp = cursor.execute("select date from cdvormonthly where date = %s", [date.today()]) uid = request.session['uid'] if int(uid) == int(id) and temp == 0: cdvor_m = models.Cdvormonthly.objects.all() cdvor_m = cdvor_m.values( 'p_id', 'date', 'time', 'measured_bearing_1', 'bearing_deviation_1', 'measured_bearing_2', 'bearing_deviation_2', 'measured_bearing_3', 'bearing_deviation_3', 'measured_bearing_4', 'bearing_deviation_4', 'measured_bearing_5', 'bearing_deviation_5', 'error_spread', 'remarks') cdvor_m = cdvor_m.filter(emp_id=id).order_by('-p_id') supdetails = models.Supervisor.objects.all() supdetails = supdetails.values('name', 'contact', 'email').filter(dept='N') return render(request, 'engineer/cdvor/cdvormrepsub.html', { 'cdvor_m': cdvor_m, 'id': id, 'supdetails': supdetails }) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def cdvorm(request, id): if request.session.has_key('uid'): uid = request.session['uid'] if int(uid) == int(id): cdvor_m = models.Cdvormonthly.objects.all() cdvor_m = cdvor_m.values( 'p_id', 'date', 'time', 'status', 'measured_bearing_1', 'bearing_deviation_1', 'measured_bearing_2', 'bearing_deviation_2', 'measured_bearing_3', 'bearing_deviation_3', 'measured_bearing_4', 'bearing_deviation_4', 'measured_bearing_5', 'bearing_deviation_5', 'error_spread', 'remarks') cdvor_m = cdvor_m.filter(emp_id=id) cdvorm = cdvor_m.order_by('-p_id') cdvor_m = cdvor_m.filter(date=date.today()) supdetails = models.Supervisor.objects.all() supdetails = supdetails.values('name', 'contact', 'email').filter(dept='N') cdvormlogs = models.Cdvormlogs.objects.all() cdvormlogs = cdvormlogs.filter( date=date.today()).order_by('-log_id') if cdvor_m: return render( request, 'engineer/cdvor/cdvormonthlyrep.html', { 'cdvormlogs': cdvormlogs, 'supdetails': supdetails, 'cdvor_m': cdvor_m, 'id': id, 'cdvorm': cdvorm }) else: messages.add_message( request, 30, 'You cannot make changes to pending report!') return routebackcdvord(request, id) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def repsubwerrors(request, p_id, id): if request.session.has_key('uid'): uid = request.session['uid'] if int(uid) == int(id): cursor = connection.cursor() cdvorw = models.Cdvorweekly.objects.all() cdvorw = cdvorw.values('p_id', 'date', 'time', 'status', 'emp_id', 'ps_5v', 'ps_12v', 'ps_28v', 'outside_temp', 'sideband_frequency', 'remarks') cdvorw = cdvorw.filter(p_id=p_id) return render(request, 'engineer/cdvor/cdvorwfinalrep.html', { 'cdvorw': cdvorw, 'p_id': p_id, 'id': id }) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def cdvorweeklyrec(request, id): if request.session.has_key('uid'): uid = request.session['uid'] if int(uid) == int(id): cursor = connection.cursor() cdvor_w = models.Cdvorweekly.objects.all() cdvor_w = cdvor_w.values('p_id', 'date', 'time', 'status', 'ps_5v', 'ps_12v', 'ps_28v', 'outside_temp', 'sideband_frequency', 'unit_incharge_approval', 'approval_date', 'approval_time') cdvor_w = cdvor_w.filter(emp_id=id).order_by('-p_id') return render(request, 'engineer/cdvor/cdvorwrecords.html', { 'cdvor_w': cdvor_w, 'id': id }) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def cdvormonthlyrec(request, id): if request.session.has_key('uid'): uid = request.session['uid'] if int(uid) == int(id): cursor = connection.cursor() cdvor_m = models.Cdvormonthly.objects.all() cdvor_m = cdvor_m.values( 'p_id', 'date', 'time', 'status', 'measured_bearing_1', 'bearing_deviation_1', 'measured_bearing_2', 'bearing_deviation_2', 'measured_bearing_3', 'bearing_deviation_3', 'measured_bearing_4', 'bearing_deviation_4', 'measured_bearing_5', 'bearing_deviation_5', 'error_spread', 'unit_incharge_approval', 'approval_date', 'approval_time') cdvor_m = cdvor_m.filter(emp_id=id).order_by('-p_id') return render(request, 'engineer/cdvor/cdvormrecords.html', { 'cdvor_m': cdvor_m, 'id': id }) else: return routebackcdvord(request, id) else: return render(request, 'login/login.html')
def repsubmerrors(request, p_id, id): if request.session.has_key('uid'): uid = request.session['uid'] if int(uid) == int(id): cursor = connection.cursor() cdvorm = models.Cdvormonthly.objects.all() cdvorm = cdvorm.values('p_id', 'date', 'time', 'status', 'emp_id', 'measured_bearing_1', 'bearing_deviation_1', 'measured_bearing_2', 'bearing_deviation_2', 'measured_bearing_3', 'bearing_deviation_3', 'measured_bearing_4', 'bearing_deviation_4', 'measured_bearing_5', 'bearing_deviation_5', 'error_spread', 'remarks') cdvorm = cdvorm.filter(p_id=p_id) return render(request, 'engineer/cdvor/cdvormfinalrep.html', { 'cdvorm': cdvorm, 'p_id': p_id, 'id': id }) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def editcdvormonthly(request, p_id): if request.session.has_key('uid'): temp = models.Cdvormonthly.objects.all().values('status').order_by( '-date').filter(date=date.today())[0]['status'] uid = request.session['uid'] if temp == "PENDING" and 'uid' in request.session: cursor = connection.cursor() emp_id = int(request.session['uid']) cdvorm = models.Cdvormonthly.objects.all() cdvorm = cdvorm.values('p_id', 'date', 'time', 'status', 'emp_id', 'measured_bearing_1', 'bearing_deviation_1', 'measured_bearing_2', 'bearing_deviation_2', 'measured_bearing_3', 'bearing_deviation_3', 'measured_bearing_4', 'bearing_deviation_4', 'measured_bearing_5', 'bearing_deviation_5', 'error_spread', 'remarks') cdvor_m = cdvorm.filter(emp_id=emp_id).order_by('-p_id') cdvorm = cdvorm.filter(p_id=p_id) cdvor_id = cdvorm.values('p_id').filter(p_id=p_id)[0]['p_id'] supdetails = models.Supervisor.objects.all() supdetails = supdetails.values('name', 'contact', 'email').filter(dept='N') cdvormlogs = models.Cdvormlogs.objects.all() cdvormlogs = cdvormlogs.filter( date=date.today()).order_by('-log_id') return render( request, 'engineer/cdvor/editcdvormrepsub.html', { 'cdvormlogs': cdvormlogs, 'cdvorm': cdvorm, 'id': cdvor_id, 'cdvor_m': cdvor_m, 'supdetails': supdetails }) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def cdvorwrep(request, id): cursor = connection.cursor() if request.session.has_key('uid'): temp = cursor.execute("select date from cdvorweekly where date = %s", [date.today()]) uid = request.session['uid'] if int(uid) == int(id) and temp == 0: cdvor_w = models.Cdvorweekly.objects.all() cdvor_w = cdvor_w.values('p_id', 'date', 'time', 'ps_5v', 'ps_12v', 'ps_28v', 'outside_temp', 'sideband_frequency', 'remarks') cdvor_w = cdvor_w.filter(emp_id=id).order_by('-p_id') supdetails = models.Supervisor.objects.all() supdetails = supdetails.values('name', 'contact', 'email').filter(dept='N') return render(request, 'engineer/cdvor/cdvorwrepsub.html', { 'cdvor_w': cdvor_w, 'id': id, 'supdetails': supdetails }) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')
def editcdvorweekly(request, p_id): if request.session.has_key('uid'): temp = models.Cdvorweekly.objects.all().values('status').order_by( '-date').filter(date=date.today())[0]['status'] emp_id = models.Cdvorweekly.objects.all().values('emp_id').filter( p_id=p_id)[0]['emp_id'] uid = request.session['uid'] if int(uid) == int(emp_id) and temp == "PENDING": cursor = connection.cursor() emp_id = models.Cdvorweekly.objects.all() emp_id = emp_id.values('emp_id').filter(p_id=p_id)[0]['emp_id'] cdvorw = models.Cdvorweekly.objects.all() cdvorw = cdvorw.values('p_id', 'date', 'time', 'status', 'emp_id', 'ps_5v', 'ps_12v', 'ps_28v', 'outside_temp', 'sideband_frequency', 'remarks') cdvor_w = cdvorw.filter(emp_id=emp_id).order_by('-p_id') cdvorw = cdvorw.filter(p_id=p_id) cdvor_id = cdvorw.values('p_id').filter(p_id=p_id)[0]['p_id'] supdetails = models.Supervisor.objects.all() supdetails = supdetails.values('name', 'contact', 'email').filter(dept='N') cdvorwlogs = models.Cdvorwlogs.objects.all() cdvorwlogs = cdvorwlogs.filter( date=date.today()).order_by('-log_id') return render( request, 'engineer/cdvor/editcdvorwrepsub.html', { 'cdvorwlogs': cdvorwlogs, 'cdvorw': cdvorw, 'id': cdvor_id, 'cdvor_w': cdvor_w, 'supdetails': supdetails }) else: return routebackcdvord(request, uid) else: return render(request, 'login/login.html')