Example #1
0
def get_salary_report():
    sql = '''SELECT
	UID,UName,DName,Salary,Award,Salary+Award as Total FROM view_get_salary_report;'''
    data = db.query(sql)
    dict = ('UID', 'UName', 'DName', 'Salary', 'Award', 'Total')
    res = tupletojson(data, dict)
    return jsonify(res)
Example #2
0
def get_attendance_info():
    sql = '''select UID, DATE_FORMAT(ADate, '%Y-%m-%d') as ADate ,TIME_FORMAT(ATime,'%T') as ATime,TIME_FORMAT(STime,'%T') as STime from attendance_info'''
    sql_user = '''select UID,  DATE_FORMAT(ADate, '%%Y-%%m-%%d') as ADate ,TIME_FORMAT(ATime,'%%T') as ATime,TIME_FORMAT(STime,'%%T') as STime from attendance_info where UID = %s'''
    if (session['authority'] == 1):
        data = db.query(sql_user, session['uid'])
    else:
        data = db.query(sql)
    dict = ('UID', 'ADate', 'ATime', 'STime')
    res = tupletojson(data, dict)
    return jsonify(res)
Example #3
0
def get_salary_info():
    sql = '''select UID, DATE_FORMAT(`Month`,'%Y-%m')`Month`, Base_salary,attendance_times,attendance_rate ,Bonus, Total_salary from salary_info'''
    sql_user = '''select UID, DATE_FORMAT(`Month`,'%%Y-%%m')`Month`, Base_salary,attendance_times,attendance_rate ,Bonus, Total_salary from salary_info where UID = %s'''
    if (session['authority'] == 1):
        data = db.query(sql_user, session['uid'])
    else:
        data = db.query(sql)
    dict = ('UID', 'Month', 'Base_salary', 'attendance_times',
            'attendance_rate', 'Bonus', 'Total_salary')
    res = tupletojson(data, dict)
    return jsonify(res)
Example #4
0
def get_bonus_info():
    db = method.db_utils.DataBaseHandle('127.0.0.1', 'root', '3323150', 'test',
                                        3306)
    sql = '''select UID, DATE_FORMAT(BDate, '%Y-%m-%d') as BDate, BType,BDays,Bonus from bonus_info'''
    sql_user = '''select UID, DATE_FORMAT(BDate, '%%Y-%%m-%%d') as BDate, BType,BDays,Bonus from bonus_info where UID = %s'''
    if (session['authority'] == 1):
        data = db.query(sql_user, session['uid'])
    else:
        data = db.query(sql)
    dict = ('UID', 'BDate', 'BType', 'BDays', 'Bonus')
    res = tupletojson(data, dict)
    return jsonify(res)
Example #5
0
def get_employee_info():
    sql = '''SELECT * from view_get_employee_info'''

    sql_user = '''SELECT * from view_get_employee_info where UID = %s'''

    if (session['authority'] == 1):
        data = db.query(sql_user, session['uid'])
    else:
        data = db.query(sql)
    dict = ('UID', 'UName', 'Age', 'Sex', 'DName', 'KName', 'Level',
            'Base_salary', 'KID', 'DID')
    res = tupletojson(data, dict)
    return jsonify(res)
Example #6
0
def get_kind_info():
    sql = '''select * from kind_info'''
    data = db.query(sql)
    dict = ('KID', 'KName', 'Level', 'Base_salary')
    res = tupletojson(data, dict)
    return jsonify(res)
Example #7
0
def get_department_info():
    sql = '''select * from department_info'''
    data = db.query(sql)
    dict = ('DID', 'DName', 'DRef', 'DNum')
    res = tupletojson(data, dict)
    return jsonify(res)
Example #8
0
def get_log_info():
    sql = '''select * from log_info'''
    data = db.query(sql)
    dict = ('UID', 'Password', 'Authority')
    res = tupletojson(data, dict)
    return jsonify(res)