001.
<?
002.
Session_start();
003.
if
(
$sess_adminid
<>session_id()){
004.
header(
"location:login.php"
);
exit
();
005.
}
006.
007.
include
"connect.php"
;
008.
$startdate
=
$_POST
[startdate];
009.
$enddate
=
$_POST
[enddate];
010.
echo
$startdate
.
$enddate
;
011.
012.
013.
014.
function
fnc_positive(
$main_date
)
015.
{
016.
list(
$date1
,
$month1
,
$year1
) =
explode
(
'/'
,
$main_date
);
017.
$yearS_new
=(
$year1
-543);
018.
$startdate1
=
$yearS_new
.
'-'
.
$month1
.
'-'
.
$date1
;
019.
return
$startdate
;
020.
}
021.
022.
function
fnc_delete(
$main_date
)
023.
{
024.
list(
$date1
,
$month1
,
$year1
) =
explode
(
'/'
,
$main_date
);
025.
$yearS_new
=(
$year1
-543);
026.
$enddate
=
$yearS_new
.
'-'
.
$month1
.
'-'
.
$date1
;
027.
return
$enddate
;
028.
}
029.
030.
031.
032.
function
fnc_add1(
$main_date
)
033.
{
034.
list(
$year1
,
$month1
,
$date1
) =
explode
(
'-'
,
$main_date
);
035.
$yearS_new
=(
$year1
+543);
036.
$startdate
=
$date1
.
'/'
.
$month1
.
'/'
.
$yearS_new
;
037.
return
$startdate
;
038.
}
039.
040.
function
fnc_add2(
$main_date
)
041.
{
042.
list(
$year1
,
$month1
,
$date1
) =
explode
(
'-'
,
$main_date
);
043.
$yearS_new
=(
$year1
+543);
044.
$enddate
=
$date1
.
'/'
.
$month1
.
'/'
.
$yearS_new
;
045.
return
$enddate
;
046.
}
047.
048.
049.
050.
051.
052.
053.
054.
055.
056.
057.
?>
059.
<head>
060.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
061.
<title>รายงานแจ้งซ่อมโรงพยาบาลแม่อาย</title>
062.
<meta name=
"keywords"
content=
""
/>
063.
<meta name=
"description"
content=
""
/>
064.
065.
<style type=
"text/css"
>
066.
<!--
067.
body,td,th {
068.
color: #0000FF;
069.
font-size: 12px;
070.
}
071.
.style2 {font-size: 13px}
072.
.style7 {font-size: 25px}
073.
-->
074.
</style>
075.
<head>
076.
<body>
077.
078.
<tr>
079.
<td valign=
"top"
><table width=
"100%"
style=
"border-bottom:2px dotted #000000;border-right:2px dotted #000000;border-left:2px dotted #000000;border-top:2px dotted #000000;"
cellspacing=
"0"
cellpadding=
"0"
>
080.
<tr>
081.
<td width=
"47%"
height=
"35"
><table width=
"482"
border=
"0"
cellpadding=
"0"
cellspacing=
"0"
>
082.
<tr>
083.
<td>จากวันที่<input name=
"startdate"
type=
"text"
value=
"<?=$startdate?>"
size=
"10"
disabled>
084.
ถึงวันที่<input name=
"enddate"
type=
"text"
value=
"<?=$enddate?>"
size=
"10"
disabled></td>
085.
</tr>
086.
<tr>
087.
088.
<td> </td>
089.
090.
</tr>
091.
</table></td>
092.
<td width=
"15%"
></td>
093.
<td width=
"38%"
><div align=
"right"
><span
class
=
"style7"
>Report Helpdesk Log</span></div></td>
094.
</tr>
095.
</table>
096.
<table width=
"100%"
border=
"0"
cellpadding=
"0"
cellspacing=
"0"
bordercolor=
"#CCCCCC"
bgcolor=
"#FFFFFF"
>
097.
<tr>
098.
<td width=
"725"
>
099.
<?
100.
if
(
empty
(
$startdate
)
or
empty
(
$enddate
))
101.
{
102.
echo
"Empty llllllllllll"
;
103.
echo
$startdate
.
$enddate
;
104.
exit
();
105.
}
106.
else
107.
{
108.
$objDB
= mysql_select_db(
"$dbname"
);
109.
110.
111.
112.
$tmp_day1
=fnc_delete(
$startdate
);
113.
$tmp_day2
=fnc_delete(
$enddate
);
114.
115.
$strSQL
=
"select * from job where job_date between '$tmp_day1' and '$tmp_day2'"
;
116.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
117.
$Num_Rows
= mysql_num_rows(
$objQuery
);
118.
119.
$Per_Page
=10;
120.
121.
$Page
=
$_GET
[
"Page"
];
122.
if
(!
$_GET
[
"Page"
])
123.
{
124.
$Page
=1;
125.
}
126.
127.
$Prev_Page
=
$Page
-1;
128.
$Next_Page
=
$Page
+1;
129.
130.
$Page_Start
= ((
$Per_Page
*
$Page
)-
$Per_Page
);
131.
if
(
$Num_Rows
<=
$Per_Page
)
132.
{
133.
$Num_Pages
=1;
134.
}
135.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
136.
{
137.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
) ;
138.
}
139.
else
140.
{
141.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
142.
$Num_Pages
= (int)
$Num_Pages
;
143.
}
144.
145.
146.
$strSQL
.=
" order by job_id ASC LIMIT $Page_Start , $Per_Page"
;
147.
$objQuery
= mysql_query(
$strSQL
);
148.
149.
if
(
empty
(
$Num_Rows
))
150.
{
151.
echo
"<center><br>StartDate <b>$startdate</b> EndDate <b>$enddate IT WRONG!!<b> </center>"
;
152.
exit
();
153.
}
154.
else
155.
{
156.
?>
157.
158.
</td>
159.
</tr>
160.
<tr>
161.
<td><table width=
"100%"
border=
"1"
cellpadding=
"0"
cellspacing=
"0"
bgcolor=
"#999999"
>
162.
<tr>
163.
<td width=
"5%"
><div align=
"center"
class
=
"style2"
>ID</div></td>
164.
<td width=
"30%"
><span
class
=
"style2"
>รายละเอียดงาน</span></td>
165.
<td width=
"30%"
><span
class
=
"style2"
>การดำเนินงาน/แก้ไข</span></td>
166.
<td width=
"7%"
><div align=
"center"
class
=
"style2"
>ชื่อผู้แจ้ง</div></td>
167.
<td width=
"7%"
><div align=
"center"
><span
class
=
"style2"
>สถานะ</span></div></td>
168.
<td width=
"7%"
><div align=
"center"
><span
class
=
"style2"
>กลุ่มปัญหา</span></div></td>
169.
<td width=
"14%"
><div align=
"center"
><span
class
=
"style2"
>Remark</span></div></td>
170.
</tr>
171.
</table>
172.
<?
173.
$i
=0;
174.
175.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
176.
{
177.
$i
++;
178.
if
(
$i
%2==0)
179.
{
180.
$bg
=
"#CCCCCC"
;
181.
}
182.
else
183.
{
184.
$bg
=
"#E4E4E4"
;
185.
}
186.
$job_date
=
$objResult
[
"job_date"
];
187.
$y
=
substr
(
$job_date
,2,2);
188.
$m
=
substr
(
$job_date
,5,2);
189.
$d
=
substr
(
$job_date
,8,2);
190.
$job_id
=
$objResult
[
"job_id"
];
191.
$code
=sprintf(
"$y$m%05d"
,
$job_id
);
192.
?>
193.
194.
<table width=
"100%"
style=
"border-bottom:1px dotted #000000;border-right:1px dotted #000000;border-left:1px dotted #000000;"
cellpadding=
"0"
cellspacing=
"0"
>
195.
196.
<tr>
197.
<td width=
"5%"
style=
"border-right:1px dotted #000000;"
rowspan=
"2"
><div align=
"center"
><?=
$code
;?></div></td>
198.
<td width=
"30%"
style=
"border-right:1px dotted #000000;"
valign=
"top"
><?=
$objResult
[
"job_date"
].
' '
.
$objResult
[
"job_detail"
];?></td> <?
199.
<td width=
"30%"
style=
"border-right:1px dotted #000000;"
valign=
"top"
><?=
$objResult
[
"job_ans"
];?></td>
200.
<td width=
"7%"
style=
"border-right:1px dotted #000000;"
><div align=
"center"
><?=
$objResult
[
"job_fname"
];?></div></td>
201.
<td width=
"7%"
style=
"border-right:1px dotted #000000;"
><div align=
"center"
><?=
$objResult
[
"job_status"
];?></div></td>
202.
<td width=
"7%"
style=
"border-right:1px dotted #000000;"
>
203.
<?
204.
$type_id
=
$objResult
[
"ref_type_id"
];
205.
?>
206.
<?
207.
$strSQL3
=
"SELECT*FROM type where type_id='$type_id' "
;
208.
$objQuery3
= mysql_query(
$strSQL3
);
209.
$Num_Rows3
= mysql_num_rows(
$objQuery3
);
210.
211.
while
(
$objResult3
= mysql_fetch_array(
$objQuery3
))
212.
213.
{
214.
?>
215.
<div align=
"center"
><?=
$objResult3
[
"type_name"
];?></div></td>
216.
<?
217.
}
218.
?>
219.
<td width=
"14%"
><?=
$objResult
[
"job_remark"
];?></td>
220.
</tr>
221.
<tr bgcolor=
""
> </tr>
222.
</table>
223.
<?
224.
}
225.
226.
?></td>
227.
</tr>
228.
229.
<tr>
230.
<td height=
"37"
><div align=
"center"
><span
class
=
"style11"
>
231.
</span>
232.
<table width=
"100%"
style=
"border-bottom:1px dotted #000000;border-right:1px dotted #000000;border-left:1px dotted #000000;"
cellspacing=
"0"
cellpadding=
"0"
>
233.
<tr>
234.
<td height=
"20"
><div align=
"center"
><span
class
=
"style11"
>Total </span><?=
$Num_Rows
;?>
235.
<span
class
=
"style11"
> Record : </span><?=
$Num_Pages
;?>
236.
<span
class
=
"style11"
>Page :</span>
237.
<?
238.
239.
$tmp_date1
=fnc_add1(
$tmp_day1
);
240.
$tmp_date2
=fnc_add1(
$tmp_day2
);
241.
242.
$startdate
=
$tmp_date1
;
243.
$enddate
=
$tmp_date2
;
244.
245.
echo
$startdate
.
$enddate
;
246.
247.
if
(
$Prev_Page
)
248.
{
249.
echo
" <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&startdate=$tmp_date1&enddate=$tmp_date2'></a> "
;
250.
251.
}
252.
253.
for
(
$i
=1;
$i
<=
$Num_Pages
;
$i
++){
254.
if
(
$i
!=
$Page
)
255.
{
256.
echo
"[<a href='$_SERVER[SCRIPT_NAME]?Page=$i&startdate=$tmp_date1&enddate=$tmp_date2'>$i</a>]"
;
257.
258.
}
259.
else
260.
{
261.
echo
"<b> $i </b>"
;
262.
}
263.
if
(
$Page
!=
$Num_Pages
)
264.
{
265.
echo
" <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&startdate=$tmp_date1&enddate=$tmp_date2'></a> "
;
266.
267.
}
268.
269.
270.
?>
271.
<?
272.
}
273.
}
274.
275.
} mysql_close();
276.
?>
277.
</div></td>
278.
</tr>
279.
</table><br>
280.
</div></td>
281.
</tr>
282.
</table></td>
283.
</tr>
284.
</table>
285.
286.
<br>
287.
<tr><td valign=
"top"
>
288.
289.
</body>
290.
</html>