01.
<?php
02.
header(
'Cache-Control: no-cache'
);
03.
header(
'Pragma: no-cache'
);
04.
header(
'Expires: 0'
);
05.
include
(
"database_connect.php"
);
06.
include
(
"translateamount.php"
);
07.
require
(
'fpdf181/fpdf.php'
);
08.
define(
'FPDF_FONTPATH'
,
'fontTH/'
);
09.
?>
10.
11.
12.
<?
13.
$result
= mysqli_query(
$dbc
,
"SELECT * FROM Receipt WHERE ReceiptID = '"
.
$_REQUEST
['id
']."'
");
14.
$row
= mysqli_fetch_array(
$result
);
15.
16.
$x
=
new
hk_baht(
$b
=
$row
[
'GrandTotal'
] );
17.
$pdf
=
new
FPDF(
'L'
,
'mm'
,
'A4'
);
18.
$pdf
->SetMargins( 48,60,10 );
19.
$pdf
->AddFont(
'angsana'
,
''
,
'angsa.php'
);
20.
$pdf
->AddFont(
'angsana'
,
'B'
,
'angsab.php'
);
21.
$pdf
->AddFont(
'angsana'
,
'I'
,
'angsai.php'
);
22.
$pdf
->AddFont(
'angsana'
,
'BI'
,
'angsaz.php'
);
23.
24.
$pdf
->AddPage();
25.
26.
27.
28.
$pdf
->SetFont(
'angsana'
,
''
,20);
29.
30.
31.
32.
$pdf
->Image(
'logofitness.png'
,230,5,35,0,
''
);
33.
$pdf
->Text( 25 , 10 ,
'X Fitness CO., LTD'
);
34.
$pdf
->Text( 25 , 15 ,
'254 Baansuan Sukhumvit Village, Soi Onnuch 46,'
);
35.
$pdf
->Text( 25 , 20 ,
'Suanluang, Sukhumvit 77, Bangkok 10250'
);
36.
$pdf
->Text( 25 , 26 ,
'Tel. 027213733'
);
37.
$pdf
->Text( 200 , 50 , iconv(
'UTF-8'
,
'cp874'
,
'No:'
));
38.
$pdf
->Text( 220 , 50 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'ReceiptID'
]));
39.
$pdf
->Cell(0.02,100,
''
,1,0,
'C'
,0);
40.
$pdf
->Text( 60 , 55 , iconv(
'UTF-8'
,
'cp874'
,
'Receipt / ใบรับเงิน'
));
41.
$pdf
->Text( 200 , 55 , iconv(
'UTF-8'
,
'cp874'
,
'Date:'
));
42.
$pdf
->Text( 220 , 55 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'Date'
]));
43.
$pdf
->Cell( 170 , 10 , iconv(
'UTF-8'
,
'cp874'
,
'ชื่อลูกค้า / Customer Name: '
),1,0,
'L'
,0);
44.
$pdf
->Text( 115 , 67 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'CustomerName'
]) ,1,0,
''
,0);
45.
46.
$pdf
->Text( 218 , 69 , iconv(
'UTF-8'
,
'cp874'
,
'_____________'
));
47.
$pdf
->Cell(30,100,
''
,1,0,
'C'
,0);
48.
$pdf
->Cell(0,100,
''
,0,1,
'C'
,0);
49.
$pdf
->Text( 50 , 80 , iconv(
'UTF-8'
,
'cp874'
,
'Description / คำอธิบาย:'
));
50.
$pdf
->SetXY(
$x
+60,
$y
+85);
51.
$pdf
->MultiCell( 0 , 7 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'Description'
] ) ,
'C'
);
52.
53.
$pdf
->Text( 50 , 157 , iconv(
'UTF-8'
,
'cp874'
,
'Payment Type:'
));
54.
$pdf
->Text( 85 , 157 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'PaymentType'
]));
55.
$pdf
->Text( 48 , 134 , iconv(
'UTF-8'
,
'cp874'
,
'______________________________________________________________________________________'
));
56.
$pdf
->Text( 193 , 141 , iconv(
'UTF-8'
,
'cp874'
,
'Total:'
));
57.
$pdf
->Text( 229 , 141 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'Total'
]) ,1,0,
''
,0);
58.
$pdf
->Text( 218 , 142 , iconv(
'UTF-8'
,
'cp874'
,
'_____________'
));
59.
$pdf
->Text( 193 , 149 , iconv(
'UTF-8'
,
'cp874'
,
'VAT 7%:'
));
60.
$pdf
->Text( 229 , 149 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'VAT'
]) ,1,0,
''
,0);
61.
$pdf
->Text( 218 , 151 , iconv(
'UTF-8'
,
'cp874'
,
'_____________'
));
62.
$pdf
->Text( 193 , 157 , iconv(
'UTF-8'
,
'cp874'
,
'Grand total:'
));
63.
$pdf
->Text( 229 , 157 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'GrandTotal'
]) ,1,0,
''
,0);
64.
$pdf
->Text( 100 , 172 , iconv(
'UTF-8'
,
'cp874'
,
$x
->result));
65.
$pdf
->SetXY(
$x
+47,
$y
+160);
66.
$pdf
->Cell(200,20,iconv(
'UTF-8'
,
'cp874'
,
'จำนวนเงินเป็นตัวอักษร:'
),1,1,
'L'
,0);
67.
$pdf
->Text( 185 , 167 , iconv(
'UTF-8'
,
'cp874'
,
'Staff Name:'
));
68.
$pdf
->Text( 185 , 177 , iconv(
'UTF-8'
,
'cp874'
,
'Sale Name:'
));
69.
$pdf
->Text( 215 , 167 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'StaffName'
]) ,1,0,
''
,0);
70.
$pdf
->Text( 215 , 177 , iconv(
'UTF-8'
,
'cp874'
,
$row
[
'SaleName'
]) ,1,0,
''
,0);
71.
72.
73.
74.
75.
$pdf
->Output();
76.
77.
78.
?>