01.
<?php
02.
include
(
"config.php"
);
03.
define(
'TTF_DIR'
,dirname(
__FILE__
).
'/fonts/'
);
04.
include_once
(
"libraries/jpgraph/src/jpgraph.php"
);
05.
include_once
(
"libraries/jpgraph/src/jpgraph_bar.php"
);
06.
include_once
(
"libraries/jpgraph/src/jpgraph_line.php"
);
07.
include_once
(
"libraries/jpgraph/src/jpgraph_flags.php"
);
08.
09.
$rpt_sql
="select A50 from (Select A50, Case When A50=0 Then 0 Else A1512/A50
End
As A51,
10.
MinA15 As A52, MaxA15 As A53, A54, A55,
11.
Case When A50=0 Then 0 Else A55/A50
End
As A56,
12.
A57, A58, A59,
13.
Case When A50=0 Then 0 Else A59/A50
End
As A60
14.
From (
15.
Select Sum(A12) As A50,
16.
Sum(A15*A12) As A1512,
17.
Min(A15) As MinA15,
18.
Max(A15) As MaxA15,
19.
Sum((A12*A15)/100) As A54,
20.
Sum(A13) As A55,
21.
Min(A13/A12) As A57,
22.
Max(A12/A12) As A58,
23.
Sum(A14) As A59
24.
From acq Where A17>=
'2014-01-01'
and
A17<=
'2014-10-01'
) As A)
as
B
25.
";
26.
mysql_query(
'set names utf8'
);
27.
$rpt_query
=mysql_query(
$rpt_sql
)
or
die
(
'Error query ['
.
$rpt_sql
.
']'
);
28.
while
(
$rpt_rows
= mysql_fetch_array(
$rpt_query
)){
29.
$ydata
[]=
$rpt_rows
[
"A50"
];
30.
31.
$xdata
[]=iconv(
'TIS-620'
,
'UTF-8'
,
'aa'
);
32.
}
33.
34.
$graph
=
new
Graph(1000,900);
35.
$graph
->SetScale(
"textlin"
);
36.
$graph
->SetMarginColor(
'white'
);
37.
$graph
->SetBackgroundGradient(
"white"
,
"whitesmoke"
,GRAD_HOR, BGRAD_MARGIN);
38.
$graph
->SetShadow();
39.
$graph
->SetMargin(200,100,100,300);
40.
41.
$graph
->title->Set(
"กราฟแสดงรายงานยอดเงินค่าสอนพิเศษ"
);
42.
$graph
->title->SetFont(FF_ANGSA,FS_BOLD,25);
43.
$graph
->subtitle->Set(
"แบบ EXTRA-LOAD"
);
44.
$graph
->subtitle->SetFont(FF_ANGSA,FS_BOLD,25);
45.
46.
47.
$graph
->xaxis->title->SetFont(FF_ANGSA,FS_BOLD,18);
48.
49.
$graph
->yaxis->title->SetFont(FF_ANGSA,FS_BOLD,18);
50.
$graph
->xaxis->SetTickLabels(
$xdata
);
51.
$graph
->xaxis->SetLabelAngle(45);
52.
$graph
->xaxis->SetFont(FF_ANGSA,FS_NORMAL,15);
53.
$graph
->SetMarginColor(
'white'
);
54.
$graph
->SetBackgroundGradient(
"white"
,
"whitesmoke"
,GRAD_HOR, BGRAD_MARGIN);
55.
56.
$bplot
=
new
BarPlot(
$ydata
);
57.
$bplot
->SetFillGradient(
'white'
,
'orchid'
,GRAD_VERT);
58.
$bplot
->SetColor(
'gainsboro'
);
59.
$bplot
->SetWeight(1);
60.
$bplot
->value->Show();
61.
$bplot
->value->SetFont(FF_ANGSA,FS_BOLD,15);
62.
$bplot
->value->SetAngle(45);
63.
64.
$graph
->Add(
$bplot
);
65.
66.
$graph
->Stroke();
67.
?>