<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2016-5-13 上午10:51:30  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="REG_SETTLEMENT_LV" defaultOrderBy="t1.contract_status asc,t1.contract_number asc">
    <bm:fields>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" prompt="REG_SETTLEMENT_LV.CONTRACT_NUMBER"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER" prompt="REG_SETTLEMENT_LV.PROJECT_NUMBER"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="REG_SETTLEMENT_LV.CONTRACT_ID"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID" prompt="REG_SETTLEMENT_LV.PROJECT_ID"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME" prompt="REG_SETTLEMENT_LV.CONTRACT_NAME"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME" prompt="REG_SETTLEMENT_LV.BP_NAME"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE" prompt="REG_SETTLEMENT_LV.BUSINESS_TYPE"/>
        <bm:field name="business_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE_DESC" prompt="REG_SETTLEMENT_LV.BUSINESS_TYPE_DESC"/>
        <bm:field name="invoice_agent" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INVOICE_AGENT" prompt="REG_SETTLEMENT_LV.INVOICE_AGENT"/>
        <bm:field name="invoice_agent_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_AGENT_DESC" prompt="REG_SETTLEMENT_LV.INVOICE_AGENT_DESC"/>
        <bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION" prompt="REG_SETTLEMENT_LV.DIVISION"/>
        <bm:field name="division_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION_DESC" prompt="REG_SETTLEMENT_LV.DIVISION_DESC"/>
        <bm:field name="bp_class_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_DESC" prompt="REG_SETTLEMENT_LV.BP_CLASS_DESC"/>
        <bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS" prompt="REG_SETTLEMENT_LV.CONTRACT_STATUS"/>
        <bm:field name="contract_status_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS_N" prompt="REG_SETTLEMENT_LV.CONTRACT_STATUS_N"/>
        <bm:field name="archive_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ARCHIVE_STATUS" prompt="REG_SETTLEMENT_LV.ARCHIVE_STATUS"/>
        <bm:field name="archive_status_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ARCHIVE_STATUS_N" prompt="REG_SETTLEMENT_LV.ARCHIVE_STATUS_N"/>
        <bm:field name="reg_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REG_STATUS" prompt="REG_SETTLEMENT_LV.REG_STATUS"/>
        <bm:field name="reg_status_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REG_STATUS_N" prompt="REG_SETTLEMENT_LV.REG_STATUS_N"/>
        <bm:field name="docu_number_reg" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCU_NUMBER_REG" prompt="REG_SETTLEMENT_LV.DOCU_NUMBER_REG"/>
        <bm:field name="docu_number_archive" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCU_NUMBER_ARCHIVE" prompt="REG_SETTLEMENT_LV.DOCU_NUMBER_ARCHIVE"/>
        <bm:field name="storage_archive" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STORAGE_ARCHIVE" prompt="REG_SETTLEMENT_LV.STORAGE_ARCHIVE"/>
        <bm:field name="storage_reg" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STORAGE_REG" prompt="REG_SETTLEMENT_LV.STORAGE_REG"/>
        <bm:field name="problem_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROBLEM_FLAG" prompt="REG_SETTLEMENT_LV.PROBLEM_FLAG"/>
        <bm:field name="problem_flag_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select v.code_value_name as value_name from sys_code_values_v v where v.code = &apos;FINISH_FLAG&apos; and v.code_value= t1.problem_flag)"/>
        <bm:field name="id_card_no"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <bm:query-field name="project_number" queryExpression="t1.project_number like upper(&apos;%&apos;||${@project_number}||&apos;%&apos;)"/>
        <bm:query-field name="contract_number" queryExpression="t1.contract_number like &apos;%&apos;||${@contract_number}||&apos;%&apos;"/>
        <!--  <bm:query-field name="contract_number" queryExpression="t1.contract_number like upper(&apos;%&apos;||${@contract_number}||&apos;%&apos;)"/> -->
        <bm:query-field name="bp_name" queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
        <bm:query-field name="archive_status" queryExpression="t1.archive_status =${@archive_status}"/>
        <bm:query-field name="reg_status" queryExpression="t1.reg_status =${@reg_status}"/>
        <bm:query-field name="invoice_agent" queryExpression="t1.invoice_agent =${@invoice_agent}"/>
        <bm:query-field name="problem_flag" queryExpression="t1.problem_flag =${@problem_flag}"/>
        <bm:query-field name="contract_status" queryExpression="t1.contract_status =${@contract_status}"/>
        <!-- <bm:query-field name="contract_id"  queryExpression="t1.contract_id=${@contract_id}" /> -->
        <bm:query-field name="id_card_no" queryExpression="t1.id_card_no like upper(&apos;%&apos;||${@id_card_no}||&apos;%&apos;)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter name="contract_status" expression="t1.contract_status in (&apos;NEW&apos;,&apos;SIGN&apos;,&apos;TERMINATE&apos;,&apos;ET&apos;)"/>
        <bm:data-filter name="reg_status" expression="t1.reg_status!=&apos;50&apos;"/>
    </bm:data-filters>
    <bm:operations>
        <bm:operation name="update">
            <bm:query-sql><![CDATA[
               update con_contract  cc
               set cc.PROBLEM_FLAG = 'Y'  where  cc.contract_id= ${@contract_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
