XLSPIVOT.jsp 2.47 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*,com.csc.library.session.*,com.csc.library.report.*"%>
<%@page import="com.csc.library.export.*"%>
<%@page import="jxl.Workbook,java.io.File"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="com.csc.library.database.*" %>
<jsp:useBean id="XLSOPTION" class="com.csc.library.system.Task" scope="page" />
<%
	XLSOPTION.setChannel(request, response);
	XLSOPTION.checkProfile();
	UProfile up=XLSOPTION.getUProfile();
%>

<head>
<title>Privot</title>
 <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />




<script language="JavaScript" type="text/JavaScript">
	function getDataPivot(){
		with(document.cscform){
			var filter = "";
			if(__condition.value!=""){
				filter += " where "+__condition.value;
			}
			if(__groupText.value!=""){
				filter += " group by "+__groupText.value;
			}
			if(__orderText.value!=""){
				filter += " order by "+__orderText.value;
			}
			pivot_dwr.getData(Array(__xlsnameFilter.value,__columnlist.value,filter), callbackPivot)
		}
	}
	var callbackPivot = function(data){

			if(data != ""){
				var value =$.parseJSON(data);
				//alert(JSON.stringify(value));
				webix.ready(function(){
					grida = webix.ui({
						container:"pivotZone",
						id:"pivot",
						view:"pivot",
						height:400,
						width:800,
						data:value,
						max: true,
						structure: {
						}
					});
				});
				
			}
		$$("pivot").configure();
	}
	function pivotToExcel(){
		//document.getElementById("pivotZoneExcel").innerHTML = document.getElementById("pivotZone").innerHTML;
		webix.toExcel($$("pivot"), {
			filename: "Pivot", // for filename
			name: "Pivot", // for sheet name
			filterHTML:true
		});
	}
</script>

</head>

<body onload="">
	<div align="center" class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title" align="right">&nbsp</h3>
		</div>
		<br>
		<div align="" id="pivotZone"></div><br>
		<div align="center">
			<button type="button" class="btn btn-sm btn-primary" onclick="goFilter()">&nbsp;&nbsp;BACK&nbsp;&nbsp;</button>
			<button type="button" class="btn btn-sm btn-primary" onclick="pivotToExcel();">Export</button>
		</div>
		<br>
	</div>
		<style type="text/css">
			html, body {
				width: 100%;
				height: 100%;
				padding: 0;
				margin: 0;
			}
		</style>
		</script>

</body>