<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2012-12-17 上午09:20:46  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:c="leaf.application.action" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <!-- <a:model-query fetchAll="true" model="rpt.rpt_datasource_query" rootPath="/model/datasource"/>
        <a:model-query fetchAll="true" model="rpt.RPT1030.rpt_instance_preview_field" rootPath="/model/fields"/>
        <a:model-query fetchAll="true" model="rpt.RPT1030.rpt_instance_preview_result" rootPath="/model/results"/> -->
        <a:model-query fetchAll="true" model="psr.psr_datasource_query" rootPath="/model/datasource"/>
        <a:model-query fetchAll="true" model="psr.psr_report_preview_result" rootPath="/model/users"/>
        <a:model-query fetchAll="true" model="psr.psr_report_preview_columns" rootPath="/model/columns"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function loadData() {
                $('rpt_data_ds').setQueryParameter('report_header_id', '${/parameter/@report_header_id}');
                $('rpt_data_ds').query();
            }
            
            function check_formatNumber_renderer(value, record, name){
                var editor_record = $('psr_report_preview_columns_ds').find('line_number', name);
                if(editor_record.get('number_allowformat')=='Y'&& Ext.isNumber(value)){
                    return Leaf.formatNumber(value,2);
                }else{
                    return value;
                }
            }
            
            function psr_report_preview_back_click(){
                $('${/parameter/@winid}').close();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="rpt_data_ds" autoCount="true" selectionModel="single">
                <a:datas dataSource="/model/users"/>
            </a:dataSet>
            <a:dataSet id="psr_report_preview_columns_ds">
                <a:datas dataSource="/model/columns"/>
            </a:dataSet>
        </a:dataSets>
        <a:screenTopToolbar>
            <a:gridButton click="psr_report_preview_back_click" text="HLS.RETURN"/>
        </a:screenTopToolbar>
        <a:screenBody>
            <a:grid bindTarget="rpt_data_ds" marginHeight="100" marginWidth="50" width="900">
                <a:toolBar>
                    <a:label prompt="报表预览"/>
                </a:toolBar>
                <a:columns>
                    <a:placeHolder id="object_ds"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
	  		loadData();
	  	]]></script>
    </a:view>
    <a:view-config>
        <c:create-config targetId="object_ds">
            <p:loop source="/model/columns">
                <c:process-config>
                    <a:column name="${@line_number}" align="left" prompt="${@field_description_dis}" renderer="check_formatNumber_renderer"/>
                </c:process-config>
            </p:loop>
        </c:create-config>
    </a:view-config>
</a:screen>