'''
	'billing.py'
	Author/CopyRight: <NAME>
	Last Edit Date: 04-27-2021--20:39:52


UPDATE Bills
SET 
billing_rate=
	(SELECT remaining from Bills WHERE date='2021-04-22' AND "hour"='20:00:00')
	+((SELECT total from Bills WHERE date='2021-04-22' AND "hour"='21:00:00')
	-(SELECT total from Bills WHERE date='2021-04-22' AND "hour"='20:00:00'))
	-(SELECT remaining from Bills WHERE date='2021-04-22' AND "hour"='21:00:00')
WHERE date='2021-04-22' AND "hour"='20:00:00';


'''

# Packages
# Non-Default Packages
import sqlite3

def date_validation(date):
	return 0

def time_validation(time):
	return 0

def count_validation(count):
	if count >= 0:
		return 0
	else 
		return 1

def set_releasetime(db_connection, date, time):
	if (date_validation(date) == 1 and time_validation(time) == 1):
		# set date and time
	else
		return print("Error")
	return 0

def set_absent(db_connection, date, count):
	return 0

def set_billcount(db_connection, date, time, count):
	return 0

def get_releasetime(db_connection, date, time):
	return 0

def get_absent(db_connection, date, count):
	return 0

def get_billcount(db_connection, date, time, count):
	return 0

def get_allreleasetime(db_connection):
	cur = db_connection.cursor()
	cur.execute("SELECT * FROM ReleaseTime")
	rows = cur.fetchall()
	return rows

def get_allabsent(db_connection):
	return 0

def get_allbillcount(db_connection):
	return 0

'''
	End 'billing.py'
'''
'''
	'billing.py'
	Author/CopyRight: <NAME>
	Last Edit Date: 04-27-2021--20:39:52


UPDATE Bills
SET 
billing_rate=
	(SELECT remaining from Bills WHERE date='2021-04-22' AND "hour"='20:00:00')
	+((SELECT total from Bills WHERE date='2021-04-22' AND "hour"='21:00:00')
	-(SELECT total from Bills WHERE date='2021-04-22' AND "hour"='20:00:00'))
	-(SELECT remaining from Bills WHERE date='2021-04-22' AND "hour"='21:00:00')
WHERE date='2021-04-22' AND "hour"='20:00:00';


'''

# Packages
# Non-Default Packages
import sqlite3

def date_validation(date):
	return 0

def time_validation(time):
	return 0

def count_validation(count):
	if count >= 0:
		return 0
	else 
		return 1

def set_releasetime(db_connection, date, time):
	if (date_validation(date) == 1 and time_validation(time) == 1):
		# set date and time
	else
		return print("Error")
	return 0

def set_absent(db_connection, date, count):
	return 0

def set_billcount(db_connection, date, time, count):
	return 0

def get_releasetime(db_connection, date, time):
	return 0

def get_absent(db_connection, date, count):
	return 0

def get_billcount(db_connection, date, time, count):
	return 0

def get_allreleasetime(db_connection):
	cur = db_connection.cursor()
	cur.execute("SELECT * FROM ReleaseTime")
	rows = cur.fetchall()
	return rows

def get_allabsent(db_connection):
	return 0

def get_allbillcount(db_connection):
	return 0

'''
	End 'billing.py'
'''
'billing.py' 	Author/CopyRight: <NAME> 	Last Edit Date: 04-27-2021--20:39:52   UPDATE Bills SET  billing_rate= 	(SELECT remaining from Bills WHERE date='2021-04-22' AND "hour"='20:00:00') 	+((SELECT total from Bills WHERE date='2021-04-22' AND "hour"='21:00:00') 	-(SELECT total from Bills WHERE date='2021-04-22' AND "hour"='20:00:00')) 	-(SELECT remaining from Bills WHERE date='2021-04-22' AND "hour"='21:00:00') WHERE date='2021-04-22' AND "hour"='20:00:00'; # Packages # Non-Default Packages # set date and time End 'billing.py'