-
Notifications
You must be signed in to change notification settings - Fork 0
/
trsSearch.php
75 lines (68 loc) · 1.82 KB
/
trsSearch.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
<?php
ob_start();
require_once (__DIR__.'/scripts/config.php');
?>
<?php
echo "<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>";
?>
<?php
echo "<div id = 'title'><h1>Transaction Report</h1></div>
<div id = 'allItems'>
<form><label>Transactions on: </label>
<input type='date' name='date' value='$date'/>
<button type='submit' name='submit' value='submit'>Apply</button>
<br/>
</form>
<table>
<tr>
<th>Transaction #</th>
<th>Transaction Date</th>
<th>Customer</th>
<th>Transaction Total</th>
</tr>";
$date=$_GET['date'];
if(empty($date))
{
$sql = "SELECT hdr.TransactionID,hdr.TransactionDate,c.customerFirstName,ttl.Amount FROM `Purchase_Hdr` hdr
join customer c on c.customerID=hdr.MemberID
join Purchase_Totals ttl on ttl.TransactionID=hdr.TransactionID
where ttl.TotalTypeID=1 order by hdr.TransactionDate";
}else
{
$sql = "SELECT hdr.TransactionID,hdr.TransactionDate,c.customerFirstName,ttl.Amount FROM `Purchase_Hdr` hdr
join customer c on c.customerID=hdr.MemberID
join Purchase_Totals ttl on ttl.TransactionID=hdr.TransactionID
where ttl.TotalTypeID=1 and hdr.TransactionDate='$date' order by hdr.TransactionDate";
}
$querystmt=$DB_con->prepare($sql);
$querystmt->execute();
try{
while($row=$querystmt->fetchObject()){
echo "<tr>";
echo "<td>{$row->TransactionID}</td>";
echo "<td>{$row->TransactionDate}</td>";
echo "<td>{$row->customerFirstName}</td>";
echo "<td>{$row->Amount}</td>";
echo "</tr>";
}
}
catch(PDOException $ex){
$user->redirect('error.php',$ex->getMessage());
}
echo "</table>";
?>
<?php
$page_Content=ob_get_contents();
ob_end_clean();
$pagetitle="Transaction Report";
include("master.php");
?>