forked from codepoetIn/POSNIC-1.02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_sales_print.php
201 lines (183 loc) · 6.62 KB
/
add_sales_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
<?php
include_once("init.php"); // Use session variable on this page. This function must put on the top of page.
if(!isset($_SESSION['username']) || $_SESSION['usertype'] !='admin'){ // if session variable "username" does not exist.
header("location:index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php
}
else
{
error_reporting (E_ALL ^ E_NOTICE);
if(isset($_GET['sid']))
{
echo $_GET['sid'];
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sales Print</title>
<style type="text/css" media="print">
.hide{display:none}
</style>
<script type="text/javascript">
function printpage() {
document.getElementById('printButton').style.visibility="hidden";
window.print();
document.getElementById('printButton').style.visibility="visible";
}
</script>
<style type="text/css">
<!--
.style1 {font-size: 10px}
-->
</style>
</head>
<body>
<input name="print" type="button" value="Print" id="printButton" onClick="printpage()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top">
<table width="595" cellspacing="0" cellpadding="0" id="bordertable" border="1">
<tr>
<td align="center"><strong>Sales Receipt <br />
</strong>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="67%" align="left" valign="top"> Date: <?php
$sid=$_GET['sid'];
$line = $db->queryUniqueObject("SELECT * FROM stock_sales WHERE transactionid='$sid' ");
$mysqldate=$line->date;
$phpdate = strtotime( $mysqldate );
$phpdate = date("d/m/Y",$phpdate);
echo $phpdate;
?> <br />
<br />
<strong><br />
Receipt No: <?php echo $sid;
?> </strong><br /></td>
<td width="33%"><div align="center">
<?php $line4 = $db->queryUniqueObject("SELECT * FROM store_details ");
?>
<strong><?php echo $line4->name; ?></strong><br />
<?php echo $line4->address; ?>,<?php echo $line4->place; ?>, <br />
<?php echo $line4->city; ?>,<?php echo $line4->pin; ?><br/>
Website<strong>:<?php echo $line4->web; ?></strong><br>Email<strong>:<?php echo $line4->email; ?></strong><br />Phone
<strong>:<?php echo $line4->phone; ?></strong>
<br />
<?php ?>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="90" align="left" valign="top"><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" align="left" valign="top"><strong> TO:</strong></td>
<td width="95%" align="left" valign="top"><br />
<?php
echo $line->customer_id;
$cname=$line->customer_id;
$line2 = $db->queryUniqueObject("SELECT * FROM customer_details WHERE customer_name='$cname' ");
echo $line2->customer_address;
?>
<br />
<?php
echo "Contact1: ".$line2->customer_contact1."<br>";
echo "Contact1: ".$line2->customer_contact2."<br>";
?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12%" align="center" bgcolor="#CCCCCC"><strong>No.</strong></td>
<td width="22%" bgcolor="#CCCCCC"><strong>Stock</strong></td>
<td width="18%" bgcolor="#CCCCCC"><strong>Quantity</strong></td>
<td width="19%" bgcolor="#CCCCCC"><strong>Rate</strong></td>
<td width="11%" bgcolor="#CCCCCC"> </td>
<td width="18%" bgcolor="#CCCCCC"><strong>Total</strong></td>
</tr>
<tr>
<td align="center"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php
$i=1;
$db->query("SELECT * FROM stock_sales where transactionid='$sid'");
while ($line3 = $db->fetchNextObject()) {
?>
<tr>
<td align="center"><?php echo $i."."; ?></td>
<td><?php echo $line3->stock_name; ?></td>
<td><?php echo $line3->quantity; ?></td>
<td><?php echo $line3->selling_price; ?></td>
<td> </td>
<td><?php echo $line3->amount ; ?></td>
</tr>
<?php
$i++;
$subtotal=$line3->subtotal;
$payment=$line3->payment;
$balance=$line3->balance;
$date=$line->due;
$discount= $line3->dis_amount;
}
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="82%" align="right" bgcolor="#CCCCCC"><strong>Discount: </strong></td>
<td width="18%" bgcolor="#CCCCCC"><?php echo $discount ?> </td>
</tr>
<tr>
<td width="82%" align="right" bgcolor="#CCCCCC"><strong>SubTotal: </strong></td>
<td width="18%" bgcolor="#CCCCCC"><?php echo $subtotal; ?> </td>
</tr>
</table> </td>
</tr>
<tr>
<td align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" align="left" valign="top"><br />
<strong> Paid Amount : <?php echo $payment; ?><br />
Balance : <?php echo $balance; ?><br />
Due Date : <?php if($balance == 0) {
$mysqldate=$ldue;
$phpdate = strtotime( $mysqldate );
$phpdate = date("d/m/Y",$phpdate);}
echo $phpdate;?> <br />
</strong> </td>
<td width="67%" align="right"><br />
<br />
<br />
Signature </td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" bgcolor="#CCCCCC">Thank you for Business with Us </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
}
else "Error in processing printing the sales receipt";
}
?>