-
Notifications
You must be signed in to change notification settings - Fork 0
/
bill.php
179 lines (156 loc) · 6.66 KB
/
bill.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
<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">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" />
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<!-- Bootstrap Css -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<script src="bill.js"></script>
<link href="assets/css/style.css" rel="stylesheet">
<title>Billing</title>
</head>
<?php
session_start();
$con = mysqli_connect('localhost', 'root', '');
if (empty($_SESSION['username'])) {
header('location:login.php');
}
mysqli_select_db($con, 'mms');
?>
<body>
<?php
$user = $_SESSION['username'];
$q = "select * from shop where manager_id='$user'";
$res = mysqli_query($con, $q);
$row = mysqli_fetch_assoc($res);
$q = "select * from users where username='$user'";
$res = mysqli_query($con, $q);
$row = mysqli_fetch_assoc($res);
?>
<header id="header" class="header fixed-top d-flex align-items-center">
<div class="d-flex align-items-center justify-content-between">
<a href="dashboard.php" class="logo d-flex align-items-center">
<img src="assets/img/logo.png" alt="">
<span class="d-none d-lg-block">MMS</span>
</a>
</div><!-- End Logo -->
</header><!-- End Header -->
<main id="main" class="main">
<script>
function showUser(str) {
if (str == "") {
document.getElementById("tab_logic").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("tab_logic").innerHTML += this.responseText;
console.log();
}
};
xmlhttp.open("GET", "getprice.php?q=" + str, true);
xmlhttp.send();
}
}
function quantity(num) {
document.getElementsById("qty").innerHTML = num;
}
</script>
<input type="text" name='term' id="term" value="<?php $qty; ?>" onchange="showUser(document.getElementById('term').value)" placeholder='Enter Product Name' class="form-control" />
<!-- <div class="container">
<div class="row clearfix">
<div class="col-md-12">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th class="text-center"> # </th>
<th class="text-center"> Product </th>
<th class="text-center"> Qty </th>
<th class="text-center"> Price </th>
<th class="text-center"> Total </th>
</tr>
</thead>
<tbody>
<tr id='addr0'>
<td>1</td>
<form>
<td><input type="text" name='term' id="term" value="<?php $qty; ?>" onchange="showUser(document.getElementById('term').value)" placeholder='Enter Product Name' class="form-control" /></td>
<td><input type="number" name='qty[]' id="quan" placeholder='Enter Qty' onchange="quantity(document.getElementById('quan').value)" class="form-control qty" step="0" min="0" /></td>
<td><input id="s_p" type="number" name='price[]' value="<?php $row1['price']; ?>" placeholder='Unit Price' class="form-control price" step="0.00" min="0" /></td>
<td><input type="number" name='total[]' placeholder='0.00' class="form-control total" readonly /></td>
</form>
</tr>
<tr id='addr1'></tr>
</tbody>
</table>
</div>
</div> -->
<div>
<table id="tab_logic" class="table table-bordered table-hover">
<tr>
<th>Name</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
</table>
</div>
<!-- <div class="row clearfix">
<div class="col-md-12">
<button id="add_row" class="btn btn-default pull-left">Add Row</button>
<button id='delete_row' class="pull-right btn btn-default">Delete Row</button>
</div>
</div> -->
<div class="row clearfix" style="margin-top:20px">
<div class="pull-right col-md-4">
<table class="table table-bordered table-hover" id="tab_logic_total">
<tbody>
<tr>
<th class="text-center">Sub Total</th>
<td class="text-center"><input type="number" name='sub_total' placeholder='0.00' class="form-control" id="sub_total" readonly /></td>
</tr>
<tr>
<th class="text-center">Tax</th>
<td class="text-center">
<div class="input-group mb-2 mb-sm-0">
<input type="number" class="form-control" id="tax" placeholder="0">
<div class="input-group-addon">%</div>
</div>
</td>
</tr>
<tr>
<th class="text-center">Tax Amount</th>
<td class="text-center"><input type="number" name='tax_amount' id="tax_amount" placeholder='0.00' class="form-control" readonly /></td>
</tr>
<tr>
<th class="text-center">Grand Total</th>
<td class="text-center"><input type="number" name='total_amount' id="total_amount" placeholder='0.00' class="form-control" readonly /></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</main>
<!-- Script -->
<script type="text/javascript">
$(function() {
$("#term").autocomplete({
source: 'ajax-db-search.php',
});
});
</script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<!-- jQuery UI -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" />
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="assets/js/main.js"></script>
<!-- Bootstrap Css -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
</body>