<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2013-1-9 下午02:01:53  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="add_pawn_link" url="${/request/@context_path}/modules/fnd/HLS201/hls_fnd_pawn_add.lview"/>
        <a:link id="pawn_detail_link" url="${/request/@context_path}/modules/fnd/HLS201/hls_fnd_pawn_detail.lview"/>
        <script type="text/javascript"><![CDATA[
            function query_pawn() {
                $('pawn_result_ds').query();
            }
            
            function add_fnd_pawn() {
                var url = $('add_pawn_link').getUrl();
                parent.document.getElementById('mainFrame').src = url;
            }
            
            function pawn_detail(value, record, name) {
                
                if (value) {
                    var pawn_id = record.get('pawn_id');
                    return "<a href='javascript:to_pawn_detail_page(" + pawn_id + ")'>" + value + "</a>";
                }
            
            }
            
            function to_pawn_detail_page(pawn_id) {
                var url = $('pawn_detail_link').getUrl() + "?pawn_id=" + pawn_id;
                parent.document.getElementById('mainFrame').src = url;
            }
            
            function dateValidator(record, name, value) {
                if (name == 'start_date' || name == 'end_date') {
                    var start_date = record.get('start_date');
                    var end_date = record.get('end_date');
                    if (typeof(end_date) != 'undefined' && !Ext.isEmpty(end_date)) {
                        if (!compareDate(start_date, end_date)) {
                            return '开始时间不能大于结束时间';
                        }
                    }
                    return true;
                }
            }
            
            function compareDate(start, end) {
                if (start.getTime() > end.getTime()) {
                    return false;
                }
                return true;
            }
            
            function moneyFormat(value, record, name) {
                return Leaf.formatNumber(value, 2);
            }
            
            function areaFormatf(value, record, name) {
                return value?value.toFixed(2):'';
            }
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="pawn_stat_ds" lookupCode="HLS_PAWN_STATUS"><![CDATA[
            ]]></a:dataSet>
            <a:dataSet id="pawn_query_ds">
                <a:fields>
                    <a:field name="pawn_name"/>
                    <a:field name="pawn_status_des" displayField="code_value_name" options="pawn_stat_ds" returnField="pawn_status" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="pawn_result_ds" autoQuery="true" model="hls.HLS209.hls_pawns" queryDataSet="pawn_query_ds" queryUrl="${/request/@context_path}/autocrud/hls.HLS209.hls_pawns/query" selectable="true">
                <a:fields><![CDATA[
            ]]></a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form column="2" title="查询条件" width="900">
                <a:textField name="pawn_name" bindTarget="pawn_query_ds" prompt="抵押物名称"/>
                <a:comboBox name="pawn_status_des" bindTarget="pawn_query_ds" prompt="抵押物状态"/>
            </a:form>
            <a:button click="query_pawn" text="查询"/>
            <a:grid id="pawn_result_grid_id" bindTarget="pawn_result_ds" height="400" navBar="true" width="1000">
                <a:toolBar>
                    <a:button click="add_fnd_pawn" icon="${/request/@context_path}/images/add.gif" text="新增"/>
                    <a:button type="delete"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="pawn_name" bindTarget="pawn_result_ds" lock="true" prompt="抵押物名称" renderer="pawn_detail"/>
                    <a:column name="pawn_contract_no" bindTarget="pawn_result_ds" prompt="抵押合同编号"/>
                    <a:column name="lease_contract_code" bindTarget="pawn_result_ds" prompt="租赁合同编号"/>
                    <a:column name="customer_name" bindTarget="pawn_result_ds" fetchRemote="false" prompt="抵押人" width="80"/>
                    <a:column name="pawn_register_no" bindTarget="pawn_result_ds" prompt="抵押登记证号"/>
                    <a:column name="pawn_registed_dept" bindTarget="pawn_result_ds" prompt="登记部门"/>
                    <a:column name="quantity" bindTarget="pawn_result_ds" prompt="抵押物数量" width="80"/>
                    <a:column name="uom_name" bindTarget="pawn_result_ds" prompt="单位" width="50"/>
                    <a:column name="pawn_value" align="right" bindTarget="pawn_result_ds" prompt="价值" renderer="moneyFormat"/>
                    <a:column name="currency_name" bindTarget="pawn_result_ds" prompt="币种" width="70"/>
                    <a:column name="estate_license_code" bindTarget="pawn_result_ds" prompt="房产证号"/>
                    <a:column name="housing_area" bindTarget="pawn_result_ds" prompt="房屋面积" renderer="areaFormatf"/>
                    <a:column name="land_certificate_code" bindTarget="pawn_result_ds" prompt="土地证号"/>
                    <a:column name="land_area" bindTarget="pawn_result_ds" prompt="土地面积" renderer="areaFormatf"/>
                    <a:column name="pawn_location" bindTarget="pawn_result_ds" prompt="房屋坐落"/>
                    <a:column name="start_date" bindTarget="pawn_result_ds" prompt="抵押日期从" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="end_date" bindTarget="pawn_result_ds" prompt="抵押日期到" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="pawn_status_des" bindTarget="pawn_result_ds" prompt="抵押物状态" width="80"/>
                    <a:column name="pawn_ownership" bindTarget="pawn_result_ds" prompt="物权所属"/>
                    <a:column name="pawn_occupied" bindTarget="pawn_result_ds" prompt="占管状况"/>
                    <a:column name="note" bindTarget="pawn_result_ds" prompt="备注"/>
                </a:columns>
                <a:editors><![CDATA[
                ]]></a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>