-
Notifications
You must be signed in to change notification settings - Fork 47
/
all_report.php
168 lines (160 loc) · 6.29 KB
/
all_report.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
<?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
{
if(isset($_GET['from_sales_purchase_date']) && isset($_GET['to_sales_purchase_date']) && $_GET['from_sales_purchase_date']!='' && $_GET['to_sales_purchase_date']!='' )
{
error_reporting (E_ALL ^ E_NOTICE);
$selected_date=$_GET['from_sales_purchase_date'];
$selected_date=strtotime( $selected_date );
$mysqldate = date( 'Y-m-d H:i:s', $selected_date );
$fromdate=$mysqldate;
$selected_date=$_GET['to_sales_purchase_date'];
$selected_date=strtotime( $selected_date );
$mysqldate = date( 'Y-m-d H:i:s', $selected_date );
$todate=$mysqldate;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Purchase Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<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>
<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">
<div align="right">
<?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>
<table width="595" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" align="center"><strong>Stock Purchase Report </strong></td>
</tr>
<tr>
<td height="30" align="center"> </td>
</tr>
<tr>
<td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><strong>Total Purchase</strong></td>
<td width="150"> <?php echo $age = $db->queryUniqueValue("SELECT sum(subtotal) FROM stock_entries where count1=1 AND type='entry' AND date BETWEEN '$fromdate' AND '$todate' ");?></td>
</tr>
<tr>
<td><strong>Paid Amount</strong></td>
<td> <?php echo $age = $db->queryUniqueValue("SELECT sum(payment) FROM stock_entries where count1=1 AND type='entry' AND date BETWEEN '$fromdate' AND '$todate' ");?></td>
</tr>
<tr>
<td width="150"><strong>Pending Payment </strong></td>
<td width="150"> <?php echo $age = $db->queryUniqueValue("SELECT sum(balance) FROM stock_entries where count1=1 AND type='entry' AND date BETWEEN '$fromdate' AND '$todate' ");?></td>
</tr>
</table></td>
<td align="right"> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="45"><hr></td>
</tr>
<tr>
<td height="20"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="45"><strong>From</strong></td>
<td width="393"> <?php echo $_GET['from_sales_purchase_date']; ?></td>
<td width="41"><strong>To</strong></td>
<td width="116"> <?php echo $_GET['to_sales_purchase_date']; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td width="45"><hr></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%"><strong>Date</strong></td>
<td width="14%"><strong>Supplier<br>
</strong></td>
<td width="14%"><strong>Stock</strong></td>
<td width="11%"><strong>Quantity</strong></td>
<td width="8%"><strong>Rate</strong></td>
<td width="11%"><strong>Opening<br>
Stock</strong></td>
<td width="11%"><strong>Closing<br>
Stock</strong></td>
<td width="11%"><strong>Total</strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php
$result = $db->query("SELECT * FROM stock_entries where type='entry' AND date BETWEEN '$fromdate' AND '$todate' ");
while ($line = $db->fetchNextObject($result)) {
?>
<tr>
<td><?php $mysqldate=$line->date;
$phpdate = strtotime( $mysqldate );
$phpdate = date("d/m/Y",$phpdate);
echo $phpdate; ?></td>
<td><?php echo $line->stock_supplier_name; ?></td>
<td><?php echo $line->payment; ?></td>
<td><?php echo $line->stock_name; ?></td>
<td><?php echo $line->company_price; ?></td>
<td><?php echo $line->opening_stock; ?></td>
<td><?php echo $line->closing_stock; ?></td>
<td><?php echo $line->total; ?></td>
</tr>
<?php
}
?>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
}
else
echo "Please from and to date to process report";
}
?>