-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsales-invoice-print.php
160 lines (157 loc) · 5.54 KB
/
sales-invoice-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
<?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>
<div class="wrapper">
<!-- 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: [email protected]
</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>
</div>
<!-- /.content -->
</div>
<!-- ./wrapper -->
<!-- Page specific script -->
<script>
window.addEventListener("load", window.print());
</script>
</body>
</html>