001.
<?php
require_once
(
'Connections/MyConnect.php'
);
002.
mysql_select_db(
$database_MyConnect
,
$MyConnect
);
003.
?>
004.
<?php
005.
if
(!isset(
$_SESSION
)) {
006.
session_start();
007.
}
008.
$MM_authorizedUsers
=
""
;
009.
$MM_donotCheckaccess
=
"true"
;
010.
011.
012.
function
isAuthorized(
$strUsers
,
$strGroups
,
$UserName
,
$UserGroup
) {
013.
014.
$isValid
= False;
015.
016.
017.
018.
if
(!
empty
(
$UserName
)) {
019.
020.
021.
$arrUsers
=
Explode
(
","
,
$strUsers
);
022.
$arrGroups
=
Explode
(
","
,
$strGroups
);
023.
if
(in_array(
$UserName
,
$arrUsers
)) {
024.
$isValid
= true;
025.
}
026.
027.
if
(in_array(
$UserGroup
,
$arrGroups
)) {
028.
$isValid
= true;
029.
}
030.
if
((
$strUsers
==
""
) && true) {
031.
$isValid
= true;
032.
}
033.
}
034.
return
$isValid
;
035.
}
036.
037.
$MM_restrictGoTo
=
"owner/Login.php"
;
038.
if
(!((isset(
$_SESSION
[
'MM_Username'
])) && (isAuthorized(
""
,
$MM_authorizedUsers
,
$_SESSION
[
'MM_Username'
],
$_SESSION
[
'MM_UserGroup'
])))) {
039.
$MM_qsChar
=
"?"
;
040.
$MM_referrer
=
$_SERVER
[
'PHP_SELF'
];
041.
if
(
strpos
(
$MM_restrictGoTo
,
"?"
))
$MM_qsChar
=
"&"
;
042.
if
(isset(
$_SERVER
[
'QUERY_STRING'
]) &&
strlen
(
$_SERVER
[
'QUERY_STRING'
]) > 0)
043.
$MM_referrer
.=
"?"
.
$_SERVER
[
'QUERY_STRING'
];
044.
$MM_restrictGoTo
=
$MM_restrictGoTo
.
$MM_qsChar
.
"accesscheck="
. urlencode(
$MM_referrer
);
045.
header(
"Location: "
.
$MM_restrictGoTo
);
046.
exit
;
047.
}
048.
?>
049.
<?php
050.
if
(!function_exists(
"GetSQLValueString"
)) {
051.
function
GetSQLValueString(
$theValue
,
$theType
,
$theDefinedValue
=
""
,
$theNotDefinedValue
=
""
)
052.
{
053.
if
(PHP_VERSION < 6) {
054.
$theValue
= get_magic_quotes_gpc() ?
stripslashes
(
$theValue
) :
$theValue
;
055.
}
056.
057.
$theValue
= function_exists(
"mysql_real_escape_string"
) ? mysql_real_escape_string(
$theValue
) : mysql_escape_string(
$theValue
);
058.
059.
switch
(
$theType
) {
060.
case
"text"
:
061.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
062.
break
;
063.
case
"long"
:
064.
case
"int"
:
065.
$theValue
= (
$theValue
!=
""
) ?
intval
(
$theValue
) :
"NULL"
;
066.
break
;
067.
case
"double"
:
068.
$theValue
= (
$theValue
!=
""
) ? doubleval(
$theValue
) :
"NULL"
;
069.
break
;
070.
case
"date"
:
071.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
072.
break
;
073.
case
"defined"
:
074.
$theValue
= (
$theValue
!=
""
) ?
$theDefinedValue
:
$theNotDefinedValue
;
075.
break
;
076.
}
077.
return
$theValue
;
078.
}
079.
}
080.
081.
$colname_salesset1
=
"-1"
;
082.
if
(isset(
$_POST
[
'dateStart'
])) {
083.
$colname_salesset1
=
$_POST
[
'dateStart'
];
084.
}
085.
$colname2_salesset1
=
"-1"
;
086.
if
(isset(
$_POST
[
'dateEnd'
])) {
087.
$colname2_salesset1
=
$_POST
[
'dateEnd'
];
088.
}
089.
090.
$query_salesset1
= sprintf("SELECT * FROM sales_detail INNER JOIN sales
091.
ON sales_detail.sales_id = sales.sales_id WHERE sales_receipt_date >= %s
and
sales_receipt_date<=%s Order by sales_receipt_date ASC
", GetSQLValueString($colname_salesset1, "
date
"),GetSQLValueString($colname2_salesset1, "
date
"));
092.
$salesset1
= mysql_query(
$query_salesset1
,
$MyConnect
)
or
die
(mysql_error());
093.
$row_salesset1
= mysql_fetch_assoc(
$salesset1
);
094.
$totalRows_salesset1
= mysql_num_rows(
$salesset1
);
095.
?>
098.
<head>
099.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
100.
<title>btween</title>
101.
<script src=
"js/jquery.js"
type=
"text/javascript"
></script>
102.
<link href=
"css/bootstrap.min.css"
rel=
"stylesheet"
type=
"text/css"
/>
103.
<script src=
"js/jquery.js"
></script>
104.
<script src=
"js/bootstrap.min.js"
></script>
105.
<style type=
"text/css"
>
106.
#MenuBar1 {
107.
font-size: 230%;
108.
font-family:
"Courier New"
, Courier, monospace;
109.
}
110.
body p {
111.
font-size: 18px;
112.
text-align: center;
113.
color: #000;
114.
}
115.
body h2 {
116.
text-align: center;
117.
}
118.
</style>
119.
<script src=
"jquery.ui-1.5.2/jquery-1.2.6.js"
type=
"text/javascript"
></script>
120.
<script src=
"jquery.ui-1.5.2/ui/ui.datepicker.js"
type=
"text/javascript"
></script>
121.
<link href=
"jquery.ui-1.5.2/themes/ui.datepicker.css"
rel=
"stylesheet"
type=
"text/css"
/>
122.
</head>
123.
124.
<body
class
=
'container'
>
125.
<p><img src=
"shop.jpg"
width=
"1117"
height=
"149"
/>
126.
</p>
127.
<h3>ร้านเกสร
128.
</h3>
129.
<p>ระบบจัดการฐานข้อมูลสำหรับร้านค้าปลีก</p>
130.
131.
<div
class
=
"btn-group"
>
132.
<button
class
=
"btn"
><a href=
"sales_detail.php"
>ขายสินค้า</a></button>
133.
</div>
134.
135.
<div
class
=
"btn-group"
>
136.
<button
class
=
"btn"
><a href=
"edit-owner.php"
>แก้ไขข้อมูลส่วนตัว</a></button>
137.
</div>
138.
<div
class
=
"btn-group"
>
139.
<button
class
=
"btn"
>ออกรายงาน</button>
140.
<button
class
=
"btn dropdown-toggle"
data-toggle=
"dropdown"
>
141.
<span
class
=
"caret"
></span>
142.
</button>
143.
<ul
class
=
"dropdown-menu"
>
144.
<li><a href=
"btween-date-product.php"
>รายงานสินค้าคงคลัง</a></li>
145.
<li><a href=
"btween-date-sales.php"
>รายงานการขายสินค้า</a></li>
146.
<li><a href=
"btween-date-repayment.php"
>รายงานลูกหนี้ค้างชำระ</a></li>
147.
<li> รายงานสินค้าขายดี </li>
148.
<li> รายงานกำไร </li>
149.
<!-- dropdown menu links -->
150.
</ul>
151.
</div>
152.
<div
class
=
"btn-group"
>
153.
<button
class
=
"btn"
><a href=
"owner/Login.php"
>ออกจากระบบ</a></button>
154.
</div>
155.
<body>
156.
<p> </p>
157.
<form id=
"form1"
name=
"form1"
method=
"post"
action=
""
>
158.
<p>จากวันที่
159.
<input type=
"date"
size=
"30"
value=
"Click to show datepicker"
name=
"dateStart"
/>
160.
ถึงวันที่
161.
<input type=
"date"
size=
"30"
value=
"Click to show datepicker"
name=
"dateEnd"
/>
162.
<input type=
"submit"
name=
"btnsearch"
id=
"btnsearch"
value=
"ค้นหา"
/>
163.
</p>
164.
<p> </p>
165.
<table
class
=
"table table-bordered"
width=
"500"
border=
"1"
align=
"center"
>
166.
<tr
class
=
"success"
>
167.
<td>รหัส</td>
168.
<td>รหัสสินค้า</td>
169.
<td>จำนวนที่ขายไป</td>
170.
<td>วันที่ใบเสร็จ</td>
171.
</tr>
172.
<?php
173.
do
{ ?>
174.
<tr>
175.
<td><?php
echo
$row_salesset1
[
'sales_id'
]; ?></td>
176.
<td><?php
echo
$row_salesset1
[
'product_id'
]; ?></td>
177.
<td><?php
echo
$row_salesset1
[
'sales_detail_qty'
]; ?></td>
178.
<td><?php
echo
$row_salesset1
[
'sales_receipt_date'
];?></td>
179.
</tr>
180.
<?php }
while
(
$row_salesset1
= mysql_fetch_assoc(
$salesset1
)); ?>
181.
</table>
182.
<p></p>
183.
<script type=
"text/javascript"
>
184.
185.
jQuery(
"#jQueryUICalendar2"
).datepicker({dateFormat:
'yy-mm-dd'
});
186.
187.
188.
</script>
189.
<p></p>
190.
<script type=
"text/javascript"
>
191.
192.
jQuery(
"#jQueryUICalendar1"
).datepicker({dateFormat:
'yy-mm-dd'
});
193.
194.
195.
</script>
196.
</form>
197.
<p>
198.
<input type=
"submit"
name=
"Submit"
value=
"Print"
onClick=
"window.print()"
>
199.
</p>
200.
201.
</body>
202.
</html>
203.
<?php
204.
mysql_free_result(
$salesset1
);
205.
?>