<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2015-11-13 上午10:02:14  
    $Revision: 1.0  
    $Purpose: 续保审批界面
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            begin
				ast_insurance_management_pkg.insurance_approve(p_contract_id      =>${@contract_id},
                              p_car_insurance_id =>${@ast_car_insurance_id},
                              p_due_amount       =>nvl(${@settle_claim_amount},0),
                              p_user_id          =>${/session/@user_id});
			end;
]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
        	select t1.* from (	select 
					   t2.contract_id,
				       t2.contract_number,
				       t2.bp_id_tenant_name,
				       t4.ast_car_insurance_id,
				       t4.item_detail_id,
				       t4.bp_id,
				       (select bp_name from hls_bp_master where bp_id = t4.bp_id) insurer_dis,
				       t4.insurance_number,
				       t4.insurance_description,
				       t4.insure_date,
				       t4.insurance_date_from,
				       t4.insurance_date_to,
				       t4.insurance_year,
				       t4.compulsory_insurance_amount,
				       t4.commercial_insurance_amount,
				       t4.damage_insurance_flag,
				       t4.third_party_insurance_flag,
				       t4.pilfer_insurance_flag,
				       t4.basic_non_deductible_flag,
				       t4.glass_insurance_flag,
				       t4.seat_insurance_flag,
				       t4.combustion_insurance_flag,
				       t4.add_non_deductible_flag,
				       t4.compulsory_rebate_rate,
				       t4.combustion_rebate_rate,
				       t4.compulsory_rebate,
				       t4.combustion_rebate,
				       t4.insure_place,
				       t4.insure_name,
				       t4.first_beneficiary,
				       t4.insurance_party,
				       t4.damage_insurance_amount,
				       t4.third_party_insurance_amount,
				       t4.basic_non_deductible_amount,
				       t4.pilfer_insurance_amount,
				       t4.commercial_insurance_flag,
				       t4.document_status,
				       (select v.code_value_name
				          from sys_code_values_v v
				         where v.code = 'AST_INSURANCE_DOCUMENT_STATUS'
				           and v.code_value = t4.document_status) document_status_des,
				       t4.payment_finish_flag,
				       t4.glass_insurance_amount,
				       t4.seat_insurance_amount,
				       t4.combustion_insurance_amount,
				       t4.insurance_type,
				       (select v.code_value_name
				          from sys_code_values_v v
				         where v.code = 'AST_INSURANCE_TYPE'
				           and v.code_value = t4.insurance_type) insurance_type_desc,
				       t4.others_insurance_amount,
				       t4.travel_tax,
				       t4.protege_name,
				       t4.confirm_flag,
				       t4.ref_v01,
				       t4.ref_v02,
				       t4.ref_v03,
				       t4.ref_v04,
				       t4.ref_v05,
				       t4.ref_n01,
				       t4.ref_n02,
				       t4.ref_n03,
				       t4.ref_n04,
				       t4.ref_n05,
				       t4.ref_d01,
				       t4.ref_d02,
				       t4.ref_d03,
				       t4.ref_d04,
				       t4.ref_d05
				  from con_contract_item_detail t1,
				       con_contract_lv          t2,
				       con_contract_lease_item  t3,
				       ast_car_insurance        t4
				 where t2.contract_id = t3.contract_id
				   and t3.contract_lease_item_id = t1.contract_lease_item_id
				   and t2.data_class = 'NORMAL'
				   and t1.item_detail_id = t4.item_detail_id
				   and t4.document_status = '30')t1
				  #WHERE_CLAUSE#
					
        	]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="contract_number" queryExpression="(t1.contract_number like ${@contract_number})"/>
        <bm:query-field name="insurance_number" queryExpression="(t1.insurance_number like ${@insurance_number})"/>
    </bm:query-fields>
</bm:model>
