Ejemplo n.º 1
0
def assets_receivable(loan_apply_id):
    '''
    资产负债表-应收账款,预付账款
    账户类型,0:应收账款,1:预付账款
    '''
    if request.method == 'POST':
        result={'result':'success'}
        try:
            sc_assets_receivable( request.form['loan_apply_id'],request.form['accounts_type'],
                            request.form['customer_name'],request.form['describe'],request.form['proportion'],
                            request.form['amount']
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            #flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            #flash('保存失败','Error')
            result={'result':'fail'}
        finally:
            return json.dumps(result,ensure_ascii=False)
    else :
        data = sc_assets_receivable.query.filter_by(loan_apply_id==loan_apply_id).all()
        encoder.FLOAT_REPR = lambda o: format(o, '.2f')#使float类型字段只显示两位小数
        return json.dumps(data,ensure_ascii=False)
Ejemplo n.º 2
0
def change_password(id):
    if request.method == 'POST':
        try:
            user = SC_User.query.filter_by(id=id).first()
            if user.login_password == GetStringMD5(request.form['old_password']):
                user.login_password = GetStringMD5(request.form['login_password'])
            else:
                raise Exception

            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('修改密码成功,请重新登录!','success')

        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('修改密码失败,为保障账号安全,请重新登录后再尝试修改!','error')

        logout_user()
        return redirect("login")
    else:
        return render_template("change_password.html")
Ejemplo n.º 3
0
def assets_fixed_assets(loan_apply_id):
    '''
    资产负债表-固定资产清单
    '''
    if request.method == 'POST':
        result={'result':'success'}
        try:
            sc_assets_fixed_assets( request.form['loan_apply_id'],request.form['assets_type'],
                                    request.form['assets_name'],request.form['assets_ah'],request.form['describe'],
                                    request.form['assets_date'],request.form['price'],request.form['amount']
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            #flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            #flash('保存失败','Error')
            result={'result':'fail'}
        finally:
            return json.dumps(result,ensure_ascii=False)
    else :
        data = sc_assets_fixed_assets.query.filter_by(loan_apply_id==loan_apply_id).all()
        encoder.FLOAT_REPR = lambda o: format(o, '.2f')#使float类型字段只显示两位小数
        return json.dumps(data,cls=json_encoding.DateEncoder,ensure_ascii=False)
Ejemplo n.º 4
0
def assets_receipts(loan_apply_id):
    """
    资产负债表-预收账款
    """
    if request.method == "POST":
        result = {"result": "success"}
        try:
            sc_assets_receipts(
                request.form["loan_apply_id"],
                request.form["source"],
                request.form["occur_date"],
                request.form["describe"],
                request.form["amount"],
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            # flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception("exception")
            # 消息闪现
            # flash('保存失败','Error')
            result = {"result": "fail"}
        finally:
            return json.dumps(result, ensure_ascii=False)
    else:
        data = sc_assets_receipts.query.filter_by(loan_apply_id == loan_apply_id).all()
        encoder.FLOAT_REPR = lambda o: format(o, ".2f")  # 使float类型字段只显示两位小数
        return json.dumps(data, cls=json_encoding.DateEncoder, ensure_ascii=False)
Ejemplo n.º 5
0
 def add(self, request):
     try:
         SC_parameter_configure.query.delete()
         db.session.flush()
         level_base_list = request.form.getlist('level_base')
         level_A1_list = request.form.getlist('level_A1')
         level_A2_list = request.form.getlist('level_A2')
         level_A3_list = request.form.getlist('level_A3')
         level_R_list = request.form.getlist('level_R')
         back_payment = request.form['back_payment']
         performance_a = request.form['performance_a']
         performance_b = request.form['performance_b']
         performance_c = request.form['performance_c']
         level_a = request.form['level_a']
         level_b = request.form['level_b']
         for i in range(len(level_base_list)):
             SC_parameter_configure(i + 1, level_base_list[i], level_A1_list[i], level_A2_list[i],
                                    level_A3_list[i], level_R_list[i], back_payment,performance_a, performance_b, performance_c,
                                    level_a, level_b).add()
         # 事务提交
         db.session.commit()
         # 消息闪现
         flash('保存成功', 'success')
     except:
         # 回滚
         db.session.rollback()
         logger.exception('exception')
         # 消息闪现
         flash('保存失败', 'error')
Ejemplo n.º 6
0
def edit_jggl(id):
    if request.method == 'POST':
        try:
            obj = OA_Org.query.filter_by(id=id).first()
            obj.name = request.form['name']
            obj.manager = request.form['manager']
            obj.amount = request.form['amount']
            obj.is_caiwu = request.form['is_caiwu']
            obj.modify_user = current_user.id
            obj.modify_date = datetime.datetime.now()
            
            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')
        
        return redirect('System/jggl')
    else:
        obj = OA_Org.query.filter_by(id=id).first()
        user = OA_User.query.filter("id!=1").all()
        return render_template("System/org/edit_jggl.html",obj=obj,user=user)
Ejemplo n.º 7
0
def edit_zkqd(id):
	if request.method == 'GET':
		accounts_list = SC_Accounts_List.query.filter_by(id=id).first()
		return render_template("Process/dqdc/edit_zkqd.html",accounts_list=accounts_list)
	else:
		try:
			accounts_list = SC_Accounts_List.query.filter_by(id=id).first()
			accounts_list.name = request.form['name']
			accounts_list.original_price = request.form['original_price']
			accounts_list.occur_date = request.form['occur_date']
			accounts_list.deadline = request.form['deadline']
			accounts_list.present_price = request.form['present_price']
			accounts_list.cooperation_history = request.form['cooperation_history']
			accounts_list.average_period = request.form['average_period']
			accounts_list.trading_frequency = request.form['trading_frequency']
			accounts_list.turnover = request.form['turnover']
			accounts_list.pay_type = request.form['pay_type']
			accounts_list.source = request.form['source']
			accounts_list.other_info = request.form['other_info']

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

		return redirect('Process/dqdc/dqdc')
Ejemplo n.º 8
0
def sc_asset_info(belong_customer_type,belong_customer_value):
	if request.method == 'POST':
		try:
			SC_Asset_Info(request.form['asset_name'],request.form['asset_type'],
				request.form['asset_description'],request.form['asset_position'],request.form['credentials_name'],
				request.form['credentials_no'],request.form['appraisal'],request.form['is_mortgage'],
				request.form['mortgage_amount'],request.form['mortgage_object'],
				belong_customer_type,belong_customer_value).add()

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

		return redirect('xxgl')

	else:
		asset_type = SC_Asset_Type.query.order_by("id").all()
		asset_info = SC_Asset_Info.query.filter_by(belong_customer_type=belong_customer_type,
			belong_customer_value=belong_customer_value).order_by("id").all()
		if belong_customer_type == 'Company':
			customer = SC_Company_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_asset_info.html",customer=customer,asset_type=asset_type,
				asset_info=asset_info)
		else:
			customer = SC_Individual_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_asset_info.html",customer=customer,asset_type=asset_type,
				asset_info=asset_info)
Ejemplo n.º 9
0
def sc_financial_affairs(belong_customer_type,belong_customer_value):
	if request.method == 'POST':
		try:
			SC_Financial_Affairs(request.form['main_supplier'],request.form['main_client'],
				request.form['total_assets'],request.form['stock'],request.form['accounts'],
				request.form['fixed_assets'],request.form['total_liabilities'],request.form['bank_borrowings'],
				request.form['private_borrowers'],request.form['monthly_sales'],request.form['profit'],
				request.form['other_monthly_income'],belong_customer_type,belong_customer_value).add()
				
			# 事务提交
			db.session.commit()
            # 消息闪现
			flash('保存成功','success')
		except:
            # 回滚
			db.session.rollback()
			logger.exception('exception')
            # 消息闪现
			flash('保存失败','error')

		return redirect('xxgl')

	else:
		financial_affairs = SC_Financial_Affairs.query.filter_by(belong_customer_type=belong_customer_type,
			belong_customer_value=belong_customer_value).order_by("id").first()

		if belong_customer_type == 'Company':
			customer = SC_Company_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_financial_affairs.html",customer=customer,financial_affairs=financial_affairs)
		else:
			customer = SC_Individual_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_financial_affairs.html",customer=customer,financial_affairs=financial_affairs)
Ejemplo n.º 10
0
def sc_dealings(belong_customer_type,belong_customer_value):
	if request.method == 'POST':
		try:
			SC_Dealings(request.form['deal_name'],request.form['deal_description'],
				belong_customer_type,belong_customer_value).add()

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

		return redirect('xxgl')

	else:
		dealings = SC_Dealings.query.filter_by(belong_customer_type=belong_customer_type,
			belong_customer_value=belong_customer_value).order_by("id").all()
		if belong_customer_type == 'Company':
			customer = SC_Company_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_dealings.html",customer=customer,dealings=dealings)
		else:
			customer = SC_Individual_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_dealings.html",customer=customer,dealings=dealings)
Ejemplo n.º 11
0
def sc_relations(belong_customer_type,belong_customer_value):
	if request.method == 'POST':
		try:
			SC_Relations(request.form['relation_no'],request.form['relation_name'],
				request.form['relation_type'],request.form['cgbl'],request.form['business_name'],
				request.form['relation_describe'],belong_customer_type,belong_customer_value).add()

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

		return redirect('xxgl')

	else:
		if belong_customer_type == 'Company':
			customer = SC_Company_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_relations.html",customer=customer)
		else:
			customer = SC_Individual_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_relations.html",customer=customer)
Ejemplo n.º 12
0
def delete_khxxgl(type,id):
    loan_apply = SC_Loan_Apply.query.filter_by(belong_customer_type=type,belong_customer_value=id).first()
    if loan_apply is None:
        try:
            if type == "Individual":
                SC_Individual_Customer.query.filter_by(id=id).delete()
            else:
                SC_Company_Customer.query.filter_by(id=id).delete()
            
            SC_Dealings.query.filter_by(belong_customer_type=type,belong_customer_value=id).delete()
            SC_Relations.query.filter_by(belong_customer_type=type,belong_customer_value=id).delete()
            SC_Manage_Info.query.filter_by(belong_customer_type=type,belong_customer_value=id).delete()
            SC_Asset_Info.query.filter_by(belong_customer_type=type,belong_customer_value=id).delete()
            SC_Financial_Affairs.query.filter_by(belong_customer_type=type,belong_customer_value=id).delete()
            SC_Other_Info.query.filter_by(belong_customer_type=type,belong_customer_value=id).delete()
            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('删除成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('删除失败','error')
    else:
        flash('该客户已提交贷款申请,无法删除','error')
        
    return redirect('Information/khxxgl')
Ejemplo n.º 13
0
def assets_loan(loan_apply_id):
    '''
    资产负债表-银行贷款,社会集资
    '''
    if request.method == 'POST':
        result={'result':'success'}
        try:
            sc_assets_loan( request.form['loan_apply_id'],request.form['loan_type'],
                                    request.form['loan_org'],request.form['loan_amount'],request.form['loan_date'],
                                    request.form['loan_deadline'],request.form['guarantee'],request.form['banlance']
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            #flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            #flash('保存失败','Error')
            result={'result':'fail'}
        finally:
            return json.dumps(result,ensure_ascii=False)
    else :
        data = sc_assets_loan.query.filter_by(loan_apply_id==loan_apply_id).all()
        encoder.FLOAT_REPR = lambda o: format(o, '.2f')#使float类型字段只显示两位小数
        return json.dumps(data,cls=json_encoding.DateEncoder,ensure_ascii=False)
Ejemplo n.º 14
0
def dqdcXed_zcfzb(loan_apply_id):
	if request.method == 'GET':
		balance_sheets = SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id).order_by("id").all()
		count_0 = SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id,loan_type=0).count()
		count_2 = SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id,loan_type=2).count()
		count_4 = SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id,loan_type=4).count()
		count_6 = SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id,loan_type=6).count()
		count_10 = SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id,loan_type=10).count()
		count_12 = SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id,loan_type=12).count()
		return render_template("Process/dqdc/dqdcXed_zcfzb.html",loan_apply_id=loan_apply_id,
			balance_sheets=balance_sheets,count_0=count_0,count_2=count_2,count_4=count_4,count_6=count_6,
			count_10=count_10,count_12=count_12)
	else:
		try:
			SC_Balance_Sheet.query.filter_by(loan_apply_id=loan_apply_id).delete()
			db.session.flush()

			for i in range(34):
				for j in range(len(request.form.getlist('type_%s' % i))):
					SC_Balance_Sheet(loan_apply_id,i,request.form.getlist('name_%s' % i)[j],
						j,request.form.getlist('value_%s' % i)[j]).add()

			# 事务提交
			db.session.commit()
			# 消息闪现
			flash('保存成功','success')
		except:
			# 回滚
			db.session.rollback()
			logger.exception('exception')
			# 消息闪现
			flash('保存失败','error')
			
		return redirect('Process/dqdc/dqdcXed_zcfzb/%d' % loan_apply_id)
Ejemplo n.º 15
0
def assets_stock(loan_apply_id):
    '''
    资产负债表-存货
    '''
    if request.method == 'POST':
        result={'result':'success'}
        try:
            sc_assets_stock( request.form['loan_apply_id'],request.form['stock_type'],
                            request.form['stock_evaluate'],request.form['stock_mobility'],request.form['proportion'],
                            request.form['amount']
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            #flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            #flash('保存失败','Error')
            result={'result':'fail'}
        finally:
            return json.dumps(result,ensure_ascii=False)
    else :
        data = sc_assets_stock.query.filter_by(loan_apply_id==loan_apply_id).all()
        encoder.FLOAT_REPR = lambda o: format(o, '.2f')#使float类型字段只显示两位小数
        return json.dumps(data,ensure_ascii=False)
Ejemplo n.º 16
0
def sc_other_info(belong_customer_type,belong_customer_value):
	if request.method == 'POST':
		try:
			# 先获取上传文件
			f = request.files['attachment']
			fname = f.filename
			f.save(os.path.join(UPLOAD_FOLDER_ABS, fname))

			SC_Other_Info(request.form['info_name'],request.form['info_description'],
				UPLOAD_FOLDER_REL + fname,belong_customer_type,belong_customer_value).add()

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

		return redirect('xxgl')

	else:
		other_info = SC_Other_Info.query.filter_by(belong_customer_type=belong_customer_type,
			belong_customer_value=belong_customer_value).order_by("id").all()
		if belong_customer_type == 'Company':
			customer = SC_Company_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_other_info.html",customer=customer,other_info=other_info)
		else:
			customer = SC_Individual_Customer.query.filter_by(id=belong_customer_value).first()
			return render_template("Information/sc_other_info.html",customer=customer,other_info=other_info)
Ejemplo n.º 17
0
def new_assets_aa(loan_apply_id):
    if request.method == "POST":
        result = {"result": "success"}
        try:
            sc_assets_acceptances(
                request.form["loan_apply_id"],
                request.form["bank"],
                request.form["account_expiry_date"],
                request.form["account_balance"],
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            # flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception("exception")
            # 消息闪现
            # flash('保存失败','Error')
            result = {"result": "fail"}
        finally:
            return json.dumps(result, ensure_ascii=False)
        # return redirect('/Process/dqdc/new_xjlfx')
    else:
        cfa_data = sc_assets_acceptances.query.filter_by(loan_apply_id == loan_apply_id).all()
        return json.dumps(cfa_data, cls=json_encoding.DateEncoder, ensure_ascii=False)
Ejemplo n.º 18
0
def new_company_customer(target_customer_id):
	if request.method == 'POST':
		try:
			SC_Company_Customer(current_user.id,request.form['customer_no'],request.form['customer_name'],
				request.form['frdb'],request.form['yyzz'],request.form['yyzz_fzjg'],request.form['swdjz'],
				request.form['swdjz_fzjg'],request.form['gszczj'],request.form['gsyyfw'],request.form['gsclrq'],
				request.form['gszclx'],request.form['jbhzh'],request.form['zcdz'],request.form['xdz'],request.form['bgdz'],
				request.form['qtdz'],request.form['education'],request.form['family'],request.form['telephone'],
				request.form['mobile'],request.form['contact_phone'],request.form['email']).add()

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

	else:	
		target_customer = SC_Target_Customer.query.filter_by(id=target_customer_id).first()
		user = SC_User.query.order_by("id").all()
		regisiter_type = SC_Regisiter_Type.query.order_by("id").all()

		return render_template("Information/new_company_customer.html",user=user,
			regisiter_type=regisiter_type,target_customer=target_customer)
Ejemplo n.º 19
0
def wdgl_delete(id):
    try:
        oa_doc = OA_Doc.query.filter_by(id=id).first()
        doc_versions = OA_Doc_Version.query.filter_by(doc_id=id).all()
        #删除db
        OA_Doc.query.filter_by(id=id).delete()
        db.session.flush()
        #删权限
        OA_Privilege.query.filter_by(privilege_access="OA_Doc",privilege_access_value=id).delete()
        db.session.flush()
        #删文件
        for obj in doc_versions:
            if oa_doc.org_id:
                dir_version = "OA_Org" + "_" +str(oa_doc.org_id)+"/"+str(id)+"_"+str(obj.version)
            else:
                dir_version = "OA_Project" + "_" +str(oa_doc.project_id)+"/"+str(id)+"_"+str(obj.version)
            shutil.rmtree(os.path.join(UPLOAD_FOLDER_ABS,dir_version))
        
        # 事务提交
        db.session.commit()
        # 消息闪现
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
        
    return render_template("wdgl/wdgl.html")
Ejemplo n.º 20
0
def new_xjlfx(id,type,loan_apply_id):
    if request.method == 'POST':
        result={'result':'success'}
        try:
            cash_flow( request.form['loan_apply_id'],request.form['type'],request.form['month'],request.form['early_cash'],
                        request.form['sale_amount'],request.form['accounts_receivable'],request.form['prepaments'],
                        request.form['total_cash_flow'],request.form['cash_purchase'],request.form['accounts_payable'],
                        request.form['advance_purchases'],request.form['total_cash_outflow'],
                        request.form['wage_labor'],request.form['tax'],
                        request.form['transportation_costs'],request.form['rent'],request.form['maintenance_fees'],
                        request.form['utility_bills'],request.form['advertising_fees'],request.form['social_intercourse_fees'],
                        request.form['fixed_asset_investment'],request.form['disposal_of_fixed_assets'],
                        request.form['investment_cash_flow'],request.form['bank_loans'],request.form['repayments_bank'],
                        request.form['financing_cash_flow'],request.form['household_expenditure'],request.form['private_use'],
                        request.form['private_cash_flow'],request.form['fixed_costs'],
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            #flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            #flash('保存失败','Error')
            result={'result':'fail'}
        finally:
            return json.dumps(result,ensure_ascii=False)
    else :
        cash_flow_data = cash_flow.query.filter_by(loan_apply_id==loan_apply_id,type==type).first()
        encoder.FLOAT_REPR = lambda o: format(o, '.2f')#使float类型字段只显示两位小数
        return json.dumps(cash_flow_data,ensure_ascii=False)
Ejemplo n.º 21
0
def fyzf_check(id, page, create_user):
    if request.method == "POST":
        try:
            # 报销单信息
            reimbursement = OA_Reimbursement.query.filter_by(id=id).first()
            reimbursement.is_paid = 1
            reimbursement.paid_date = datetime.datetime.now()
            db.session.commit()
            # 消息闪现
            flash("保存成功", "success")
        except:
            # 回滚
            db.session.rollback()
            logger.exception("exception")
            # 消息闪现
            flash("保存失败", "error")
    else:
        project = OA_Project.query.order_by("id").all()
        reimbursement = OA_Reimbursement.query.filter_by(id=id).first()
        return render_template(
            "bxsq/fysp/checkzf_bxsq.html",
            reimbursement=reimbursement,
            project=project,
            userId=current_user.id,
            create_user=create_user,
            parentPage=int(page),
        )
Ejemplo n.º 22
0
def edit_dkfk(id):
    try:
        #保存SC_Approval_Decision剩余信息
        approval_decision = SC_Approval_Decision.query.filter_by(loan_apply_id=id).first()
        approval_decision.loan_date = request.form['loan_date']
        approval_decision.first_repayment_date = request.form['first_repayment_date']
        #approval_decision.management_coats = request.form['management_coats']
        #approval_decision.agency_coats = request.form['agency_coats']
        approval_decision.contract_date = request.form['contract_date']
        approval_decision.loan_account = request.form['loan_account']
        #approval_decision.bank_customer_no = request.form['bank_customer_no']
        approval_decision.loan_contract_number = request.form['loan_contract_number']
        approval_decision.guarantee_contract_number = request.form['guarantee_contract_number']
        approval_decision.collateral_contract_number = request.form['collateral_contract_number']

        #保存还款计划
        repayment_plan_id = 0
        repayment_plan = SC_Repayment_Plan.query.filter_by(loan_apply_id=id).first()
        if repayment_plan:
            repayment_plan_id = repayment_plan.id
            repayment_plan.repayment_type=request.form['repayment_type']
            repayment_plan.amount=request.form['amount']
            repayment_plan.lending_date=request.form['loan_date']
            repayment_plan.first_repayment_date=request.form['first_repayment_date']
            repayment_plan.ratio=request.form['rates']
            repayment_plan.installmenst=request.form['deadline']
            repayment_plan.modify_user=current_user.id
            repayment_plan.modify_date=datetime.datetime.now()
        else:
            repayment_plan_new = SC_Repayment_Plan(id,request.form['repayment_type'],request.form['amount'],
                request.form['loan_date'],request.form['loan_date'],request.form['rates'],
                request.form['deadline'])
            repayment_plan_new.add()
            db.session.flush()
            repayment_plan_id = repayment_plan_new.id

        #保存还款细则
        SC_Repayment_plan_detail.query.filter_by(loan_apply_id=id,change_record=1).delete()
        db.session.flush()
        for i in range(1,int(request.form['deadline'])+1):
            SC_Repayment_plan_detail(repayment_plan_id,id,None,request.form['rates'],
                request.form['mybj%d' % i],request.form['mylx%d' % i],
                request.form['mybx%d' % i],i,request.form['myrq%d' % i],None,1).add() 

        loan_apply = SC_Loan_Apply.query.filter_by(id=id).first()
        loan_apply.process_status = PROCESS_STATUS_DKFKJH

        # 事务提交
        db.session.commit()
        #计算绩效
        reckonIncome(id)
        # 消息闪现
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现 
        flash('保存失败','error')
    return redirect("Process/dkfk/dkfk")    
Ejemplo n.º 23
0
 def editRise(self, manager_id, apply_type, level_id, apply_result):
     try:
         # 同意
         if apply_result == "2":
             # 晋级
             if apply_type == "1":
                 SC_Privilege.query.filter_by(
                     priviliege_master_id=manager_id,
                     privilege_master="SC_User",
                     priviliege_access="sc_account_manager_level",
                 ).update({"priviliege_access_value": int(level_id) + 1})
             else:
                 SC_Privilege.query.filter_by(
                     priviliege_master_id=manager_id,
                     privilege_master="SC_User",
                     priviliege_access="sc_account_manager_level",
                 ).update({"priviliege_access_value": int(level_id) - 1})
         SC_examine_rise.query.filter_by(manager_id=manager_id, apply_result=1).update(
             {"apply_result": apply_result}
         )
         # 事务提交
         db.session.commit()
     except:
         # 回滚
         db.session.rollback()
         logger.exception("exception")
Ejemplo n.º 24
0
Archivo: load.py Proyecto: JohnCny/xhsc
	def yidaitong(self):
		try:
			#上一个月的第一天
			lst_fist = datetime.date(datetime.datetime.now().year,datetime.datetime.now().month-1,1)
			#上一个月的最后一天
		 	lst_last = datetime.date(datetime.datetime.now().year,datetime.datetime.now().month,1)-datetime.timedelta(1)
			#获取所有上月存在利润贷款
			lst = str(lst_fist) + " 00:00:00"
			last = str(lst_last) + " 23:59:59"
			sql = "loan_due_date > '" + lst + "'"
			sc_bank_loans_main= SC_Bank_Loans_Main.query.filter(sql).all()
			logger.info("=======模拟利润更新========")
			for obj in sc_bank_loans_main:
				sc_loan_apply = SC_Loan_Apply.query.filter_by(id=obj.loan_apply_id).first()
				logger.info(sc_loan_apply.loan_type)
				if sc_loan_apply:
					if sc_loan_apply.loan_type=='2':
						#接口--模拟利润
						server = SOAPpy.SOAPProxy(WEBSERVICE_URL) 
						dd = server.mnlr(obj.loan_account,lst_last.strftime("%Y%m%d"))
						logger.info("sc_loan_apply:"+str(sc_loan_apply.id))
						data = json.loads(dd)
						self.return_examp(obj.loan_apply_id,data[0]["BYMNLR"])
		except:
			logger.exception('exception')
Ejemplo n.º 25
0
def assets_other_non_operate(loan_apply_id):
    '''
    资产负债表-其它非经营资产
    '''
    if request.method == 'POST':
        result={'result':'success'}
        try:
            sc_assets_other_non_operate( request.form['loan_apply_id'],request.form['project'],
                            request.form['project_owner'],request.form['describe'],request.form['amount'],
            ).add()
            # 事务提交
            db.session.commit()
            # 消息闪现
            #flash('保存成功','Success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            #flash('保存失败','Error')
            result={'result':'fail'}
        finally:
            return json.dumps(result,ensure_ascii=False)
    else :
        data = sc_assets_other_non_operate.query.filter_by(loan_apply_id==loan_apply_id).all()
        encoder.FLOAT_REPR = lambda o: format(o, '.2f')#使float类型字段只显示两位小数
        return json.dumps(data,ensure_ascii=False)
Ejemplo n.º 26
0
def new_user():
	if request.method == 'GET':
		roles = OA_Role.query.order_by("id").all()
		return render_template("System/user/new_user.html",roles=roles)
	else:
		try:
			user = OA_User(request.form['login_name'],GetStringMD5(request.form['login_password']),
				request.form['real_name'],request.form['sex'],request.form['mobile'],request.form['active'],request.form['email'])
			user.add()

			#清理缓存
			db.session.flush()

			OA_UserRole(user.id,request.form['roles']).add()

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

		return redirect('System/user/1')
Ejemplo n.º 27
0
def new_cust_mgr():
    if request.method=='POST':
        try:
            date=datetime.datetime.now()

            work_type=request.form['work_type']
            work_type_detail=request.form['work_type_detail']
            s_beg_date=request.form['beg_date']
            s_beg_time=time.strptime(s_beg_date,'%H:%M')
            beg_date=date.replace(hour=s_beg_time.tm_hour,minute=s_beg_time.tm_min)
            s_end_date=request.form['end_date']
            s_end_time=time.strptime(s_end_date,'%H:%M')
            end_date=date.replace(hour=s_end_time.tm_hour,minute=s_end_time.tm_min)
            time_consume=request.form['time_consume']
            remark=request.form['remark']

            SC_Day_Work(work_type,work_type_detail,beg_date,end_date,time_consume,remark).add()

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

        return redirect('/Cust_mgr/add')

    elif request.method=='GET':
        return render_template('/Performance/gsjl/new_gsjl.html')
Ejemplo n.º 28
0
def edit_user(id):
    if request.method == 'GET':
        user = OA_User.query.filter_by(id=id).first()
        roles = OA_Role.query.order_by("id").all()
        role = OA_UserRole.query.filter_by(user_id=id).first().oa_userrole_ibfk_2
        return render_template("System/user/edit_user.html",user=user,roles=roles,role=role)
    else:
        try:
            user = OA_User.query.filter_by(id=id).first()
            user.login_name = request.form['login_name']
            #user.login_password = request.form['login_password']
            user.real_name = request.form['real_name']
            user.sex = request.form['sex']
            user.mobile = request.form['mobile']
            user.active = request.form['active']
            user.email = request.form['email']
            user.modify_user = current_user.id
            user.modify_date = datetime.datetime.now()

            user_role = OA_UserRole.query.filter_by(user_id=id).first()
            user_role.role_id = request.form['roles']
            user_role.modify_user = current_user.id
            user_role.modify_date = datetime.datetime.now()

            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')
        return redirect('System/user/1')
Ejemplo n.º 29
0
Archivo: data.py Proyecto: JohnCny/xhsc
def data_import():
    if request.method == "POST":
        try:
            # 先获取上传文件
            f = request.files["attachment"]
            fname = f.filename
            if not os.path.exists(os.path.join(LOCALDB_FOLDER_ABS, str(current_user.id))):
                os.mkdir(os.path.join(LOCALDB_FOLDER_ABS, str(current_user.id)))
            f.save(os.path.join(LOCALDB_FOLDER_ABS, "%d\\%s" % (current_user.id, fname)))

            SC_LocalDB.query.filter_by(user_id=current_user.id).delete()
            db.session.flush()

            SC_LocalDB(current_user.id, fname).add()

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

        return redirect("Data/drbdsj")
Ejemplo n.º 30
0
def check_zcfl(loan_apply_id):
    if request.method == 'GET':
        view_query_loan = View_Query_Loan.query.filter_by(loan_apply_id=loan_apply_id).first()
        co_borrower = SC_Co_Borrower.query.filter_by(loan_apply_id=loan_apply_id).all()
        guaranty = SC_Guaranty.query.filter_by(loan_apply_id=loan_apply_id).all()
        guarantees = SC_Guarantees.query.filter_by(loan_apply_id=loan_apply_id).all()
        
        loan_product = SC_Loan_Product.query.all()
        
        return render_template("Process/zcflsh/check_zcfl.html",view_query_loan=view_query_loan,
        	co_borrower=co_borrower,guaranty=guaranty,guarantees=guarantees,loan_product=loan_product)
    else:
        try:
            loan_apply = SC_Loan_Apply.query.filter_by(id=loan_apply_id).first()
            loan_apply.classify = request.form['classify']
            loan_apply.classify_dec = request.form['classify_dec']
            
            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')
    
        return redirect('Process/zcflsh/zcflsh')