def notify_show(request, notify_id): # 查看放款通知 current_url_name = resolve(request.path).url_name # 获取当前URL_NAME authority_list = request.session.get('authority_list') # 获取当前用户的所有权限 menu_result = MenuHelper(request).menu_data_list() job_list = request.session.get('job_list') # 获取当前用户的所有角色 PAGE_TITLE = '放款通知' notify_obj = models.Notify.objects.get(id=notify_id) product_name_list = [ '房抵贷', '担保贷', '过桥贷', ] agree_amount_cn = convert(notify_obj.agree.agree_amount) notify_money_cn = convert(notify_obj.notify_money) agree_term_cn = convert_num(notify_obj.agree.agree_term) agree_rate_str = notify_obj.agree.agree_rate date_today = datetime.date.today() date_today_str = str(date_today) agree_amount = notify_obj.agree.agree_amount provide_agree_list = models.Provides.objects.filter( notify__agree=notify_obj.agree) if provide_agree_list: provide_agree_count = provide_agree_list.count() provide_agree_aount = provide_agree_list.aggregate( Sum('provide_money'))['provide_money__sum'] # remainder = round(agree_amount - provide_agree_aount, 2) return render(request, 'dbms/provide/provide-notify-show.html', locals())
def agree_preview(request, agree_id): current_url_name = resolve(request.path).url_name # 获取当前URL_NAME authority_list = request.session.get('authority_list') # 获取当前用户的所有权限 menu_result = MenuHelper(request).menu_data_list() agree_obj = models.Agrees.objects.get(id=agree_id) AGREE_TYP_D = models.Agrees.AGREE_TYP_D # 担保公司合同类型 AGREE_TYP_X = models.Agrees.AGREE_TYP_X # 小贷公司合同类型 agree_amount_cn = convert(agree_obj.agree_amount) # 转换为金额大写 agree_amount_str = amount_s(agree_obj.agree_amount) # 元转换为万元并去掉小数点后面的零 agree_amount_y = amount_y(agree_obj.agree_amount) # 元转换为万元并去掉小数点后面的零 agree_term_cn = convert_num(agree_obj.agree_term) # 合同期限转大写 agree_copy_cn = convert_num(agree_obj.agree_copies) UN, ADD, CNB = un_dex(agree_obj.agree_typ) # 不同合同种类下主体适用 if agree_obj.agree_typ in [ 22, ]: # (22, 'D-公司保函'), page_home_y_y = '申请人(乙方)' page_home_y_j = '担保人(甲方)' elif agree_obj.agree_typ in [ 21, ]: # (21, 'D-分离式保函'), page_home_y_y = '乙方' page_home_y_j = '甲方' else: page_home_y_y = '被担保人(乙方)' page_home_y_j = '担保人(甲方)' notarization_typ = False # 是否公证 if agree_obj.agree_typ in [1, 2, 3, 4, 21, 22, 23]: agree_copy_jy_cn = convert_num(agree_obj.agree_copies - 2) else: notarization_typ = True agree_copy_jy_cn = convert_num(agree_obj.agree_copies - 3) '''利率(费率)处理''' agree_rate_cn_q = '' try: rate_b = True single_quota_rate = float(agree_obj.agree_rate) charge = round(agree_obj.agree_amount * single_quota_rate / 100, 2) agree_rate_cn_q = convert_num(float( agree_obj.agree_rate)) # 合同利率转换为千分之,大写 agree_rate_p = round(((20 - float(agree_obj.agree_rate)) / 30 * 10), 4) agree_rate_w = convert_num_4(agree_rate_p) charge_cn = convert(charge) except ValueError: rate_b = False single_quota_rate = agree_obj.agree_rate agree_rate_cn_q = agree_obj.agree_rate agree_rate_w = '叁点叁叁叁叁' return render(request, 'dbms/agree/preview-agree.html', locals())
def supplementary_preview(request, agree_id): current_url_name = resolve(request.path).url_name # 获取当前URL_NAME authority_list = request.session.get('authority_list') # 获取当前用户的所有权限 menu_result = MenuHelper(request).menu_data_list() agree_obj = models.Agrees.objects.get(id=agree_id) agree_amount_cn = convert(agree_obj.agree_amount) # 转换为金额大写 agree_copy_cn = convert_num(agree_obj.agree_copies) investigation_fee_cn = '零' if agree_obj.investigation_fee > 0: investigation_fee_cn = convert( round(agree_obj.agree_amount * agree_obj.investigation_fee / 100, 2)) # 调查费大写 return render(request, 'dbms/agree/preview-supplementary.html', locals())
def repay_plan_prew(request, provide_id): #还款计划预览 current_url_name = resolve(request.path).url_name # 获取当前URL_NAME authority_list = request.session.get('authority_list') # 获取当前用户的所有权限 menu_result = MenuHelper(request).menu_data_list() job_list = request.session.get('job_list') # 获取当前用户的所有角色 PAGE_TITLE = '还款计划表' provide_list = models.Provides.objects.filter(id=provide_id) provide_obj = provide_list.first() provide_money_cn = convert(provide_obj.provide_money) #金额大写 agree_term_cn = convert_num(provide_obj.notify.agree.agree_term) #期限大写 repay_method_DE = [ 21, ] #等额本息 repay_method_FQ = [11, 31] #按月付息 repay_plan_list = provide_obj.track_provide.all().filter( track_typ__in=[21, 25, 31]) if not repay_plan_list: return HttpResponse("请先生成还款计划") term_pri_total = round( repay_plan_list.aggregate(Sum('term_pri'))['term_pri__sum'], 2) #应收本金合计 term_int_total = round( repay_plan_list.aggregate(Sum('term_int'))['term_int__sum'], 2) #应收利息合计 return render(request, 'dbms/provide/repay-plan-prew.html', locals())
def letter_knowing(request, agree_id, warrant_id): # 顺位抵押知晓函预览 current_url_name = resolve(request.path).url_name # 获取当前URL_NAME authority_list = request.session.get('authority_list') # 获取当前用户的所有权限 menu_result = MenuHelper(request).menu_data_list() agree_obj = models.Agrees.objects.get(id=agree_id) warrant_obj = models.Warrants.objects.get(id=warrant_id) AGREE_TYP_D = models.Agrees.AGREE_TYP_D # 担保公司合同类型 AGREE_TYP_X = models.Agrees.AGREE_TYP_X # 小贷公司合同类型 agree_amount_cn = convert(agree_obj.agree_amount) # 转换为金额大写 agree_amount_str = amount_s(agree_obj.agree_amount) # 元转换为万元并去掉小数点后面的零 agree_amount_y = amount_y(agree_obj.agree_amount) # 元转换为万元并去掉小数点后面的零 agree_term_cn = convert_num(agree_obj.agree_term) # 合同期限转大写 agree_copy_cn = convert_num(agree_obj.agree_copies) UN, ADD, CNB = un_dex(agree_obj.agree_typ) # 不同合同种类下主体适用 return render(request, 'dbms/agree/preview-letter-knowing.html', locals())
def counter_preview(request, agree_id, counter_id): current_url_name = resolve(request.path).url_name # 获取当前URL_NAME authority_list = request.session.get('authority_list') # 获取当前用户的所有权限 menu_result = MenuHelper(request).menu_data_list() agree_obj = models.Agrees.objects.get(id=agree_id) # 委托合同 counter_obj = models.Counters.objects.get(id=counter_id) # 反担保合同 AGREE_TYP_H = models.Agrees.AGREE_TYP_H # 最高额合同类型 AGREE_TYP_X = models.Agrees.AGREE_TYP_X # 小贷公司合同类型 AGREE_TYP_D = models.Agrees.AGREE_TYP_D # 担保公司合同类型 AGREE_TYP_X = models.Agrees.AGREE_TYP_X # 小贷公司合同类型 X_COUNTER_TYP_LIST = models.Counters.COUNTER_TYP_X # 保证类(反)担保合同类型 D_COUNTER_TYP_LIST = models.Counters.COUNTER_TYP_D # 抵押类(反)担保合同类型 Z_COUNTER_TYP_LIST = models.Counters.COUNTER_TYP_Z # 质押类(反)担保合同类型 # credit_term_cn = credit_term_c(agree_obj.agree_term) # 授信期限(月) credit_term_cn = convert_num(agree_obj.agree_term) # 授信期限(月) counter_copy_cn = convert_num(counter_obj.counter_copies) # 合同份数(大写) agree_amount = agree_obj.agree_amount agree_amount_cn = convert(agree_obj.agree_amount) # 转换为货币大写 agree_amount_str = amount_s(agree_obj.agree_amount) # 元转换为万元并去掉小数点后面的零 agree_amount_y = amount_y(agree_obj.agree_amount) # 元去掉小数点后面的零 agree_term = agree_obj.agree_term agree_term_str = convert_num(agree_obj.agree_term) # 转换为数字大写 UN, ADD, CNB = un_dex(agree_obj.agree_typ) # 不同合同种类下主体适用 notarization_typ = False if agree_obj.agree_typ in [41, 42, 51, 52]: notarization_typ = True co_owner_list = [] # 共有人列表 ownership_owner_list = [] # 产权人列表 if counter_obj.counter_typ not in X_COUNTER_TYP_LIST: ownership_list = counter_obj.warrant_counter.warrant.all().first( ).ownership_warrant.all() for ownership in ownership_list: ownership_owner_list.append(ownership.owner) for ownership in ownership_list: if ownership.owner.genre == 2: if ownership.owner.person_custome.spouses and ownership.owner.person_custome.spouses not in ownership_owner_list: co_owner_list.append( ownership.owner.person_custome.spouses) j_typ = '' if counter_obj.counter_typ in X_COUNTER_TYP_LIST: # 保证类(反)担保合同类型 j_typ = '担保人' elif counter_obj.counter_typ in D_COUNTER_TYP_LIST: # 抵押类(反)担保合同类型 j_typ = '抵押权人' elif counter_obj.counter_typ in Z_COUNTER_TYP_LIST: # 抵押类(反)担保合同类型 j_typ = '质权人' if counter_obj.counter_typ in [1, 2]: # 个人反担保 assure_counter_obj = counter_obj.assure_counter custom_obj = assure_counter_obj.custome else: warrant_counter_obj = counter_obj.warrant_counter # 抵质押(反)担保合同 counter_warrant_count = warrant_counter_obj.warrant.count( ) # (反)担保合同项下抵质押物数量 counter_warrant_list = warrant_counter_obj.warrant.all( ) # (反)担保合同项下抵质押物列表 counter_warrant_obj = counter_warrant_list.first() # (反)担保合同项下抵质押物(首个) '''WARRANT_TYP_LIST = [ (1, '房产'), (2, '房产包'), (5, '土地'), (6, '在建工程'), (11, '应收账款'), (21, '股权'), (31, '票据'), (41, '车辆'), (51, '动产'), (55, '其他'), (99, '他权')]''' counter_warrant_typ = counter_warrant_obj.warrant_typ # (反)担保合同项下抵质押物种类 counter_warrant_list_count = counter_warrant_list.count() for counter_warrant in counter_warrant_list: if counter_warrant.warrant_typ == 2: # (2, '房产包') counter_warrant_list_count += counter_warrant.housebag_warrant.all( ).count() - 1 counter_property_type = '' if counter_warrant_typ in [1, 2]: # (1, '房产'), (2, '房产包'), counter_property_type = '房产' elif counter_warrant_typ in [ 5, ]: # (5, '土地'), counter_property_type = '国有土地使用权' elif counter_warrant_typ in [ 6, ]: # (6, '在建工程'), counter_property_type = '在建工程' elif counter_warrant_typ in [ 11, ]: # (11, '应收账款'), counter_property_type = '应收账款' counter_receive_obj = counter_warrant_obj.receive_warrant receive_extend_list = counter_receive_obj.extend_receiveable.all() elif counter_warrant_typ in [ 21, ]: # (21, '股权'), counter_stock_obj = counter_warrant_obj.stock_warrant stock_registe_str = str( counter_stock_obj.registe).rstrip('0').rstrip('.') stock_share_str = str( counter_stock_obj.share).rstrip('0').rstrip('.') agree_share_cn = convert(counter_stock_obj.share * 10000) elif counter_warrant_typ in [ 31, ]: # (31, '票据'), DRAFT_TYP_DIC = dict(models.Draft.TYP_LIST) counter_property_type = DRAFT_TYP_DIC[ counter_warrant_list[0].draft_warrant.typ] counter_draft_obj = counter_warrant_obj.draft_warrant counter_draft_bag_list = counter_draft_obj.extend_draft.all() counter_draft_list_count = counter_draft_bag_list.count() #票据张数 denomination_str = str( round(counter_draft_obj.denomination / 10000, 6)).rstrip('0').rstrip('.') denomination_cn = convert(round(counter_draft_obj.denomination, 2)) elif counter_warrant_typ in [ 41, ]: # (41, '车辆'), counter_vehicle_obj = counter_warrant_obj.vehicle_warrant counter_property_type = '车辆' elif counter_warrant_typ in [ 51, ]: # (51, '动产'), '''CHATTEL_TYP_LIST = [(1, '存货'), (11, '机器设备'), (99, '其他')]''' chattel_typ = counter_warrant_obj.chattel_warrant.chattel_typ # 动产种类 if chattel_typ == 1: counter_property_type = '存货' elif chattel_typ == 11: counter_property_type = '机器设备' elif counter_warrant_typ in [ 55, ]: '''OTHER_TYP_LIST = [(11, '购房合同'), (21, '车辆合格证'), (31, '专利'), (41, '商标'), (71, '账户'), (99, '其他')]''' counter_other_list = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ] counter_other_obj = counter_warrant_obj.other_warrant other_typ = counter_other_obj.other_typ # 其他种类 cost_str = str(counter_other_obj.cost / 10000).rstrip('0').rstrip('.') cost_cn = convert(counter_other_obj.cost) if counter_other_obj.other_typ in [ 11, ]: counter_property_type = '购房合同' elif counter_other_obj.other_typ in [ 21, ]: counter_property_type = '车辆合格证' counter_home_b_b = '' if agree_obj.agree_typ == 21 or agree_obj.agree_typ == 22: # (21, 'D-分离式保函'), (22, 'D-公司保函'), counter_home_b_b = '被担保人' else: counter_home_b_b = '借款人' agree_rate_cn_q = '' try: rate_b = True single_quota_rate = float(agree_obj.agree_rate) charge = round(agree_obj.agree_amount * single_quota_rate / 100, 2) agree_rate_cn_q = convert_num(float( agree_obj.agree_rate)) # 合同利率转换为千分之,大写 agree_rate_w = convert_num( round(((20 - float(agree_obj.agree_rate)) / 30 * 10), 4)) charge_cn = convert(charge) except ValueError: rate_b = False single_quota_rate = agree_obj.agree_rate agree_rate_cn_q = agree_obj.agree_rate agree_rate_w = '叁点叁叁叁叁' return render(request, 'dbms/agree/preview-counter.html', locals())