001.
<center>
002.
<center>
003.
<h2>เปรียบเทียบยอดขาย 1 มกราคม ถึงปัจจุบัน</h2>
004.
</center>
005.
006.
<?php
007.
date_default_timezone_set(
'Asia/Bangkok'
);
008.
009.
include
(
"Connections/connect_sqlserver.php"
);
010.
011.
012.
013.
$cur_date
=
date
(
"n-j"
);
014.
$cur_date1
=
date
(
"n"
);
015.
016.
017.
018.
019.
if
(isset(
$_POST
[
"years1"
]) && isset(
$_POST
[
"years2"
]) ) {
020.
$years1
=
$_POST
[
'years1'
];
021.
$years2
=
$_POST
[
'years2'
];
022.
}
else
{
023.
$y2
=
date
(
"Y"
);
024.
$y1
=
$y2
-1;
025.
$years1
=
$y1
;
026.
$years2
=
$y2
;
027.
}
028.
029.
030.
031.
$year1
=
$years1
+543;
032.
$year2
=
$years2
+543;
033.
034.
035.
036.
037.
038.
039.
$date1
=
$years1
.
"-1-1 05:00:00.000"
;
040.
041.
042.
043.
$date2
=
$years1
.
"-"
.
$cur_date
.
" 23:59:59.000"
;
044.
045.
046.
047.
048.
$months
=
array
(1=>
'มกราคม'
,
'กุมภาพันธ์'
,
'มีนาคม'
,
'เมษายน'
,
'พฤษภาคม'
,
'มิถุนายน'
,
'กรกฎาคม'
,
'สิงหาคม'
,
'กันยายน'
,
'ตุลาคม'
,
'พฤศจิกายน'
,
'ธันวาคม'
);
049.
050.
$day
=
array
(31, 30, 29, 28);
051.
$month
=
date
(
"n"
);
052.
$year
=
date
(
"Y"
)+543;
053.
for
(
$i
=0;
$i
<
count
(
$day
);
$i
++)
054.
{
055.
$day_check
=
$day
[
$i
];
056.
if
(
checkdate
(
$month
,
$day_check
,
$years1
))
057.
{
058.
$last_date
=
"$day_check"
;
059.
break
;
060.
}
061.
}
062.
063.
064.
$date2
=
$years1
.
"-"
.
$cur_date
.
" 23:59:59.000"
;
065.
066.
067.
068.
069.
070.
071.
072.
073.
074.
075.
$objExec
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date1' AND '$date2' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=1)); "
;
076.
077.
$objresult
= odbc_exec(
$cid
,
$objExec
)
or
die
(odbc_error()) ;
078.
$SumOfTotalPrice_p
=0;
079.
while
(
$result
= odbc_fetch_array(
$objresult
)){
080.
$SumOfTotalPrice_p
=
$SumOfTotalPrice_p
+
$result
[
'SumOfTotalPrice'
];
081.
}
082.
083.
084.
085.
$objExec1
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date1' AND '$date2' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=1)); "
;
086.
087.
$objresult1
= odbc_exec(
$cid
,
$objExec1
)
or
die
(odbc_error()) ;
088.
$SumOfTotalPrice_p1
=0;
089.
while
(
$result1
= odbc_fetch_array(
$objresult1
)){
090.
$SumOfTotalPrice_p1
=
$SumOfTotalPrice_p1
+
$result1
[
'SumOfTotalPrice'
];
091.
}
092.
093.
094.
095.
096.
097.
$objExec2
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date1' AND '$date2' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=3)); "
;
098.
099.
$objresult2
= odbc_exec(
$cid
,
$objExec2
)
or
die
(odbc_error()) ;
100.
$SumOfTotalPrice_s
=0;
101.
while
(
$result2
= odbc_fetch_array(
$objresult2
)){
102.
$SumOfTotalPrice_s
=
$SumOfTotalPrice_s
+
$result2
[
'SumOfTotalPrice'
];
103.
}
104.
105.
106.
107.
108.
$objExec3
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date1' AND '$date2' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=3)); "
;
109.
110.
$objresult3
= odbc_exec(
$cid
,
$objExec3
)
or
die
(odbc_error()) ;
111.
$SumOfTotalPrice_s1
=0;
112.
while
(
$result3
= odbc_fetch_array(
$objresult3
)){
113.
$SumOfTotalPrice_s1
=
$SumOfTotalPrice_s1
+
$result3
[
'SumOfTotalPrice'
];
114.
}
115.
116.
117.
118.
119.
$objExec4
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date1' AND '$date2' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=2)); "
;
120.
121.
$objresult4
= odbc_exec(
$cid
,
$objExec4
)
or
die
(odbc_error()) ;
122.
$SumOfTotalPrice_k
=0;
123.
while
(
$result4
= odbc_fetch_array(
$objresult4
)){
124.
$SumOfTotalPrice_k
=
$SumOfTotalPrice_k
+
$result4
[
'SumOfTotalPrice'
];
125.
}
126.
127.
128.
129.
130.
$objExec5
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date1' AND '$date2' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=2)); "
;
131.
132.
$objresult5
= odbc_exec(
$cid
,
$objExec5
)
or
die
(odbc_error()) ;
133.
$SumOfTotalPrice_k1
=0;
134.
while
(
$result5
= odbc_fetch_array(
$objresult5
)){
135.
$SumOfTotalPrice_k1
=
$SumOfTotalPrice_k1
+
$result5
[
'SumOfTotalPrice'
];
136.
}
137.
138.
139.
140.
141.
$objExec6
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date1' AND '$date2' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=5)); "
;
142.
143.
$objresult6
= odbc_exec(
$cid
,
$objExec6
)
or
die
(odbc_error()) ;
144.
$SumOfTotalPrice_h
=0;
145.
while
(
$result6
= odbc_fetch_array(
$objresult6
)){
146.
$SumOfTotalPrice_h
=
$SumOfTotalPrice_h
+
$result6
[
'SumOfTotalPrice'
];
147.
}
148.
149.
150.
151.
152.
$objExec7
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date1' AND '$date2' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=5)); "
;
153.
154.
$objresult7
= odbc_exec(
$cid
,
$objExec7
)
or
die
(odbc_error()) ;
155.
$SumOfTotalPrice_h1
=0;
156.
while
(
$result7
= odbc_fetch_array(
$objresult7
)){
157.
$SumOfTotalPrice_h1
=
$SumOfTotalPrice_h1
+
$result7
[
'SumOfTotalPrice'
];
158.
}
159.
160.
161.
162.
163.
164.
165.
$date3
=
$years2
.
"-1-1 05:00:00.000"
;
166.
167.
168.
169.
$date4
=
$years2
.
"-"
.
$cur_date
.
" 23:59:59.000"
;
170.
171.
172.
173.
$months
=
array
(1=>
'มกราคม'
,
'กุมภาพันธ์'
,
'มีนาคม'
,
'เมษายน'
,
'พฤษภาคม'
,
'มิถุนายน'
,
'กรกฎาคม'
,
'สิงหาคม'
,
'กันยายน'
,
'ตุลาคม'
,
'พฤศจิกายน'
,
'ธันวาคม'
);
174.
175.
$day
=
array
(31, 30, 29, 28);
176.
$month
=
date
(
"n"
);
177.
$year
=
date
(
"Y"
)+543;
178.
for
(
$i
=0;
$i
<
count
(
$day
);
$i
++)
179.
{
180.
$day_check
=
$day
[
$i
];
181.
if
(
checkdate
(
$month
,
$day_check
,
$years2
))
182.
{
183.
$last_date
=
"$day_check"
;
184.
break
;
185.
}
186.
}
187.
188.
189.
190.
191.
$date4
=
$years2
.
"-"
.
$cur_date
.
" 23:59:59.000"
;
192.
193.
194.
195.
196.
197.
198.
$objExec8
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date3' AND '$date4' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=1)); "
;
199.
200.
$objresult8
= odbc_exec(
$cid
,
$objExec8
)
or
die
(odbc_error()) ;
201.
$SumOfTotalPrice_pk
=0;
202.
while
(
$result8
= odbc_fetch_array(
$objresult8
)){
203.
$SumOfTotalPrice_pk
=
$SumOfTotalPrice_pk
+
$result8
[
'SumOfTotalPrice'
];
204.
}
205.
206.
207.
208.
209.
$objExec9
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date3' AND '$date4' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=1)); "
;
210.
211.
$objresult9
= odbc_exec(
$cid
,
$objExec9
)
or
die
(odbc_error()) ;
212.
$SumOfTotalPrice_pk1
=0;
213.
while
(
$result9
= odbc_fetch_array(
$objresult9
)){
214.
$SumOfTotalPrice_pk1
=
$SumOfTotalPrice_pk1
+
$result9
[
'SumOfTotalPrice'
];
215.
}
216.
217.
218.
219.
$objExec10
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date3' AND '$date4' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=3)); "
;
220.
221.
$objresult10
= odbc_exec(
$cid
,
$objExec10
)
or
die
(odbc_error()) ;
222.
$SumOfTotalPrice_sg
=0;
223.
while
(
$result10
= odbc_fetch_array(
$objresult10
)){
224.
$SumOfTotalPrice_sg
=
$SumOfTotalPrice_sg
+
$result10
[
'SumOfTotalPrice'
];
225.
}
226.
227.
228.
229.
230.
$objExec11
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date3' AND '$date4' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=3)); "
;
231.
232.
$objresult11
= odbc_exec(
$cid
,
$objExec11
)
or
die
(odbc_error()) ;
233.
$SumOfTotalPrice_sg1
=0;
234.
while
(
$result11
= odbc_fetch_array(
$objresult11
)){
235.
$SumOfTotalPrice_sg1
=
$SumOfTotalPrice_sg1
+
$result11
[
'SumOfTotalPrice'
];
236.
}
237.
238.
239.
240.
241.
$objExec12
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date3' AND '$date4' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=2)); "
;
242.
243.
$objresult12
= odbc_exec(
$cid
,
$objExec12
)
or
die
(odbc_error()) ;
244.
$SumOfTotalPrice_kg
=0;
245.
while
(
$result12
= odbc_fetch_array(
$objresult12
)){
246.
$SumOfTotalPrice_kg
=
$SumOfTotalPrice_kg
+
$result12
[
'SumOfTotalPrice'
];
247.
}
248.
249.
250.
251.
252.
$objExec13
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date3' AND '$date4' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=2)); "
;
253.
254.
$objresult13
= odbc_exec(
$cid
,
$objExec13
)
or
die
(odbc_error()) ;
255.
$SumOfTotalPrice_kg1
=0;
256.
while
(
$result13
= odbc_fetch_array(
$objresult13
)){
257.
$SumOfTotalPrice_kg1
=
$SumOfTotalPrice_kg1
+
$result13
[
'SumOfTotalPrice'
];
258.
}
259.
260.
261.
262.
263.
$objExec14
=
"SELECT dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.Sell.TotalPrice) AS SumOfTotalPrice FROM ((dbo.Customer INNER JOIN dbo.Sell ON dbo.Customer.CusCode = dbo.Sell.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID) INNER JOIN dbo.Branch ON dbo.Sell.Branch = dbo.Branch.ID WHERE dbo.Sell.CrTime between '$date3' AND '$date4' GROUP BY dbo.Sell.Branch, dbo.Sell.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.Sell.Status)=0) AND ((dbo.CusType.ID)=5)); "
;
264.
265.
$objresult14
= odbc_exec(
$cid
,
$objExec14
)
or
die
(odbc_error()) ;
266.
$SumOfTotalPrice_hm
=0;
267.
while
(
$result14
= odbc_fetch_array(
$objresult14
)){
268.
$SumOfTotalPrice_hm
=
$SumOfTotalPrice_hm
+
$result14
[
'SumOfTotalPrice'
];
269.
}
270.
271.
272.
273.
274.
$objExec15
=
"SELECT dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name, Sum(dbo.CNCus.TotalPrice) AS SumOfTotalPrice FROM (dbo.CNCus INNER JOIN dbo.Customer ON dbo.CNCus.CusCode = dbo.Customer.CusCode) INNER JOIN dbo.CusType ON dbo.Customer.CusType = dbo.CusType.ID WHERE dbo.CNCus.CrTime between '$date3' AND '$date4' GROUP BY dbo.CNCus.Branch, dbo.CNCus.Status, dbo.CusType.ID, dbo.CusType.Name HAVING (((dbo.CNCus.Status)=0) AND ((dbo.CusType.ID)=5)); "
;
275.
276.
$objresult15
= odbc_exec(
$cid
,
$objExec15
)
or
die
(odbc_error()) ;
277.
$SumOfTotalPrice_hm1
=0;
278.
while
(
$result15
= odbc_fetch_array(
$objresult15
)){
279.
$SumOfTotalPrice_hm1
=
$SumOfTotalPrice_hm1
+
$result15
[
'SumOfTotalPrice'
];
280.
}
281.
282.
283.
284.
285.
286.
$plik
=
$SumOfTotalPrice_p
-
$SumOfTotalPrice_p1
;
287.
288.
289.
290.
$plik55
= number_format(
$plik
/10000000,1);
291.
292.
293.
$song
=
$SumOfTotalPrice_s
-
$SumOfTotalPrice_s1
;
294.
295.
$song55
= number_format(
$song
/10000000,1);
296.
297.
298.
$kong
=
$SumOfTotalPrice_k
-
$SumOfTotalPrice_k1
;
299.
300.
$kong55
= number_format(
$kong
/10000000,1);
301.
302.
303.
$home
=
$SumOfTotalPrice_h
-
$SumOfTotalPrice_h1
;
304.
305.
$home55
= number_format(
$home
/10000000,1);
306.
307.
308.
$total
=
$song
+
$plik
+
$kong
+
$home
;
309.
310.
311.
312.
313.
314.
315.
$song1
=
$SumOfTotalPrice_sg
-
$SumOfTotalPrice_sg1
;
316.
317.
$song56
= number_format(
$song1
/10000000,1);
318.
319.
320.
$plik1
=
$SumOfTotalPrice_pk
-
$SumOfTotalPrice_pk1
;
321.
322.
$plik56
= number_format(
$plik1
/10000000,1);
323.
324.
325.
$kong1
=
$SumOfTotalPrice_kg
-
$SumOfTotalPrice_kg1
;
326.
327.
$kong56
= number_format(
$kong1
/10000000,1);
328.
329.
330.
$home1
=
$SumOfTotalPrice_hm
-
$SumOfTotalPrice_hm1
;
331.
332.
$home56
= number_format(
$home1
/10000000,1);
333.
334.
335.
$total1
=
$song1
+
$plik1
+
$kong1
+
$home1
;
336.
337.
338.
339.
340.
341.
342.
$diff_p
=
$plik1
-
$plik
;
343.
344.
$diff_s
=
$song1
-
$song
;
345.
346.
$diff_k
=
$kong1
-
$kong
;
347.
348.
$diff_h
=
$home1
-
$home
;
349.
350.
$total_diff
=
$total1
-
$total
;
351.
352.
353.
354.
355.
356.
357.
$per_p
=
$diff_p
/
$plik
;
358.
359.
$per_s
=
$diff_s
/
$song
;
360.
361.
$per_k
=
$diff_k
/
$kong
;
362.
363.
$per_h
=
$diff_h
/
$home
;
364.
365.
$per_t
=
$total_diff
/
$total
;
366.
367.
368.
369.
370.
$sd_p
=
$plik1
/
$total1
;
371.
$sd_p56
= number_format(
$sd_p
,2);
372.
373.
374.
375.
$sd_s
=
$song1
/
$total1
;
376.
$sd_s56
= number_format(
$sd_s
,2);
377.
378.
$sd_k
=
$kong1
/
$total1
;
379.
$sd_k56
= number_format(
$sd_k
,2);
380.
381.
$sd_h
=
$home1
/
$total1
;
382.
$sd_h56
= number_format(
$sd_h
,2);
383.
384.
385.
386.
387.
388.
389.
390.
$sn_p
=
$plik
/
$total
;
391.
$sn_p55
= number_format(
$sn_p
,2);
392.
393.
394.
$sn_s
=
$song
/
$total
;
395.
$sn_s55
= number_format(
$sn_s
,2);
396.
397.
398.
$sn_k
=
$kong
/
$total
;
399.
$sn_k55
= number_format(
$sn_k
,2);
400.
401.
402.
$sn_h
=
$home
/
$total
;
403.
$sn_h55
= number_format(
$sn_h
,2);
404.
?>
405.
<table width=
"81%"
height=
"188"
border=
"1"
bordercolor=
"#000000"
align=
"center"
style=
"border:hidden"
>
406.
<tr>
407.
<td width=
"20%"
align=
"center"
bgcolor=
"#FFFFFF"
><strong>#</strong></td>
408.
<td width=
"15%"
align=
"center"
bgcolor=
"#FFFFFF"
><strong>ขายปลีก</strong></td>
409.
<td width=
"15%"
align=
"center"
bgcolor=
"#FFFFFF"
><strong>ขายส่ง</strong></td>
410.
<td width=
"15%"
align=
"center"
bgcolor=
"#FFFFFF"
><strong>โครงการ</strong></td>
411.
<td width=
"15%"
align=
"center"
bgcolor=
"#FFFFFF"
><strong>ขายส่งหน้าร้าน</strong></td>
412.
<td width=
"15%"
align=
"center"
bgcolor=
"#FFFFFF"
><strong>ยอดรวม</strong></td>
413.
</tr>
414.
<tr>
415.
<td width=
"20%"
bgcolor=
"#FFFFFF"
><strong>ปี <?
echo
"{$year2}"
;?></strong></td>
416.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$plik1
<0){
echo
" <font color=red>"
. number_format (
$plik1
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$plik1
,
'2'
);} ?></td>
417.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$song1
<0){
echo
" <font color=red>"
. number_format (
$song1
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$song1
,
'2'
);} ?></td>
418.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$kong1
<0){
echo
" <font color=red>"
. number_format (
$kong1
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$kong1
,
'2'
);} ?></td>
419.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$home1
<0){
echo
" <font color=red>"
. number_format (
$home1
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$home1
,
'2'
);} ?></td>
420.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$total1
<0){
echo
" <font color=red>"
. number_format (
$total1
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$total1
,
'2'
);} ?></td>
421.
</tr>
422.
<tr>
423.
<td width=
"20%"
bgcolor=
"#FFFFFF"
><strong>ปี <?
echo
"{$year1}"
;?></strong></td>
424.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$plik
<0){
echo
" <font color=red>"
. number_format (
$plik
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$plik
,
'2'
);} ?></td>
425.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$song
<0){
echo
" <font color=red>"
. number_format (
$song
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$song
,
'2'
);} ?></td>
426.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$kong
<0){
echo
" <font color=red>"
. number_format (
$kong
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$kong
,
'2'
);} ?></td>
427.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$home
<0){
echo
" <font color=red>"
. number_format (
$home
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$home
,
'2'
);} ?></td>
428.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$total
<0){
echo
" <font color=red>"
. number_format (
$total
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$total
,
'2'
);} ?></td>
429.
</tr>
430.
<tr>
431.
<td width=
"20%"
bgcolor=
"#FFFFFF"
><strong>Diff</strong></td>
432.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$diff_p
<0){
echo
" <font color=red>"
. number_format (
$diff_p
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$diff_p
,
'2'
);} ?></td>
433.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$diff_s
<0){
echo
" <font color=red>"
. number_format (
$diff_s
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$diff_s
,
'2'
);} ?></td>
434.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$diff_k
<0){
echo
" <font color=red>"
. number_format (
$diff_k
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$diff_k
,
'2'
);} ?></td>
435.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$diff_h
<0){
echo
" <font color=red>"
. number_format (
$diff_h
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$diff_h
,
'2'
);} ?></td>
436.
437.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?=number_format(
$total_diff
,2);?></td>
438.
</tr>
439.
<tr>
440.
<td width=
"20%"
height=
"26"
bgcolor=
"#FFFFFF"
><strong>เติบโต % ปี <?
echo
"{$year1}"
;?> - <?
echo
"{$year2}"
;?></strong></td>
441.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$per_p
<0){
echo
" <font color=red>"
. number_format (
$per_p
,
'2'
).
"</font>"
; }
else
{
echo
number_format (
$per_p
,
'2'
);} ?></td>
442.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$per_s
<0){
echo
" <font color=red>"
. number_format (
$per_s
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$per_s
,
'2'
);} ?></td>
443.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$per_k
<0){
echo
" <font color=red>"
. number_format (
$per_k
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$per_k
,
'2'
);} ?></td>
444.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$per_h
<0){
echo
" <font color=red>"
. number_format (
$per_h
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$per_h
,
'2'
);} ?></td>
445.
<td width=
"15%"
align=
"center"
bgcolor=
"#E6E6E6"
><?
if
(
$per_t
<0){
echo
" <font color=red>"
. number_format (
$per_t
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$per_t
,
'2'
);} ?></td>
446.
</tr>
447.
<tr bgcolor=
"#E6E6E6"
>
448.
<td width=
"20%"
bgcolor=
"#FFFFFF"
><strong>สัดส่วนการขายในปี <?
echo
"{$year2}"
;?></strong></td>
449.
<td width=
"15%"
align=
"center"
><?
if
(
$sd_p
<0){
echo
" <font color=red>"
. number_format (
$sd_p
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sd_p
,
'2'
);} ?></td>
450.
<td width=
"15%"
align=
"center"
><?
if
(
$sd_s
<0){
echo
" <font color=red>"
. number_format (
$sd_s
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sd_s
,
'2'
);} ?></td>
451.
<td width=
"15%"
align=
"center"
><?
if
(
$sd_k
<0){
echo
" <font color=red>"
. number_format (
$sd_k
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sd_k
,
'2'
);} ?></td>
452.
<td width=
"15%"
align=
"center"
><?
if
(
$sd_h
<0){
echo
" <font color=red>"
. number_format (
$sd_h
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sd_h
,
'2'
);} ?></td>
453.
454.
</tr>
455.
<tr bgcolor=
"#E6E6E6"
>
456.
<td width=
"20%"
bgcolor=
"#FFFFFF"
><strong>สัดส่วนการขายในปี <?
echo
"{$year1}"
;?></strong></td>
457.
<td width=
"15%"
align=
"center"
><?
if
(
$sn_p
<0){
echo
" <font color=red>"
. number_format (
$sn_p
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sn_p
,
'2'
);} ?></td>
458.
<td width=
"15%"
align=
"center"
><?
if
(
$sn_s
<0){
echo
" <font color=red>"
. number_format (
$sn_s
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sn_s
,
'2'
);} ?></td>
459.
<td width=
"15%"
align=
"center"
><?
if
(
$sn_k
<0){
echo
" <font color=red>"
. number_format (
$sn_k
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sn_k
,
'2'
);} ?></td>
460.
<td width=
"15%"
align=
"center"
><?
if
(
$sn_h
<0){
echo
" <font color=red>"
. number_format (
$sn_h
,
'2'
) .
"</font>"
; }
else
{
echo
number_format (
$sn_h
,
'2'
);} ?></td>
461.
462.
</tr>
463.
</table>
464.
465.
</center>
466.
<table width=
"100%"
border=
"1"
>
467.
<tr>
468.
<td colspan=
"2"
><img src=
"image/deptcom1.jpeg"
width=
"100%"
height=
""
/></td>
469.
</tr>
470.
<tr>
471.
<td><img src=
"image/sp56.jpeg"
width=
"100%"
height=
""
/></td>
472.
<td><img src=
"image/sp57.jpeg"
width=
"100%"
height=
""
/></td>
473.
</tr>
474.
</table>