<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: duzhihong  
    $Date: 2015-1-14 下午3:29:31  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_BATCH_ADJUST_INT_TEST_HD" defaultOrderBy="batch_hd_id ">
    <bm:fields>
        <bm:field name="batch_hd_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BATCH_HD_ID" prompt="CON_BATCH_ADJUST_INT_TEST_HD.BATCH_HD_ID"/>
        <bm:field name="batch_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BATCH_NUM" prompt="CON_BATCH_ADJUST_INT_TEST_HD.BATCH_NUM"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="CON_BATCH_ADJUST_INT_TEST_HD.DESCRIPTION"/>
        <bm:field name="adjust_date" databaseType="DATE" datatype="java.util.Date"/>
        <bm:field name="approval_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPROVAL_STATUS" prompt="CON_BATCH_ADJUST_INT_TEST_HD.APPROVAL_STATUS"/>
        <bm:field name="approval_status_n" expression="decode(t1.approval_status,&apos;NEW&apos;,&apos;未结算&apos;,&apos;已计算&apos;)" forInsert="false" forUpdate="false" prompt="CON_BATCH_ADJUST_INT_TEST_HD.APPROVAL_STATUS"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="batch_hd_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter name="document_category" expression="t1.document_category !=&apos;LOAN_CONTRACT&apos; or t1.document_category is null"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field field="batch_hd_id" queryExpression="t1.batch_hd_id=${@batch_hd_id}"/>
        <bm:query-field field="batch_num" queryExpression="t1.batch_num=${@batch_num}"/>
        <bm:query-field field="approval_status" queryExpression="t1.approval_status=${@approval_status}"/>
        <bm:query-field field="description" queryExpression="t1.description=${@description}"/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
    begin
  -- Call the procedure
  hn_con_batch_adj_int_test_pkg.batch_adjust_interest_hd_save(p_batch_hd_id => ${@batch_hd_id},
                                                              p_description => ${@description},
                                                              p_adjust_date => to_date(${@adjust_date},'yyyy-mm-dd'),
                                                              p_company_id => ${/session/@company_id},
                                                              p_user_id => ${/session/@user_id});
end;  
]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[begin
  -- Call the procedure
  hn_con_batch_adj_int_test_pkg.batch_adjust_interest_hd_save(p_batch_hd_id => ${@batch_hd_id},
                                                              p_description => ${@description},
                                                              p_adjust_date => to_date(${@adjust_date},'yyyy-mm-dd'),
                                                              p_company_id => ${/session/@company_id},
                                                              p_user_id => ${/session/@user_id});
end;
       
]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
begin
  -- Call the procedure
  hn_con_batch_adj_int_test_pkg.delete_adjust_test_result(p_batch_hd_id => ${@batch_hd_id},
                                                     p_user_id => ${/session/@user_id});
end;

            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
            begin
            
            	hn_con_batch_adj_int_test_pkg.con_floating_rate_adj_test(p_batch_hd_id => ${@batch_hd_id},
                                                          p_company_id => ${/session/@company_id},
                                                           p_user_id => ${/session/@user_id});
                                                           
            end;
]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
