-
Notifications
You must be signed in to change notification settings - Fork 1
/
kits_issue_slip_print.php
254 lines (242 loc) · 9.67 KB
/
kits_issue_slip_print.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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<?php
include './include/check_login.php';
include './include/connection.php';
include_once 'include/admin-main.php';
$guard_sql = "SELECT * FROM guards WHERE status = 1 LIMIT 1";
$guard_result = $con->query($guard_sql);
if ($guard_result->num_rows > 0) {
$guard = $guard_result->fetch_assoc();
$signature_file_path = $guard['signature'];
} else {
// Handle case where no guard has status = 1
$guard_name = "No default guard set";
$signature_file_path = null;
}
$supervisors_sql = "SELECT * FROM supervisors WHERE status = 1 LIMIT 1";
$supervisors_result = $con->query($supervisors_sql);
if ($supervisors_result->num_rows > 0) {
$supervisors = $supervisors_result->fetch_assoc();
$signature_supervisors_path = $supervisors['signature'];
} else {
// Handle case where no guard has status = 1
$supervisors_name = "No default guard set";
$signature_supervisors_path = null;
}
// Fetch the last submitted entry
$query = "SELECT * FROM kits_issue ORDER BY id DESC LIMIT 1";
$result = mysqli_query($con, $query);
$entry = mysqli_fetch_assoc($result);
if (!$entry) {
echo "No entries found.";
exit();
}
// Fetch all added products corresponding to the last submitted entry's challan_no
$challan_no = $entry['challan_no'];
$product_query = "SELECT * FROM kits_issue WHERE challan_no = '$challan_no'";
$product_result = mysqli_query($con, $product_query);
// Fetch the stitcher name for the invoice
$stitcher_name = $entry['stitcher_name']; // Fetching stitcher name from the last submitted entry
$stitcher_query = "SELECT * FROM stitcher WHERE stitcher_name = '$stitcher_name' LIMIT 1";
$stitcher_result = mysqli_query($con, $stitcher_query);
$stitcher_row = mysqli_fetch_assoc($stitcher_result);
$stitcher_address = $stitcher_row['stitcher_address'];
$stitcher_aadhar = $stitcher_row['stitcher_aadhar'];
$stitcher_pan = $stitcher_row['stitcher_pan'];
$signature_filename = $stitcher_row['signature']; // Get the signature filename
// Define the path to the signature
$signature_path = 'uploads/signatures/' . $signature_filename;
// Fetch the date and time
$date_and_time_query = "SELECT date_and_time FROM kits_issue WHERE challan_no = '$challan_no' LIMIT 1";
$date_and_time_result = mysqli_query($con, $date_and_time_query);
$date_and_time_row = mysqli_fetch_assoc($date_and_time_result);
$date_and_time = $date_and_time_row['date_and_time'];
// Fetch the stitcher contact for the invoice
$stitcher_contact_query = "SELECT stitcher_contact FROM stitcher WHERE stitcher_name = '$stitcher_name' LIMIT 1";
$stitcher_contact_result = mysqli_query($con, $stitcher_contact_query);
$stitcher_contact_row = mysqli_fetch_assoc($stitcher_contact_result);
$stitcher_contact = $stitcher_contact_row['stitcher_contact'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Khanna Sports Kits Issue Slip</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
@page {
size: A4;
margin: 1cm;
}
body {
font-family: Arial, sans-serif;
}
.container {
margin-top: 50px;
padding: 20px;
border-radius: 10px;
}
.heading {
text-align: center;
margin-bottom: 20px;
color: #333;
line-height: 5px;
}
.table {
margin-top: 0px;
}
.footer {
margin-top: 30px;
display: flex;
justify-content: space-between;
align-items: center;
color: #555;
}
.signature-box {
flex: 1;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.signature-box img {
width: 150px;
height: 50px;
margin-top: 5px;
}
.print-btn {
display: block;
margin-top: 20px;
text-align: center;
}
#head_details {
display: flex;
margin-top: 0px;
padding-top: 0px;
flex-direction: row;
align-items: flex-end;
justify-content: space-between;
}
@media print {
.print-btn {
display: none !important;
}
}
p {
line-height: 7px;
}
.stitcher_bold {
font-weight: bold;
}
.issue_heading {
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<div class="invoice-header">
<div>
<p class="issue_heading">KITS ISSUE SLIP</p>
<hr>
<h2 class="heading">KHANNA SPORTS INDUSTRIES PVT. LTD</h2>
<p class="heading">A-7, Sports Complex Delhi Road Meerut Uttar Pradesh 250002</p>
<p class="heading">Contact: 8449441387, 98378427750 GST: 09AAACK9669A1ZD</p>
</div>
<div id="head_details">
<div>
<p class="stitcher_bold">Stitcher: <?php echo $stitcher_name; ?></p>
<p>Stitcher Contact: <?php echo $stitcher_contact; ?></p>
<p>Stitcher Aadhar: <?php echo $stitcher_aadhar; ?></p>
<p>Stitcher Pan: <?php echo $stitcher_pan; ?></p>
<p>Stitcher Address: <?php echo $stitcher_address; ?></p>
</div>
<div>
<p><br/><br/>Challan No: <?php echo $entry['challan_no']; ?></p>
<p>Date: <?php echo date('d-m-Y', strtotime($date_and_time)); ?></p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-bordered">
<thead>
<tr>
<th>Product Name</th>
<th>Product Base</th>
<th>Product Color</th>
<th>Product Quantity</th>
<th>Bladder Type</th>
<th>Bladder Quantity</th>
<th>Thread Type</th>
<th>Thread Quantity</th>
</tr>
</thead>
<tbody>
<?php
$total_product_quantity = 0;
$total_bladder_quantity = 0;
$total_thread_quantity = 0;
while ($product = mysqli_fetch_assoc($product_result)) :
$total_product_quantity += $product['issue_quantity'];
$total_bladder_quantity += $product['bladder_quantity'];
$total_thread_quantity += $product['thread_quantity'];
?>
<tr>
<td><?php echo $product['product_name']; ?></td>
<td><?php echo $product['product_base']; ?></td>
<td><?php echo $product['product_color']; ?></td>
<td><?php echo $product['issue_quantity']; ?></td>
<td><?php echo $product['bladder_name']; ?></td>
<td><?php echo $product['bladder_quantity']; ?></td>
<td><?php echo $product['thread_name']; ?></td>
<td><?php echo $product['thread_quantity']; ?></td>
</tr>
<?php endwhile; ?>
</tbody>
<tfoot>
<tr>
<td colspan="3">Total</td>
<td><?php echo $total_product_quantity; ?></td>
<td colspan="1"></td>
<td><?php echo $total_bladder_quantity; ?></td>
<td colspan="1"></td>
<td><?php echo $total_thread_quantity; ?></td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="footer">
<div class="signature-box">
<span>Stitcher Signature</span>
<?php if (!empty($signature_filename)): ?>
<img src="<?php echo htmlspecialchars($signature_path); ?>" alt="Stitcher Signature">
<?php else: ?>
<p>No signature available</p>
<?php endif; ?>
</div>
<div class="signature-box">
<span>Guard Signature</span>
<?php if ($signature_file_path): ?>
<img src="<?= htmlspecialchars($signature_file_path) ?>" alt="Guard Signature" style="width: 200px; height: 75px;">
<?php else: ?>
<p>No signature available.</p>
<?php endif; ?>
</div>
<div class="signature-box">
<span>Supervisor Signature</span>
<?php if ($signature_supervisors_path): ?>
<img src="<?= htmlspecialchars($signature_supervisors_path) ?>" alt="Supervisor Signature">
<?php else: ?>
<p>No signature available.</p>
<?php endif; ?>
</div>
</div>
<div class="print-btn">
<button class="btn btn-primary" onclick="window.print()">Print</button>
</div>
</div>
</body>
</html>