audi_deposit_document.lwm 7.98 KB
Newer Older
Spencer Chang's avatar
Spencer Chang 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 99 100 101 102 103 104 105 106 107 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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-2-6 上午10:08:06  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
       select t1.* from     
       (SELECT t.contract_id,
       (SELECT A.BP_NAME FROM HLS_BP_MASTER A 
       WHERE A.BP_ID=T.BP_ID_TENANT) TENANT_NAME,
       t.bp_id_tenant,
       t.contract_number,
       de.item_frame_number item_frame_number_1,
       'SYLC' partner_code,
       (SELECT b.bp_code
          FROM con_contract_bp a,
               hls_bp_master   b
         WHERE a.contract_id = t.contract_id
               AND a.bp_category = 'AGENT'
               AND b.bp_id = a.bp_id) agent_code,
       (SELECT b.bp_name
          FROM con_contract_bp a,
               hls_bp_master   b
         WHERE a.contract_id = t.contract_id
               AND a.bp_category = 'AGENT'
               AND b.bp_id = a.bp_id) agent_name,
       '01' brand_code,
       'T' special_flag,
       'S05' special_approved_flag,
       prj.creation_date prj_creation_date,
		t.creation_date con_creation_date,
       '' reject_date,
       '' cancel_date,
       (SELECT ca.full_write_off_date
          FROM con_contract_cashflow ca
         WHERE ca.contract_id = t.contract_id
               AND ca.cf_item = 109
               AND ca.cf_type = 109
               AND ca.write_off_flag = 'FULL') payment_completed_date,
       decode(t.lease_term,
              1,
              '0',
              2,
              '0.065000',
              3,
              '0.090000') customer_rate,
       decode(nvl(t.lease_charge_ratio,
                  0),
              0,
              '0',
              to_char(nvl(t.lease_charge_ratio,
                          0),
                      '0.999999')) lease_charge_ratio,
       decode(nvl(t.lease_charge,
                  0),
              0,
              '0',
              to_char(nvl(t.lease_charge,
                          0),
                      '99999999999.999999')) lease_charge,
       to_char(t.hd_user_col_n07,
               '0.999999') return_value_ratio,
       to_char(t.hd_user_col_n02,
               '99999999.99') return_value,
       to_char(t.other_fee,
               '99999999.99') other_fee,
       to_char(t.finance_amount,
               '99999999.99') finance_amount,
       decode(nvl(t.down_payment_ratio,
                  0),
              0,
              '0',
              to_char(nvl(t.down_payment_ratio,
                          0),
                      '0.9999')) down_payment_ratio,
       decode(nvl(t.down_payment,
                  0),
              0,
              '0',
              to_char(nvl(t.down_payment,
                          0),
                      '999999999.99')) down_payment,
       decode(nvl(t.deposit_ratio,
                  0),
              0,
              '0',
              to_char(nvl(t.deposit_ratio,
                          0),
                      '0.9999')) deposit_ratio,
       decode(nvl(t.deposit,
                  0),
              0,
              '0',
              to_char(nvl(t.deposit,
                          0),
                      '999999999.99')) deposit,
       '0' end_value_ratio,
       '1' end_value,
       t.lease_times,
       (SELECT a.code_value_name
          FROM sys_code_values_v a
         WHERE a.code = 'HLS500_ANNUAL_PAY_TIMES'
               AND a.code_value = t.annual_pay_times) annual_pay_times_n,
       (SELECT COUNT(1)
          FROM con_contract_cashflow ca
         WHERE ca.cf_item = 1
               AND ca.cf_type = 1
               AND times <> 0
               AND ca.write_off_flag = 'FULL'
               AND ca.contract_id = t.contract_id) paid_times,
       '期先付' rentail_pay_type,
       to_char(t.pmt_first,
               '99999999.99') pmt_first,
       to_char(t.total_rental,
               '99999999.99') total_rental,
       decode(t.business_type,
              'LEASE',
              '正租业务',
              '售后回租业务') business_type,
       decode(t.hd_user_col_v01,
              '10',
              '否',
              '是') out_finance,
       t.lease_term,
       decode(nvl(t.insurance_fee,
                  0),
              0,
              '0.00',
              to_char(nvl(t.insurance_fee,
                          0),
                      '99999999.99')) insurance_fee,
       decode(nvl(t.other_fee3,
                  0),
              0,
              '0.00',
              to_char(nvl(t.other_fee3,
                          0),
                      '99999999.99')) other_fee3,
       decode(nvl(t.hd_user_col_n05,
                  0),
              0,
              '0.00',
              to_char(nvl(t.hd_user_col_n05,
                          0),
                      '99999999.99')) license_value,
       '0.00' fee_1,
       '0.00' fee_2,
       '0.00' fee_3,
       '0.00' fee_4,
       '0.00' fee_5,
       to_char(t.contract_amount,
               '999999999.99') contract_amount,
       '期末退还客户' deposit_return_type,
       '客户留购' residual_type,
       (SELECT A.INVOICE_DATE FROM 
           acp_invoice_hd a,
               acp_invoice_ln b
         WHERE a.invoice_hd_id = b.invoice_header_id
               AND b.cf_type = 109
               and b.cf_item=109
               and a.reversed_flag='N'
               AND a.contract_id = t.contract_id) invoice_date,
       (SELECT decode(bp.bp_class,
                      'ORG',
                      '机构',
                      'NP',
                      '个人')
          FROM hls_bp_master bp
         WHERE bp.bp_id = t.bp_id_tenant) bp_category,
       (SELECT v.code_value_name
          FROM hls_bp_master     bp,
               sys_code_values_v v
         WHERE bp.bp_id = t.bp_id_tenant
               AND bp.bp_class = 'ORG'
               AND v.code = 'PRJ_BP_PROPERTY'
               AND v.code_value = bp.bp_property) bp_property,
       de.item_frame_number item_frame_number_2,
       t.price_list
  FROM prj_project              prj,
       con_contract             t,
       con_contract_lease_item  it,
       con_contract_item_detail de
 WHERE t.data_class = 'NORMAL'
       AND prj.project_id = t.project_id
       AND t.contract_id = it.contract_id
       AND it.contract_lease_item_id = de.contract_lease_item_id
       AND t.contract_status IN ('INCEPT')
       AND t.hd_user_col_n02 is not null
       )t1 #WHERE_CLAUSE#
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="bp_id" queryExpression="t1.bp_id_tenant = ${@bp_id}"/>
        <bm:query-field name="price_list" queryExpression="t1.price_list = ${@price_list}"/>
        <bm:query-field name="agent_name" queryExpression="t1.agent_name like ${@agent_name}"/>
        <bm:query-field name="contract_number" queryExpression="t1.contract_number like ${@contract_number}"/>
        <bm:query-field name="item_frame_number" queryExpression="t1.item_frame_number_2 like ${@item_frame_number}"/>
        <bm:query-field name="prj_creation_date_from" queryExpression="t1.prj_creation_date &gt;=trunc( to_date(${@prj_creation_date_from},&apos;yyyy-mm-dd&apos;))"/>
        <bm:query-field name="prj_creation_date_to" queryExpression="t1.prj_creation_date &lt;= to_date(${@prj_creation_date_to},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="payment_completed_date_from" queryExpression="t1.payment_completed_date &gt;=trunc(to_date(${@payment_completed_date_from},&apos;yyyy-mm-dd&apos;))"/>
        <bm:query-field name="payment_completed_date_to" queryExpression="t1.payment_completed_date &lt;=to_date( ${@payment_completed_date_to},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="invoice_date_from" queryExpression="t1.invoice_date &gt;=trunc(to_date(${@invoice_date_from},&apos;yyyy-mm-dd&apos;))"/>
        <bm:query-field name="invoice_date_to" queryExpression="t1.invoice_date &lt;=to_date( ${@invoice_date_to},&apos;yyyy-mm-dd&apos;)"/>
    </bm:query-fields>
</bm:model>