<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2015-9-4 下午3:48:17  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="BGFL_ACP_INVOICE_IPT" defaultOrderBy="line_number">
    <bm:fields>
        <bm:field name="ipt_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="IPT_ID" prompt="BGFL_ACP_INVOICE_IPT.IPT_ID"/>
        <bm:field name="batch_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BATCH_ID" prompt="BGFL_ACP_INVOICE_IPT.BATCH_ID"/>
        <bm:field name="line_number" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LINE_NUMBER" prompt="序号"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" prompt="合同号"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME" prompt="合同名称"/>
        <bm:field name="cf_item_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_ITEM_DESC" prompt="应付项目"/>
        <bm:field name="times" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TIMES" prompt="期数"/>
        <bm:field name="product_name_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRODUCT_NAME_DESC" prompt="发票内容"/>
        <bm:field name="invoice_kind_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_KIND_DESC" prompt="发票种类"/>
        <bm:field name="invoice_date_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_DATE_DESC" prompt="发票日期"/>
        <bm:field name="accounting_date_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ACCOUNTING_DATE_DESC" prompt="记账日期"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME" prompt="销方对象"/>
        <bm:field name="billing_amount" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BILLING_AMOUNT" prompt="开票金额"/>
        <bm:field name="note" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTE" prompt="备注"/>
        <bm:field name="import_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="IMPORT_FLAG" prompt="导入标志"/>
        <bm:field name="import_message" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="IMPORT_MESSAGE" prompt="错误消息"/>
        <bm:field name="match_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MATCH_FLAG" prompt="匹配标志"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="BGFL_ACP_INVOICE_IPT.CONTRACT_ID"/>
        <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID" prompt="BGFL_ACP_INVOICE_IPT.CASHFLOW_ID"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="BGFL_ACP_INVOICE_IPT.BP_ID"/>
        <bm:field name="product_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRODUCT_NAME" prompt="BGFL_ACP_INVOICE_IPT.PRODUCT_NAME"/>
        <bm:field name="invoice_kind" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_KIND" prompt="BGFL_ACP_INVOICE_IPT.INVOICE_KIND"/>
        <bm:field name="invoice_date" databaseType="DATE" datatype="java.util.Date" physicalName="INVOICE_DATE" prompt="BGFL_ACP_INVOICE_IPT.INVOICE_DATE"/>
        <bm:field name="accounting_date" databaseType="DATE" datatype="java.util.Date" physicalName="ACCOUNTING_DATE" prompt="BGFL_ACP_INVOICE_IPT.ACCOUNTING_DATE"/>
        <bm:field name="invoice_code"/>
        <bm:field name="invoice_number"/>
    </bm:fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.batch_id = ${@batch_id}"/>
        <bm:data-filter enforceOperations="query" expression="t1.import_flag = &apos;N&apos;"/>
    </bm:data-filters>
    <bm:operations>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
	    	
	    		begin
				  -- Call the procedure
				  bgfl_acp_invoice_ipt_pkg.execute_import(p_batch_id => ${@batch_id},
				                                          p_user_id => ${/session/@user_id});
				end;
	    	
    	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
	    	
	    		begin
				  -- Call the procedure
				  bgfl_acp_invoice_ipt_pkg.execute_create(p_batch_id => ${@batch_id},
				                                          p_session_id => ${/session/@session_id},
				                                          p_company_id => ${/session/@company_id},
				                                          p_role_id => ${/session/@role_id},
				                                          p_user_id => ${/session/@user_id});
				end;
	    	
    	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
