<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author:
    $Date: 2018/8/2
    $Revision: 1.0
    11.回款查询
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default" package="leaf.ui.std">
        <style>
            html,body{
            background-color:#eee;
            width:1170px;
            height:355px;
            margin: 0;
            padding: 0;
            }
            .widget_csh_transaction{
            width:1170px;
            height:355px;
            position:relative;
            }
            .widget_csh_transaction .hls-pagging-grid{
            width:870px;
            }
            .widget_csh_transaction .hls-pagging-grid .grid-title{
            border-bottom:4px solid #F57B69;
            height:45px;
            }
            .widget_csh_transaction .hls-pagging-grid .grid-title img{
            width:20px;
            height:20px;
            position:relative;
            top:5px;
            }
            .widget_csh_transaction .hls-pagging-grid .grid-title>span{
            font-family:"Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma, "Microsoft Yahei", "Hiragino Sans GB", sans-serif;
            font-size:13px;
            line-height:45px;
            color:#000;
            text-size-adjust:100%;
            font-weight:bold;
            }
            .widget_csh_transaction .clickable{
            cursor:pointer;
            }
            .widget_csh_transaction .left{
            width:270px;
            height:355px;
            background-color:#fff;
            float:left;
            }
            .widget_csh_transaction .right{
            width:870px;
            height:355px;
            background-color:#fff;
            float:left;
            margin-left:30px;
            }
            .widget_csh_transaction .clearFloat{
            clear:both;
            height:0;
            line-height:0;
            font-size:0
            }
            .widget_csh_transaction .queryList .listTitle{
            border-bottom:4px solid #00B3B3;
            font-size: 13px;
            height: 40px;
            line-height: 40px;
            padding: 0 10px;
            font-weight: 600;
            }
            .widget_csh_transaction .queryList .listTitle .right-img{
            width: 20px;
            height: 20px;
            margin:10px 10px 0 0;
            float:right;
            }
            .widget_csh_transaction .queryList .listBody{
            padding:10px;
            }
            .widget_csh_transaction .queryList .listRow{
            padding:5px;
            border-bottom:1px solid rgb(229, 229, 229);
            }
            .widget_csh_transaction .queryList .listRow p{
            color:#000;
            font-size:13px;
            font-weight:100;
            line-height:20px;
            margin:5px 0;
            }
            .widget_csh_transaction .queryList .listRow .inputWrapper{
            border: 1px solid rgb(204, 204, 204);
            width: 230px;
            height: 30px;
            margin-top: 5px;
            border-radius: 5px;
            }
            .widget_csh_transaction .queryList .listRow .inputWrapper img{
            width: 20px;
            height: 20px;
            margin:5px;
            }
            .widget_csh_transaction .queryList .listRow .inputWrapper input{
            background: #fff;
            width: 200px;
            height: 24px;
            position:relative;
            top:-10px;
            border:none;
            }
            .widget_csh_transaction .queryList .listRow .selectSpan{
            display: inline-block;
            width:72px;
            height:30px;
            line-height:30px;
            text-align: center;
            border: 1px solid #CCC;
            border-radius: 4px;
            font-size: 12px;
            margin:10px 2px;
            cursor: pointer;
            background-color:#fff;
            color:#000;
            }
            .widget_csh_transaction .queryList .listRow .selectedSpan{
            background-color:#00b3b3;
            color:#fff;
            }
            .widget_csh_transaction .queryList .listRow .submitBtn{
            text-align:right
            }
            .widget_csh_transaction .queryList .listRow .submitBtn span{
            display:inline-block;
            width:72px;
            height:30px;
            line-height:30px;
            text-align: center;
            background-color:#FA6A4D;
            color:#fff;
            border-radius: 4px;
            font-size: 12px;
            margin:10px 2px;
            cursor: pointer;
            }
        </style>
        <script><![CDATA[
        //查询条件数据结构
        var queryParam={
            "timeZone":"",
            "conInfo":"",
            "conl":0,
            "conlb":0,
            contract_type:""
        };
        jQuery(document).ready(function(){
            jQuery(".listBody").on('click',function(e){
                $this=jQuery(e.target);

                //时间跨度单选点击事件
                if($this.attr("class").indexOf('timeZone')>=0){
                    var allSpans=jQuery(".timeZone");
                    for(var i=0;i<allSpans.length;i++){
                        if(allSpans[i].id!=$this.attr("id")){
                            jQuery(allSpans[i]).removeClass("selectedSpan");
                        }
                    }
                    $this.toggleClass("selectedSpan");
                    if($this.attr("class").indexOf('selectedSpan')>=0){
                        queryParam.timeZone=$this.attr("id");
                    }else{
                        queryParam.timeZone="";
                    }
                }

                //合同类型多选点击事件
                if($this.attr("id")=='conl'){
                    $this.toggleClass("selectedSpan");
                    if($this.attr("class").indexOf('selectedSpan')>=0){
                        queryParam.conl=1;
                    }else{
                        queryParam.conl=0;
                    }
                }
                if($this.attr("id")=='conlb'){
                    $this.toggleClass("selectedSpan");
                    if($this.attr("class").indexOf('selectedSpan')>=0){
                        queryParam.conlb=1;
                    }else{
                        queryParam.conlb=0;
                    }
                }

                //查询按钮点击事件
                if($this.attr("id")=='submitBtn'){
                    $("csh_transaction_ds").qpara=getQueryParam();
                    $("csh_transaction_ds").query();
                }
            });

        });
        //获取查询条件函数
        function getQueryParam(){
            queryParam.conInfo=document.getElementById("conInfoInput").value;
            return queryParam;
        }
        function add_transaction_handler(){
            <!--top.mainJumpCode('CSH511',true);-->
            location.href='/modules/csh/CSH511/csh_transaction_receipt.lview';
        }
        function go_csh_transaction_query(){
            <!--top.mainJumpCode('CSH510',true)-->
            location.href='/modules/csh/CSH510/csh_transaction_receipt_maintain.lview';
        }
        function bp_info_renderer(record,index){
            var html='<p style="width:150px;max-height:16px;">'+record.data['bp_code']+'</p>';
            html+='<p style="color:#9f9f9f;width:150px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">'+record.data['bp_name']+'</p>';
            return html;
        }
        function con_info_renderer(record,index){
            var html='<p style="width:150px;max-height:16px;">'+record.data['contract_number']+'</p>';
            html+='<p style="color:#9f9f9f;width:150px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">'+record.data['contract_name']+'</p>';
            return html;
        }
        function bank_info_renderer(record,index){
            var html='<p style="width:150px;max-height:16px;">'+record.data['bp_bank_account_id']+'</p>';
            html+='<p style="color:#9f9f9f;width:150px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">'+record.data['bp_bank_account_num']+'</p>';
            return html;
        }
        function transaction_info_btn_renderer(record,index){
            var transaction_id=record.data["transaction_id"];
            return "<img onclick='openWindow(\"/modules/csh/CSH510/csh_transaction_receipt_post_query.lview?transaction_id=" + transaction_id+ "\")' style='cursor:pointer;width:15px;height:15px;display:inline-block;margin:0px;' src='${base.contextPath}/leafresource/images/widget/detail.png' alt='png'/>";
        }
        function openWindow(url) {
            new Leaf.Window({
                id: 'csh_transaction_receipt_link_winid',
                params: {
                    winId: 'csh_transaction_receipt_link_winid'
                },
                url: url,
                title: '${l:CSH510.CSH_RECEIPT_UPDATE}',
                fullScreen: true
            });
        }
            ]]></script>
        <a:dataSets>
            <a:dataSet id="csh_transaction_ds" autoQuery="true"  pageSize="5" model="csh.CSH911.csh_transaction">
                <a:fields>
                    <a:field name="transaction_date"/>
                    <a:field name="write_off_date"/>
                    <a:field name="bp_name"/>
                    <a:field name="bp_code"/>
                    <a:field name="contract_number"/>
                    <a:field name="contract_name"/>
                    <a:field name="transaction_amount"/>
                    <a:field name="bp_bank_account_id"/>
                    <a:field name="bp_bank_account_num"/>
                    <a:field name="payment_method"/>
                    <a:field name="transaction_id"/>
                    <a:field name="transaction_num"/>
                    <a:field name="contract_type_n"/>
                    <a:field name="contract_type"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <div class="widget_csh_transaction">
            <div class="left queryList">
                <div class="listTitle">
                    <img class="right-img clickable" onclick="go_csh_transaction_query()" src="${/request/@context_path}/leafresource/images/widget/search_flag.png"/>
                    <span>收款查询</span>
                </div>
                <div class="listBody">
                    <div class="listRow">
                        <p class="">时间跨度</p>
                        <span id="7" class="selectSpan timeZone">1周内</span>
                        <span id="30" class="selectSpan timeZone">1个月内</span>
                        <span id="90" class="selectSpan timeZone">3个月内</span>
                    </div>
                    <div class="listRow">
                        <p class="">合同信息</p>
                        <div class="inputWrapper">
                            <img src="${/request/@context_path}/leafresource/images/widget/search.png"/>
                            <input type="text" id="conInfoInput" placeholder="请输入合同编号、名称或承租人名称" class=""/>
                        </div>
                    </div>
                    <div class="listRow">
                        <p class="">合同类型</p>
                        <span id="conl" class="selectSpan">直租合同</span>
                        <span id="conlb" class="selectSpan">回租合同</span>
                        <div class="submitBtn"><span class="" id="submitBtn">查询</span></div>
                    </div>
                </div>
            </div>
            <div class="right">
                <a:hapGrid title="回笼信息" bindTarget="csh_transaction_ds" titleImg="/leafresource/images/widget/receipt.png" canWheel="true">
                    <a:toolBar>
                        <a:button icon="/leafresource/images/widget/add.png" click="add_transaction_handler"/>
                    </a:toolBar>
                    <a:columns>
                        <a:column name="transaction_date" prompt="收款日期"/>
                        <a:column name="write_off_date" prompt="核销日期"/>
                        <a:column template="bp_info_renderer" prompt="商业伙伴名称/编号"/>
                        <a:column template="con_info_renderer"  prompt="合同信息"/>
                        <a:column name="transaction_amount"  prompt="收款金额"/>
                        <a:column template="bank_info_renderer"  prompt="收款账户/账号"/>
                        <a:column name="payment_method"  prompt="收款方式"/>
                        <a:column template="transaction_info_btn_renderer" prompt="明细"/>
                    </a:columns>
                </a:hapGrid>
            </div>
            <div class="clearFloat"> </div>
        </div>
        <a:screenBody style="display:none"> </a:screenBody>
    </a:view>
</a:screen>