<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>

<link rel="stylesheet" href="${contextPath}/static/assets/css/jquery.gritter.css" />
<link rel="stylesheet" href="${contextPath}/static/assets/css/bootstrap-datetimepicker.css" />

<style>
</style>
    <div style="height: 50%">
        <table class="table table-bordered">
            <caption>日报</caption>
            <thead>
            <tr>
                <th>今日付款数</th>
                <th>今日付款金额</th>
                <th>本月付款数</th>
                <th>本月付款金额</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td id="dayNum">Tanmay</td>
                <td id="dayPrice">Bangalore</td>
                <td id="monthNum">560001</td>
                <td id="montPrice">560001</td>
            </tr>
            </tbody>
        </table>

    </div>

        <div style="height: 50%">

            开始日期：<input id="startDate" type="text">
            &nbsp;&nbsp;&nbsp;&nbsp;
            结束日期：<input id="endDate" type="text">
            <a data-toggle="tab" href="javascript:void(0)" class="btn-new-mail" id="row11">
                <button type="button" class="btn btn-default" onclick="getDate()">查询</button>
            </a>

            <table class="table table-bordered">
                <caption>周报月报</caption>
                <thead>
                <tr>
                    <th>付款数</th>
                    <th>付款金额</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td id="LszpCount"></td>
                    <td id="LszpSum"></td>
                </tr>
                </tbody>
            </table>

        </div>


<script src="${contextPath}/static/assets/js/excanvas.js"></script>

<script type="text/javascript">
    var scripts = [ null,  "${contextPath}/static/assets/js/date-time/bootstrap-datepicker.js",
        "${contextPath}/static/assets/js/date-time/locales/bootstrap-datepicker.zh-CN.js",
        "${contextPath}/static/assets/js/jqGrid/jquery.jqGrid.js",
        "${contextPath}/static/assets/js/jqGrid/i18n/grid.locale-cn.js", null ]

    $(".page-content-area").ace_ajax("loadScripts", scripts, function() {
        jQuery(function($){
            $('#startDate').datepicker({
                language: 'zh-CN',
                pickTime: false,
                todayBtn: true,
                autoclose: true,
                minView: '2',
                forceParse: false,
                format:"yyyy-mm-dd"
            });
            $('#endDate').datepicker({
                language: 'zh-CN',
                pickTime: false,
                todayBtn: true,
                autoclose: true,
                minView: '2',
                forceParse: false,
                format:"yyyy-mm-dd"
            });
        });

    });

    getCount();

    function getCount() {

        console.log(1);
        $.ajax({
            type:"post",
            url:"${contextPath}/lszp/Job/lszpData",
            dataType:"json",
            success:function(res){
              var dayNum  =  res[0]; //日付款数
              var monthNum  =  res[1];//月付款数
              var dayPrice  =  res[2];//日付款金额
              var montPrice  =  res[3];//月付款金额
                $("#dayNum").html(dayNum);
                $("#monthNum").html(monthNum);
                $("#dayPrice").html(dayPrice);
                $("#montPrice").html(montPrice);
            }
        })
    }


    $(document).keydown(function(event) {
        var key = window.event ? event.keyCode : event.which;
        if (key == 13) {
            $("#count").click();
        }
    });

    function getDate(){
        var startDate = encodeURI(encodeURI($("#startDate").val()));
        var endDate = encodeURI(encodeURI($("#endDate").val()));
        $.ajax({
            type:"post",
            url:"${contextPath}/lszp/Job/lszpAllData",
            data:{
                "startDate":startDate,
                "endDate":endDate
            },
            dataType:"json",
            success:function(res){
                var count =  res[0];
                var sum =  res[1];
                $("#LszpCount").html(count);
                $("#LszpSum").html(sum);
            }
        })
    }



</script>