<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-5-9 上午10:28:44  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function hls_hls500_quotation_choose_return() {
                $('hls_fin_calc_quotation_choose_winid').close();
            }
            
            function hls_hls500_quotation_confirm() {
                var record = $('hls_quotation_history_choose_form_ds').getAt(0);
                if (record.get('override_flag') == record.get('create_flag')) {
                    Leaf.showMessage('${l:PROMPT}', '${l:PRJ501.CHOOSE_VERSION_STYLE}');
                    return;
                }
                $('hls_hls500_quotation_confirm_id').disable();
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/hls.HLS500.hls_quotation_save/update',
                    para: {
                        quotation_id: '${/parameter/@quotation_id}',
                        document_id: '${/parameter/@document_id}',
                        document_category: '${/parameter/@document_category}',
                        override_flag: record.get('override_flag'),
                        create_flag: record.get('create_flag')
                    },
                    success: function(res) {
                        $('${/parameter/@dsId}').query();
                        if ('${/parameter/@dsId1}') {
                            $('${/parameter/@dsId1}').query();
                        }
                        $('hls_fin_calc_quotation_choose_winid').close();
                        $('${/parameter/@winId}').close();
                        if ('${/parameter/@winId1}') {
                            $('${/parameter/@winId1}').close();
                        }
                    },
                    failure: function() {
                        $('hls_hls500_quotation_confirm_id').enable();
                    },
                    error: function() {
                        $('hls_hls500_quotation_confirm_id').enable();
                    },
                    scope: this
                });
            }
            
            function onupdate_prj_quotation_history_choose(ds, record, name, value, oldvalue) {
                if (name == 'override_flag') {
                    if (value == 'Y') {
                        record.set('create_flag', 'N');
                    }
                }
                if (name == 'create_flag') {
                    if (value == 'Y') {
                        record.set('override_flag', 'N');
                    }
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls_quotation_history_choose_form_ds" autoCreate="true">
                <a:fields>
                    <a:field name="override_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="create_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onupdate_prj_quotation_history_choose"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form column="1" height="100" labelWidth="120" title=" " width="350">
                <a:checkBox name="override_flag" bindTarget="hls_quotation_history_choose_form_ds" prompt="PRJ501.PRJ_OVERRIDE_VERSION"/>
                <a:checkBox name="create_flag" bindTarget="hls_quotation_history_choose_form_ds" prompt="PRJ501.CREATE_NEW_VERSION"/>
            </a:form>
            <a:screenTopToolbar>
                <a:gridButton click="hls_hls500_quotation_choose_return" text="HLS.RETURN"/>
                <a:gridButton id="hls_hls500_quotation_confirm_id" click="hls_hls500_quotation_confirm" text="HLS.CONFIRM"/>
            </a:screenTopToolbar>
        </a:screenBody>
    </a:view>
</a:screen>
