Example #1
0
def grxc(page):
    role = SC_UserRole.query.filter_by(user_id=current_user.id).first().role
    level = role.role_level #取得用户权限等级
    payment = Payment()
    if level==2 or level==3:
        data = payment.getPaymentByPerson(page,request,current_user.id)
        return render_template("Performance/jxxc/grxc.html",data=data,beg_time = request.form['beg_time'],
            end_time = request.form['end_time'])
    else:
        data = payment.getPaymentByQuery(page,request)
        return render_template("Performance/jxxc/xccx.html",data=data,beg_time = request.form['beg_time'],
            end_time = request.form['end_time'],user_id = request.form['user_id'])
Example #2
0
File: load.py Project: JohnCny/xhsc
	def paymentMonth(self):
		#获取所有人员名单
		sql="select a.id,b.role_level from sc_user a,sc_role b,sc_userrole c where a.id=c.user_id and c.role_id=b.id"
		data = db.session.execute(sql).fetchall()
		pay = Payment()
		#上月
		lst_fist = datetime.date(datetime.datetime.now().year,datetime.datetime.now().month-1,1)
		#客户经理工资计算
		for obj in data:
			if obj.role_level==2:
				pay.payroll(obj.id,lst_fist,80)
		#后台岗工资计算
		for obj in data:
			if obj.role_level==3:
				pay.backPayment(obj.id,lst_fist,80)
Example #3
0
def htgKPI(id):
    if request.method == 'GET':
        kpi_yunying = SC_Kpi_Yunying.query.filter_by(id=id).first()
        return render_template("Performance/ygpgkh/htgKPI.html",kpi_yunying=kpi_yunying)
    else:
        try:
            kpi_yunying = SC_Kpi_Yunying.query.filter_by(id=id).first()
            kpi_yunying.bm_dkye = request.form['bm_dkye']
            kpi_yunying.bm_ghs = request.form['bm_ghs']
            kpi_yunying.bm_lrgxd = request.form['bm_lrgxd']
            kpi_yunying.gz_sjlr = request.form['gz_sjlr']
            kpi_yunying.gz_ywtj = request.form['gz_ywtj']
            kpi_yunying.gz_ht = request.form['gz_ht']
            kpi_yunying.gz_fk = request.form['gz_fk']
            kpi_yunying.gz_dagl = request.form['gz_dagl']
            kpi_yunying.gz_khgx = request.form['gz_khgx']
            kpi_yunying.gz_alzl = request.form['gz_alzl']
            kpi_yunying.gz_fxkz = request.form['gz_fxkz']
            kpi_yunying.gz_rcxw = request.form['gz_rcxw']
            kpi_yunying.gz_yql = request.form['gz_yql']
            kpi_yunying.total = request.form['total']
            kpi_yunying.result = request.form['result']
            kpi_yunying.qtpj = request.form['qtpj']
            kpi_yunying.manager = current_user.id
            kpi_yunying.date_2 = datetime.datetime.now()

            #调用贺珈的函数
            pay = Payment()
            pay.backPayment(kpi_yunying.user_id,kpi_yunying.assess_date,kpi_yunying.total)
            
            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')

        return redirect('Performance/ygpgkh/zgpg_search')
Example #4
0
def khjlKPI(id):
    if request.method == 'GET':
        kpi_officer = SC_Kpi_Officer.query.filter_by(id=id).first()
        return render_template("Performance/ygpgkh/khjlKPI.html",kpi_officer=kpi_officer)
    else:
        kpi_officer = SC_Kpi_Officer.query.filter_by(id=id).first()
        try:
            kpi_officer.bq_dkye = request.form['bq_dkye']
            kpi_officer.bq_ghs = request.form['bq_ghs']
            kpi_officer.bq_khs = request.form['bq_khs']
            kpi_officer.bq_lxsr = request.form['bq_lxsr']
            kpi_officer.bq_zsbs = request.form['bq_zsbs']
            kpi_officer.bm_dkye = request.form['bm_dkye']
            kpi_officer.bm_ghs = request.form['bm_ghs']
            kpi_officer.bm_lrgxd = request.form['bm_lrgxd']
            kpi_officer.gr_dkye = request.form['gr_dkye']
            kpi_officer.gr_ghs = request.form['gr_ghs']
            kpi_officer.gr_xzkhs = request.form['gr_xzkhs']
            kpi_officer.gr_zsbs = request.form['gr_zsbs']
            kpi_officer.gr_lrgxd = request.form['gr_lrgxd']
            kpi_officer.rcxwpg = request.form['rcxwpg']
            kpi_officer.yql = request.form['yql']
            kpi_officer.total = request.form['total']
            kpi_officer.result = request.form['result']
            kpi_officer.qtpj = request.form['qtpj']
            kpi_officer.xq_dkye = request.form['xq_dkye']
            kpi_officer.xq_ghs = request.form['xq_ghs']
            kpi_officer.xq_xzkhs = request.form['xq_xzkhs']
            kpi_officer.xq_lxsr = request.form['xq_lxsr']
            kpi_officer.xq_zsbs = request.form['xq_zsbs']
            kpi_officer.manager = current_user.id
            kpi_officer.date_2 = datetime.datetime.now()

            #计算三个月的分数
            assess_record = SC_assess_record.query.filter_by(manager_id=kpi_officer.user_id).first()
            if assess_record:
                if assess_record.assess_sum == '1':
                    assess_record.assess_score_2 = assess_record.assess_score_1
                    assess_record.assess_score_1 = request.form['total']
                    assess_record.assess_sum = 2
                    assess_record.assess_arg = (Decimal(assess_record.assess_score_1)+Decimal(assess_record.assess_score_2))/2
                elif assess_record.assess_sum == '2':
                    assess_record.assess_score_3 = assess_record.assess_score_2
                    assess_record.assess_score_2 = assess_record.assess_score_1
                    assess_record.assess_score_1 = request.form['total']
                    assess_record.assess_sum = 3
                    assess_record.assess_arg = (Decimal(assess_record.assess_score_1)+Decimal(assess_record.assess_score_2)+Decimal(assess_record.assess_score_3))/3
                elif assess_record.assess_sum == '3':
                    assess_record.assess_score_3 = assess_record.assess_score_2
                    assess_record.assess_score_2 = assess_record.assess_score_1
                    assess_record.assess_score_1 = request.form['total']
                    assess_record.assess_sum = 3
                    assess_record.assess_arg = (Decimal(assess_record.assess_score_1)+Decimal(assess_record.assess_score_2)+Decimal(assess_record.assess_score_3))/3
            else:
                assess_record_new = SC_assess_record(kpi_officer.user_id)
                assess_record_new.add()
                db.session.flush()
                assess_record_new.assess_sum = 1
                assess_record_new.assess_arg = request.form['total']
                assess_record_new.assess_score_1 = request.form['total']

            #调用贺珈的函数
            pay = Payment()
            pay.payroll(kpi_officer.user_id,kpi_officer.assess_date,kpi_officer.total)

            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')

        return redirect('Performance/ygpgkh/zgpg_search')