<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>

<div class="content_wrapper">

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#payment/account">
                                        <span class="gap"></span>
                                        <div class="form-group">
                                                <label>开始时间: </label>
                                                <input type="text" class="form-control datetimepicker" value="<?php if($stime) echo $stime;?>" placeholder="开始时间" name="bluepay_stime" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                                <label>结束时间: </label>
                                                <input type="text" class="form-control datetimepicker" value="<?php if($etime) echo $etime;?>" placeholder="结束时间" name="bluepay_etime" />
                                        </div>
                                        <button type="submit" class="btn btn-primary">查询</button>
<!--                                        <div  id="mySwitch" class="pull-right">-->
<!--                                            <label class="control-label">是否显示泰铢: </label>-->
<!--                                            <input  type="checkbox"  data-on-text="是" data-off-text="否"/>-->
<!--                                        </div>-->

                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <section>
                        <div>
                            <table class="table table-striped">
                                <tr>
                                    <td>总金额:</td><td><h3>$<?php echo (($sucDeviceMoney[1]['money'] ?? 0) + ($sucDeviceMoney[2]['money'] ?? 0));?></h3></td><td class="thb-col"><h3>฿<?php echo (($sucDeviceMoney[1]['moneyThb'] ?? 0) + ($sucDeviceMoney[2]['moneyThb'] ?? 0));?></h3></td>
                                    <td>Android:</td><td><h3>$<?php echo ($sucDeviceMoney[1]['money'] ?? 0)  ;?></h3></td><td class="thb-col"><h3>฿<?php echo ($sucDeviceMoney[1]['moneyThb'] ?? 0) ;?></h3></td>
                                    <td>IOS:</td><td><h3>$<?php echo ($sucDeviceMoney[2]['money'] ?? 0 ) ;?></h3></td><td class="thb-col"><h3>฿<?php echo ($sucDeviceMoney[2]['moneyThb'] ?? 0 ) ;?></h3></td>
                                </tr>
                            </table>

                            <!--bluePay汇总-->
                                <?php $bluePayAndroid = 0; $bluePayIOS = 0;$bluePayAndroidThb = 0; $bluePayIOSThb = 0;?>
                                <?php foreach ($sucChannelMoney as $channel => $info) {?>
                                    <!--bluepay支付-->
                                    <?php if(!in_array($channel, [1, 2])) {?><!--如果不是android和ios本地支付-->
                                        <?php $androidMoney = $info[1]['money'] ?? 0; $iosMoney = $info[2]['money'] ?? 0?>
                                        <?php $bluePayAndroid += $androidMoney; $bluePayIOS += $iosMoney;?>
                                        <!--bluepay 泰铢-->
                                        <?php $androidMoneyThb = $info[1]['moneyThb'] ?? 0; $iosMoneyThb = $info[2]['moneyThb'] ?? 0?>
                                        <?php $bluePayAndroidThb += $androidMoneyThb; $bluePayIOSThb += $iosMoneyThb;?>
                                    <?php }?>
                                <?php }?>
                                <div class="panel-group" id="accordion">
                                    <div class="panel panel-default">
                                        <div class="panel-heading" style="margin:0;">
                                            <h4 class="panel-title">
                                                <a data-toggle="collapse" data-parent="#accordion"
                                                   href="#collapseOne">
                                                    <table class="table table-striped">
                                                        <tr data-toggle="collapse"
                                                                 data-target="#demo">
<!--                                                            <td>BluePay总金额:</td><td><h3>$--><?php //echo ($bluePayAndroid + $bluePayIOS)/100;?><!--</h3></td><td class="thb-col"> <h3>฿--><?php //echo ($bluePayAndroidThb + $bluePayIOSThb);?><!--</h3></td>-->
<!--                                                            <td>Android:</td><td><h3>$--><?php //echo $bluePayAndroid / 100;?><!--</h3></td><td class="thb-col">  <h3>฿--><?php //echo $bluePayAndroidThb;?><!--</h3></td>-->
<!--                                                            <td>IOS:</td><td><h3>$--><?php //echo $bluePayIOS / 100;?><!--</h3> </td><td class="thb-col"> <h3>฿--><?php //echo $bluePayIOSThb;?><!--</h3></td>-->
                                                        </tr>
                                                    </table>
                                                </a>
                                            </h4>
                                        </div>
                                    </div>
                                    <div id="collapseOne" class="panel-collapse collapse">
                                        <div class="panel-body">
                                            <table class="table table-striped">
                                            <?php foreach ($sucChannelMoney as $channel => $info) {?>
                                            <!--bluepay支付-->
                                            <?php if(!in_array($channel, [1, 3])) {?><!--如果不是android和ios本地支付-->
                                                <?php $androidMoney = $info[1]['money'] ?? 0; $iosMoney = $info[2]['money'] ?? 0; $androidMoneyThb = $info[1]['moneyThb'] ?? 0; $iosMoneyThb = $info[2]['moneyThb'] ?? 0?>
                                                <tr class="success">
                                                    <td>
                                                        <?php echo $channelList[$channel];?>总金额:
                                                    </td>
                                                    <td>
                                                        <h3>$<?php echo ($androidMoney + $iosMoney) / 100;?></h3>
                                                    </td>
                                                    <td class="thb-col">
                                                        <h3>฿<?php echo ($androidMoneyThb + $iosMoneyThb);?></h3>
                                                    </td>
                                                    <td>
                                                        Android:
                                                    </td>
                                                    <td>
                                                        <h3>$<?php echo $androidMoney / 100;?></h3>
                                                    </td>
                                                    <td class="thb-col">
                                                        <h3>฿<?php echo $androidMoneyThb;?></h3>
                                                    </td>
                                                    <td>
                                                        IOS:
                                                    </td>
                                                    <td>
                                                        <h3>$<?php echo $iosMoney / 100;?></h3>
                                                    </td>
                                                    <td class="thb-col">
                                                        <h3>฿<?php echo $iosMoneyThb;?></h3>
                                                    </td>
                                                </tr>
                                            <?php }}?>
                                            </table>
                                        </div>
                                    </div>
                                </div>

                            <table class="table table-striped">
                                <!--android和ios本地支付-->
                                <?php foreach ($sucChannelMoney as $channel => $info) {?>
                                    <?php if(in_array($channel, [1, 3])) {?>
                                        <tr>
                                            <td width="24%"><?php echo $channelList[$channel];?>总金额:</td><td><h3>$<?php echo (($info[1]['money'] ?? 0) + ($info[2]['money'] ?? 0)) / 100;?></h3> </td><td class="thb-col"><h3>฿<?php echo (($info[1]['moneyThb'] ?? 0) + ($info[2]['moneyThb'] ?? 0));?></h3></td>
<!--                                            --><?php //if($channel == 1) {?>
<!--                                            <td>Android:</td><td><h3>$--><?php //echo ($info[1]['money'] ?? 0) / 100;?><!--</h3></td>-->
<!--                                            --><?php //}else {?>
<!--                                            <td>IOS:</td><td><h3>$--><?php //echo ($info[2]['money'] ?? 0) / 100;?><!--</h3></td>-->
<!--                                            --><?php //}?>
                                        </tr>
                                    <?php }?>
                                <?php }?>
                            </table>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>

<script>
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });

    $('.thb-col').hide();
    $('#mySwitch input').bootstrapSwitch({
    });

    $('#mySwitch').on('switchChange.bootstrapSwitch', function (event,state) {
        if(state === true) {
            $('.thb-col').show();
        }else {
            $('.thb-col').hide();
        }
    });
</script>