<?php if(session::get('ver') == 'corp'){ ?>
<style type="text/css">
    @media (max-width: 1366px) {
        .htmldir {
            display: none;
        }
    }
</style>

<div class="main-right-box">
    <h5><?php echo lang_admin('cash');?>

    </h5>

    <div class="box" id="box">


        <form name="searchform" id="searchform"  action="<?php echo uri();?>" method="post"  onsubmit="return returnform(this)"class="form-inline">
            <div class="form-group">
                <?php echo lang_admin('time_choice');?>:
                <select id="search_state" name="search_data" class="form-control select search_state">
                    <option value="0" <?php if($search_data=='0'|| $search_data=='') { ?>selected<?php } ?>>请选择...</option>
                    <option value="1" <?php if($search_data==1) { ?>selected<?php } ?>><?php echo lang_admin('today');?></option>
                    <option value="2" <?php if($search_data==2) { ?>selected<?php } ?>><?php echo lang_admin('this_week');?></option>
                    <option value="3" <?php if($search_data==3) { ?>selected<?php } ?>><?php echo lang_admin('this_month');?></option>
                </select>
            </div>

            <div class="form-group">&nbsp;
                <?php echo lang_admin('state');?>:
                <select id="search_state" name="search_state" class="form-control select search_state">
                    <option value="-1" <?php if($search_state=='-1') { ?>selected<?php } ?>><?php echo lang_admin('please_choose');?>...</option>
                    <option value="1" <?php if($search_state==1) { ?>selected<?php } ?>><?php echo lang_admin('to_examine').lang_admin('success');?></option>
                    <option value="2" <?php if($search_state==2) { ?>selected<?php } ?>><?php echo lang_admin('to_examine').lang_admin('failure');?></option>
                    <option value="0" <?php if($search_state==0) { ?>selected<?php } ?>><?php echo lang_admin('cash_application');?></option>
                </select>

            </div>

            <div class="form-group">&nbsp;
                <?php echo lang_admin('account_receivable');?>：
                <input type="text" class="form-control" name="search_title" id="search_number" placeholder="<?php echo lang_admin('account_receivable');?>" value="" />
                <button  class="btn btn-default search-btn" name="submit" type="submit">
                    <i class="glyphicon glyphicon-search"></i>
                </button>
            </div>
        </form>

        <div class="blank30"></div>
        <form name="listform" id="listform"  action="<?php echo uri();?>" method="post" onsubmit="return returnform(this);">


            <div class="blank30"></div>

            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr class="th">
                        <th class="s_out"><input title="<?php echo lang_admin('click_to_select_all_items_on_this_page');?>"  onclick="CheckAll(this.form)" type="checkbox" name="chkall" class="checkbox" /></th>
                        <th class="catid text-center htmldir"><!--id--><?php echo lang_admin('id');?></th>
                        <th class="catname"><!--oid--><?php echo lang_admin('cash_menoy');?></th>
                        <th class="htmldir"><!--pname--><?php echo lang_admin('adddate');?></th>
                        <th class="catname"><!--pname--><?php echo lang_admin('account_receivable');?></th>
                        <th class="catname"><!--pname--><?php echo lang_admin('username');?></th>
                        <th class="catname"><!--pname--><?php echo lang_admin('cash_type');?></th>
                        <th class="htmldir"><!--pname--><?php echo lang_admin('remarks');?></th>
                        <th class="catname text-center"><?php echo lang_admin('state');?></th>
                        <th class="manage"><?php echo lang_admin('dosomething');?></th>
                    </tr>

                    </thead>
                    <tbody>
                    <?php if(is_array($data))
                        foreach($data as $d) { ?>
                            <tr class="s_out">
                                <td ><input onclick="c_chang(this)" type="checkbox"  value="<?php echo $d['id'];?>" name="select[]" class="checkbox" /></td>
                                <td class="catid text-center htmldir"><?php echo $d['id'];?></td>
                                <td class="catname"><?php echo $d['menoy'];?></td>
                                <td class="htmldir" align="left"><?php echo $d['adddate'];?></td>
                                <td class="catname" align="left"><?php echo $d['number'];?></td>
                                <td class="catname"><?php echo $d['username'];?></td>
                                <td class="catname">
                                    <?php
                                    switch($d['type']){
                                        case 1:
                                            echo "<p><span class='btn-soft-success'>".lang_admin('pay_zfb')."</span></p>";
                                            break;
                                        case 2:
                                            echo "<p><span class='btn-soft-success'>".lang_admin('wechat')."</span></p>";
                                            break;
                                        case 3:
                                            echo "<p><span class='btn-soft-success'>".lang_admin('paypal')."</span></p>";
                                            break;
                                        case 3:
                                            echo "<p><span class='btn-soft-success'>".lang_admin('tenpay')."</span></p>";
                                            break;
                                        default:
                                            echo "<p><span class='btn-icon-inner'>".lang_admin('pay_zfb')."</span></p>";
                                            break;
                                    }
                                    ?>
                                </td>
                                <td class="htmldir" align="left"><?php echo $d['message'];?></td>
                                <?php
                                switch($d['state']){
                                    case 1:
                                        $d['status']=lang_admin('audit_successful');
                                        break;
                                    case 2:
                                        $d['status']=lang_admin('audit_failed');
                                        break;
                                    default:
                                        $d['status']=lang_admin('cash_application');
                                        break;
                                }
                                ?>
                                <td class="catname text-center"><?php echo  $d['status'];?></td>

                                <td class="manage">
                                    <?php if ($d['state']==0){;?>
                                        <a href="#" onclick="gotourl(this)"
                                           data-dataurl="<?php echo url("cash/audit/id/".$d['id']);?>"
                                           title="<?php echo lang_admin('handle');?>" class="btn btn-gray" ><?php echo lang_admin('to_examine');?></a>
                                        <a href="#"   data-toggle="modal" data-target="#canceladuit"  onclick="$('#cash_id').val(<?php echo $d['id'];?>);"
                                           title="<?php echo lang_admin('handle');?>" class="btn btn-default" data-dataurlname="<?php echo lang_admin('cancellation_of_audit');?>"><?php echo lang_admin('cancellation_of_audit');?></a>
                                    <?php } else { ?>
                                        <a class="btn btn-default"><?php echo lang_admin('reviewed');?></a>
                                    <?php } ?>
                                </td>
                            </tr>
                        <?php } ?>

                    </tbody>
                </table>


                <div class="blank30"></div>
                <div class="line"></div>
                <div class="page"><?php if(get('table')!='type' && front::get('case')!='field') echo pagination::adminhtml($record_count); ?></div>
                <div class="blank30"></div>
            </div>

        </form>

        <!-- 取消审核Modal -->
        <div class="modal fade" id="canceladuit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-body" >
                        <div class="blank20"></div>
                        <div class="form-group">
                            <label><?php echo lang_admin('reason_for_failure');?>：</label>
                            <input type="hidden" id="cash_id" value="0">
                            <textarea name="returncon" id="returncon" class="form-control textarea"></textarea>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" id="confirm_noaudit" class="btn btn-primary"><?php echo lang('confirm');?></button>
                        <button type="button"  name="clos" class="btn btn-danger" data-dismiss="modal"><?php echo lang_admin("close");?></button>
                    </div>
                </div>
            </div>
        </div>
        <script>
            //取消审核
            $('#confirm_noaudit').click(function(){
                var cash_id=$("#cash_id").val();
                var returncon=$("#returncon").val();
                $.ajax({
                    type: "post",
                    url: "<?php echo url('cash/audit/noaudit/1',true);?>",
                    data: {"id": cash_id, "returncon": returncon},
                    dataType: 'json',
                    async: true,
                    success: function (data) {
                        //关闭服务器登录弹出框
                        $('#confirm_noaudit').modal('hide');
                        $(".modal-backdrop.fade").hide();
                        alert(data.message);
                        if (data.state){
                            gotoinurl("<?php echo uri();?>");
                        }
                    }
                });
            });
        </script>

        <div class="blank30"></div>
    </div>
</div>
<?php } ?>