<div id="centre" class="layout">
    <div class="centreInner ">
        <div class="mainInner radius5 "> 
            <div class="belongBox radius5">
                <div class="personalPInner fdPayInner clearfix"> 
                    <div class="nameBox"> <span class="bold mr45 left">&nbsp;姓名：<span class="color1"><?=$info['truename']?></span></span> 
                        <span class="bold left">账户：</span><em class="color2 mr45 left"><?=$info['username']?></em> 
                        <span class="bold left">星级：</span><em class="color2 mr45 left"><?=$broker_new_info[0]['starlevel']?>星</em> <span class="bold left">房豆：</span><em class="color3 left"><?=$info['credit']?></em>
						<?php if(!empty($functionSwitch['payment'])){?>
							<div class="btnFBbox btnLJCZbox left"> <a class="btnB btnSubmit radius5" href="<?=$info['recharge_url']?>">立即充值</a> </div>
						<?php }?>
                    </div>
                </div>
            </div>
            <form id="search_form" name="search_form" method="post" action="">
            <div class="belongBox belongBox_visible radius5">
                <div class="titleTabBox titleTabBoxPay">
                    <div class="titleTab">
                        <div class="titleTabB clearfix">
                            <dl class="list">
                                <?php foreach($info['page_tab'] as $k => $v) { ?>
                                <dd class="item <?php if($k == $info['tab']) {echo 'itemOn';}?>"><a href="<?=$v['url']?>" class="link"><?=$v['name']?></a></dd>
                                <?php } ?>
                            </dl>
                        </div>
                    </div>
                </div>
                <?php
                if ($info['select_time_tab'] == '') {
                    $info['select_time_tab'] = 'month';
                }
                /***
                if ($info['select_time_tab'] == 'month') {
                    $start_time = date('Y-m', time()) . '-01';
                    $end_time = date('Y-m-d',time());
                } else if ($info['select_time_tab'] == 'week') {
                    $start_time = date('Y-m-d', strtotime('-7days'));
                    $end_time = date('Y-m-d',time());
                }**/
                ?>
                <div class="forms functionBox functionBoxPay">
                    <dl class="list">
                        <dd class="list_item clearfix">
                            <div class="fields">
                                <div class="fgInput"> <a style="float:left;" href="####" class="downReportBtn btnCon radius5 downReportBtn2 btnCon_pay" id="month" onclick="select_date('month')">最近一月</a> </div>
                                <p class="textFg textFg2">&nbsp;</p>
                                <div class="fgInput"> <a href="####" class="downReportBtn btnCon radius5 downReportBtn2"  id="week" onclick="select_date('week')" style="float:left;">最近一周</a> </div>
                                <input type="hidden" id="select_time_tab" name='select_time_tab' value="<?=$info['select_time_tab']?>">
                                <p class="textFg textFg2">&nbsp;</p>
                                <div class="fgInput ">
                                    <div class="simulationSelect simulationSelect2 left">
										<div class="reveal">
											<label id='wp4label' class="reveal" for="jsWdatePicker3"  title="点击选择日期">
												<input  name="start_time" id="jsWdatePicker3" class="Wdate input_text w126" value="<?=$info['start_time']?>" readonly>
											</label>
										</div>
									</div>
                                </div>
                                <span class="fg">一</span>
                                <div class="fgInput ">
                                    <div class="simulationSelect simulationSelect2 left">
										<div class="reveal">
											<label id='wp4label' class="reveal" for="jsWdatePicker4"  title="点击选择日期">
												<input  name="end_time" id="jsWdatePicker4" class="Wdate input_text w126" value="<?=$info['end_time']?>" readonly>
                                                <input type="hidden" id="currentDay" name="currentDay" value="{@date('Y-m-d',time())@}">
											</label>
										</div>
									</div>
                                </div>
                                <p class="textFg textFg2">&nbsp;</p>
                                <?php
                                if (isset($info['source']) && $info['source'] != '') {
                                    $source_name = $info['sources'][$info['source']];
                                } else {
                                    $source_name = '全部渠道';
                                }
                                ?>
                                <div class="fgInput jsFgInput">
                                    <div class="imitateSelect">
                                        <label class="labelImitate"><?=$source_name?></label>
                                        <input type="text" value="<?=$source_name?>" readonly class="imitate imitateIe" name="source_name">
                                        <input type="hidden" value="<?=$info['source']?>" class="jsImitateHidden" name="source">
                                        <div class="listImitate">
                                            <dl class="inner">
                                                <?php 
                                                foreach($info['sources'] as $k => $v) { ?>
                                                <dd><a href="####" oid="<?=$k?>" class="link"><?=$v?></a></dd>
                                                <?php } ?>
                                            </dl>
                                        </div>
                                    </div>
                                </div>
                                <p class="textFg textFg2">&nbsp;</p>
                                <?php
                                if (isset($info['infofrom']) && $info['infofrom'] != '') {
                                    $infofrom_name = $info['infofroms'][$info['infofrom']]['name'];
                                } else {
                                    $infofrom_name = '全部途径';
                                }
                                ?>
                                <div class="fgInput jsFgInput">
                                    <div class="imitateSelect">
                                        <label class="labelImitate"><?=$infofrom_name?></label>
                                        <input type="text" value="<?=$infofrom_name?>" readonly class="imitate imitateIe" name="infofrom_name">
                                        <input type="hidden" value="<?=$info['infofrom']?>" class="jsImitateHidden" name="infofrom">
                                        <div class="listImitate">
                                            <dl class="inner">
                                                <?php foreach($info['infofroms'] as $v) { ?>
                                                <dd><a href="####" oid="<?=$v['alias']?>" class="link"><?=$v['name']?></a></dd>
                                                <?php } ?>
                                            </dl>
                                        </div>
                                    </div>
                                </div>
                                <p class="textFg textFg2">&nbsp;</p>
                                <div class="fgInput">
                                    <input type="submit" style="cursor: pointer;float:left;" class="downReportBtn btnCon radius5 downReportBtn2" value="搜索"></div>
                            </div>
                        </dd>
                    </dl>
                </div>
                <div class="pay_fd_tip"><span class="p">当前查询条件共有<strong class="b c m"><?=$info['total_count']?></strong>条交易记录</span>
                    <?php if (isset($info['expend_num'])) {?>
                    <span class="p">共消耗<strong class="c m" style="color:#53a000">
                        <?=abs($info['expend_num'])?></strong>房豆</span>
                    <?php } ?>
                    <?php if (isset($info['get_num'])) {?>
                    共获取<strong class="c m"><?=$info['get_num']?></strong>房豆
                    <?php } ?>
                    <?php if (isset($info['recharge_num'])) {?>
                    共充值<strong class="c m"><?=$info['recharge_num']?></strong>房豆
                    <?php } ?>
                </div>
                
        </div>
        <input type='hidden' name='page' value='1'>
    </form>
    <div class="branchCommon branchCommon_pay radius5 ">
           <?php if ($info['tab'] == 'recharge') { ?>
               <div class="hd">
                   <table class="tableExpert">
                       <tr>
                           <td class="td f w160"><div class="text_l">交易时间</div></td>
                           <td class="td w160"><div class="text_l">订单号</div></td>
                           <td class="td w80"><div class="text_l">充值金额</div></td>
                           <td class="td w70"><div class="text_l">渠道</div></td>
                           <td class="td w70"><div class="text_l">房豆</div></td>
                           <td class="td w80"><div class="text_l">房豆余额</div></td>
                           <td class="td w120"><div class="text_l">发票抬头</div></td>
                           <td class="td"><div class="text_l">状态</div></td>
                       </tr>
                   </table>
               </div>
               <?php if (count($info['transaction_record']) == 0) {?>
               <div class="mod">
                   <div class="no_pay_list" >很遗憾，您暂时还没有任何交易记录哦！</div>
               </div>
               <?php } else { ?>
               <div class="mod">
                   <table class="tableExpert tableExpert_no">
                       <?php 
                       foreach($info['transaction_record'] as $v) { 
                           if ($v['num'] > 0) {
                               $num_css = 'c1';
                               $num = '+' . $v['num'];
                           } else {
                               $num_css = 'c2';
                               $num = '--';
                           }
                        ?>
                       <tr>
                           <td class="td f w160"><div class="text_l"><?=$v['ctime']?></div></td>
                           <td class="td w160"><div class="text_l"><?=$v['transaction_id']?></div></td>
                           <td class="td w80"><div class="text_l"><?=$v['price']?></div></td>
                           <td class="td w70"><div class="text_l"><?=$v['source']?></div></td>
                           <td class="td w70"><div class="text_l"><strong class="<?=$num_css?>"><?=$num?></strong></div></td>
                           <td class="td w80"><div class="text_l"><strong class="c1"><?=$v['remain_num']?></strong></div></td>
                           <td class="td w120"><div class="text_l"><?=$v['invoice']?></div></td>
                           <td class="td">
                               <div class="text_l">
                               <?php if ($v['num'] == 0 && $v['status'] == 0) {?>
                                   <strong class="c4">失败</strong>
                                   <a href="<?=$info['recharge_url']?><?=$v['id']?>/" class="cz_btn">充值</a>
                               <?php } elseif($v['status'] == 2) {?>
                                   <strong class="c3">充值中</strong>
							   <?php } else {?>
                                   <strong class="c3">成功</strong>
                               <?php } ?>
                               </div>
                           </td>
                       </tr>
                       <?php } ?>
                   </table>
               </div>
               <?php } ?>
           <?php } else { ?>
               <div class="hd">
                   <table class="tableExpert">
                       <tr>
                           <td class="td f w160"><div class="text_l">交易时间</div></td>
                           <td class="td w160"><div class="text_l">订单号</div></td>
                           <td class="td w110"><div class="text_l">购买产品</div></td>
                           <td class="td w70"><div class="text_l">渠道</div></td>
                           <td class="td w70"><div class="text_l">房豆</div></td>
                           <td class="td w80"><div class="text_l">房豆余额</div></td>
                           <td class="td w135"><div class="text_l">说明</div></td>
                       </tr>
                   </table>
               </div>
               <?php if (count($info['transaction_record']) == 0) {?>
               <div class="mod">
                   <div class="no_pay_list" >很遗憾，您暂时还没有任何交易记录哦！</div>
               </div>
               <?php } else { ?>
               <div class="mod">
                   <table class="tableExpert tableExpert_no">
                       <?php foreach($info['transaction_record'] as $v) { ?>
                       <tr>
                           <td class="td f w160"><div class="text_l"><?=$v['ctime']?></div></td>
                           <td class="td w160"><div class="text_l"><?=$v['transaction_id']?></div></td>
                           <td class="td w110"><div class="text_l"><?=$v['name']?></div></td>
                           <td class="td w70"><div class="text_l"><?=$v['source']?></div></td>
                           <td class="td w70"><div class="text_l"><strong class="<?php if ($v['num'] > 0 && $v['way_alias']!='sysExpireHouseBean') {echo 'c1';}else{echo 'c2';}?>"><?php if($v['way_alias']=='sysExpireHouseBean'){echo "-";}?><?=$v['num']?></strong></div></td>
                           <td class="td w80"><div class="text_l"><strong class="c1"><?=$v['remain_num']?></strong></div></td>
                           <td class="td w135"><div class="text_l"><?=$v['description']?></div></td>
                       </tr>
                       <?php } ?>
                   </table>
               </div>
               <?php } ?>
                <?php } ?>
                <?php if (!empty($info['pagination'])) { ?>
                <div class="bd">
                    <div class="picPreviewPagBox">
                        <div class="picPreviewPag">
                            <?php echo $info['pagination']; ?>
                            <input type='hidden' name='page' value='<?php echo $info['page']; ?>'>
                        </div>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>
    </div>
</div>
<?=$page_js?>
<script type="text/javascript">
    $(function(){
        $("#jsWdatePicker4").focus(wp41);
        $("#jsWdatePicker3").focus(wp31);
    });
	var wp41 = function(){
		var region = GetDateRegion("currentDay","jsWdatePicker3");
		if(region<=7) {
			region = region-2;
			xdate = $("#currentDay").val();
		} else {
			xdate ='#F{$dp.$D(\'jsWdatePicker3\',{d:31})}';
		}
		WdatePicker({maxDate:xdate,
				minDate:'#F{$dp.$D(\'jsWdatePicker3\')}'});
	}
	var wp31 = function(){
		function pick(dp) {
			$("#jsWdatePicker4").val(dp.cal.getDateStr());
		}
		WdatePicker({minDate:'%y-{%M-1}-{%d}',maxDate:'%y-%M-%d',onpicked:pick});
	}
    /*
    * 计算两个日期的间隔天数
    * BeginDate:起始日期的文本框，格式為：2012-01-01
    * EndDate:結束日期的文本框，格式為：2012-01-02
    * 返回兩個日期所差的天數
    * 調用方法：
    * alert("相差"+Computation("date1","date2")+"天");
    */            
    function GetDateRegion(BeginDate,EndDate)
    { 
        var aDate, oDate1, oDate2, iDays;
        var sDate1=document.getElementById(BeginDate).value;   //sDate1和sDate2是2008-12-13格式
        var sDate2=document.getElementById(EndDate).value;              
        aDate = sDate1.split("-");
        oDate1 = new Date(aDate[1] + '/' + aDate[2] + '/' + aDate[0]);   //转换为12/13/2008格式
        aDate = sDate2.split("-");
        oDate2 = new Date(aDate[1] + '/' + aDate[2] + '/' + aDate[0]);
        //iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 /24)+1;   //把相差的毫秒数转换为天数
        var i=(oDate1 - oDate2) / 1000 / 60 / 60 /24;
        if(i<0)
        {
            i-=1;
        }
        else
        {
            i+=1;
        }
        iDays = i;   //把相差的毫秒数转换为天数
        //alert(iDays);
        return iDays;
    }
    //选择日期类型
    function select_date(type) {
        var strToday = "<?=date('Y-m-d', time())?>";
        var strWeekstr = "<?=date('Y-m-d', strtotime('-7 days'))?>";
        var strMonthstr = "<?=date('Y-m-d', strtotime('-1 months'))?>";
        if(type === 'week')
        {
            $('#week').addClass('btnCon_pay');
            $('#month').removeClass('btnCon_pay');
            startday = strWeekstr;
        }else{
            $('#month').addClass('btnCon_pay');
            $('#week').removeClass('btnCon_pay');
            startday = strMonthstr;
        }
        $('#select_time_tab').val(type);
        $('#jsWdatePicker3').val(startday);
        $('#jsWdatePicker4').val(strToday);
    }
</script>
