def priv_menu():

while True:
	os.system('clear')
	mode=utilities.getInt('MENU\n\nSelect your choice:\n1.Administrative Stuff\n2.POS\n3.System Configuration\n\n0.Exit\n\nChoice:',0,3)
	if(mode==0):
		exit()
	elif(mode==1):
		administrative_menu()
	elif(mode==2):
		pos_menu()		
	elif(mode==3):
		sys_config_menu()
	os.system('clear')

def administrative_menu():

while True:
	os.system('clear')
	mode=utilities.getInt('MENU\n\nSelect your choice:\n1.Inventory\n2.Abrir Caja\n\n0.Exit\n\nChoice:',0,1)
	if mode==0:
		return
	elif mode==1:
		admin.inventory()
	elif mode==2:
		admin.box()
	os.system('clear')
	

def pos_menu():

while True:
	os.system('clear')	
	pos.show_open_accounts()
	mode=utilities.getInt('MENU\n\nSelect your choice:\n1.New account\n2.Quick sale\n3.Add products to account\n4.Print & checkout\n5.Only print account\n6.Others\n\n0.Exit\n\nChoice:',0,6)
	if mode==0:
		return
	elif mode==1:	
		pos.new_account(str((datetime.datetime.now()).strftime("%Y-%m-%d %H:%M")))
	elif mode==2: 
		pos.quick_sale()
	elif mode==3:
		pos.add_products(str(raw_input('Enter account name:')))
	elif mode==4:
		pos.checkout_account(str(raw_input('Client:')))
	elif mode==5:
		pos.print_account(str(raw_input('Client:')))
	elif mode==6:
			pos.others_menu()
	os.system('clear')
		

def sys_config_menu():

while True:
	os.system('clear')
	mode=utilities.getInt('SYSTEM CONFIGURATION\n\nSelect your choice:\n1.User Accounts\n2.Mail List\n3.Product List\n\n0.Back\nChoice:',0,4)
	if(mode==0):
		os.system('clear')
		return
	elif(mode==1):
		system_config.user_accounts_menu()
	elif(mode==2): 
		system_config.mail_list_menu()
	elif(mode==3): 
		system_config.product_list_menu()
	elif (mode==4):
		system_config.check_existence()
	os.system('clear')

def main():

#priv=utilities.login()
priv=1
while True:
	if priv==1:
		priv_menu()	
	elif priv==0:
		pos_menu()
return 0

if name == 'main':

main()