-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateReportFront.php
More file actions
216 lines (152 loc) · 7.44 KB
/
generateReportFront.php
File metadata and controls
216 lines (152 loc) · 7.44 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?php
include_once 'object/Customer.php';
if (isset($_POST["generateReportForm"])) {
// Create customer
$user = new User();
if (isset($_GET['customerReportID'])) {
$customerID = $_GET['customerReportID'];
}
// = $_POST['customerID'];
$startDate = $_POST['startDate'];
$endDate = $_POST['endDate'];
$customerDetailResult = $user->generateReport($startDate, $endDate, $customerID);
$customerResult = $user->searchCustomerByID($customerID);
} else if (isset($_POST['generateReportYearForm'])) {
$user = new User();
if (isset($_GET['customerReportID'])) {
$customerID = $_GET['customerReportID'];
}
$startDate = $_POST['startDate'];
$endDate = $_POST['endDate'];
$customerYearlyDetailResult = $user->generateYearlyReport($startDate, $endDate, $customerID);
$customerResult = $user->searchCustomerByID($customerID);
// $yearlySum = $user->yearlySum();
}
?>
<!DOCTYPE html>
<html lang="en">
<?php include_once 'head.php' ?>
<body>
<?php include_once 'header.php' ?>
<?php
$user = new User();
$allCustomers = $user->selectAllCustomer();
?>
<form method="POST">
<!-- <input type="hidden" value="<?php ?>">
<div class="d-flex justify-content-center pt-2">
<input list="browsers" class="w-25" name="getReport" id="browser">
<datalist id="browsers">
<?php if (!empty($allCustomers)) { ?>
<?php foreach ($allCustomers as $customer) { ?>
<option value="<?php echo $customer['name'] ?>">
<?php } ?>
<?php } ?>
</datalist>
<input type="submit" name="generateReportForm" class=" btn btn-primary" value="Generate Report">
</div> -->
<div class="d-flex justify-content-center pt-2">
<input type="text" class="w-25 text-center" name="name" value="<?php if (isset($_GET['customerReportName'])) {
echo $_GET['customerReportName'];
} ?>" disabled>
</div>
<input type="hidden" name="customerID" value="">
<div class="d-flex justify-content-around ">
<!-- Some Php Code to fetch Connection Date of given person from customers Table -->
<?php
$user = new User();
if (isset($_GET['customerReportID'])) {
$customerID = $_GET['customerReportID'];
}
$customerResult = $user->searchCustomerByID($customerID);
if (!empty($customerResult)) {
foreach ($customerResult as $cusResult) {
$defautlConValue = $cusResult['connection_date'];
}
}
?>
<!-- Code END -->
<div class="form-group">
<label for="Start Date">Start Date</label>
<input type="date" class="form-control" name="startDate" id="" value="<?php echo $defautlConValue ?>" aria-describedby="helpId" placeholder="" required>
</div>
<div class="form-group">
<label for="Start Date">End Date</label>
<input type="date" class="form-control" name="endDate" id="" aria-describedby="helpId" placeholder="" required>
</div>
</div>
<!-- Year Selection Date -->
<!-- <div class="d-flex justify-content-around ">
<div class="form-group">
<label for="Start Date">Start Year</label>
<input type="date" class="form-control" name="startYearDate" id="" aria-describedby="helpId" placeholder="" required>
</div>
<div class="form-group">
<label for="Start Date">End Year</label>
<input type="date" class="form-control" name="endYearDate" id="" aria-describedby="helpId" placeholder="" required>
</div>
</div> -->
<div class="d-flex justify-content-center ">
<div class="pr-1">
<input type="submit" name="generateReportForm" class=" btn btn-primary" value="Generate Report">
</div>
<div class="pl-1">
<input type="submit" name="generateReportYearForm" class=" btn btn-primary" value="Yearly Report">
</div>
</div>
</form>
<div class="row">
<div class="container pt-3">
<table class="table table-striped text-center table-sm ">
<thead class="bg-primary text-white">
<tr>
<th>ID</th>
<th>Name</th>
<th>Mobile</th>
<th>Fee Paid</th>
<th>Fee Payable</th>
<th>Arrears</th>
<th>Dated</th>
</tr>
</thead>
<tbody>
<?php if (!empty($customerDetailResult)) { ?>
<?php foreach ($customerDetailResult as $cusDetailResult) { ?>
<tr>
<?php if (!empty($customerResult)) { ?>
<?php foreach ($customerResult as $cusResult) { ?>
<td scope="row"><?php echo $cusResult['Customer_ID'] ?></td>
<td><?php echo $cusResult['name'] ?></td>
<td><?php echo $cusResult['mobile'] ?></td>
<?php } ?>
<?php } ?>
<td><?php echo $cusDetailResult['fee_paid'] ?></td>
<td></td>
<td><?php echo $cusDetailResult['arrears'] ?></td>
<td><?php echo $cusDetailResult['paid_date'] ?></td>
</tr>
<?php } ?>
<?php } else if (!empty($customerYearlyDetailResult)) { ?>
<?php foreach ($customerYearlyDetailResult as $cusDetailResult) { ?>
<tr>
<?php if (!empty($customerResult)) { ?>
<?php foreach ($customerResult as $cusResult) { ?>
<td scope="row"><?php echo $cusResult['Customer_ID'] ?></td>
<td><?php echo $cusResult['name'] ?></td>
<td><?php echo $cusResult['mobile'] ?></td>
<?php } ?>
<?php } ?>
<td><?php echo $cusDetailResult['feeSum'] ?></td>
<td></td>
<td><?php echo $cusDetailResult['arrearsSum'] ?></td>
<td><?php echo $cusDetailResult['paid_date'] ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php include_once 'footer.php' ?>
</body>
</html>