-
Notifications
You must be signed in to change notification settings - Fork 0
/
partycu1.php
183 lines (146 loc) · 7.41 KB
/
partycu1.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
<?php
session_start();
if (!isset($_SESSION['username'])) {
header("Location: index.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Partywise Cutting Report</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="cloth1.css">
<script src="jquery-3.6.0.min.js"></script>
<script>
function printDiv() {
var divContents = document.getElementById("GFG").innerHTML;
var a = window.open('', '', 'height=500, width=500');
a.document.write('<html>');
a.document.write('<body> <center><h2>AVR Garment<h2><center><br>');
a.document.write(divContents);
a.document.write('</body></html>');
a.document.close();
a.print();
}
</script>
<style>
body {
background-color: #F0F8FF ;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12 mt-4">
<div class="card">
<div class="card-header">
<h4 class="card-title">Partywise Cutting Report</h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<form action="" method="POST">
<div class="form-group">
<input type="text" name="emp_name" value="<?php if(isset($_GET['PARTYNAME'])){echo $_GET['PARTYNAME'];} ?>"class="form-control" splaceholder="Name" required>
</div><br>
<button type="submit" name="search_by_name" class="btn btn-primary">Search</button>
</form><br>
</div>
</div>
<div class="table-responsive">
<div id="GFG">
<?php
if(isset($_POST['search_by_name']))
{
echo $_POST['emp_name'];
}
?><br>
<table id="Table"class="table table-bordered">
<thead>
<tr>
<th scope="col">DATE</th>
<th scope="col">BILL NO.</th>
<th scope="col">EMPLOYEENAME</th>
<th scope="col">USED MTR</th>
<th scope="col">QUANTITY</th>
</tr>
</thead>
</div>
<tbody>
<?php
$connection=mysqli_connect("localhost","root","","inward");
if(isset($_POST['search_by_name']))
{
$name=$_POST['emp_name'];
$query="SELECT * FROM cutting WHERE PARTYNAME='$name'";
$query_run=mysqli_query($connection, $query);
$total=mysqli_num_rows($query_run);
if($total>0)
{
while($row = mysqli_fetch_array($query_run))
{
?>
<tr>
<td><input type="text" disabled value="<?php echo $row['DATE']; ?>"></td>
<td><input type="text" disabled value="<?php echo $row['id']; ?>"></td>
<td><input type="text" disabled value="<?php echo $row['EMPLOYEENAME']; ?>"></td>
<td><input type="text" id="tquantity" value="<?php echo $row['USEDMTR']; ?>"></td>
<td><input type="text" id="price" value="<?php echo $row['QUANTITY']; ?>"></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="6">No Record Found</td>
</tr>
<?php
}
?>
</tbody>
<tfoot align="">
<tr>
<td colspan="3">Total:</td>
<?php
$querys="SELECT sum(USEDMTR) FROM cutting WHERE PARTYNAME='$name'";
$results = mysqli_query($connection,$querys) or die(mysqli_error());
while($rows = mysqli_fetch_array($results)){?>
<td colspan=""align=""><input type="text" disabled value="<?php echo $rows['sum(USEDMTR)']; ?>"></td>
<?php
}
?>
<?php
$querys="SELECT sum(QUANTITY) FROM cutting WHERE PARTYNAME='$name'";
$results = mysqli_query($connection,$querys) or die(mysqli_error());
while($rows = mysqli_fetch_array($results)){?>
<td colspan="4"align=""><input type="text" disabled value="<?php echo $rows['sum(QUANTITY)']; ?>"></td>
<?php
}
}
?>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<table align="center">
<tr>
<td><input type="button" onclick="printDiv();" value="Print"/></td>
</tr>
</table>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>