001.
<?php
002.
include
"config.inc.php"
;
003.
$id_employee
=
$_GET
[
"id_employee"
];
004.
$con
= mysql_connect(
$host
,
$username
,
$password
);
005.
if
(!
$con
)
006.
{
die
(
'Could not connect: '
. mysql_error()); }
007.
mysql_select_db(
$database
,
$con
);
008.
mysql_query(
"SET NAMES UTF8"
);
009.
?>
010.
011.
<?php
012.
$month
=
$_REQUEST
[
'month'
];
013.
$year
=
$_REQUEST
[
'year'
];
014.
$num
=0;
015.
if
(
$month
==
""
and
$year
==
""
){
016.
$msg
=
"รายงานสินค้าทั้งหมด"
;
017.
$sql
=
"select * from employee_totalot where id_employee='$id_employee' order by date_ot ASC"
;
018.
019.
}
elseif
(
$month
!=
""
and
$year
!=
""
){
020.
$msg
=
"รายงานการส่งสินค้าประจำเดือน"
;
021.
$day_start
=
$year
.
"-"
.
$month
.
"-01"
;
022.
$day_end
=
$year
.
"-"
.
$month
.
"-31"
;
023.
024.
$sql
=
"select * from employee_totalot WHERE id_employee='$id_employee' between '$day_start' and '$day_end'"
;
025.
026.
}
elseif
(
$month
==
""
and
$year
!=
""
){
027.
$msg
=
"รายงานการส่งสินค้าประจำปี"
;
028.
$day_start
=
$year
.
"-01-01"
;
029.
$day_end
=
$year
.
"-12-31"
;
030.
$sql
=
"select * from products,p_status where products.id_status=p_status.id_status and products.date_in between '$day_start' and '$day_end' order by products.id_pro desc"
;
031.
}
032.
$result
=mysql_query(
$sql
);
033.
if
(
$result
!=
""
){
034.
$Num_Rows
=mysql_num_rows(
$result
);
035.
}?>
038.
<head>
039.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
040.
<title>Untitled Document</title>
041.
</head>
042.
043.
<body>
044.
<a href=
"./?P=Report&Type=Shipping"
>รายงานสินค้า</a> <a href=
"./?P=Report&Type=Shipping_permouth"
>รายงานสินค้าตามเดือนและปี</a> <a href=
"test_report_shipping_word.php?month=<?=$month?>&?year=<?=$year?>"
target=
"_blank"
><img src=
"pic/word.png"
width=
"30"
height=
"30"
alt=
"print to word"
/></a>
045.
<div align=
"right"
>
046.
047.
<form id=
"form1"
name=
"form1"
method=
"post"
action=
""
>
048.
<table width=
"500"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
049.
<tr>
050.
<td align=
"center"
>รายงานตามเดือน/ปี ที่รับ
051.
<label
for
=
"day"
></label>
052.
<label
for
=
"month"
></label>
053.
<select name=
"month"
id=
"month"
>
054.
<option value=
""
>เลือกเดือน</option>
055.
<option value=
"01"
>มกราคม</option>
056.
<option value=
"02"
>กุมภาพันธ์</option>
057.
<option value=
"03"
>มีนาคม</option>
058.
<option value=
"04"
>เมษายน</option>
059.
<option value=
"05"
>พฤษภาคม</option>
060.
<option value=
"06"
>มิถุนายน</option>
061.
<option value=
"07"
>กรกฎาคม</option>
062.
<option value=
"08"
>สิงหาคม</option>
063.
<option value=
"09"
>กันยายน</option>
064.
<option value=
"10"
>ตุลาคม</option>
065.
<option value=
"11"
>พฤศจิกายน</option>
066.
<option value=
"12"
>ธันวาคม</option>
067.
</select>
068.
<label
for
=
"year"
></label>
069.
<select name=
"year"
id=
"year"
>
070.
<option value=
""
>เลือกปี</option>
071.
<option value=
"2012"
>2555</option>
072.
<option value=
"2013"
>2556</option>
073.
<option value=
"2014"
>2557</option>
074.
<option value=
"2015"
>2558</option>
075.
<option value=
"2015"
>2559</option>
076.
<option value=
"2015"
>2560</option>
077.
</select>
078.
<input type=
"submit"
name=
"Submit"
id=
"button"
value=
"ค้นหาข้อมูล"
/></td>
079.
</tr>
080.
</table>
081.
</form></div>
082.
<?php
083.
if
(
$Num_Rows
==0){
084.
echo
"<center><font color='red'><br><br><br>ไม่พบข้อมูลในระบบ<br><br><br></font></center>"
;
085.
}
else
{
086.
echo
"$msg"
;
087.
?>
088.
<?
089.
$sum1
=0;
090.
$co
= 1;
091.
$tr
= 0;
092.
echo
'<table width="300" border="1" cellspacing="0" cellpadding="2" align="center">'
;
093.
echo
'<td>'
;
094.
echo
"รหัสพนักงาน : "
;
095.
echo
$id_employee
;
096.
echo
'</td>'
;
097.
echo
'</table>'
;
098.
echo
'<table width=
"300"
border=
"1"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
099.
100.
<tr>
101.
<th>วันที่ทำ OT</th>
102.
<th>ชั่วโมงที่ทำ</th>
103.
<th>รายรับ</th>
104.
</tr>';
105.
106.
while
(
$read
=mysql_fetch_array(
$result
)){
107.
$id_ot
=
$read
[id_ot];
108.
$id_employee
=
$read
[id_employee];
109.
$id_otsala
=
$read
[id_otsala];
110.
$date_ot
=
$read
[date_ot];
111.
$hour_ot
=
$read
[hour_ot];
112.
$tot_ot
=
$read
[tot_ot];
113.
114.
$sum1
=
$tot_ot
+
$sum1
;
115.
echo
'<td>'
;
116.
echo
$date_ot
;
117.
echo
'</td>'
;
118.
echo
'<td>'
;
119.
echo
$hour_ot
;
120.
echo
'</td>'
;
121.
echo
'<td>'
;
122.
echo
$tot_ot
;
123.
124.
echo
'</td>'
;
125.
$tr
++;
126.
if
(
$tr
==
$co
)
127.
{
128.
echo
'</tr><tr>'
;
129.
$tr
=0;
130.
}
131.
132.
'<tr>'
; }
133.
echo
'<td>'
;
134.
135.
echo
'</td>'
;
136.
echo
'<td>'
;
137.
138.
echo
'</td>'
;
139.
echo
'<td>'
;
140.
echo
$sum1
;
141.
echo
'</td>'
;
142.
'</tr>'
;
143.
echo
'</tr></table>'
; }
144.
?>
145.
</body>
146.
</html>