-
Notifications
You must be signed in to change notification settings - Fork 8
/
sales-invoice.php
206 lines (193 loc) · 8.23 KB
/
sales-invoice.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
<?php
session_start();
if(!isset($_SESSION['store_id'])) {
header("location:login.php");
exit();
}elseif(!isset($_GET['id']) || ctype_space($_GET['id'])){
echo "<script>window.history.back();</script>";
exit();
}
else{
include('config/db.php');
$id = $_GET['id'];
$check = mysqli_num_rows($conn->query("SELECT `invoice` FROM `p_invoice` WHERE `invoice` = '$id'"));
if($check > 0){
$invoiceDetails = $conn->query("SELECT * FROM `p_invoice` WHERE `invoice` = '$id' AND `store` = '$_SESSION[store_id]'");
$invoiceSummary = mysqli_fetch_assoc($conn->query("SELECT * FROM `p_invoice_summary` WHERE `invoice` = '$id' AND `store` = '$_SESSION[store_id]'"));
$user = mysqli_fetch_assoc($conn->query("SELECT * FROM `p_customer` WHERE `id` = '$invoiceSummary[client]' AND `store` = '$_SESSION[store_id]'"));
}else{
echo "<script>window.history.back();</script>";
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pharmacy</title>
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/adminlte.min.css">
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">
<!-- Navbar -->
<?php include("part/navbar.php");?>
<!-- Navbar end -->
<!-- Sidebar -->
<?php include("part/sidebar.php");?>
<!-- Sidebar end -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="callout callout-info">
<h5><i class="fas fa-info"></i> Note:</h5>
This page has been enhanced for printing. Click the print button at the bottom of the invoice to test.
</div>
<!-- Main content -->
<div class="invoice p-3 mb-3">
<!-- title row -->
<div class="row">
<div class="col-12">
<h4>
<i class="fas fa-globe"></i> Pharmacy
<small class="float-right">Date: <?php echo $invoiceSummary['order_date'];?></small>
</h4>
</div>
</div>
<div class="row invoice-info">
<div class="col-sm-4 invoice-col">
<strong>From</strong>
<address>
<strong>Admin, Inc.</strong><br>
795 Folsom Ave, Suite 600<br>
San Francisco, CA 94107<br>
Phone: (804) 123-5432<br>
Email: info@almasaeedstudio.com
</address>
</div>
<div class="col-sm-4 invoice-col">
<strong>To</strong>
<address>
Name: <strong><?php echo isset($user["name"])?$user["name"]:"Walk in customer"; ?></strong><br>
Phone: <?php echo isset($user["phone"])?$user["phone"]:""; ?><br>
Email: <?php echo isset($user["email"])?$user["email"]:""; ?><br>
Address: <?php echo isset($user["address"])?$user["address"]:""; ?>
</address>
</div>
<div class="col-sm-4 invoice-col">
<h5>Invoice #<?php echo $id; ?></h5><br>
</div>
</div>
<!-- Table row -->
<div class="row">
<div class="col-12 table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>SL</th>
<th>Product</th>
<th>Quantity</th>
<th>Price</th>
<th>Subtotal</th>
</tr>
</thead>
<tbody>
<?php
$sumPrice = 0; $total = 0; $n = 0;
while($value = mysqli_fetch_assoc($invoiceDetails)){
$sumPrice += $value['price']*$value['qty'];
$total += $sumPrice;
?>
<tr>
<td><?php echo ++$n; ?></td>
<td><?php echo $value['product'] ?></td>
<td><?php echo $value['qty'] ?></td>
<td><?php echo $value['price'] ?></td>
<td><?php echo $sumPrice ?></td>
</tr>
<?php $sumPrice =0; } ?>
</tbody>
</table>
</div>
</div>
<div class="row">
<!-- accepted payments column -->
<div class="col-6">
<p class="lead">Payment Methods:</p>
<img src="dist/img/credit/visa.png" alt="Visa">
<img src="dist/img/credit/mastercard.png" alt="Mastercard">
<img src="dist/img/credit/american-express.png" alt="American Express">
<img src="dist/img/credit/paypal2.png" alt="Paypal">
<p class="text-muted well well-sm shadow-none" style="margin-top: 10px;">
Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem
plugg
dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra.
</p>
</div>
<!-- /.col -->
<div class="col-6">
<p class="lead"></p>
<div class="table-responsive">
<table class="table">
<tr>
<th style="width:50%">Subtotal:</th>
<td><?php echo number_format((float)$total, 2, '.', ''); ?> Tk</td>
</tr>
<tr>
<th>Discount:</th>
<td><?php echo ($invoiceSummary["discount"] < 0) ? 0.00 : number_format((float)$invoiceSummary["discount"], 2, '.', ''); ?> (<?php echo $invoiceSummary["discount_type"]; ?>)</td>
</tr>
<tr>
<th>Grand Total: </th>
<td><?php echo $invoiceSummary["payable"]; ?> Tk</td>
</tr>
<tr>
<th>Paid: </th>
<td><?php echo $invoiceSummary["paid"]; ?> Tk</td>
</tr>
<tr>
<th>Due: </th>
<td><?php echo ($invoiceSummary["due"] <= 0) ? 0.00 : number_format((float)$invoiceSummary["due"], 2, '.', ''); ?> Tk</td>
</tr>
</table>
</div>
</div>
</div>
<!-- this row will not appear when printing -->
<div class="row no-print">
<div class="col-12">
<a href="sales-invoice-print.php?id=<?php echo $id; ?>" rel="noopener" target="_blank" class="btn btn-default"><i class="fas fa-print"></i> Print</a>
<!-- <button type="button" class="btn btn-success float-right"><i class="far fa-credit-card"></i> Submit Payment </button> -->
<!-- <button type="button" class="btn btn-primary float-right" style="margin-right: 5px;"> <i class="fas fa-download"></i> Generate PDF </button> -->
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- Footer -->
<?php include("part/footer.php");?>
<!-- Footer End -->
<!-- Alert -->
<?php include("part/alert.php");?>
<!-- Alert end -->
</div>
<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
</body>
</html>