report.jsp 15.2 KB
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
    <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">
    <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
    <link href="<%=basePath %>resource/css/form.css" rel="stylesheet">
    <link href="<%=basePath %>resource/css/bootstrap.min.css" rel="stylesheet" >
    <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>
    <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
    <link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">
    <link rel="stylesheet" href="<%=basePath %>resource/css/loading.css">
    <style type="text/css">
    	td{
    		border:1px solid #aaa;
    		text-align:center;
    	}
    	th{
    		text-align:center;
    	}
    </style>
    <!-- validate 验证中英文 -->
    <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
</head>
<body>
<div class="container" style="padding:10px;margin-left:0px;margin-right:0px;width:100%">
    <div data-options="closable:true" class="datagrid-toolbar">

        <div id="tb" style="padding:0 30px;">
            <form id="searchForm" action="<%=basePath %>billcheck/report">
   				 <spring:message code="billcheck.station" />
                 <select class="required" id="deliveryStation"  name="deliveryStation"  style="width:166px;height:35px;line-height:35px;padding-left: 10px;">
                     <option value=""><spring:message code="opt.select" /></option>
                     <c:forEach items="${stations}" var="item">
                         <option value="${item.code}" <c:if test="${check.deliveryStation == item.name}">selected</c:if>>${item.name}</option>
                     </c:forEach>
                 </select>
          		 <spring:message code="billcheck.month" />
                 <input class="Wdate required" type="text" id="start_date" name="start_date" value="${dateModel}" onClick="WdatePicker1()" style="width:150px;height:31px;line-height:31px;padding-left: 10px;">
                 <input class="Wdate required" type="text" id="end_date" name="end_date" value="${dateModel}" onClick="WdatePicker1()" style="width:150px;height:31px;line-height:31px;padding-left:10px">
                 
                 <a href="javascript:doSearch()" class="easyui-linkbutton" iconClass="icon-search" data-options="selected:true"><spring:message code="opt.search"/></a>
            </form>
        </div>
    </div>
    <div class="datagrid-view content" style="padding-left: 0px;">   	
	 		<div id="loading" style="display:none;position:absolute;left:45%;top:20%;z-index:100;width:100px;height:100px;">	
 				<div id="preloader_3"></div>
 			</div>
 			<div id="page_div">
    	
    	</div>
        <%-- 
        <table style="width:100%;" class="datagrid-toolbar kv-table">
            <thead>
            <tr>
            	<th class="kv-label" style="width:350px;" ><spring:message code="billcheck.snumber"/></th>
                <th class="pl-10 kv-label" width="50"><spring:message code="billcheck.destinationstation" /></th>
                <th class="pl-10 kv-label" width="50"><spring:message code="billcheck.masterbillnumber" /></th>
                <th class="pl-10 kv-label" width="50"><spring:message code="billcheck.airfare" /></th>
                <th class="pl-10 kv-label" width="30"><spring:message code="billcheck.oilcharge" /></th>
                <th class="pl-10 kv-label" width="50"><spring:message code="billcheck.otherexpenses" /></th>
                <th class="pl-10 kv-label" width="50"><spring:message code="billcheck.hawb" /></th>
                <th class="pl-10 kv-label" width="25"><spring:message code="billcheck.housebillcost" /></th>
            </tr>
            </thead>
            <c:if test="${check != null }">
            <tbody>
                <tr>
                    <td class="kv-label" style="width: 350px;">${check.agent}</td>
                    <td class="pl-10 kv-label" width="50">${check.payee}</td>
                    <td class="pl-10 kv-label" width="50">${check.payDate}</td>
                    <td class="pl-10 kv-label" width="50">${check.paymentMethod}</td>
                    <td class="pl-10 kv-label" width="80">${check.mawbCash}</td>
                    <td class="pl-10 kv-label" width="50">${check.hawbCash}</td>
                    <td class="pl-10 kv-label" width="50">${check.totalCash}</td>
                    <td class="pl-10 kv-label" width="25"><a href="javascript:void(0)" style="text-decoration:none;" onclick="editRow()"><i class="iconfont">&#xe65a;</i></a></td>
                </tr>
            </tbody>
            </c:if>
        </table> --%>
    </div>
    
    
    
    <div id="Dialog" class="easyui-dialog" title="账单核审" style="width: 600px; height: 280px;"
         data-options="iconCls:'pag-list',modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,closed:true">
        <div style="margin-left: 5px;margin-right: 5px;margin-top: 5px;">
            <form id="dialogForm">
            <div class="data-tips-info">
                <div class="data-tips-tip icon-tip">

                </div>
            </div>
            <div class="modal-body" style="padding-top: 30px;padding-left: 20px;padding-right: 20px;">
                <%-- <table class="kv-table">
                    <input type="hidden" name="id" value="${check.id}">
                    <input type="hidden" name="agent" value="${check.agent}">
                    <input type="hidden" id="payDate" name="payDate" value="${check.payDate}">
                    <input type="hidden" name="mawbCash" value="${check.mawbCash}">
                    <input type="hidden" name="hawbCash" value="${check.hawbCash}">
                    <input type="hidden" name="totalCash" value="${check.totalCash}">
                    <input type="hidden" id="station" name="deliveryStation" value="${check.deliveryStation}">
                    <tr>
                        <td class="dialog_td"><spring:message code="billcheck.payee" /></td>
                        <td class="dialog_td"><input type="text" name="payee" value="${check.payee}"></td>
                    </tr>
                    <tr>
                        <td class="dialog_td"><spring:message code="billcheck.paymentmethod" /></td>
                        <td class="dialog_td">
                            <select name="paymentMethod">
                                <option ><spring:message code="opt.select"></spring:message> </option>
                                <option value="银联" <c:if test="${check.paymentMethod=='银联'}">selected="selected" </c:if>>银联</option>
                                <option value="支付宝" <c:if test="${check.paymentMethod=='支付宝'}">selected="selected" </c:if>>支付宝</option>
                                <option value="微信" <c:if test="${check.paymentMethod=='微信'}">selected="selected" </c:if>>微信</option>
                            </select>
                        </td>
                    </tr>
                </table> --%>
            </div>
            <div style="text-align: center;padding-top: 30px;">
                <button type="button" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true" onclick="save()">
                    <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save"/></span></span>
                </button>
                <button type="button" class="easyui-linkbutton l-btn l-btn-small" onclick="cancel()" style="margin-left: 20px;"><span class="l-btn-left">
                    <span class="l-btn-text"><spring:message code="opt.cancel"/></span></span>
                </button>
            </div>
            </form>
        </div>
    </div>

</div>
<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
<script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/femy/fpage.js"></script>

<script type="text/javascript">

    function doSearch(){

       /* if($("#deliveryStation").val()==''){
            layer.open({content: "请选择交运货站"});
            return;
        }*/
        //var formdata = $("#searchForm").serialize();
        //$("#searchForm").submit();
        
        
    	search();
    }

    var s;
    var load_data;
    var data_index = -1;
    var return_count = 0;
    var resultCount = {
    		s1:0.0,
    		s2:0.0,
    		s3:0.0,
    		s4:0.0
    };
    $(document).ready(function(){
    	s = $("#page_div").loaddata({
    		url:"<%=basePath %>billcheck/search",
    		data:{},
    		page_count:10,
    		page:1,
    		error:function(){
    			layer.alert("数据加载失败!");
    			$("#loading").hide();
    		},
    		page_click:function(page){
    			$("#loading").show();
    		},
    		startData:function(){
    			load_data = [];
    			var tablestr = ""+
    	        /* "<table style='width:100%;' class='table table-striped table-bordered table-hover'>"+ */
    	        "<table style='width:100%' class='datagrid-toolbar kv-table' cellspacing='1' cellpadding='0'>"+
                "<thead>"+
                "<tr>"+
                	"<th class=\"kv-label\" style=\"width:50px;\" ><spring:message code='billcheck.snumber'/></th>"+
                    "<th class='pl-10 kv-label' width='50'><spring:message code='billcheck.destinationstation' /></th>"+
                    "<th class='pl-10 kv-label' width='50'><spring:message code='billcheck.masterbillnumber' /></th>"+
                    "<th class='pl-10 kv-label' width='50'><spring:message code='billcheck.airfare' /></th>"+
                    "<th class='pl-10 kv-label' width='30'><spring:message code='billcheck.oilcharge' /></th>"+
                    "<th class='pl-10 kv-label' width='50'><spring:message code='billcheck.otherexpenses' /></th>"+
                    "<th class='pl-10 kv-label' width='50'><spring:message code='billcheck.hawb' /></th>"+
                    "<th class='pl-10 kv-label' width='25'><spring:message code='billcheck.housebillcost' /></th>"
                "</tr>"+
                "</thead>"+
                "<tbody>";
                
                resultCount.s1 = 0; resultCount.s2 = 0;
                resultCount.s3 = 0; resultCount.s4 = 0;
    			return tablestr;
    		},
    		callData:function(data, index){
    			return_count ++;
    			load_data.push(data);
    			console.log(data);
    			var rdata = data;
    			data = rdata.mawblist;
    			var odata = rdata.hawblist;
    			
    			var text = "<tr>";
    			text += "<td>"+(index+1)+"</td>";
    			text += "<td>"+(data.airport?data.airport:'')+"</td>";		//目的站
    			text += "<td>"+(data.mawbNo?data.mawbNo:'')+"</td>";							//主单号
    			text += "<td>"+(data.chgs_code?data.chgs_code:'')+"</td>";						//航空费用
    			resultCount.s1 += parseFloat(data.chgs_code?data.chgs_code:"0");				//航空费用
    			
    			//燃油费other_charges
    			var otherCharges = data.other_charges;
    			var reg = /MYC:\d+\.?\d+/;
    			if(otherCharges && (vp = otherCharges.match(reg)))
    			{
    				text += "<td>"+vp[0].substr(4, vp[0].length)+"</td>";
    				resultCount.s2 += parseFloat(vp[0].substr(4, vp[0].length));				//燃油费
    			}
    			else
    				text += "<td></td>";
    			reg = /OTHER:\d+\.?\d+/;
    			if(otherCharges && (vp = otherCharges.match(reg)))
    			{
    				text += "<td>"+vp[0].substr(6, vp[0].length)+"</td>";
    				resultCount.s3 += parseFloat(vp[0].substr(6, vp[0].length));
    			}
    			else
	    			text += "<td></td>";
	    		
    			text += "<td>"+((odata&&odata.mawbNo)?odata.mawbNo:'')+"</td>";
    			text += "<td>"+((odata&&odata.chgs_code)?odata.chgs_code:'')+"</td>";
    			resultCount.s4 += parseFloat((odata&&odata.chgs_code)?odata.chgs_code:"0");
    			text += "</tr>";
    			return text;
    		//	return "<li class='list-group-item'><a href='javascript:void(0)' onclick='show_popover("+index+")'> 姓名:"+data.name+" 日期:"+date.toLocaleDateString()+"</a></li>";
    		},
    		endData:function(){
    			$("#loading").hide();
    			if(return_count == 0)
    			{
    				$($("#page_div").find("div")[0]).html("未找到数据");
    			}
    			var text = "<tr>";
    			text += "<td>总计</td>";
    			text += "<td></td>"; text += "<td></td>";
    			text += "<td>"+resultCount.s1+"</td>";
    			text += "<td>"+resultCount.s2+"</td>";
    			text += "<td>"+resultCount.s3+"</td><td></td>";
    			text += "<td>"+resultCount.s4+"</td>";
    			text += "</tr>";
    			return text+"</tbody></table>";
    		}
    	});
    });
    function search(){
    	
    	var start_page;				//查询第几页
    	var page_length;			//每一页的长度
    	
    	var param = s.getParam();
    	param.data.start_time = $("#start_date").val();
    	param.data.end_time = $("#end_date").val();
    	param.data.deliveryStation = $("#deliveryStation").val();
    	param.page = 1;
    	//console.log(param);
    	s.setParam(param);
    	s.page = 0;
    	s.query();
    	
    	$("#loading").show();
    }

    function editRow(id){
        $("#station").val($("#deliveryStation").val())
        $("#Dialog").dialog('open');
        /*if($("#deliveryStation").val()==''){
            layer.open({content: "请选择交运货站"});
            return;
        }else{
            $("#station").val($("#deliveryStation").val())
            $("#Dialog").dialog('open');
        }*/
    }

    function cancel(){
        $("#Dialog").dialog('close');
    }

    function save(){
        var date =$("#date").val();
        $("#Dialog").dialog('close');
        var formdata = $("#dialogForm").serialize();
        $.post("<%=basePath %>billcheck/save",formdata,function(data){
            if (data.status == 200) {
                layer.confirm("<spring:message code="opt.savesuccess"/>", {btn: ['<spring:message code="opt.confirm"/>', '<spring:message code="opt.cancel"/>']}, function () {
                    window.location.href="<%=basePath %>billcheck/report?id="+data.data;
                })
            } else {
                layer.open({content: "<spring:message code="opt.savefailed"/>"});
            }
        })
    }

    function WdatePicker1(){
        WdatePicker({dateFmt:'yyyy-MM-dd',isShowToday:false,isShowClear:false})
    }
</script>
</body>
</html>