<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-15 下午01:35:36  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.document_category=&apos;CHANGE_REQUEST&apos; and t1.document_type=&apos;RESCH_REQ&apos;" fetchAll="true" model="basic.hls_document_type_for_lov" rootPath="con712_hls_document_type_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con712_contract_reschedule_main_update_link" url="${/request/@context_path}/modules/cont/CON712/con_contract_reschedule_update.lview"/>
        <script type="text/javascript"><![CDATA[
            function con712_con_contract_maintain_grid_reset() {
                $('con712_con_contract_maintain_query_ds').reset();
            }
            
            function con712_contract_maintain_query_ds_onUpdate(ds, record, name, value, oldValue) {
                if (name == 'batch_id_f') {
                    if (!Leaf.isEmpty(value) && Leaf.isEmpty(record.get('batch_id_t'))) {
                        record.set('batch_id_t', value);
                    }
                } else if (name == 'change_req_number_f') {
                    if (!Leaf.isEmpty(value) && Leaf.isEmpty(record.get('change_req_number_t'))) {
                        record.set('change_req_number_t', value);
                    }
                } else if (name == 'req_date_f') {
                    if (!Leaf.isEmpty(value) && Leaf.isEmpty(record.get('req_date_t'))) {
                        record.set('req_date_t', value);
                    }
                }
            }
            
            function con712_con_contract_maintain_detail() {
                var records = $('con712_con_contract_maintain_ds').getSelected();
                if (records.length != 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.SELECT_RECORD}');
                    return;
                } else {
                    var batch_id = records[0].get('batch_id');
                    con712_con_contract_maintain_detail_win(batch_id);
                }
            }
            
            function con712_con_contract_maintain_detail_win(batch_id) {
                new Leaf.Window({
                    id: 'con712_contract_reschedule_update_window',
                    url: $('con712_contract_reschedule_main_update_link').getUrl() + '?batch_id=' + batch_id,
                    params: null,
                    title: '${l:CON712.CONTRACT_RESCHEDULE_DETAIL}',
                    fullScreen: true
                });
            }
            
            function con712_con_contract_maintain_grid_render(value, record, name) {
                if (name == 'batch_id') {
                    return '<a href="javascript:con712_con_contract_maintain_detail_win(' + value + ')">' + value + '</a>';
                }
                return value;
            }
            
            function con712_con_contract_maintain_grid_query(){
                $('con712_con_contract_maintain_ds').query();
            }
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con712_hls_document_type_ds">
                <a:datas dataSource="/model/con712_hls_document_type_path"/>
            </a:dataSet>
            <a:dataSet id="con712_change_req_status_ds" lookupCode="CON_CHANGE_REQ_STATUS"/>
            <a:dataSet id="con712_con_contract_maintain_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="contract_number" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="cont.CON500.con_contract_number_lov" lovWidth="500" title="HLS.CONTRACT_NUMBER">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="document_type_desc" defaultValue="${/model/con712_hls_document_type_path/record/@description}" displayField="description" options="con712_hls_document_type_ds" returnField="document_type" valueField="document_type"/>
                    <a:field name="document_type" defaultValue="${/model/con712_hls_document_type_path/record/@document_type}"/>
                    <a:field name="req_status_desc" displayField="code_value_name" options="con712_change_req_status_ds" returnField="req_status" valueField="code_value"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="con712_contract_maintain_query_ds_onUpdate"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="con712_con_contract_maintain_ds" autoPageSize="true" autoQuery="true" model="cont.CON711.con_contract_change_req" queryDataSet="con712_con_contract_maintain_query_ds" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="reschedule_fee" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="con712_con_contract_maintain_grid_query" text="HLS.QUERY"/>
                <a:gridButton click="con712_con_contract_maintain_grid_reset" text="HLS.RESET"/>
                <a:gridButton click="con712_con_contract_maintain_detail" text="CON712.CONTRACT_RESCHEDULE_DETAIL"/>
            </a:screenTopToolbar>
            <a:form column="4" labelSeparator=" " labelWidth="100" marginWidth="30" title="CON301.CONTRACT_QUERY">
                <a:lov name="project_number" bindTarget="con712_con_contract_maintain_query_ds" prompt="HLS.PROJECT_NUMBER">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:lov>
                <a:textField name="project_name" bindTarget="con712_con_contract_maintain_query_ds" prompt="HLS.PROJECT_NAME">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:textField>
                <a:numberField name="batch_id_f" allowDecimals="false" allowNegative="false" bindTarget="con712_con_contract_maintain_query_ds" prompt="CON712.BATCH_ID_F">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:numberField>
                <a:numberField name="batch_id_t" allowDecimals="false" allowNegative="false" bindTarget="con712_con_contract_maintain_query_ds" prompt="CON712.BATCH_ID_T">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:numberField>
                <a:lov name="contract_number" bindTarget="con712_con_contract_maintain_query_ds" prompt="HLS.CONTRACT_NUMBER">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:lov>
                <a:textField name="contract_name" bindTarget="con712_con_contract_maintain_query_ds" prompt="HLS.CONTRACT_NAME">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:textField>
                <a:textField name="change_req_number_f" bindTarget="con712_con_contract_maintain_query_ds" prompt="CON712.CHANGE_REQ_NUMBER_F">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:textField>
                <a:textField name="change_req_number_t" bindTarget="con712_con_contract_maintain_query_ds" prompt="CON712.CHANGE_REQ_NUMBER_T">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:textField>
                <a:datePicker name="req_date_f" bindTarget="con712_con_contract_maintain_query_ds" prompt="HLS.REQ_DATE_F">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:datePicker>
                <a:datePicker name="req_date_t" bindTarget="con712_con_contract_maintain_query_ds" prompt="HLS.REQ_DATE_T">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:datePicker>
                <a:comboBox name="req_status_desc" bindTarget="con712_con_contract_maintain_query_ds" prompt="HLS.REQ_STATUS_DESC">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:comboBox>
                <a:comboBox name="document_type_desc" bindTarget="con712_con_contract_maintain_query_ds" prompt="CON711.DOCUMENT_TYPE_DESC">
                    <a:events>
                        <a:event name="enterdown" handler="con712_con_contract_maintain_grid_query"/>
                    </a:events>
                </a:comboBox>
            </a:form>
            <a:grid id="con712_con_contract_maintain_grid" bindTarget="con712_con_contract_maintain_ds" marginHeight="250" marginWidth="50" navBar="true">
                <a:columns>
                    <a:column name="batch_id" align="right" lock="true" prompt="CON711.BATCH_ID" renderer="con712_con_contract_maintain_grid_render" width="50"/>
                    <a:column name="change_req_number" prompt="CON711.CHANGE_REQ_NUMBER" width="130"/>
                    <a:column name="req_status_desc" prompt="HLS.REQ_STATUS_DESC" width="60"/>
                    <a:column name="document_type_desc" prompt="CON711.DOCUMENT_TYPE_DESC" width="100"/>
                    <a:column name="req_date" prompt="HLS.REQ_DATE" renderer="Leaf.formatDate" width="90"/>
                    <a:column name="contract_number" prompt="HLS.CONTRACT_NUMBER" width="120"/>
                    <a:column name="contract_name" prompt="HLS.CONTRACT_NAME" width="200"/>
                    <a:column name="project_number" prompt="HLS.PROJECT_NUMBER" width="120"/>
                    <a:column name="project_name" prompt="HLS.PROJECT_NAME" width="200"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
