<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2014-2-21 上午10:01:30  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="prj_cdd_terms_check_tabpannel_link_id" url="${/request/@context_path}/modules/prj/PRJ517/prj_cdd_terms_check_tabpannel.lview"/>
        <a:link id="prj_cdd_terms_check_select_link_id" url="${/request/@context_path}/modules/prj/PRJ517/prj_cdd_terms_check_select.lview"/>
        <a:link id="prj_cdd_terms_check_contract_detail_link_id" url="${/request/@context_path}/modules/prj/PRJ517/prj_cdd_terms_check_contract_detail.lview"/>
        <script type="text/javascript"><![CDATA[
            function prj_cdd_terms_check_query() {
                $('prj_cdd_terms_check_result_ds').query();
            }
            
            function prj_cdd_terms_check_select() {
                var record = $('prj_cdd_terms_check_result_ds').getSelected();
                if(Ext.isEmpty(record)){
                    return;
                }
                new Leaf.Window({
                    id: 'prj_cdd_terms_check_select_link_winid',
                    params: {
                        project_id: record[0].get('project_id'),
                        winid: 'prj_cdd_terms_check_select_link_winid'
                    },
                    url: $('prj_cdd_terms_check_select_link_id').getUrl(),
                    title: '${l:PRJ517.BP_MASTER_SELECT}',
                    width: 450,
                    height: 450
                });
            }
            
            function prj517_grid_terms_check(reocrd_id) {
                var record = $('prj_cdd_terms_check_result_ds').findById(reocrd_id);
                new Leaf.Window({
                    id: 'prj_cdd_terms_check_tabpannel_link_winid',
                    params: {
                        project_id: record.get('project_id'),
                        bp_id: record.get('bp_id'),
                        bp_category: record.get('bp_category'),
                        function_code: 'PRJ517',
                        winid: 'prj_cdd_terms_check_tabpannel_link_winid'
                    },
                    url: $('prj_cdd_terms_check_tabpannel_link_id').getUrl(),
                    title: '${l:PRJ517.CDD_TERMS_CHECK}',
                    fullScreen: true,
                    draggable: true
                });
            }
            
            function prj517_project_number_render(value, record, name) {
                return '<a href="javascript:prj517_grid_terms_check(' + record.id + ');">' + value + '</a>';
            }
            
            //显示项目下的合同
            
            
            function contract_name_show_renderer(value, record, name) {
                if (!Ext.isEmpty(record.get('project_id'))) {
                    return '<a href="javascript:open_contract_win(' + record.get('project_id') + ')">'+'${l:CON301.CONTRACT_DETAIL}'+'</a>';
                }
            }
            
            function open_contract_win(project_id) {
                new Leaf.Window({
                    id: 'contract_win_id',
                    title: '${l:CON301.CONTRACT_DETAIL}',
                    url: $('prj_cdd_terms_check_contract_detail_link_id').getUrl(),
                    params: {
                        'winid': 'contract_win_id',
                        'project_id': project_id
                    },
                    width:500,
                    height:300
                });
            }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=PROJECT&amp;function_code=PRJ517"/>
        <a:dataSets>
            <a:dataSet id="prj_cdd_terms_check_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="project_number" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="prj.PRJ501.prj_project_for_lov" lovWidth="500" title="HLS.PROJECT_NUMBER">
                        <a:mapping>
                            <a:map from="project_number" to="project_number"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="project_name"/>
                    <a:field name="not_project_status" defaultValue="REJECT"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="prj_cdd_terms_check_result_ds" autoPageSize="true" model="prj.PRJ501.prj_project_v" queryDataSet="prj_cdd_terms_check_query_ds" selectable="true" selectionModel="single">
                <a:events>
                    <a:event name="query" handler="aut_authority_list_validate_query"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="prj_cdd_terms_check_query" text="HLS.QUERY"/>
                <a:gridButton click="prj_cdd_terms_check_select" text="PRJ517.BP_MASTER_SELECT"/>
            </a:screenTopToolbar>
            <a:form column="2">
                <a:lov name="project_number" bindTarget="prj_cdd_terms_check_query_ds" prompt="HLS.PROJECT_NUMBER">
                    <a:events>
                        <a:event name="focus" handler="function(object){on_std_focus(object,&apos;PROJECT&apos;)}"/>
                    </a:events>
                </a:lov>
                <a:textField name="project_name" bindTarget="prj_cdd_terms_check_query_ds" prompt="HLS.PROJECT_NAME"/>
            </a:form>
            <a:grid id="prj_cdd_terms_check_grid_id" bindTarget="prj_cdd_terms_check_result_ds" marginHeight="240" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="project_number" prompt="PRJ501.PRJ_PROJECT.PROJECT_NO" renderer="prj517_project_number_render" width="120"/>
                    <a:column name="project_name" prompt="HLS.PROJECT_NAME" width="250"/>
                    <a:column name="employee_name" prompt="HLS.SALES_EMPLOYEE"/>
                    <a:column name="lease_organization_desc" prompt="HLS.LEASE_ORGANIZATION"/>
                    <a:column name="contract_name_show" align="center" prompt="CON301.CONTRACT_DETAIL" renderer="contract_name_show_renderer"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>