Esempio n. 1
0
def barcode_initial_10R(request):

  request.session["barcode_skid"] = 1
  request.session["barcode_part_number"] = '9341'

  request.session["route_1"] = 'barcode_input_10R'
  return direction(request)
Esempio n. 2
0
def barcode_input(request):
    db, cur = db_set(request)
    # the above call makes the below call unnecessary now.  
    #request.session["local_toggle"]="/trakberry"
  
    part = request.session["barcode_part"]
    # db, cur = db_set(request)
    sql = "SELECT * FROM barcode"
    cur.execute(sql)
    tmp2 = cur.fetchall()


    if request.POST:
        bc1 = request.POST.get("barcode")
        request.session["barcode"] = bc1
        request.session["barcode_part_number"] = bc1[-4:]
        request.session["barcode_part_short"] = bc1[-2:]
        request.session["route_1"] = 'barcode_check'
        return direction(request)
    else:
		form = kiosk_dispForm1()
    args = {}
    args.update(csrf(request))
    args['form'] = form
    return render(request,"kiosk/barcode_input.html",{'args':args})
Esempio n. 3
0
def barcode_verify(request):
    if request.POST:
        bc = request.POST.get("barcode")
        request.session["barcode"] = bc
        request.session["route_1"] = 'barcode_verify_check'
        return direction(request)
    else:
		form = kiosk_dispForm1()
    args = {}
    args.update(csrf(request))
    args['form'] = form
    return render(request,"kiosk/barcode_verify.html",{'args':args})
def barcode_count(request):
	if request.POST:
		count1 = request.POST.get("skid_count")
		request.session["barcode_part"] = count1
		request.session["route_1"] = 'barcode_input'
		return direction(request)
	else:
		form = kiosk_dispForm1()
	args = {}
	args.update(csrf(request))
	args['form'] = form
	return render(request,"kiosk/barcode_count.html",{'args':args})
def barcode_wrong_part2(request):
	a = 1
	db, cur = db_set(request)
	sql3 = '''SELECT * FROM barcode_alarms where alarm = "%d"'''%(a)
	cur.execute(sql3)
	tmp = cur.fetchall()
	db.close()
	try:
		tmp2 = tmp[0]
		return render(request,"barcode_warning_part.html")
	except:
		request.session["route_1"] = 'barcode_input'
		return direction(request)
Esempio n. 6
0
def barcode_reset(request):
  b = 0
  a = '0'
  db, cur = db_set(request)

  sql = "SELECT max(scrap) FROM barcode"
  cur.execute(sql)
  tmp2 = cur.fetchall()
  tmp3 = tmp2[0]
  max_stamp = tmp3[0]
  max_stamp = max_stamp + 1

  skid = 1
  cur.execute('''INSERT INTO barcode(asset_num,scrap,skid,part) VALUES(%s,%s,%s,%s)''', (a,max_stamp,skid,b))
  db.commit()
  request.session["barcode_part"] = 0
  request.session["route_1"] = 'barcode_input'
  return direction(request)
Esempio n. 7
0
def barcode_initial(request):
  db_set(request)
  db, cur = db_set(request)
  sql = "SELECT max(scrap) FROM barcode"
  cur.execute(sql)
  tmp2 = cur.fetchall()
  tmp3 = tmp2[0]
  max_stamp = tmp3[0]

  sql = "SELECT * from barcode where scrap = '%s'" %(tmp3[0])
  cur.execute(sql)
  tmp2 = cur.fetchall()
  request.session["barcode1"] = tmp2[0][2]
  skid = tmp2[0][3] 
  part = tmp2[0][4]
  request.session["barcode_skid"] = skid
  request.session["barcode_part"] = part 

  request.session["route_1"] = 'barcode_input'
  return direction(request)
Esempio n. 8
0
def barcode_input_10R(request):

    part = request.session["barcode_part"]
    pn = request.session["barcode_part_number"]

    if request.POST:
        bc1 = request.POST.get("barcode")
        request.session["barcode"] = bc1
        request.session["barcode_part_number"] = bc1[-4:]

        request.session["route_1"] = 'barcode_check_10R'
        return direction(request)
    else:
		form = kiosk_dispForm1()
    args = {}
    args.update(csrf(request))
    args['form'] = form
    if pn == 'GM 9341':
      return render(request,"kiosk/barcode_input_10R_GM.html",{'args':args})
    elif pn == 'FORD 9341':
      return render(request,"kiosk/barcode_input_10R_FORD.html",{'args':args})
    return render(request,"kiosk/barcode_input_10R.html",{'args':args})
Esempio n. 9
0
def mgmt_display(request):
	
	#request.session["mgmt_table_call"] = "SELECT id,asset_num,machine,partno,actual_produced,down_time,comments,pdate,shift,shift_hours_length,target FROM sc_production1"
	
	s2 = ""
	date_check = ['' for y in range(0)]
	ctr_var = 1
	request.session["date_check"] = 0
	for a in request.session["table_variables"]:

		if ctr_var == 1:
			id_name = a
		s2 = s2 + a + ','
		if a == 'pdate':
			date_check.append(1)
		else:
			date_check.append(0)
		ctr_var = ctr_var + 1
	request.session['ctr_var'] = ctr_var    #Assign the session variable to number of columns there are.  Use this on template to span
	request.session["date_check"] = date_check
	s2 = s2[:-1]
#	try:
	min_id = request.session["starting_id"]
	direction_id = int(request.session['direction_id'])
	cctr = int(request.session['ctr'])

#	except:
#		db, cur = db_set(request)
#		s3 = 'SELECT MAX('+id_name+') FROM '+request.session["mgmt_table_name"]
#		cur.execute(s3)
#		tmp3_1 = cur.fetchall()
#		tmp3_2=tmp3_1[0]
#		min_id = tmp3_2[0]
#		min_id = min_id + 1
#		db.close()
#		direction_id = 1
#	min_id = 456638
	x5 = '1507'
	x6 = x5
	x7 = x5
	x8 = x5
	x9 = x5
	x10 = x5
	x11 = x5
	xx5='i'
	zz = ['' for y in range(0)]
	z = ['' for y in range(0)]

	z.append(xx5)
	z.append(xx5)
	z.append(xx5)
	z.append(xx5)
	z.append(xx5)
	z.append(xx5)
	z.append(xx5)	
	zz.append(x5)
	zz.append(x6)
	zz.append(x7)
	zz.append(x8)
	zz.append(x9)
	zz.append(x10)
	zz.append(x11)

#	s2 = s2 + id_name + ') FROM '+ request.session["mgmt_table_name"] + " ORDER BY "+id_name+" DESC limit 20"
	# Template that will include filtering in every column
	if direction_id == 1:
		s1 = ("""SELECT xx1 FROM xx2 where xx3<%s ORDER BY xx4 DESC limit 20""")%(min_id)
		# s1 = ("""SELECT xx1 FROM xx2 where xx3<%s AND w10=%s OR w11=%s OR w12=%s OR w13=%s OR w14=%s OR w15=%s OR w16=%s ORDER BY xx4 DESC limit 20""")%(min_id,zz[0],zz[1],zz[2],zz[3],zz[4],zz[5],zz[6])
	else:
		# uu = request.session["eee"]
		s1 = ("""SELECT xx1 FROM xx2 where xx3>%s ORDER BY xx4 ASC limit 20""")%(min_id)
		# s1 = ("""SELECT xx1 FROM xx2 where xx3>%s AND w10=%s OR w11=%s OR w12=%s OR w13=%s OR w14=%s OR w15=%s OR w16=%s ORDER BY xx4 ASC limit 20""")%(min_id,zz[0],zz[1],zz[2],zz[3],zz[4],zz[5],zz[6])


	# This part is a test part
	# s1 = ("""SELECT xx1 FROM xx2 where xx3<%s xxy ORDER BY xx4 DESC limit 20""")%(min_id)
	

	index = s1.find('xx1')
	s1 = s1[:index] + s2 + s1[index+3:]
	index = s1.find('xx2')
	s1 = s1[:index] + request.session["mgmt_table_name"] + s1[index+3:]
	index = s1.find('xx3')
	s1 = s1[:index] + id_name + s1[index+3:]
	index = s1.find('xx4')
	s1 = s1[:index] + id_name + s1[index+3:]


# Uncomment below block to put filtering trial back in play
	# for a in range(1,8):
	# 	b = a + 9
	# 	a_var = 'w' + str(b)
	# 	index = s1.find(a_var)
	# 	s1 = s1[:index] + z[(a-1)] + s1[index+3:]




	# index = s1.find('z02')
	# s1 = s1[:index] + z[1] + s1[index+3:]
	# index = s1.find('z03')
	# s1 = s1[:index] + z[2] + s1[index+3:]


	# first test 
	# index = s1.find('xx5')
	# s1 = s1[:index-4] + s1[index+6:]
	# index = s1.find('xx5v')
	# s1 = s1[:index-1] + s1[index+4:]


	# jj = request.session["dlkjlk"]
#	Below Error check for end of or start of table.  Refresh to start if it is.
	# return render(request,'kiosk/kiosk_test2.html', {'tmp':s1})


	try:
		db, cur = db_set(request)
		cur.execute(s1)
		tmp = cur.fetchall()
		tmp1=tmp[0]
		db.close()
	except:
		request.session["route_1"] = request.session["mgmt_production_call"]
		return direction(request)


	cctr = int(request.session['ctr'])
	# return render(request,'kiosk/kiosk_test2.html', {'tmp':tmp})


	# set min_id to the last id on the page

	# this point needs to re establish the Min and Max id value for ones displayed
	#need to work on the below code

	if direction_id == 0:
		tmp = tmp[::-1]

	for b in tmp:
		tmp1=b[0]
		if tmp1>min_id:
			min_id = tmp1

	last_id = min_id
	for b in tmp:
		tmp1=b[0]
		if tmp1<last_id:
			last_id = tmp1

#	if cctr == 8:
	# jjj = request.session['biker']
	request.session['ending_id'] = last_id
	request.session['starting_id'] = min_id
	
	return render(request,'mgmt_display.html', {'tmp':tmp})
Esempio n. 10
0
def mgmt_display_insert(request,index):
	# request.session["table_headers"]  ==>  The name displayed on page 
	# request.session["table_variables"] ==> The name in the DB 
	p = ['' for y in range(0)]
	v = ['' for y in range(0)]
	datecheck = ['' for y in range(0)]
	a1 = ['' for y in range(0)]

	# call in to tmp the row to edit
	update_list = ''
	ctr = 0
	tmp_index = index
	db, cur = db_set(request) 
	sq1 = request.session["mgmt_table_call"] + "  where id = '%s'" %(tmp_index)
	cur.execute(sq1)
	tmp = cur.fetchall()
	tmp2 = tmp[0]

	ptr = 1
	for x in tmp2:
		if type(x) is dt.date:
			y = vacation_set_current6(x)
			datecheck.append(1)
			v.append(y)
		else:
			datecheck.append(0)
			v.append(x)
		p.append(ptr)
		ptr = ptr + 1
		

	tmp3 = zip(p,v,datecheck)
	
	if request.POST:
		try:
			kiosk_button1 = int(request.POST.get("kiosk_assign_button1"))
			if kiosk_button1 == -1:
				request.session["route_1"] = 'mgmt_production_hourly'
				return direction(request)
		except:
			dummy = 1
#		return render(request,'kiosk/kiosk_test2.html',{'tmp':ddd})
		for i in tmp3:
			pst = str(i[0])
			b1 = request.POST.get(pst)
			b1=str(b1)
			c1 = '"' + b1 + '"'
			a1.append(c1)
		# Brilliant recursive algorithm to update known table with known variables
		tb1 = request.session["mgmt_table_name"]
		i1 = index
		db, cur = db_set(request)       # Open DB
		for x in request.session["table_variables"]:  # column names
			#  x ==>  name of column
			#  a1[ctr] ==> value of column
			col1 = x
			v1 = a1[ctr]
			v2 = v[ctr]
			if ctr == 0 :
				id1 = x
			if ctr > 0:
				
				s1 = ("""SELECT xx1 FROM xx2 where xx3<%s ORDER BY xx4 DESC limit 20""")%(min_id)

				zql = ("""INSERT INTO xx1(xx2) VALUES(xx3)""",(xx4))
				
				cur.execute('''INSERT INTO tkb_kiosk(Clock,Job1,Job2,Job3,Job4,Job5,Job6,TimeStamp_In,TimeStamp_Out) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s)''', (kiosk_clock,kiosk_job1,kiosk_job2,kiosk_job3,kiosk_job4,kiosk_job5,kiosk_job6,TimeStamp,TimeOut))
				db.commit()
				db.close()

				zql = ("""update xx1 SET xx2=%s where xx3=%s"""%(v1,i1))
				index = zql.find('xx1')
				zql = zql[:index] + tb1 + zql[index+3:]
				index = zql.find('xx2')
				zql = zql[:index] + col1 + zql[index+3:]
				index = zql.find('xx3')
				zql = zql[:index] + id1 + zql[index+3:]
				cur.execute(zql)   # Execute SQL
				db.commit()
			ctr = ctr + 1
		db.close()
		return mgmt_display(request)
		request.session["route_1"] = request.session["mgmt_production_call"]
		return direction(request)

	else:
		form = kiosk_dispForm3()
	args = {}
	args.update(csrf(request))
	args['form'] = form  
	return render(request,'mgmt_display_edit.html', {'tmp':tmp3})	
Esempio n. 11
0
def barcode_check(request):
    bar1 = request.session["barcode"]
    bar1=str(bar1)
    stamp = time.time()
    part = request.session["barcode_part"]
    h = len(bar1)
    if len(bar1) >24:
      return render(request,"barcode_warning.html")
    if len(bar1) <22:
      if len(bar1) != 16:
        return render(request,"barcode_warning.html")
  

    db, cur = db_set(request)
    if len(bar1) == 16:
      request.session["barcode_part_number"] = '9341'
 #   try:
    
    bar2 = bar1[-4:]
    len_bar1 = len(bar1)
    bar3 = bar1[:(len_bar1 - 4)]
    

    # mql = "SELECT * FROM barcode WHERE asset_num = '%s'" %(bar1)
    mql = "SELECT * FROM barcode WHERE left(asset_num,length(asset_num)-4) = '%s'" %(bar3)
    cur.execute(mql)
    tmp2 = cur.fetchall()

    # kk = request.session["bbummy"]

    
    try:
     tmp3=tmp2[0]
     tmp4=tmp3[0]
     timestamp = tmp3[2]
     dd = vacation_1(stamp)
     d = vacation_1(timestamp)
     request.session["alert_time"] = d
     request.session["now_time"] = dd
     request.session["diff_time"] = int(stamp - timestamp)
     return render(request,"barcode_alert.html")

    except:
      dummy = 1

    part = part + 1
    skid = 1
    cur.execute('''INSERT INTO barcode(asset_num,scrap,skid,part) VALUES(%s,%s,%s,%s)''', (bar1,stamp,skid,part))
    db.commit()
    
    request.session["bar1"] = bar1
    
    request.session["barcode_part"] = part

    db.close()

    part_num = request.session["barcode_part_number"]
    part_short = request.session["barcode_part_short"]

    if part_short == "BB":
      part_num == "5214"
      request.session["barcode_part_number"] = "5214"
    if part_short == "CB":
      part_num == "3214"
      request.session["barcode_part_number"] = "3214"
    if part_num == "5214" and part == 280:
      return render(request,"barcode_complete.html")
    if part_num == "3214" and part == 280:
      return render(request,"barcode_complete.html")

    if part_num == "5401" and part == 144:
      return render(request,"barcode_complete.html")
    if part_num == "3214" and part == 280:
      return render(request,"barcode_complete.html")
    if part_num == "5214" and part == 280:
      return render(request,"barcode_complete.html")
    if part_num == "8670" and part == 40:
      return render(request,"barcode_complete.html")
    if part_num == "5404" and part == 120:
      return render(request,"barcode_complete.html")
    if part_num == "9341" and part == 112:
      
      return render(request,"barcode_complete.html")


    return render(request,"barcode_ok.html")
    
    request.session["route_1"] = 'barcode_input'
    return direction(request)

    
Esempio n. 12
0
def mgmt_display_edit(request, index):
    # request.session["table_headers"]  ==>  The name displayed on page
    # request.session["table_variables"] ==> The name in the DB
    p = ['' for y in range(0)]
    v = ['' for y in range(0)]
    datecheck = ['' for y in range(0)]
    a1 = ['' for y in range(0)]

    # call in to tmp the row to edit
    update_list = ''
    ctr = 0
    tmp_index = index
    db, cur = db_set(request)
    sq1 = request.session["mgmt_table_call"] + "  where id = '%s'" % (
        tmp_index)
    cur.execute(sq1)
    tmp = cur.fetchall()
    tmp2 = tmp[0]

    ptr = 1
    for x in tmp2:
        if type(x) is dt.date:  ## whats this loop doing
            y = vacation_set_current6(x)
            datecheck.append(1)
            v.append(y)
        else:
            datecheck.append(0)
            v.append(x)
        p.append(ptr)
        ptr = ptr + 1

    tmp3 = zip(p, v, datecheck)

    if request.POST:
        try:
            kiosk_button1 = int(
                request.POST.get("kiosk_assign_button1"))  ##why is kiosk back
            if kiosk_button1 == -1:
                request.session["route_1"] = 'mgmt_production_hourly'
                return direction(request)
        except:
            dummy = 1


#		return render(request,'kiosk/kiosk_test2.html',{'tmp':ddd})
        for i in tmp3:
            pst = str(i[0])
            b1 = request.POST.get(pst)
            b1 = str(b1)
            c1 = '"' + b1 + '"'
            a1.append(c1)
        # Brilliant recursive algorithm to update known table with known variables
        tb1 = request.session["mgmt_table_name"]
        i1 = index
        db, cur = db_set(request)  # Open DB
        for x in request.session["table_variables"]:  # column names
            #  x ==>  name of column
            #  a1[ctr] ==> value of column
            col1 = x
            v1 = a1[ctr]
            v2 = v[ctr]
            if ctr == 0:
                id1 = x
            if ctr > 0:
                zql = ("""update xx1 SET xx2=%s where xx3=%s""" % (v1, i1))
                index = zql.find('xx1')
                zql = zql[:index] + tb1 + zql[index + 3:]
                index = zql.find('xx2')
                zql = zql[:index] + col1 + zql[index + 3:]
                index = zql.find('xx3')
                zql = zql[:index] + id1 + zql[index + 3:]
                cur.execute(zql)  # Execute SQL
                db.commit()
            ctr = ctr + 1
        db.close()
        return mgmt_display(request)
        request.session["route_1"] = request.session["mgmt_production_call"]
        return direction(request)

    else:
        form = kiosk_dispForm3()
    args = {}
    args.update(csrf(request))
    args['form'] = form
    return render(request, 'mgmt_display_edit.html', {'tmp': tmp3})
def barcode_check(request):
		
		bar1 = request.session["barcode"]
		
		bar1=str(bar1)
		stamp = time.time()
		part = request.session["barcode_part"]
		part = int(part)
		current_part = request.session["current_part"]

		


		short1 = request.session["barcode_part_short"]
		if short1 == 'BB' or short1 == 'CB':
			try:
				last_short = request.session["last_part"]
			except:
				last_short = short1

			if short1 != last_short:
				request.session["route_1"] = 'barcode_wrong_part'
				return direction(request)
			
			request.session["last_part"] = short1
			ctr = request.session["barcode_part"]
			ctr = ctr + 1
			request.session["barcode_part"] = ctr
			if short1 == 'BB':
				request.session["barcode_part_number"] = '50-5214'
			else:
				request.session["barcode_part_number"] = '50-3214'
			return render(request,"barcode_ok.html")


		h = len(bar1)
		if len(bar1) >24:
			return render(request,"barcode_warning.html")
		if len(bar1) <22:
			if len(bar1) != 16:
				return render(request,"barcode_warning.html")

		# This section checks for the wrong part
		try:  # if last_part sv doesn't exist make it current_part
			last_part = request.session["last_part"]
		except:
			last_part = current_part
		if current_part != last_part :
			# Go to warning message saying this part is a different part
			request.session["route_1"] = 'barcode_wrong_part'
			return direction(request)


		db, cur = db_set(request)
		if len(bar1) == 16:
			request.session["barcode_part_number"] = '9341'
 #   try:
		
		bar2 = bar1[-4:]
		len_bar1 = len(bar1)
		bar3 = bar1[:(len_bar1 - 4)]
		

		# mql = "SELECT * FROM barcode WHERE asset_num = '%s'" %(bar1)
		mql = "SELECT * FROM barcode WHERE left(asset_num,length(asset_num)-4) = '%s'" %(bar3)
		cur.execute(mql)
		tmp2 = cur.fetchall()

		# kk = request.session["bbummy"]

		
		


		try:
			tmp3=tmp2[0]
			tmp4=tmp3[0]
			timestamp = tmp3[2]
			dd = vacation_1(stamp)
			d = vacation_1(timestamp)
			request.session["alert_time"] = d
			request.session["now_time"] = dd
			request.session["diff_time"] = int(stamp - timestamp)
			return render(request,"barcode_alert.html")

		except:
			dummy = 1


		part = part + 1
		skid = 1
		cur.execute('''INSERT INTO barcode(asset_num,scrap,skid,part) VALUES(%s,%s,%s,%s)''', (bar1,stamp,skid,part))
		db.commit()
		
		request.session["bar1"] = bar1
		request.session["last_part"] = request.session["current_part"]
		request.session["barcode_part"] = part

		db.close()

		part_num = request.session["barcode_part_number"]
		part_short = request.session["barcode_part_short"]

		if part_short == "BB":
			part_num == "5214"
			request.session["barcode_part_number"] = "5214"
		if part_short == "CB":
			part_num == "3214"
			request.session["barcode_part_number"] = "3214"
		if part_num == "5214" and part == 280:
			return render(request,"barcode_complete.html")
		if part_num == "3214" and part == 280:
			return render(request,"barcode_complete.html")

		if part_num == "5401" and part == 144:
			return render(request,"barcode_complete.html")
		if part_num == "3214" and part == 280:
			return render(request,"barcode_complete.html")
		if part_num == "5214" and part == 280:
			return render(request,"barcode_complete.html")
		if part_num == "8670" and part == 40:
			return render(request,"barcode_complete.html")
		if part_num == "5404" and part == 120:
			return render(request,"barcode_complete.html")
		if part_num == "9341" and part == 112:
			
			return render(request,"barcode_complete.html")


		return render(request,"barcode_ok.html")
		
		request.session["route_1"] = 'barcode_input'
		return direction(request)
Esempio n. 14
0
def mgmt_production_hourly_edit(request, index):
    tmp_index = index
    #request.session["index"] = index
    db, cur = db_set(request)
    try:
        sql = "SELECT * FROM sc_prod_hour where id = '%s'" % (tmp_index)
        cur.execute(sql)
        tmp = cur.fetchall()
        tmp2 = tmp[0]
    except:
        tmp = "No"

# ***********************************************************************************************************************************
    request.session["mgmt_hourly_cell"] = tmp2[1]
    request.session["mgmt_hourly_initials"] = tmp2[2]
    request.session["mgmt_hourly_shift"] = tmp2[5]
    ddate = tmp2[4]
    ddd = vacation_set_current6(ddate)
    request.session["mgmt_hourly_date"] = vacation_set_current6(ddate)
    request.session["mgmt_hourly_hour"] = tmp2[6]
    request.session["mgmt_hourly_actual"] = tmp2[8]
    request.session["mgmt_hourly_dtcode"] = tmp2[11]
    request.session["mgmt_hourly_dtmins"] = tmp2[12]
    request.session["mgmt_hourly_dtreason"] = " "
    request.session["mgmt_hourly_dtreason"] = tmp2[13]

    try:
        if len(request.session["mgmt_hourly_dtreason"]) < 2:
            request.session["mgmt_hourly_dtreason"] = "-"
    except:
        request.session["mgmt_hourly_dtreason"] = "-"

    if request.POST:
        try:
            kiosk_button1 = int(request.POST.get("kiosk_assign_button1"))
            if kiosk_button1 == -1:
                request.session["route_1"] = 'mgmt_production_hourly'
                return direction(request)
        except:
            dummy = 1

#		return render(request,'kiosk/kiosk_test2.html',{'tmp':ddd})
        mgmt_hourly_date = request.POST.get("mgmt_hourly_date")
        mgmt_hourly_cell = request.POST.get("mgmt_hourly_cell")
        mgmt_hourly_initials = request.POST.get("mgmt_hourly_initials")
        mgmt_hourly_shift = request.POST.get("mgmt_hourly_shift")
        mgmt_hourly_hour = request.POST.get("mgmt_hourly_hour")
        mgmt_hourly_actual = request.POST.get("mgmt_hourly_actual")
        mgmt_hourly_dtcode = request.POST.get("mgmt_hourly_dtcode")
        mgmt_hourly_dtmins = request.POST.get("mgmt_hourly_dtmins")
        mgmt_hourly_dtreason = request.POST.get("mgmt_hourly_reason")

        try:
            cql = (
                'update sc_prod_hour SET p_cell = "%s",initial="%s",hourly_actual="%s", p_date="%s", p_shift="%s" WHERE id ="%s"'
                % (mgmt_hourly_cell, mgmt_hourly_initials, mgmt_hourly_actual,
                   mgmt_hourly_date, mgmt_hourly_shift, tmp_index))
            cur.execute(cql)
            db.commit()
        except:
            dummy = 1

        db.close()
        request.session["route_1"] = 'mgmt_production_hourly'
        return direction(request)
        #return render(request,'kiosk/kiosk_test2.html',{'tmp':tmp2})

    else:
        form = kiosk_dispForm3()
    args = {}
    args.update(csrf(request))
    args['form'] = form

    #	db, cur = db_set(request)
    #	s1 = "SELECT MAX(id)  FROM sc_prod_hour WHERE p_cell = '%s'" %(p_cell)
    #	cur.execute(s1)
    #	tmp = cur.fetchall()
    #	tmp2 = tmp[0]
    #	tmp3 = tmp2[0]

    return render(request, "production/mgmt_production_hourly_edit.html", {
        'args': args,
        'tmp': tmp2,
        'ddate': ddd
    })