acr_invoice_reverse.lwm 5.95 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-18 上午09:32:02  
    $Revision: 1.0  
    $Purpose: 
-->
lijingjing's avatar
lijingjing committed
8

lijingjing's avatar
lijingjing committed
9 10


Spencer Chang's avatar
Spencer Chang committed
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
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT t1.invoice_hd_id,
				       t1.document_number,
				       TO_CHAR(t1.invoice_date, 'yyyy-mm-dd') as invoice_date,
				       t1.document_category,
				       t1.contract_id,
				       t1.contract_number,
				       t1.contract_name,
				       t1.project_id,
				       t1.project_number,
				       t1.project_name,
				       t1.invoice_bp_id,
				       t1.invoice_bp_code,
				       t1.invoice_bp_name,
				       t1.vat_interface_status,
				       t1.vat_interface_status_desc,
				       t1.invoice_title,
				       t1.invoice_number,
				       t1.invoice_status,
				       t1.invoice_status_desc,
				       t1.currency,
				       t1.business_type,
				       t1.business_type_desc,
				       t1.invoice_kind,
				       t1.invoice_kind_desc,
				       t1.document_type,
				       t1.created_by_name,
				       t1.created_by,
				       to_char(t1.accounting_date, 'yyyy-mm-dd') as accounting_date,
				       t1.total_amount,
				       t1.tax_amount,
				       t1.billing_method,
				       t1.lease_organization,
				       t1.lease_channel,
				       t1.division,
				       t1.company_id,
				       t1.confirmed_by,
				       t1.confirmed_by_name,
				       t1.CREATE_JE_FLAG,
				       t1.vat_red_notice_num,
lijingjing's avatar
lijingjing committed
54
				       to_char(sysdate,'yyyy-mm-dd') as reverse_date
Spencer Chang's avatar
Spencer Chang committed
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
				  FROM acr_invoice_hd_v t1
                    #WHERE_CLAUSE#
                ORDER BY t1.invoice_date desc , t1.document_number desc
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                BEGIN
                    acr_invoice_pkg.reverse_invoice(p_invoice_hd_id 		=> ${@invoice_hd_id},
								                    p_reverse_date 			=> to_date(${@reverse_date},'yyyy-mm-dd'), 
								                    p_vat_red_notice_num	=> ${@vat_red_notice_num},
								                    p_user_id 				=> ${/session/@user_id}, 
								                    p_role_id 				=> ${/session/@role_id});
                END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="document_number_f" queryExpression="t1.document_number &gt;= ${@document_number_f}"/>
        <bm:query-field name="document_number_t" queryExpression="t1.document_number &lt;= ${@document_number_t}"/>
        <bm:query-field name="invoice_number_f" queryExpression="t1.invoice_number &gt;= ${@invoice_number_f}"/>
        <bm:query-field name="invoice_number_t" queryExpression="t1.invoice_number &lt;= ${@invoice_number_t}"/>
        <bm:query-field name="invoice_date_f" queryExpression="t1.invoice_date &gt;= to_date(${@invoice_date_f},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="invoice_date_t" queryExpression="t1.invoice_date &lt;= to_date(${@invoice_date_t},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="accounting_date_f" queryExpression="t1.accounting_date &gt;= to_date(${@accounting_date_f},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="accounting_date_t" queryExpression="t1.accounting_date &lt;= to_date(${@accounting_date_t},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="total_amount_f" queryExpression="t1.total_amount &gt;= ${@total_amount_f}"/>
        <bm:query-field name="total_amount_t" queryExpression="t1.total_amount &lt;= ${@total_amount_t}"/>
83 84
        <bm:query-field name="invoice_bp_code" queryExpression="t1.invoice_bp_code= ${@invoice_bp_code}"/>
        <!--<bm:query-field name="invoice_bp_code_t" queryExpression="t1.invoice_bp_code &lt;= ${@invoice_bp_code_t}"/>-->
Spencer Chang's avatar
Spencer Chang committed
85 86 87 88 89 90 91 92 93 94
        <bm:query-field name="currency" queryExpression="t1.currency = ${@currency}"/>
        <bm:query-field name="invoice_status" queryExpression="t1.invoice_status = ${@invoice_status}"/>
        <bm:query-field name="vat_interface_status" queryExpression="t1.vat_interface_status = ${@vat_interface_status}"/>
        <bm:query-field name="business_type" queryExpression="t1.business_type = ${@business_type}"/>
        <bm:query-field name="invoice_kind" queryExpression="t1.invoice_kind = ${@invoice_kind}"/>
        <bm:query-field name="invoice_title" queryExpression="t1.invoice_title like ${@invoice_title}"/>
        <bm:query-field name="created_by" queryExpression="t1.created_by = ${@created_by}"/>
        <bm:query-field name="received_flag" queryExpression="(nvl(t1.express_status,&apos;UNDELIVERED&apos;) !=&apos;RECEIVED&apos; or ${@received_flag}=&apos;Y&apos;)"/>
        <bm:query-field name="express_status" queryExpression="t1.express_status = ${@express_status}"/>
        <bm:query-field name="confirmed_by" queryExpression="t1.confirmed_by = ${@confirmed_by}"/>
lijingjing's avatar
lijingjing committed
95
        <bm:query-field name="query_contract_number" queryExpression="exists     (select 1            from  con_contract cc           where t1.contract_id = cc.contract_id         and cc.contract_number between nvl(${@contract_number_f}, cc.contract_number) and nvl(${@contract_number_t}, cc.contract_number))"/>
Spencer Chang's avatar
Spencer Chang committed
96 97 98 99 100 101 102 103
        <bm:query-field name="query_project_number" queryExpression="exists     (select 1           from hls_document_flow_all_v df, prj_project pp          where df.ar_invoice_hd_id = t1.invoice_hd_id            and df.project_id = pp.project_id            and pp.project_number between nvl(${@project_number_f}, pp.project_number) and nvl(${@project_number_t}, pp.project_number))"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.company_id = ${/session/@company_id}"/>
        <bm:data-filter enforceOperations="query" expression="t1.reversed_flag = &apos;N&apos;"/>
        <bm:data-filter enforceOperations="query" expression="t1.invoice_status IN (&apos;CONFIRM&apos;, &apos;POST&apos;)"/>
    </bm:data-filters>
</bm:model>