01.
public
function
show(Request
$request
) {
02.
03.
$DateStart
=
$request
->DateStart;
04.
$DateEnd
=
$request
->DateEnd;
05.
06.
$nowyear
=
date
(
'Y'
);
07.
$startyear
= 2017;
08.
09.
$bargraph
= DB::select("
10.
SELECT * FROM
11.
(SELECT
count
(tbmaster.id)
as
Previousyear
12.
FROM TB_INFO tbinfo
13.
LEFT JOIN TB_MASTER tbmaster
14.
ON tbinfo.id = tbmaster.id
15.
LEFT JOIN TB_NAME tbname
16.
ON tbinfo.id = tbname.id
17.
WHERE tbinfo.datetime is not null
18.
AND tbinfo.datetime BETWEEN
'$DateStart'
AND
'$DateEnd'
19.
AND tbmaster.CancleCode is not null
20.
AND tbmaster.CancleCode in (
'10'
,
'20'
)
21.
AND tbname.suff =
'1'
22.
)
as
Y1,
23.
(SELECT
Count
(tbmaster.id)
as
Currentyear
24.
FROM TB_INFO tbinfo
25.
LEFT JOIN TB_MASTER tbmaster
26.
ON tbinfo.id = tbmaster.id
27.
LEFT JOIN TB_NAME tbname
28.
ON tbinfo.id = tbname.id
29.
WHERE tbinfo.datetime is not null
30.
AND tbinfo.datetime BETWEEN
'$DateStart'
AND
'$DateEnd'
31.
AND tbmaster.CancleCode is not null
32.
AND tbmaster.CancleCode in (
'10'
,
'20'
)
33.
AND tbname.suff =
'1'
34.
)
as
Y2 ");
35.
36.
37.
38.
return
view(
'myview'
)->with([
'bargraph'
=>
$bargraph
,
'nowyear'
=>
$nowyear
,
'startyear'
=>
$startyear
]);
39.
}