def emp_gross_sal(empcode, month, year): pay_period = get_pay_period(month, year) prod = Connection.get_connection() cursor = Connection.get_cursor() cursor.execute(query.GROSS_SALRY,(empcode, pay_period)) #9||01/04/2017||30/04/2017||0 resultset = cursor.fetchall() return resultset
def get_distinct_emp(month, year): pay_period = get_pay_period(month, year) prod = Connection.get_connection() cursor = Connection.get_cursor() cursor.execute(query.DISTINCT_EMP,(pay_period,)) resultset = cursor.fetchall() return resultset
def get_employee_pro_sal(emp_code, year, month): pay_period = get_pay_period(month, year) connection = Connection.get_connection() cursor = Connection.get_cursor() cursor.execute(query.EMP_SAL, (emp_code, pay_period)) #9||01/04/2017||30/04/2017||0 resultset = cursor.fetchall() return resultset
def update_database(amount, empcode, policy): connection = Connection.get_connection() cursor = Connection.get_cursor() cursor.execute(query.UPDATE_LIC, (float(amount), empcode, policy)) connection.commit()
__author__ = 'gaa8664' from salary.connection import Connection from salary import query # create static object for connection and cursor. Connection.get_connection() cursor = Connection.get_cursor() # fetch data that needs to be updated def get_resultset(): cursor.execute(query.GET_EMPLOYEE_TEMPLATE, ('2017-11-01', '2017-11-30')) resultset = cursor.fetchall() return resultset # display the fetched data def show_data(resultset): #resultset = get_resultset() for row in resultset: print(row) print('{}->{}'.format(row[0], row[3])) # update the template information def update_template(resultset: ''): con = Connection.get_connection() cursor.executemany(query.UPDATE_TEMPLATE_INC, resultset) con.commit()