<?xml version="1.0" encoding="UTF-8"?>
<!--
	&author:DJ
	$date:2013/05/08
	$purpose:价目表复制
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.price_list = ${/parameter/@price_list}" model="hls.HLS050.hls_price_list" rootPath="price_list_record"/>
    </a:init-procedure>
    <a:view>
        <a:link id="bmLink_priceList_copy" model="hls.HLS050.hls_price_list" modelaction="execute"/>
        <a:screen-include screen="modules/hls/hls_common_javascript.lview"/>
        <script type="text/javascript"><![CDATA[
        
			function priceListCopyScreen_close() {
            	$('hls_price_list_copy').close();
        	}
        		        
	        function priceListCopyDs_save() {
	            var win = $('hls_price_list_copy');
	            f_hls.winMask(win);
	            var ds = $('priceListCopyDs');
	            if (!ds.validate()) {
	                f_hls.winNoMask(win);
	            	return;
	            }
	            Leaf.showConfirm('${l:HLS.PROMPT}','${l:HLS.ARE_YOU_SURE}' , function() {
	                var record=ds.getAt(0);
	                Leaf.request({
	                    url: $('bmLink_priceList_copy').getUrl(),
	                    para: {
	                        price_list:'${/parameter/@price_list}',
	                        new_price_list:record.get('price_list'),
	                        new_price_list_desc:record.get('description')
	                    },
	                    success: function(res) {
	                        f_hls.winNoMask(win);
	                        priceListScreen_query();
	            			priceListCopyScreen_close();
	                    },
	                    failure: function() {
	                        f_hls.winNoMask(win);
	                    },
	                    error: function() {
	                        f_hls.winNoMask(win);
	                    },
	                    scope: this
	                });
	            },function() {
	            	f_hls.winNoMask(win);
	            });
	        }
	        
	        
			
			
		]]></script>
        <a:dataSets>
            <a:dataSet id="priceListCopyDs" autoCreate="true" model="hls.HLS050.hls_price_list" selectable="true">
                <a:fields>
                    <a:field name="old_price_list" defaultValue="${/model/price_list_record/record/@price_list}" readOnly="true"/>
                    <a:field name="old_description" defaultValue="${/model/price_list_record/record/@description}" readOnly="true"/>
                    <a:field name="price_list" required="true" validator="hlsCommon_validateCode"/>
                    <a:field name="description" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="priceListCopyScreen_close" text="HLS.CLOSE"/>
                <a:gridButton click="priceListCopyDs_save" text="HLS.COPY"/>
            </a:screenTopToolbar>
            <a:form column="2" title=" ">
                <a:textField name="old_price_list" bindTarget="priceListCopyDs" prompt="源价目表" width="150"/>
                <a:textField name="old_description" bindTarget="priceListCopyDs" prompt="描述" width="200"/>
                <a:textField name="price_list" bindTarget="priceListCopyDs" width="150"/>
                <a:textField name="description" bindTarget="priceListCopyDs" width="200"/>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>
