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 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 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 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 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 agree_sign_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) '''COUNTER_TYP_LIST = [ (1, '企业担保'), (2, '个人保证'), (11, '房产抵押'), (12, '土地抵押'), (13, '动产抵押'), (14, '在建工程抵押'), (15, '车辆抵押'), (31, '应收质押'), (32, '股权质押'), (33, '票据质押'), (34, '动产质押'), (41, '其他权利质押'), (51, '股权预售'), (52, '房产预售'), (53, '土地预售')]''' agree_typ = agree_obj.agree_typ '''AGREE_TYP_LIST = [(1, '单笔'), (2, '最高额'), (3, '保函'), (7, '小贷'), (41, '单笔(公证)'), (42, '最高额(公证)'), (47, '小贷(公证)')]''' AGREE_TYP_GZ = models.Agrees.AGREE_TYP_G AGREE_TYP_X = models.Agrees.AGREE_TYP_X # 小贷公司合同类型 AGREE_TYP_D = models.Agrees.AGREE_TYP_D # 担保公司合同类型 # credit_term_cn = credit_term_c(agree_obj.agree_term) credit_term_cn = convert_num(agree_obj.agree_term) agree_amount_str = amount_s(agree_obj.agree_amount) # 元转换为万元并去掉小数点后面的零 article_amount_str = amount_s(round(agree_obj.lending.summary.amount, 2)) '''AGREE_STATE_LIST = [(11, '待签批'), (21, '已签批'), (31, '未落实'), (41, '已落实'), (51, '待变更'), (61, '已解保'), (99, '已注销')]''' agree_article = agree_obj.lending.summary article_agree_list = models.Agrees.objects.filter( lending__summary=agree_article, id__lt=agree_obj.id).exclude(agree_state=99) article_agree_amount = article_agree_list.aggregate( Sum('agree_amount'))['agree_amount__sum'] if not article_agree_amount: article_agree_amount_ar = 0 else: article_agree_amount_ar = round(article_agree_amount) # article_agree_amount_ar = round(article_agree_amount - agree_obj.agree_amount, 2) article_agree_amount_ar_str = amount_s(article_agree_amount_ar) '''RESULT_TYP_LIST = [(11, '股东会决议'), (21, '董事会决议'), (31, '弃权声明'), (41, '单身声明')]''' counter_list = agree_obj.counter_agree.all() counter_count = counter_list.count() + 1 '''RESULT_TYP_LIST = [(11, '股东会决议'), (13, '合伙人会议决议'), (15, '举办者会议决议'), (21, '董事会决议'), (23, '管委会决议'), (31, '声明书'), (41, '个人婚姻状况及财产申明')]''' result_list = agree_obj.result_agree.all() result_count = result_list.count() return render(request, 'dbms/agree/preview-sign.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())
def endor_list_scan(request, article_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() PAGE_TITLE = '签批单' article_list = models.Articles.objects.filter(id=article_id) article_obj = article_list.first() amount_str_w = amount_s(article_obj.amount) # 转化为万为单位,并且去掉小数点后面的零 credit_term_str = convert_num(article_obj.credit_term) # 去掉小数点后面的零 single_quota_list = article_obj.single_quota_summary.all() # 单项额度列表 flow_rate = single_quota_list[0].flow_rate # 费率 product_name = article_obj.product.name # 产品名称 lending_list = article_obj.lending_summary.all() # 放款次序列表 sure_lending_list = lending_list[0].sure_lending.all() sure_typ_dic = dict(models.LendingSures.SURE_TYP_LIST) # 反担保类型 process_typ = article_obj.process.typ # 流程类型 ttt = '由' for lending in article_obj.lending_summary.all(): sure_lending_list = lending.sure_lending.all() # 担保措施下客户列表 sure_lending_count = sure_lending_list.count() # 担保措施下客户数量 sure_lending_c = 0 for sure in lending.sure_lending.all(): sure_lending_c += 1 if sure.sure_typ in [1, 2]: # (1, '企业保证'), (2, '个人保证'), sure_custom_list = sure.custom_sure.custome.all() # 担保措施下客户列表 sure_custom_count = sure_custom_list.count() # 担保措施下客户数量 sure_custom_c = 0 for custom in sure_custom_list: sure_custom_c += 1 ttt += custom.name if sure_custom_c < sure_custom_count: ttt += '、' ttt += '提供%s%s' % (sure_typ_dic[sure.sure_typ], '担保') elif sure.sure_typ in [11, 21]: # (11, '房产抵押'), (21, '房产顺位'), sure_warrant_list = sure.warrant_sure.warrant.all( ) # 担保措施下权证列表 sure_warrant_count = sure_warrant_list.count() # 担保措施下权证数量 sure_warrant_c = 0 for warrant in sure_warrant_list: sure_warrant_c += 1 owner_ship_list = warrant.ownership_warrant.all( ) # 权证项下权证列表 owner_ship_count = owner_ship_list.count() # 权证项下权证数量 owner_ship_c = 0 if owner_ship_list: for owner_ship in owner_ship_list: owner_ship_c += 1 ttt += '%s(%s)' % (owner_ship.owner.name, owner_ship.ownership_num) if owner_ship_c < owner_ship_count: ttt += '、' else: ttt += '???????????' ttt += '所有的位于%s的%s' % (warrant.house_warrant.house_locate, '住宅') if sure_warrant_c < sure_warrant_count: ttt += '、' ttt += '提供%s%s' % (sure_typ_dic[sure.sure_typ], '担保。') if sure_lending_c < sure_lending_count: ttt += ';' PROCESS_LIST_XD = [ '房抵贷', '担保贷', '过桥贷', ] return render(request, 'dbms/appraisal/endor-list.html', locals())