-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport.php
More file actions
159 lines (152 loc) · 4.54 KB
/
Copy pathreport.php
File metadata and controls
159 lines (152 loc) · 4.54 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
include('components/config.php');
$total = 0;
$header = "";
if(isset($_POST['purchaseorderid'])) {
$header = "Purchase Order ". $_POST['purchaseorderid'];
$result = $user->generateReport('purchaseorder_id', $_POST['purchaseorderid']);
$purchaseorder = $user->getPurchaseOrder($_POST['purchaseorderid']);
}
else if(isset($_POST['release'])) {
$header = 'Release ' . $_POST['release'];
$result = $user->generateReport('release_version', $_POST['release']);
}
else if (isset($_POST['crtrno'])) {
$header = 'CR / TR No ' . $_POST['crtrno'];
$result = $user->generateReport('crtrno', $_POST['crtrno']);
}
else if (isset($_POST['expirydate'])) {
$header = 'Expiring before ' . $_POST['expirydate'];
$result = $user->generateReport('expirydate', $_POST['expirydate']);
}
else {
header('Location: generatereport.php');
}
date_default_timezone_set('Asia/Singapore');
$time = date("Y-m-d H:i:s");
include('components/sidebar.php')
?>
<script>
document.getElementById('generatereport.php').setAttribute("class", "current-page");
var purchaseorderid = <?php echo json_encode($result[0]); ?>;
console.log(<?php echo json_encode($purchaseorder);?>);
</script>
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Reports</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<section class="content invoice">
<!-- title row -->
<div class="row">
<div class="col-xs-12 invoice-header">
<h1>
<i class="fa fa-globe"></i> <?php echo $header; ?>
<small class="pull-right">Time Generated: <?php echo $time; ?></small>
</h1>
</div>
<!-- /.col -->
</div>
<!-- Table row -->
<div class="row">
<div class="col-xs-12 table">
<table class="table table-striped">
<thead>
<tr>
<th>Qty</th>
<th>Asset ID</th>
<th style="width: 59%">Description</th>
<th>Expiry Date</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<?php
foreach($result['asset'] as $row) {
echo '<tr>';
echo "<td>".htmlentities($row['quantity']) ."</td>";
echo "<td>".htmlentities($row['asset_ID']) ."</td>";
echo "<td>".htmlentities($row['description']) ."</td>";
echo "<td>".htmlentities($row['expirydate']) ."</td>";
if (isset($row['price'])) {
echo "<td>$".htmlentities($row['price']) ."</td>";
$total += $row['price'];
}
else {
echo "<td>NA</td>";
}
echo '</tr>';
}
if (isset($result['renewal'])) {
foreach($result['renewal'] as $row) {
echo '<tr>';
echo "<td>1</td>";
echo "<td>" .htmlentities($row['asset_ID']) ."</td>";
echo "<td>Renewal for Asset " .htmlentities($row['parent_ID']) ."</td>";
echo "<td>" .htmlentities($row['expiry_date']) ."</td>";
echo "<td>NA</td>";
echo '</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-6">
</div>
<!-- /.col -->
<div class="col-xs-6">
<p class="lead pull-right">Calculated Total $<?php echo $total;?>
<?php if(isset($_POST['purchaseorderid']) and $purchaseorder['exists']) {
echo "<br />Discount \${$purchaseorder['purchaseorder']['discount']}";
echo "<br />Saved Total \${$purchaseorder['purchaseorder']['total']}";
}?>
</p>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<!-- this row will not appear when printing -->
<div class="row hidden-print">
<div class="col-xs-12">
<button class="btn btn-default" onclick="window.print();"><i class="fa fa-print"></i> Print</button>
<a class="btn btn-default" href="downloadreport.php?<?php
if(isset($_POST['purchaseorderid'])) {
echo 'purchaseorderid='.$_POST['purchaseorderid'];
}
else if(isset($_POST['release'])) {
echo 'release='.$_POST['release'];
}
else if (isset($_POST['crtrno'])) {
echo 'crtrno='. $_POST['crtrno'];
}
else if (isset($_POST['expirydate'])) {
echo 'expirydate='. $_POST['expirydate'];
};
?>"><i class="fa fa-download"></i> Download Report</a>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<?php
include 'components/footer.php';
include 'components/closing.php';
?>