001.
<?php
002.
define(
'FPDF_FONTPATH'
,
'font/'
);
003.
require
(
'fpdf.php'
);
004.
005.
class
PDF
extends
FPDF
006.
{
007.
008.
function
Footer()
009.
{
010.
011.
012.
$this
->SetY( -10 );
013.
014.
015.
$this
->SetFont(
'Arial'
,
'I'
,5);
016.
017.
$this
->Cell(0,10,
'Create by www.select2web.com'
,0,0,
'L'
);
018.
019.
020.
$this
->Cell(0,10,
'page '
.
$this
->PageNo().
' of tp'
,0,0,
'R'
);
021.
022.
}
023.
024.
}
025.
026.
027.
028.
029.
030.
031.
032.
033.
034.
035.
036.
$pdf
=
new
FPDF();
037.
$pdf
->AddFont(
'angsana'
,
''
,
'angsa.php'
);
038.
$pdf
->SetMargins( 40,10,30);
039.
$pdf
->AddPage();
040.
$pdf
->SetFont(
'angsana'
,
''
,14);
041.
042.
include
"connect.php"
;
043.
mysql_select_db(
$dbname
,
$dbconnect
)
or
die
(
"Can not Choose DATABASE ?????"
).mysql_error();
044.
mysql_query(
"SET NAMES UTF8"
);
045.
046.
047.
$strSQL1
=
"SELECT * FROM tbltype_work WHERE id_type_work = '"
.
$_GET
[
"id_type_work"
].
"'"
;
048.
$objQuery1
= mysql_query(
$strSQL1
)
or
die
(
"Error Query ["
.
$strSQL1
.
"]"
);
049.
$objResult1
= mysql_fetch_array(
$objQuery1
);
050.
$name_type_work
=
$objResult1
[
"name_type_work"
];
051.
$id_type_work
=
$objResult1
[
"id_type_work"
];
052.
053.
$sql_sharetype_work
=
"SELECT*FROM tblsharetype_work WHERE id_type_work = '$id_type_work'"
;
054.
$result_sharetype_work
=mysql_query(
$sql_sharetype_work
,
$dbconnect
)
or
die
(
"ไม่สามารถเชื่อมต่อฐานข้อมูลได้!!"
).mysql_error();
055.
$show_sharetype_work
=mysql_fetch_array(
$result_sharetype_work
);
056.
$id_sharetype_work
=
$show_sharetype_work
[id_sharetype_work];
057.
058.
$day
=
substr
(
$row
[
"install_day"
],8,2);
059.
$month1
=
substr
(
$row
[
"install_day"
],5,2);
060.
$year
=
substr
(
$row
[
"install_day"
],0,4)+543;
061.
$thaimonth
=
array
(
"มกราคม"
,
"กุมภาพันธ์"
,
"มีนาคม"
,
"เมษายน"
,
062.
"พฤษภาคม"
,
"มิถุนายน"
,
"กรกฎาคม"
,
"สิงหาคม"
,
"กันยายน"
,
"ตุลาคม"
,
063.
"พฤศจิกายน"
,
"ธันวาคม"
);
064.
$month
=
$thaimonth
[
$month1
-1];
065.
$rent_advertise
=
$row
[rent_advertise];
066.
$detail_advertise
=
$row
[detail_advertise];
067.
$payment
=
$row
[payment];
068.
$design_worker
=
$row
[design_worker];
069.
$before_photo1
=
$row
[before_photo1];
070.
071.
$pdf
->Cell( 0 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'รายงาน '
), 0 , 1 ,
'C'
);
072.
$pdf
->Cell( 0 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'ประเภทงานแบบหลัก '
.
$name_type_work
) , 0 , 1 ,
'C'
);
073.
$pdf
->Ln();
074.
$pdf
->Cell( 10 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'ลำดับ'
), 1,0,
'C'
);
075.
076.
if
(
$id_sharetype_work
<>
""
)
077.
{
078.
$pdf
->Cell( 30 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'ประเภทแบบย่อย'
), 1,0,
'C'
);
079.
$pdf
->Cell( 60 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'ชื่อร้านค้า'
), 1,0,
'C'
);
080.
$pdf
->Cell( 50 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'วันที่ติดตั้ง'
), 1,0,
'C'
);
081.
}
082.
else
083.
{
084.
$pdf
->Cell( 80 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'ชื่อร้านค้า'
), 1,0,
'C'
);
085.
$pdf
->Cell( 60 , 6 , iconv(
'UTF-8'
,
'cp874'
,
'วันที่ติดตั้ง'
), 1,0,
'C'
);
086.
}
087.
088.
$pdf
->Ln();
089.
$sql
=
"SELECT * FROM tblcatalogue_store WHERE id_type_work = '"
.
$_GET
[
"id_type_work"
].
"' and year_install_day = '"
.
$_GET
[
"year_install_day"
].
"' order by install_day DESC"
;
090.
$result
=mysql_query(
$sql
,
$dbconnect
)
or
die
(
"Can not SELECT into DATABASE ???!"
).mysql_error();
091.
while
(
$row
=mysql_fetch_array(
$result
))
092.
{
093.
094.
$day
=
substr
(
$row
[
"install_day"
],8,2);
095.
$month1
=
substr
(
$row
[
"install_day"
],5,2);
096.
$year
=
substr
(
$row
[
"install_day"
],0,4)+543;
097.
$thaimonth
=
array
(
"มกราคม"
,
"กุมภาพันธ์"
,
"มีนาคม"
,
"เมษายน"
,
098.
"พฤษภาคม"
,
"มิถุนายน"
,
"กรกฎาคม"
,
"สิงหาคม"
,
"กันยายน"
,
"ตุลาคม"
,
099.
"พฤศจิกายน"
,
"ธันวาคม"
);
100.
$month
=
$thaimonth
[
$month1
-1];
101.
$rent_advertise
=
$row
[rent_advertise];
102.
$detail_advertise
=
$row
[detail_advertise];
103.
$payment
=
$row
[payment];
104.
$design_worker
=
$row
[design_worker];
105.
$before_photo1
=
$row
[before_photo1];
106.
107.
108.
$sql_sharetype_work
=
"SELECT*FROM tblsharetype_work WHERE id_sharetype_work = '$row[id_sharetype_work]'"
;
109.
$result_sharetype_work
=mysql_query(
$sql_sharetype_work
,
$dbconnect
)
or
die
(
"ไม่สามารถเชื่อมต่อฐานข้อมูลได้!!"
).mysql_error();
110.
$show_sharetype_work
=mysql_fetch_array(
$result_sharetype_work
);
111.
$name_sharetype_work
=
$show_sharetype_work
[name_sharetype_work];
112.
113.
$sql_store
=
"SELECT*FROM tblstore WHERE id_store = '$row[id_store]'"
;
114.
$result_store
=mysql_query(
$sql_store
,
$dbconnect
)
or
die
(
"ไม่สามารถเชื่อมต่อฐานข้อมูลได้!!"
).mysql_error();
115.
$show_store
=mysql_fetch_array(
$result_store
);
116.
$name_store
=
$show_store
[name_store];
117.
$num
=
$num
+1;
118.
$pdf
->Cell( 10 , 6 , iconv(
'UTF-8'
,
'cp874'
,
$num
.
'.'
), 1,0,
'L'
);
119.
if
(
$name_sharetype_work
<>
""
)
120.
{
121.
$pdf
->Cell( 30 , 6 , iconv(
'UTF-8'
,
'cp874'
,
$name_sharetype_work
), 1,0,
'L'
);
122.
$pdf
->Cell( 60 , 6 , iconv(
'UTF-8'
,
'cp874'
,
$name_store
), 1,0,
'L'
);
123.
$pdf
->Cell( 50 , 6 , iconv(
'UTF-8'
,
'cp874'
,
$day
.
' '
.
$month
.
' '
.
$year
), 1,0,
'L'
);
124.
}
125.
if
(
$name_sharetype_work
==
""
)
126.
{
127.
$pdf
->Cell( 80 , 6 , iconv(
'UTF-8'
,
'cp874'
,
$name_store
), 1,0,
'L'
);
128.
$pdf
->Cell( 60 , 6 , iconv(
'UTF-8'
,
'cp874'
,
$day
.
' '
.
$month
.
' '
.
$year
), 1,0,
'L'
);
129.
}
130.
$pdf
->Ln();
131.
132.
}
133.
134.
mysql_close(
$dbconnect
);
135.
$pdf
->Output();
136.
?>