acr_invoice_query.lwm 6.51 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-17 下午06:23:23  
    $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.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.invoice_title,
				       t1.vat_interface_status,
				       t1.vat_interface_status_desc,
				       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,
				       to_char(t1.express_date, 'yyyy-mm-dd') express_date,
				       t1.express_status,
				       t1.express_status_desc,
				       t1.express_num,
				       t1.express_company,
				       t1.express_by,
				       t1.express_note,
				       t1.express_by_name,
				       t1.confirmed_by,
				       t1.confirmed_by_name,
				       t1.CREATE_JE_FLAG,
				       t1.reversed_flag,
				       t1.reversed_flag_desc,
				       t1.source_document_number,
				       t1.receipt_print_status,
				       t1.receipt_number,
				       decode(t1.receipt_print_status,'Y','已打印','未打印') receipt_print_status_des,
				       to_char(t1.last_receipt_print_time, 'yyyy-mm-dd') as last_receipt_print_time,
				       t1.vat_invoice_code
				  FROM acr_invoice_hd_v t1
                #WHERE_CLAUSE#
                order by t1.invoice_date desc , t1.document_number desc
            ]]></bm:query-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="project_number_f" queryExpression="t1.project_number &gt;= ${@project_number_f}"/>
        <bm:query-field name="project_number_t" queryExpression="t1.project_number &lt;= ${@project_number_t}"/>
        <bm:query-field name="contract_number_f" queryExpression="t1.contract_number &gt;= ${@contract_number_f}"/>
        <bm:query-field name="contract_number_t" queryExpression="t1.contract_number &lt;= ${@contract_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}"/>
        <bm:query-field name="invoice_bp_code_f" queryExpression="t1.invoice_bp_code &gt;= ${@invoice_bp_code_f}"/>
        <bm:query-field name="invoice_bp_code_t" queryExpression="t1.invoice_bp_code &lt;= ${@invoice_bp_code_t}"/>
        <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}"/>
        <bm:query-field name="reversed_flag" queryExpression="t1.reversed_flag = ${@reversed_flag}"/>
        <bm:query-field name="receipt_print_status" queryExpression="nvl(t1.receipt_print_status,&apos;N&apos;) = ${@receipt_print_status}"/>
        <!-- <bm:query-field name="query_contract_number" queryExpression="exists     (select 1            from hls_document_flow_all_v df, con_contract cc           where df.contract_id = cc.contract_id             and df.ar_invoice_hd_id = t1.invoice_hd_id             and cc.contract_number between nvl(${@contract_number_f}, cc.contract_number) and nvl(${@contract_number_t}, cc.contract_number))"/>
        <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-filters>
</bm:model>