con_cashflow_info.lwm 2.48 KB
Newer Older
chenzhuo's avatar
chenzhuo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="times"/>
        <bm:field name="due_year"/>
        <bm:field name="due_date"/>
        <bm:field name="cf_item"/>
        <bm:field name="due_amount"/>
        <bm:field name="received_amount"/>
        <bm:field name="cf_status"/>
        <bm:field name="cf_status_n"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                  select cc.times, --期数
                         to_char(cc.due_date, 'YYYY') due_year, --支付年
chenzhuo's avatar
chenzhuo committed
18
                         to_char(cc.due_date, 'MM-dd') due_date, --支付日期
chenzhuo's avatar
chenzhuo committed
19 20 21 22 23 24
                         (select h.description  from hls_cashflow_item h
                         where h.cf_item = cc.cf_item
                         and h.enabled_flag = 'Y'
                         and rownum =1) cf_item, --项目
                         to_char(nvl(cc.due_amount, 0),
                                 'FM9,999,999,999,990.00') due_amount, --应付金额
chenzhuo's avatar
chenzhuo committed
25
                         to_char(nvl(cc.due_amount, 0)-nvl(cc.received_amount, 0),
chenzhuo's avatar
chenzhuo committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
                                 'FM9,999,999,999,990.00') received_amount, --已付金额
                          (case
                           when cc.write_off_flag = 'FULL' then
                            'PAID'
                           when cc.overdue_status = 'Y' then
                            'OVERDUE'
                           else
                            'TOPAY'
                         end) as cf_status,
                         (case
                           when cc.write_off_flag = 'FULL' then
                            '已支付'
                           when cc.overdue_status = 'Y' then
                            '已逾期'
                           else
                            '待支付'
                         end) as cf_status_n --支付状态
                    from con_contract_cashflow cc
                    where cc.contract_id = ${@contract_id}
chenzhuo's avatar
chenzhuo committed
45
                    and ((cc.cf_type = 1 and cc.cf_item in (1,200,250)) or (cc.cf_item = 11 and cc.cf_type =11)
chenzhuo's avatar
chenzhuo committed
46 47 48
                    or (cc.cf_item = 8 and cc.cf_type = 8) or (cc.cf_item = 9 and cc.cf_type = 9))
                    and cc.cf_direction = 'INFLOW'
                    and cc.cf_status = 'RELEASE'
chenzhuo's avatar
chenzhuo committed
49
                    order by cc.cf_item,cc.times
chenzhuo's avatar
chenzhuo committed
50 51 52 53
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>