002.
<html xmlns=
"http://www.w3.org/1999/xhtml"
><!-- InstanceBegin template=
"/Templates/water_template2.dwt.php"
codeOutsideHTMLIsLocked=
"false"
-->
003.
<head>
004.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
005.
<!-- InstanceBeginEditable name=
"doctitle"
-->
006.
<title>Untitled Document</title>
007.
<!-- InstanceEndEditable -->
008.
<!-- InstanceBeginEditable name=
"head"
-->
009.
<style type=
"text/css"
>
010.
<!--
011.
.style25 {font-family: AngsanaUPC; font-size: 20px; }
012.
.style26 {
013.
font-family: AngsanaUPC;
014.
font-size: 20px;
015.
font-weight: bold;
016.
color: #0000FF;
017.
}
018.
.style23 {font-family: AngsanaUPC;
019.
font-size: 22px;
020.
font-weight: bold;
021.
}
022.
.style33 {font-size: 20px}
023.
-->
024.
</style>
025.
<!-- InstanceEndEditable -->
026.
<style type=
"text/css"
>
027.
<!--
028.
a:link {
029.
color: #0000FF;
030.
text-decoration: none;
031.
}
032.
a:visited {
033.
color: #0000FF;
034.
text-decoration: none;
035.
}
036.
a:hover {
037.
color: #FF00FF;
038.
text-decoration: none;
039.
}
040.
a:active {
041.
color: #FF00FF;
042.
text-decoration: none;
043.
}
044.
.style3 {
045.
color: #FFFFFF;
046.
font-weight: bold;
047.
font-family: AngsanaUPC;
048.
font-size: 22px;
049.
}
050.
.style22 {font-family: AngsanaUPC; font-size: 20px; color: #FFFFFF;}
051.
-->
052.
</style>
053.
</head>
054.
055.
<body>
056.
057.
<table width=
"798"
height=
"460"
border=
"0"
align=
"center"
cellpadding=
"0"
cellspacing=
"0"
bordercolor=
"#C8E2F9"
>
058.
<tr>
059.
<td height=
"140"
><img src=
"header3.png"
width=
"798"
height=
"140"
/></td>
060.
</tr>
061.
<tr>
062.
<td height=
"239"
valign=
"top"
bgcolor=
"#E2F2F5"
><!-- InstanceBeginEditable name=
"EditRegion1"
-->
063.
064.
<form id=
"form1"
name=
"form1"
method=
"post"
action=
""
>
065.
<?php
066.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"123"
)
or
die
(
"ไม่สามารถติดต่อกับฐานข้อมูลได้"
);
067.
$objDB
= mysql_select_db(
"water"
);
068.
$strSQL
=
"SELECT * FROM receipt"
;
069.
mysql_query(
"SET NAMES UTF8"
);
070.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
071.
$Num_Rows
= mysql_num_rows(
$objQuery
);
072.
$Per_Page
= 20;
073.
$Page
=
$_GET
[
"Page"
];
074.
if
(!
$_GET
[
"Page"
])
075.
{
076.
$Page
=1;
077.
}
078.
079.
$Prev_Page
=
$Page
-1;
080.
$Next_Page
=
$Page
+1;
081.
082.
$Page_Start
= ((
$Per_Page
*
$Page
)-
$Per_Page
);
083.
if
(
$Num_Rows
<=
$Per_Page
)
084.
{
085.
$Num_Pages
=1;
086.
}
087.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
088.
{
089.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
) ;
090.
}
091.
else
092.
{
093.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
094.
$Num_Pages
= (int)
$Num_Pages
;
095.
}
096.
097.
$strSQL
.=
" order by cus_id ASC LIMIT $Page_Start , $Per_Page"
;
098.
$objQuery
= mysql_query(
$strSQL
);
099.
100.
?>
101.
<table width=
"584"
border=
"0"
align=
"center"
>
102.
<tr>
103.
<td width=
"578"
height=
"105"
><fieldset>
104.
<legend><span
class
=
"style23"
>ค้นหาใบเสร็จ</span></legend>
105.
<br />
106.
<table width=
"450"
border=
"0"
align=
"center"
>
107.
<tr>
108.
<td><div align=
"right"
><span
class
=
"style25"
>ใบเสร็จประจำเดือน : </span></div></td>
109.
<td><select name=
"month"
id=
"month"
style=
"width:80px;"
>
110.
<option value=
""
selected=
"selected"
>เลือกเดือน</option>
111.
<option value=
"01"
<?php
if
(
$_POST
[
'month'
]==
"01"
){
echo
"selected"
; } ?>>มกราคม</option>
112.
<option value=
"02"
<?php
if
(
$_POST
[
'month'
]==
"02"
){
echo
"selected"
; } ?>>กุมภาพันธ์</option>
113.
<option value=
"03"
<?php
if
(
$_POST
[
'month'
]==
"03"
){
echo
"selected"
; } ?>>มีนาคม</option>
114.
<option value=
"04"
<?php
if
(
$_POST
[
'month'
]==
"04"
){
echo
"selected"
; } ?>>เมษายน</option>
115.
<option value=
"05"
<?php
if
(
$_POST
[
'month'
]==
"05"
){
echo
"selected"
; } ?>>พฤษภาคม</option>
116.
<option value=
"06"
<?php
if
(
$_POST
[
'month'
]==
"06"
){
echo
"selected"
; } ?>>มิถุนายน</option>
117.
<option value=
"07"
<?php
if
(
$_POST
[
'month'
]==
"07"
){
echo
"selected"
; } ?> >กรกฎาคม</option>
118.
<option value=
"08"
<?php
if
(
$_POST
[
'month'
]==
"08"
){
echo
"selected"
; } ?>>สิงหาคม</option>
119.
<option value=
"09"
<?php
if
(
$_POST
[
'month'
]==
"09"
){
echo
"selected"
; } ?>>กันยายน</option>
120.
<option value=
"10"
<?php
if
(
$_POST
[
'month'
]==
"10"
){
echo
"selected"
; } ?>>ตุลาคม</option>
121.
<option value=
"11"
<?php
if
(
$_POST
[
'month'
]==
"11"
){
echo
"selected"
; } ?>>พฤศจิกายน</option>
122.
<option value=
"12"
<?php
if
(
$_POST
[
'month'
]==
"12"
){
echo
"selected"
; } ?>>ธันวาคม</option>
123.
</select></td>
124.
<td><div align=
"right"
><span
class
=
"style25"
>ปี : </span></div></td>
125.
<td><select name=
"year"
>
126.
<option value=
""
>เลือกปี</option>
127.
<?php
for
(
$i
=
date
(
"Y"
);
$i
>=
date
(
"Y"
)-20;
$i
--){?>
128.
<option value=
"<?php echo ($i)?>"
<?php
if
(
$_POST
[
'year'
]==(
$i
)){
echo
"selected"
; } ?>> <?php
echo
(
$i
+543)?> </option>
129.
<?php } ?>
130.
</select></td>
131.
<td><input name=
"Submit"
type=
"submit"
value=
"แสดงข้อมูล"
/></td>
132.
</tr>
133.
</table>
134.
<p> </p>
135.
</fieldset>
136.
</td>
137.
</tr>
138.
</table>
139.
<p>
140.
<?php
141.
$Condition
=
array
();
142.
$Con
=
array
();
143.
if
(
$_POST
[
'year'
]!=
""
){
144.
$year
=
$_POST
[
'year'
];
145.
$Con
[] =
$year
;
146.
147.
}
148.
if
(
$_POST
[
'month'
]!=
""
){
149.
$month
=
$_POST
[
'month'
];
150.
$Con
[] =
$month
;
151.
152.
}
153.
154.
if
(
count
(
$Con
)>0) {
155.
$strCond1
= implode(
'-'
,
$Con
);
156.
$Condition
[] =
"date_after LIKE '$strCond1%'"
;
157.
}
158.
159.
if
(
count
(
$Condition
)==0)
$Condition
[] =
'1'
;
160.
$strCond
= implode(
' AND '
,
$Condition
);
161.
$condition
=
" where "
.
$strCond
;
162.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"123"
)
or
die
(
"ไม่สามารถติดต่อกับฐานข้อมูลได้"
);
163.
$objDB
= mysql_select_db(
"water"
);
164.
$strSQL
=
"SELECT * FROM receipt $date_after"
;
165.
$strSQL
.=
$condition
;
166.
mysql_query(
"SET NAMES UTF8"
);
167.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
168.
$Num_Rows
= mysql_num_rows(
$objQuery
);
169.
$Per_Page
= 20;
170.
$Page
=
$_GET
[
"Page"
];
171.
if
(!
$_GET
[
"Page"
])
172.
{
173.
$Page
=1;
174.
}
175.
176.
$Prev_Page
=
$Page
-1;
177.
$Next_Page
=
$Page
+1;
178.
179.
$Page_Start
= ((
$Per_Page
*
$Page
)-
$Per_Page
);
180.
if
(
$Num_Rows
<=
$Per_Page
)
181.
{
182.
$Num_Pages
=1;
183.
}
184.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
185.
{
186.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
) ;
187.
}
188.
else
189.
{
190.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
191.
$Num_Pages
= (int)
$Num_Pages
;
192.
}
193.
194.
$strSQL
.=
" order by cus_id ASC LIMIT $Page_Start , $Per_Page"
;
195.
$objQuery
= mysql_query(
$strSQL
);
196.
197.
?>
198.
</p>
199.
<table width=
"626"
border=
"1"
align=
"center"
cellpadding=
"1"
cellspacing=
"0"
bordercolor=
"#000000"
>
200.
<tr>
201.
<td colspan=
"6"
><div align=
"center"
><strong><span
class
=
"style25"
>ใบเสร็จประจำเดือน ปี</span></strong></div></td>
202.
</tr>
203.
<tr>
204.
<td width=
"85"
bgcolor=
"#A9D2F3"
><div align=
"center"
><strong><span
class
=
"style25"
>เลขที่ใบเสร็จ</span></strong></div></td>
205.
<td width=
"70"
bgcolor=
"#A9D2F3"
><div align=
"center"
><strong><span
class
=
"style25"
>รหัสผู้ใช้น้ำ</span></strong></div></td>
206.
<td width=
"101"
bgcolor=
"#A9D2F3"
><div align=
"center"
><strong><span
class
=
"style25"
>ชื่อ-นามสกุล</span></strong></div></td>
207.
<td width=
"160"
bgcolor=
"#A9D2F3"
><div align=
"center"
><strong><span
class
=
"style25"
>รายละเอียดการใช้น้ำ</span></strong></div></td>
208.
<td width=
"76"
bgcolor=
"#A9D2F3"
><div align=
"center"
><strong><span
class
=
"style25"
>พิมพ์ใบเสร็จ</span></strong></div></td>
209.
<td bgcolor=
"#A9D2F3"
><div align=
"center"
><strong><span
class
=
"style25"
>สถานะใบเสร็จ</span></strong></div></td>
210.
</tr> <?
211.
$i
= 0;
212.
while
(
$dbarr
= mysql_fetch_array(
$objQuery
))
213.
{
214.
$i
++;
215.
?>
216.
<tr>
217.
<td><div align=
"center"
><span
class
=
"style25"
><?php
echo
$dbarr
[
'receipt_id'
] ?></span></div></td>
218.
<td><div align=
"center"
><span
class
=
"style25"
><?php
echo
$dbarr
[
'cus_id'
] ?></span></div></td>
219.
<td><div align=
"center"
><span
class
=
"style25"
><?php
echo
$dbarr
[
'cus_name'
] ?><?php
echo
$dbarr
[
'cus_lastname'
] ?></span></div></td>
220.
<td><div align=
"center"
class
=
"style25"
><a href=
"receipt_deta2.php?receipt_id=<?=$dbarr['receipt_id'];?>"
>ดูรายละเอียด</a></div></td>
221.
222.
<td><div align=
"center"
><a href=
"receipt_new.php?receipt_id=<?=$dbarr['receipt_id'];?>"
><img src=
"icon/printer.png"
width=
"25"
height=
"25"
border=
"0"
/></a><a href=
"receipt_new.php"
target=
"_blank"
></a></div></td>
223.
<td><div align=
"center"
class
=
"style25"
>
224.
<?php
$pay_st_id
=
$dbarr
[
'pay_st_id'
];
225.
if
(
$pay_st_id
== 1 ){
226.
echo
"ยังไม่จ่าย"
;
227.
}
else
if
(
$pay_st_id
==2){
228.
echo
"จ่ายแล้ว"
;
229.
230.
} ?>
231.
</div></td>
232.
<?php
233.
}
234.
?>
235.
</tr>
236.
</table>
237.
<p>
238.
<?
239.
if
(
$Prev_Page
)
240.
{
241.
echo
" <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ก่อนหน้า</a> "
;
242.
}
243.
244.
for
(
$i
=1;
$i
<=
$Num_Pages
;
$i
++){
245.
if
(
$i
!=
$Page
)
246.
{
247.
echo
"[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"
;
248.
}
249.
else
250.
{
251.
echo
"<b> $i </b>"
;
252.
}
253.
}
254.
if
(
$Page
!=
$Num_Pages
)
255.
{
256.
echo
" <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>ถัดไป>></a> "
;
257.
}
258.
mysql_close(
$objConnect
);
259.
?>
260.
</p>
261.
<p align=
"center"
class
=
"style26"
><a href=
"search_receipt.php"
>< ค้นหาใบเสร็จ ></a> <a href=
"index11.php"
> < กลับหน้าแรก ></a></p>
262.
</form>
263.
<p> </p>
264.
<p> </p>
265.
<!-- InstanceEndEditable --></td>
266.
</tr>
267.
<tr>
268.
<td height=
"30"
bgcolor=
"#3F94E9"
><div align=
"center"
class
=
"style22"
>การประปาหมู่บ้านปากทาง<br />
269.
24 ม.13 ต.ตลิ่งชัน อ.บันนังสตา จ.ยะลา 95130<br />
270.
โทรศัพท์ : 081-7983950 </div></td>
271.
</tr>
272.
</table>
273.
274.
</body>
275.
<!-- InstanceEnd --></html>