<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wujun  
    $Date: 2016年11月18日13:10:00
    $Revision: 1.0  
    $Purpose: 付款先决条件变更维护
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="csh910_submit_condition_change_req_link" model="csh.CSH910.csh_submit_condition_change_req" modelaction="execute"/>
        <a:link id="csh910_cancle_condition_change_req_link" model="csh.CSH910.csh_cancel_condition_change_req" modelaction="execute"/>
        <a:link id="csh910_save_condition_change_req_link" model="csh.CSH910.csh_hn_payment_cond_change_req_query" modelaction="update"/>
        <a:link id="csh910_hn_payment_cond_change_req_back_turn_link" url="${/request/@context_path}/modules/csh/CSH910/csh_prerequisites_for_payment.lview"/>
        <script type="text/javascript"><![CDATA[
            Leaf.onReady(init);
            
            function init() {
                $('csh910_hn_payment_cond_change_req_maintain_query_ds').setQueryParameter('change_req_id', '${/parameter/@change_req_id}');
                $('csh910_hn_payment_cond_change_req_maintain_query_ds').query();
            }
            
            function csh910_hn_payment_cond_change_req_maintain_query() {
                $('csh910_hn_payment_cond_change_req_after_change_result_ds').query();
            }
            
            function csh910_hn_payment_cond_change_req_close() {
                location.href = $('csh910_hn_payment_cond_change_req_back_turn_link').getUrl();
                parent.shMenu('show');
            }
            
            function csh910_hn_payment_cond_change_req_submit() {
                Leaf.showConfirm('${l:PROMPT}', '您确定要提交审批吗?', function() {
                    var record = $('csh910_hn_payment_cond_change_req_ds').getAt(0);
                    Leaf.request({
                        url: $('csh910_submit_condition_change_req_link').getUrl(),
                        para: {
                            change_req_id: record.get('change_req_id')
                        },
                        success: function(res) {
                            location.href = $('csh910_hn_payment_cond_change_req_back_turn_link').getUrl();
                            parent.shMenu('show');
                        },
                        failure: function() {},
                        error: function() {},
                        scope: this
                    });
                });
                return;
            }
            
            function csh910_hn_payment_cond_change_req_cancle() {
                Leaf.showConfirm('${l:PROMPT}', '您确定撤销审批吗?', function() {
                    var record = $('csh910_hn_payment_cond_change_req_ds').getAt(0);
                    Leaf.request({
                        url: $('csh910_cancle_condition_change_req_link').getUrl(),
                        para: {
                            change_req_id: record.get('change_req_id')
                        },
                        success: function(res) {
                            location.href = $('csh910_hn_payment_cond_change_req_back_turn_link').getUrl();
                            parent.shMenu('show');
                        },
                        failure: function() {},
                        error: function() {},
                        scope: this
                    });
                });
                return;
            }
            
            function csh910_hn_payment_cond_change_req_save(){
                 var record = $('csh910_hn_payment_cond_change_req_maintain_query_ds').getAt(0);
                 Leaf.request({
                        url: $('csh910_save_condition_change_req_link').getUrl(),
                        para: {
                            change_req_id: record.get('change_req_id'),
                             description: record.get('description')
                        },
                        success: function(res) {
                             $('csh910_hn_payment_cond_change_req_after_change_result_ds').submit();
                        },
                        failure: function() {},
                        error: function() {},
                        scope: this
                    });
               
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="csh910_hn_payment_cond_change_req_ds" autoCreate="true">
                <a:fields>
                    <a:field name="change_req_id" defaultValue="${/parameter/@change_req_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="csh910_hn_payment_cond_change_req_maintain_query_ds" model="csh.CSH910.csh_hn_payment_cond_change_req_query" queryDataSet="csh910_hn_payment_cond_change_req_ds">
                <a:fields>
                    <a:field name="change_req_number" readOnly="true"/>
                    <a:field name="req_date" datatype="date" readOnly="true"/>
                    <a:field name="bp_name" readOnly="true"/>
                    <a:field name="manager" readOnly="true"/>
                    <a:field name="contract_number" readOnly="true"/>
                    <a:field name="contract_name" readOnly="true"/>
                    <a:field name="description" required="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="csh910_hn_payment_cond_change_req_after_change_result_ds" autoQuery="true" model="csh.CSH910.hn_con_payment_conditions" queryDataSet="csh910_hn_payment_cond_change_req_ds" selectable="true">
                <a:fields>
                    <a:field name="confirm_flag" checkedValue="Y" uncheckedValue="N"/>
                    <a:field name="hd_id" defaultValue="${/parameter/@change_req_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="csh910_hn_payment_cond_change_req_before_change_result_ds" autoQuery="true" model="csh.CSH910.csh_payment_prerequisite_maintain_before_change" queryDataSet="csh910_hn_payment_cond_change_req_ds" selectable="true">
                <a:fields>
                    <a:field name="confirm_flag" checkedValue="Y" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="csh910_hn_payment_cond_change_req_close" text="关闭"/>
                <a:gridButton click="csh910_hn_payment_cond_change_req_save" text="保存"/>
                <a:gridButton click="csh910_hn_payment_cond_change_req_submit" text="提交审批"/>
                <a:gridButton click="csh910_hn_payment_cond_change_req_cancle" text="撤销变更"/>
            </a:screenTopToolbar>
            <a:form column="1" labelWidth="120" marginWidth="50" title="变更信息">
                <a:hBox>
                    <a:textField name="change_req_number" bindTarget="csh910_hn_payment_cond_change_req_maintain_query_ds" prompt="变更编号"/>
                    <a:textField name="req_date" bindTarget="csh910_hn_payment_cond_change_req_maintain_query_ds" prompt="变更日期" renderer="Leaf.formatDate"/>
                    <a:textField name="bp_name" bindTarget="csh910_hn_payment_cond_change_req_maintain_query_ds" prompt="承租人名称" width="335"/>
                </a:hBox>
                <a:hBox>
                    <a:textField name="manager" bindTarget="csh910_hn_payment_cond_change_req_maintain_query_ds" prompt="项目经理"/>
                    <a:textField name="contract_number" bindTarget="csh910_hn_payment_cond_change_req_maintain_query_ds" prompt="支付表编号"/>
                    <a:textField name="contract_name" bindTarget="csh910_hn_payment_cond_change_req_maintain_query_ds" prompt="支付表名称" width="335"/>
                </a:hBox>
                <a:hBox>
                    <a:textArea name="description" bindTarget="csh910_hn_payment_cond_change_req_maintain_query_ds" height="50" prompt="变更说明" width="800"/>
                </a:hBox>
            </a:form>
            <a:tabPanel marginHeight="280" marginWidth="50">
                <a:tabs>
                    <a:tab prompt="变更后" width="110">
                        <a:grid id="csh910_hn_payment_cond_change_req_after_change_result_grid_id" bindTarget="csh910_hn_payment_cond_change_req_after_change_result_ds" marginHeight="320" marginWidth="80" navBar="true">
                            <a:toolBar>
                                <a:button type="add"/>
                                <a:button type="save"/>
                                <a:button type="delete"/>
                            </a:toolBar>
                            <a:columns>
                                <a:column name="description" editor="editor_tf" prompt="描述" showTitle="true" width="500"/>
                            </a:columns>
                            <a:editors>
                                <a:textField id="editor_tf"/>
                            </a:editors>
                        </a:grid>
                    </a:tab>
                    <a:tab prompt="变更前" width="110">
                        <a:grid id="csh910_hn_payment_cond_change_req_before_change_result_grid_id" bindTarget="csh910_hn_payment_cond_change_req_before_change_result_ds" marginHeight="320" marginWidth="80" navBar="true">
                            <a:columns>
                                <a:column name="description" prompt="描述" showTitle="true" width="500"/>
                            </a:columns>
                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
        </a:screenBody>
    </a:view>
</a:screen>