csh_write_off.lwm 9.58 KB
Newer Older
高泉铭's avatar
高泉铭 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features">
    <bm:operations>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
                begin
                csh_transaction_interface_pkg.delete_write_off_interface(
                p_write_off_interface_id=>${@write_off_interface_id},
                p_user_id => ${/session/@user_id}
                );
                end;
                ]]>
            </bm:update-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
                begin
                -- Call the procedure
                csh_transaction_interface_pkg.insert_write_off_interface(p_write_off_interface_id =>
                ${@write_off_interface_id},
                p_record_type => ${@record_type},
                p_transaction_id => ${@trx_interface_id},
                p_company_id => ${@company_id},
                p_contract_number => ${@contract_number},
                p_contract_id => ${@contract_id},
                p_write_off_type => ${@write_off_type},
                p_write_off_date => to_date(${@write_off_date},'yyyy-mm-dd'),
                p_write_off_period_name => ${@write_off_period_name},
                p_write_off_period_num => ${@write_off_period_num},
                p_write_off_amount => ${@write_off_amount},
                p_write_off_bp_id => ${@write_off_bp_id},
                p_batch_id => ${@batch_id},
                p_write_off_cashflow_id => ${@write_off_cashflow_id},
                p_write_off_times => ${@write_off_times},
                p_write_off_cf_item => ${@write_off_cf_item},
                p_write_off_principal => ${@write_off_principal},
                p_write_off_interest => ${@write_off_interest},
                p_write_off_description => ${@write_off_description},
                p_post_flag => ${@post_flag},
                p_write_off_classification => ${@write_off_classification},
                p_journal_date => to_date(${@journal_date},'yyyy-mm-dd'),
                p_user_id => ${/session/@user_id});
                end;
                ]]>
            </bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                begin
                -- Call the procedure
                csh_transaction_interface_pkg.insert_write_off_interface(p_write_off_interface_id =>
                ${@write_off_interface_id},
                p_record_type => ${@record_type},
                p_transaction_id => ${@trx_interface_id},
                p_company_id => ${@company_id},
                p_contract_number => ${@contract_number},
                p_contract_id => ${@contract_id},
                p_write_off_type => ${@write_off_type},
                p_write_off_date => to_date(${@write_off_date},'yyyy-mm-dd'),
                p_write_off_period_name => ${@write_off_period_name},
                p_write_off_period_num => ${@write_off_period_num},
                p_write_off_amount => ${@write_off_amount},
                p_write_off_bp_id => ${@write_off_bp_id},
                p_batch_id => ${@batch_id},
                p_write_off_cashflow_id => ${@write_off_cashflow_id},
                p_write_off_times => ${@write_off_times},
                p_write_off_cf_item => ${@write_off_cf_item},
                p_write_off_principal => ${@write_off_principal},
                p_write_off_interest => ${@write_off_interest},
                p_write_off_description => ${@write_off_description},
                p_post_flag => ${@post_flag},
                p_write_off_classification => ${@write_off_classification},
                p_journal_date => to_date(${@journal_date},'yyyy-mm-dd'),
                p_user_id => ${/session/@user_id});
                end;
                ]]>
            </bm:update-sql>
        </bm:operation>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                select * from (
                select write_off_id,
                       (select company_id from csh_transaction where transaction_id = t1.csh_transaction_id) company_id,
                       t1.csh_transaction_id transaction_id,
                       (select contract_number from con_contract where contract_id = t1.contract_id) contract_number,
                       contract_id,
                       cashflow_id write_off_cashflow_id,
                       (select a.due_date from con_contract_cashflow a where a.cashflow_id = t1.cashflow_id) due_date,
                       write_off_date,
                       write_off_type,
                       period_name write_off_period_name,
                       t1.INTERNAL_PERIOD_NUM write_off_period_num,
                       times write_off_times,
                       cf_item write_off_cf_item,
                       (select a.cf_item_desc from hls_cashflow_item_v a where a.cf_item = t1.cf_item) write_off_cf_item_desc,
                       t1.WRITE_OFF_DUE_AMOUNT write_off_amount,
                       t1.WRITE_OFF_PRINCIPAL,
                       t1.WRITE_OFF_INTEREST,
Darming's avatar
Darming committed
99 100
                       (select principal from con_contract_cashflow where cashflow_id = t1.cashflow_id) principal,
                       (select interest from con_contract_cashflow where cashflow_id = t1.cashflow_id) interest,
101 102 103 104 105 106
                       (select decode(cf_item, 9,
                                      CON_OVERDUE_PENALTY_PKG.CALC_PENALTY_FOR_WRITE_OFF(p_cashflow_id=>t1.cashflow_id,
                                                                                         p_calc_date=>to_date(${@transaction_date}, 'yyyy-mm-dd'),
                                                                                         p_user_id=>${/session/@user_id},
                                                                                         p_penalty_flag=>'Y'),
                                      due_amount) from con_contract_cashflow where cashflow_id = t1.cashflow_id) due_amount,
107
                       (select bp_name from hls_bp_master h,con_contract c where h.bp_id = c.bp_id_tenant and c.contract_id = t1.contract_id) bp_tenant_name
高泉铭's avatar
高泉铭 committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
                       from csh_write_off t1) t
                       #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"
                  prompt="CSH_WRITE_OFF.COMPANY_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CONTRACT_NUMBER" prompt="合同编号"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID"
                  prompt="CSH_WRITE_OFF.CONTRACT_ID"/>
        <bm:field name="write_off_cashflow_id" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="WRITE_OFF_CASHFLOW_ID" prompt="CSH_WRITE_OFF.WRITE_OFF_CASHFLOW_ID"/>
        <bm:field name="due_date" datatype="java.util.Date" forInsert="false" forUpdate="false"/>
        <bm:field name="write_off_type" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="WRITE_OFF_TYPE" prompt="CSH_WRITE_OFF.WRITE_OFF_TYPE"/>
        <bm:field name="write_off_date" databaseType="DATE" datatype="java.util.Date" physicalName="WRITE_OFF_DATE"
                  prompt="CSH_WRITE_OFF.WRITE_OFF_DATE"/>
        <bm:field name="write_off_period_name" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="WRITE_OFF_PERIOD_NAME" prompt="CSH_WRITE_OFF.WRITE_OFF_PERIOD_NAME"/>
        <bm:field name="write_off_period_num" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="WRITE_OFF_PERIOD_NUM" prompt="CSH_WRITE_OFF.WRITE_OFF_PERIOD_NUM"/>
        <bm:field name="write_off_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_TIMES"
                  prompt="CSH_WRITE_OFF.WRITE_OFF_TIMES"/>
        <bm:field name="write_off_cf_item" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="WRITE_OFF_CF_ITEM" prompt="CSH_WRITE_OFF.WRITE_OFF_CF_ITEM"/>
        <bm:field name="write_off_cf_item_desc" forInsert="false" forUpdate="false"/>
        <bm:field name="write_off_amount" databaseType="NUMBER" datatype="java.lang.Double"
                  physicalName="WRITE_OFF_AMOUNT" prompt="核销金额"/>
        <!--        <bm:field name="write_off_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_PRINCIPAL" prompt="CSH_WRITE_OFF.WRITE_OFF_PRINCIPAL"/>-->
        <!--        <bm:field name="write_off_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_INTEREST" prompt="CSH_WRITE_OFF.WRITE_OFF_INTEREST"/>-->
        <!--        <bm:field name="write_off_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_DESCRIPTION" prompt="CSH_WRITE_OFF.WRITE_OFF_DESCRIPTION"/>-->
        <bm:field name="write_off_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_ID"
                  prompt="CSH_WRITE_OFF.WRITE_OFF_ID"/>
        <bm:field name="transaction_id"/>
        <bm:field name="bp_tenant_name"/>
Darming's avatar
Darming committed
145 146 147
        <bm:field name="principal"/>
        <bm:field name="interest"/>
        <bm:field name="due_amount"/>
高泉铭's avatar
高泉铭 committed
148 149 150 151
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="transaction_id" queryOperator="="/>
    </bm:query-fields>
高泉铭's avatar
高泉铭 committed
152 153 154
    <bm:data-filters>
        <bm:data-filter name="query" expression="t.contract_id is not null"/>
    </bm:data-filters>
高泉铭's avatar
高泉铭 committed
155
</bm:model>