-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreports-installations-custom.php
106 lines (102 loc) · 5.45 KB
/
reports-installations-custom.php
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
97
98
99
100
101
102
103
104
105
106
<?php
require_once'includes/initialize.php';
require_once 'layouts/header.php';
require_once 'layouts/sidepane.php'; ?>
<div class="container1">
<h3 style="text-align: center; ">Reports-Custom Subscription Report</h3>
<hr/>
<?php if(isset($message)){ echo "<h4 class='alert-info'>".$message."</h4>" ;} ?>
<ul class="navsmall">
<li><a href="reports.php"><h4>Overview</h4></a></li>
<li><a href="reports-sales.php"><h4>Sales</h4></a></li>
<li><a href="reports-installations.php"><h4>Subscriptions</h4></a></li>
<li><a href="reports-stock.php"><h4>Stock</h4></a></li>
</ul><br /><hr />
<ul class="navsmall">
<li><a href="reports-installations.php"><h4>Subscription Report / User</h4></a></li>
<li><a href="reports-installations-package.php"><h4>Subscription Report / Package </h4></a></li>
<li><a href="reports-installations-custom.php"><h4>Custom Report</h4></a></li>
</ul><br /><hr />
<div id="container2">
<table class="data_pes" style="width: 90%">
<thead style="position: relative;">
<th>START DATE</th>
<th>END DATE</th>
<th>PACKAGE</th>
<th>USER</th>
<th>ORDER</th>
<th>DIRECTION</th>
<th></th>
</thead>
<tbody>
<tr>
<td><input type="date" id="sdate" class="input-medium" value="<?php echo date("Y-m-01") ?>" /></td>
<td><input type="date" id="edate" class="input-medium" /></td>
<td>
<select id="package" class="input-medium">
<option value="">All</option>
<?php $categorys = Category::find_all(); if ($categorys){ foreach($categorys as $category): ?>
<optgroup label="<?php echo $category->name; ?>">
<?php $packages = Package::find_all_for_category($category->id);
foreach ($packages as $package): ?>
<option value="<?php echo $package->id ?>"><?php echo $package->name ?></option>
<?php endforeach; echo "</optgroup>"; endforeach; } ?>
</select>
</td>
<td> <select id="user" class="input-medium">
<?php if ($session->role == 1){ ?>
<option value="">All</option>
<?php $users = User::find_all(); if ($users){ foreach($users as $user): ?>
<option value="<?php echo $user->id ?>"><?php echo $user->name ?></option>
<?php endforeach; } } else { ?>
<option value="<?php echo $session->id ?>">Me</option>
<?php } ?>
</select></td>
<td> <select id="order" class="input-medium">
<option value="created">Date</option>
<option value="stock">Package</option>
<?php if ($session->role == 1){ ?><option value="createdby">User</option> <?php } ?>
</select></td>
<td> <select id="direction" class="input-medium">
<option value="ASC">Earliest First</option>
<option value="DESC">Latest First</option>
</select></td>
<td>
<button onclick="show_report();" class="btn btn-info">SHOW</button>
</td>
</tr>
</tbody>
</table>
<hr />
<div id="results"></div>
</div>
</div>
<script type="text/javascript">
function show_report(){
document.getElementById('results').innerHTML = "Please Wait, Processing...";
var sdate = document.getElementById('sdate').value;
var edate = document.getElementById('edate').value;
var package = document.getElementById('package').value;
var user = document.getElementById('user').value;
var order = document.getElementById('order').value;
var direction = document.getElementById('direction').value;
if(window.XMLHttpRequest) {
mlhttp=new XMLHttpRequest();
}
else {
mlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
mlhttp.onreadystatechange=function(){
if (mlhttp.readyState===4 && mlhttp.status===200){
document.getElementById('results').innerHTML = mlhttp.responseText;
var myScripts = editdiv.getElementsByTagName("script");
if (myScripts.length > 0) {
eval(myScripts[0].innerHTML);
}
}
};
mlhttp.open("GET","as/search.php?type=subsearch&sdate="+ sdate + "&edate="+edate + "&package=" +package+"&user="+user+"&order="+order+"&direction="+direction,true);
mlhttp.send();
}
</script>
<?php require_once 'layouts/footer.php';