<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-11-6 下午02:26:55  
    $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 c.check_id,
               a.file_name,
               a.file_path,
               i.description,
               a.file_type_code,
               r.document_id,
               t.TAB_CODE,
               upper(r.document_table) document_table
          FROM prj_cdd_item_check       c,
               prj_cdd_item_doc_ref     r,
               fnd_atm_attachment_multi m,
               fnd_atm_attachment       a,
               prj_cdd_item             i,
               hls_doc_layout_tab       t
         WHERE a.attachment_id = m.attachment_id
           AND m.table_pk_value = TO_CHAR(c.check_id)
           AND r.check_id = c.check_id
           AND a.file_type_code IN ('jpg', 'jpeg', 'bmp', 'gif','png')
           and i.cdd_item_id = c.cdd_item_id
           and i.project_tab_group = t.attachment_tab_group
           and t.layout_code = 'PROJECT_MODIFY'
           and t.TAB_CODE in ('C_TENANT_BASIC_INFO',
                              'C_HIST_EVOLUTION',
                              'C_STOCK_STRUCTURE',
                              'C_ORG_STRUCTURE',
                              'C_TRANSACTOR',
                              'C_OTHERS',
                              'C_MANAGEMENT',
                              'C_FIN_STATEMENT',
                              
                              'C_BASIC_INFO_G',
                              'C_HIST_EVOLUTION_G',
                              'C_STOCK_STRUCTURE_G',
                              'C_ORG_STRUCTURE_G',
                              'C_TRANSACTOR_G',
                              'C_OTHERS_G',
                              'C_MANAGEMENT_G',
                              'C_FIN_STATEMENT_G')) t1
 WHERE t1.document_id in
       (select t.prj_bp_id from prj_project_bp t where t.project_id = ${@project_id})
   and t1.document_table = 'PRJ_PROJECT_BP'
   order by t1.check_id
              
              
              ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
