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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <?php require_once '../include/head.php'; require_once '../include/checkuser.php'; require_once '../include/Nav_bar.php'; include_once '../include/DBConnect.php'; ?> <script> $(function() { $('.date-picker').datetimepicker({pickTime: false, format: 'yyyy-MM-dd'}); }); $(document).ready(function() { $('#start_date').datetimepicker().on('changeDate', function(ev) { date = new Date($('#start_date_input').val()); $('#end_date').datetimepicker('setStartDate', date); $('#end_date').datetimepicker('setDate', date); $('#end_date').datetimepicker('show'); $('#start_date').datetimepicker('hide'); $('#end_date').datetimepicker('remove'); }); $('#end_date').datetimepicker().on('changeDate', function(ev) { $('#end_date').datetimepicker('hide'); }); }); </script> </head> <body> <!-- line between nav bar and content --> <div class="text-right"> <ul class="breadcrumb"> <li class="active">Invoice record</li> </ul> </div> <div class="container-fluid pathways-container"> <div> <table border="0" width="100%"> <tr> <td><h2>Invoice Records</h2></td> <td><a href="invoice_search.php" class="btn pull-right"><i class="icon-plus"></i> Generate</a></td> </tr> </table> </div> <div class="pathways-search"> <form action="" method="POST" class="form-inline"> <table border="0"> <tr> <?php if (isset($_POST['search']) && $_POST['search'] == "Search") { $invoice_code = $_POST['invoice_code']; $from_date = $_POST['from_date']; $to_date = $_POST['to_date']; ?> <td>Invoice Code:</td> <td><input type="text" name="invoice_code" value="<?= $invoice_code ?>"></td> <td>Date From</td> <td> <div class="input-append date-picker" id="start_date"> <input type="text" name="from_date" id="start_date_input" class="dateISO" value="<?= $from_date ?>"> <span class="add-on"> <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i> </span> </div> </td> <td>Date To</td> <td> <div class="input-append date-picker" id="end_date"> <input type="text" name="to_date" class="dateISO" value="<?= $to_date ?>"> <span class="add-on"> <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i> </span> </div> </td> <?php } else { ?> <td>Invoice Code:</td> <td><input type="text" name="invoice_code"></td> <td>Date From</td> <td> <div class="input-append date-picker" id="start_date"> <input type="text" name="from_date" id="start_date_input" class="dateISO"> <span class="add-on"> <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i> </span> </div> </td> <td>Date To</td> <td> <div class="input-append date-picker" id="end_date"> <input type="text" name="to_date" class="dateISO"> <span class="add-on"> <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i> </span> </div> </td> <?php } ?> <td><input type="submit" name="search" value="Search" class="btn"></td> </tr> </table> </form> </div> <form action="" method="POST"> <table border="0" class="table table-striped table-bordered table-hover table-condensed"> <thead> <tr> <th> </th> <th>Invoice Code</th> <th>Create Date</th> <th>Related Student Name(Student Code)/School Name</th> </tr> </thead> <tbody id='search_result'> <?php if (isset($_POST['search']) && $_POST['search'] == "Search") { $invoice_code = $_POST['invoice_code']; $from_date = $_POST['from_date']; $to_date = $_POST['to_date'];
if ($from_date == "" && $to_date == "") { $query = "Select i.invoice_id,i.invoice_code,i.invoice_date,stu.linking_id,stu.New_stu_ID as id,stu.last_name,stu.first_name,stu.root_id from student as stu, invoice as i where stu.root_id=i.stu_linking_id and stu.deleted=0 and stu.actived=1 and i.deleted=0 and i.actived=1 and i.invoice_code like '%$invoice_code%' order by i.createdate DESC"; } else { $query = "Select i.invoice_id,i.invoice_code,i.invoice_date,stu.linking_id,stu.New_stu_ID as id,stu.last_name,stu.first_name,stu.root_id from student as stu, invoice as i where stu.root_id=i.stu_linking_id and stu.deleted=0 and stu.actived=1 and i.deleted=0 and i.actived=1 and i.invoice_code like '%$invoice_code%' and i.invoice_date>='$from_date' and i.invoice_date<='$to_date' order by i.createdate DESC"; }
$result = $dbh->query($query); $result->setFetchMode(PDO::FETCH_OBJ); while ($row = $result->fetch()) { ?> <tr> <td> <a href="invoice_edit.php?linking_id=<?= $row->linking_id ?>&invoice_id=<?= $row->invoice_id ?>&stu_root_id=<?= $row->root_id ?>&action=View" class="btn"><i class="icon-eye-open"></i> View</a> </td> <td><?= $row->invoice_code ?></td> <td><?= $row->invoice_date ?></td> <td><?= $row->last_name . ' ' . $row->first_name . '(' . $row->id . ')' ?></td> </tr> <?php }//in-house if ($from_date == "" && $to_date == "") { $query = "Select i.invoice_id,i.invoice_code,i.invoice_date,i.school_id,sch.sch_name from school as sch, invoice as i where sch.school_id=i.school_id and sch.deleted=0 and sch.actived=1 and i.deleted=0 and i.actived=1 and i.invoice_code like '%$invoice_code%' order by i.createdate DESC"; } else { $query = "Select i.invoice_id,i.invoice_code,i.invoice_date,i.school_id,sch.sch_name from school as sch, invoice as i where sch.school_id=i.school_id and sch.deleted=0 and sch.actived=1 and i.deleted=0 and i.actived=1 and i.invoice_code like '%$invoice_code%' and i.invoice_date>='$from_date' and i.invoice_date<='$to_date' order by i.createdate DESC"; } $result = $dbh->query($query); $result->setFetchMode(PDO::FETCH_OBJ); while ($row = $result->fetch()) { ?> <tr> <td> <a href="invoice_edit.php?school_id=<?= $row->school_id ?>&invoice_id=<?= $row->invoice_id ?>&action=View" class="btn"><i class="icon-eye-open"></i> View</a> </td> <td><?= $row->invoice_code ?></td> <td><?= $row->invoice_date ?></td> <td><?= $row->sch_name ?></td> </tr> <?php } } ?> </tbody> </table> </form> </div> </body> </html>
|