-
Notifications
You must be signed in to change notification settings - Fork 1
/
kits_issue_printing_slip_print.php
239 lines (227 loc) · 8.8 KB
/
kits_issue_printing_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
<?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 print_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 print_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 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 Received 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: 30px;
}
.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;
gap: 7rem;
align-items: flex-end;
color: #555;
}
.receiver-signature,
.issuer-signature {
flex: 1;
text-align: left;
}
.middle-signature {
flex: 1;
text-align: center;
}
.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;
}
/* Define the size for signatures */
.signature-img {
width: 150px;
height: 50px;
object-fit: contain;
}
</style>
</head>
<body>
<div class="container">
<div class="invoice-header">
<div>
<p class="issue_heading" >KITS ISSUE SLIP (WITHOUT PRINT)</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"); ?></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>Issue Quantity</th>
<th>Ink Name</th>
<th>Ink Quantity</th>
</tr>
</thead>
<tbody>
<?php
$total_issue_quantity = 0;
$total_ink_quantity = 0;
while ($product = mysqli_fetch_assoc($product_result)) :
$total_issue_quantity += $product['issue_quantity'];
$total_ink_quantity += $product['ink_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['ink_name']; ?></td>
<td><?php echo $product['ink_quantity']; ?></td>
</tr>
<?php endwhile; ?>
</tbody>
<tfoot>
<tr>
<td colspan="3">Total</td>
<td><?php echo $total_issue_quantity; ?></td>
<td></td>
<td><?php echo $total_ink_quantity; ?></td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="footer">
<div class="receiver-signature">Stitcher Signature <br>
<?php if (!empty($signature_filename)): ?>
<img src="<?php echo htmlspecialchars($signature_path); ?>" alt="Stitcher Signature" class="signature-img">
<?php else: ?>
<p>No signature available</p>
<?php endif; ?>
</div>
<div class="middle-signature">Guard Signature <br>
<?php if ($signature_file_path): ?>
<img src="<?= htmlspecialchars($signature_file_path) ?>" alt="Guard Signature" class="signature-img" style="width:250px; height:80px;">
<?php else: ?>
<p>No signature available.</p>
<?php endif; ?>
</div>
<div class="issuer-signature">Supervisor Signature <br>
<?php if ($signature_supervisors_path): ?>
<img src="<?= htmlspecialchars($signature_supervisors_path) ?>" alt="Supervisor Signature" class="signature-img">
<?php else: ?>
<p>No signature available.</p>
<?php endif; ?>
</div>
</div>
<div class="print-btn">
<button onclick="window.print()" class="btn btn-primary">Print</button>
</div>
</div>
</body>
</html>