<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-12-10 上午09:49:24  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="aut_allocation_batch_link" url="${/request/@context_path}/modules/aut/AUT110/zj_wfl_to_do_list.lview"/>
        <script type="text/javascript"><![CDATA[
            function aut_allocation_renderer(value, record, name) {
                //
                var user_id = record.get('user_id');
                //alert(sequence_num); 
                return '<a  href="javascript:aut_allocation_win(\'' + user_id + '\',\'' + name + '\')">' + '<font color="#FF9900">分配单据</font>' + '</a>';
            }
            
            function aut_allocation_win(id, name, record, ds) {
                new Leaf.Window({
                    id: 'aut_allocation_win',
                    url: $('aut_allocation_batch_link').getUrl(),
                    params: {
                        winId: 'aut_allocation_win',
                        user_id: id
                    },
                    title: '单据信息',
                    fullScreen: true,
                    draggable: true
                });
            }
            
            
            function aut_query() {
                $('aut_admin_allocation_ds').query();
            }
            
            function aut_reset() {
                $('aut_query_ds').reset();
            }
            
            function summaryRenderer(datas, name) {
                var sum = 0;
                for (var i = 0;i < datas.length;i++) {
                    var r = datas[i];
                    var d = r.get(name);
                    var n = parseFloat(d);
                    if (!isNaN(n)) {
                        sum += n;
                    }
                }
                return ' <font color="red">' + '合计:' + Leaf.formatNumber(sum) + '</font>';
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="aut_query_ds">
                <a:fields>
                    <a:field name="user_id"/>
                    <a:field name="description" lovGridHeight="300" lovHeight="450" lovService="aut.AUT110.aut_admin_sys_user_lov" lovWidth="500" prompt="用户">
                        <a:mapping>
                            <a:map from="user_id" to="user_id"/>
                            <a:map from="description" to="description"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="project_number"/>
                    <a:field name="bp_name"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="aut_admin_allocation_ds" autoQuery="true" model="aut.AUT110.aut_admin_allocation_document" pageSize="20" queryDataSet="aut_query_ds">
                <a:fields>
                    <a:field name="description"/>
                    <a:field name="user_name"/>
                    <a:field name="count_num"/>
                    <a:field name="user_id"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="aut_query" text="查询"/>
                <a:gridButton click="aut_reset" text="重置"/>
            </a:screenTopToolbar>
            <a:form Width="800" column="3" title="查询条件">
                <a:lov name="description" bindTarget="aut_query_ds" prompt="审批用户"/>
                <a:textField name="project_number" bindTarget="aut_query_ds" prompt="项目编号"/>
                <a:textField name="bp_name" bindTarget="aut_query_ds" prompt="承租人姓名"/>
            </a:form>
            <a:grid bindTarget="aut_admin_allocation_ds" marginHeight="300" navBar="true" width="830">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="count_num" footerRenderer="summaryRenderer" prompt="当前待办件数" width="200"/>
                    <a:column name="user_name" prompt="审批用户" width="200"/>
                    <a:column name="description" prompt="描述" width="270"/>
                    <a:column name="allocation" prompt="分配单据" renderer="aut_allocation_renderer" width="120"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>