1 | <?php |
---|
2 | require_once("../require.php"); |
---|
3 | require_once("./index_sub.php"); |
---|
4 | require_once("../batch/daily.php"); |
---|
5 | |
---|
6 | require_once("./class/SC_GraphPie.php"); |
---|
7 | require_once("./class/SC_GraphLine.php"); |
---|
8 | require_once("./class/SC_GraphBar.php"); |
---|
9 | |
---|
10 | class LC_Page { |
---|
11 | var $arrResults; |
---|
12 | var $keyname; |
---|
13 | var $tpl_image; |
---|
14 | var $arrTitle; |
---|
15 | function LC_Page() { |
---|
16 | $this->tpl_mainpage = 'total/index.tpl'; |
---|
17 | $this->tpl_subnavi = 'total/subnavi.tpl'; |
---|
18 | $this->tpl_graphsubtitle = 'total/subtitle.tpl'; |
---|
19 | $this->tpl_titleimage = '/img/title/title_sale.jpg'; |
---|
20 | $this->tpl_mainno = 'total'; |
---|
21 | global $arrWDAY; |
---|
22 | $this->arrWDAY = $arrWDAY; |
---|
23 | // ¥Ú¡¼¥¸¥¿¥¤¥È¥ë |
---|
24 | $this->arrTitle[''] = "´ü´ÖÊ̽¸·×"; |
---|
25 | $this->arrTitle['term'] = "´ü´ÖÊ̽¸·×"; |
---|
26 | $this->arrTitle['products'] = "¾¦ÉÊÊ̽¸·×"; |
---|
27 | $this->arrTitle['age'] = "ǯÂåÊ̽¸·×"; |
---|
28 | $this->arrTitle['job'] = "¿¦¶ÈÊ̽¸·×"; |
---|
29 | $this->arrTitle['member'] = "²ñ°÷Ê̽¸·×"; |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | $objPage = new LC_Page(); |
---|
34 | $objView = new SC_AdminView(); |
---|
35 | $objSess = new SC_Session(); |
---|
36 | // ǧ¾Ú²ÄÈݤÎȽÄê |
---|
37 | sfIsSuccess($objSess); |
---|
38 | |
---|
39 | // ÆþÎÏ´ü´Ö¤ò¥»¥Ã¥·¥ç¥ó¤ËµÏ¿¤¹¤ë |
---|
40 | lfSaveDateSession(); |
---|
41 | |
---|
42 | // ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ |
---|
43 | $objFormParam = new SC_FormParam(); |
---|
44 | // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ |
---|
45 | lfInitParam(); |
---|
46 | $objFormParam->setParam($_POST); |
---|
47 | $objFormParam->setParam($_GET); |
---|
48 | |
---|
49 | // ¸¡º÷¥ï¡¼¥É¤Î°ú¤·Ñ¤® |
---|
50 | foreach ($_POST as $key => $val) { |
---|
51 | if (ereg("^search_", $key)) { |
---|
52 | $objPage->arrHidden[$key] = $val; |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | switch($_POST['mode']) { |
---|
57 | case 'pdf': |
---|
58 | case 'csv': |
---|
59 | case 'search': |
---|
60 | // ÆþÎÏÃͤÎÊÑ´¹ |
---|
61 | $objFormParam->convParam(); |
---|
62 | $objPage->arrErr = lfCheckError($arrRet); |
---|
63 | $arrRet = $objFormParam->getHashArray(); |
---|
64 | |
---|
65 | // ÆþÎÏ¥¨¥é¡¼¤Ê¤· |
---|
66 | if (count($objPage->arrErr) == 0) { |
---|
67 | foreach ($arrRet as $key => $val) { |
---|
68 | if($val == "") { |
---|
69 | continue; |
---|
70 | } |
---|
71 | switch ($key) { |
---|
72 | case 'search_startyear': |
---|
73 | $sdate = $_POST['search_startyear'] . "/" . $_POST['search_startmonth'] . "/" . $_POST['search_startday']; |
---|
74 | break; |
---|
75 | case 'search_endyear': |
---|
76 | $edate = $_POST['search_endyear'] . "/" . $_POST['search_endmonth'] . "/" . $_POST['search_endday']; |
---|
77 | break; |
---|
78 | case 'search_startyear_m': |
---|
79 | list($sdate, $edate) = sfTermMonth($_POST['search_startyear_m'], $_POST['search_startmonth_m'], CLOSE_DAY); |
---|
80 | break; |
---|
81 | default: |
---|
82 | break; |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | if($_POST['type'] != "") { |
---|
87 | $type = $_POST['type']; |
---|
88 | } |
---|
89 | |
---|
90 | $page = $objFormParam->getValue('page'); |
---|
91 | switch($page) { |
---|
92 | // ¾¦ÉÊÊ̽¸·× |
---|
93 | case 'products': |
---|
94 | if($type == "") { |
---|
95 | $type = 'all'; |
---|
96 | } |
---|
97 | $objPage->tpl_page_type = "total/page_products.tpl"; |
---|
98 | // ̤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦ |
---|
99 | lfRealTimeDailyTotal($sdate, $edate); |
---|
100 | // ¸¡º÷·ë²Ì¤Î¼èÆÀ |
---|
101 | $objPage = lfGetOrderProducts($type, $sdate, $edate, $objPage); |
---|
102 | break; |
---|
103 | // ¿¦¶ÈÊ̽¸·× |
---|
104 | case 'job': |
---|
105 | if($type == "") { |
---|
106 | $type = 'all'; |
---|
107 | } |
---|
108 | $objPage->tpl_page_type = "total/page_job.tpl"; |
---|
109 | // ̤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦ |
---|
110 | lfRealTimeDailyTotal($sdate, $edate); |
---|
111 | // ¸¡º÷·ë²Ì¤Î¼èÆÀ |
---|
112 | $objPage = lfGetOrderJob($type, $sdate, $edate, $objPage); |
---|
113 | break; |
---|
114 | // ²ñ°÷Ê̽¸·× |
---|
115 | case 'member': |
---|
116 | if($type == "") { |
---|
117 | $type = 'all'; |
---|
118 | } |
---|
119 | $objPage->tpl_page_type = "total/page_member.tpl"; |
---|
120 | // ̤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦ |
---|
121 | lfRealTimeDailyTotal($sdate, $edate); |
---|
122 | // ¸¡º÷·ë²Ì¤Î¼èÆÀ |
---|
123 | $objPage = lfGetOrderMember($type, $sdate, $edate, $objPage); |
---|
124 | break; |
---|
125 | // ǯÂåÊ̽¸·× |
---|
126 | case 'age': |
---|
127 | if($type == "") { |
---|
128 | $type = 'all'; |
---|
129 | } |
---|
130 | $objPage->tpl_page_type = "total/page_age.tpl"; |
---|
131 | // ̤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦ |
---|
132 | lfRealTimeDailyTotal($sdate, $edate); |
---|
133 | // ¸¡º÷·ë²Ì¤Î¼èÆÀ |
---|
134 | $objPage = lfGetOrderAge($type, $sdate, $edate, $objPage); |
---|
135 | break; |
---|
136 | // ´ü´ÖÊ̽¸·× |
---|
137 | default: |
---|
138 | if($type == "") { |
---|
139 | $type = 'day'; |
---|
140 | } |
---|
141 | $objPage->tpl_page_type = "total/page_term.tpl"; |
---|
142 | // ̤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦ |
---|
143 | lfRealTimeDailyTotal($sdate, $edate); |
---|
144 | // ¸¡º÷·ë²Ì¤Î¼èÆÀ |
---|
145 | $objPage = lfGetOrderTerm($type, $sdate, $edate, $objPage); |
---|
146 | |
---|
147 | break; |
---|
148 | } |
---|
149 | |
---|
150 | if($_POST['mode'] == 'csv') { |
---|
151 | // CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤Î¼èÆÀ |
---|
152 | list($arrTitleCol, $arrDataCol) = lfGetCSVColum($page, $objPage->keyname); |
---|
153 | $head = sfGetCSVList($arrTitleCol); |
---|
154 | $data = lfGetDataColCSV($objPage->arrResults, $arrDataCol); |
---|
155 | // CSV¤òÁ÷¿®¤¹¤ë¡£ |
---|
156 | sfCSVDownload($head.$data, $page."_".$type); |
---|
157 | exit; |
---|
158 | } |
---|
159 | |
---|
160 | if($_POST['mode'] == 'pdf') { |
---|
161 | // CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤Î¼èÆÀ |
---|
162 | list($arrTitleCol, $arrDataCol, $arrColSize, $arrAlign, $title) = lfGetPDFColum($page, $type, $objPage->keyname); |
---|
163 | $head = sfGetPDFList($arrTitleCol); |
---|
164 | $data = lfGetDataColPDF($objPage->arrResults, $arrDataCol, 40); |
---|
165 | // PDF½ÐÎÏÍÑ |
---|
166 | $graph_name = basename($objPage->tpl_image); |
---|
167 | lfPDFDownload($graph_name, $head . $data, $arrColSize, $arrAlign, $sdate, $edate, $title); |
---|
168 | exit; |
---|
169 | } |
---|
170 | } |
---|
171 | break; |
---|
172 | default: |
---|
173 | if(count($_GET) == 0) { |
---|
174 | /* |
---|
175 | ¥ê¥¢¥ë¥¿¥¤¥à½¸·×¤ËÀÚ¤êÂؤ¨ by Nakagawa 2006/08/31 |
---|
176 | // 1¥ö·îʬ¤Î½¸·× |
---|
177 | lfStartDailyTotal(31,0); |
---|
178 | */ |
---|
179 | } |
---|
180 | break; |
---|
181 | } |
---|
182 | |
---|
183 | // ÅÐÏ¿¡¦¹¹¿·Æü¸¡º÷ÍÑ |
---|
184 | $objDate = new SC_Date(); |
---|
185 | $objDate->setStartYear(RELEASE_YEAR); |
---|
186 | $objDate->setEndYear(DATE("Y")); |
---|
187 | $objPage->arrYear = $objDate->getYear(); |
---|
188 | $objPage->arrMonth = $objDate->getMonth(); |
---|
189 | $objPage->arrDay = $objDate->getDay(); |
---|
190 | // ÆþÎÏÃͤμèÆÀ |
---|
191 | $objPage->arrForm = $objFormParam->getFormParamList(); |
---|
192 | |
---|
193 | $objPage->tpl_subtitle = $objPage->arrTitle[$objFormParam->getValue('page')]; |
---|
194 | |
---|
195 | |
---|
196 | $objView->assignobj($objPage); |
---|
197 | $objView->display(MAIN_FRAME); |
---|
198 | |
---|
199 | //--------------------------------------------------------------------------------------------------------------------------- |
---|
200 | /* PDF½ÐÎÏ */ |
---|
201 | function lfPDFDownload($image, $table, $arrColSize, $arrAlign, $sdate, $edate, $title) { |
---|
202 | |
---|
203 | $objPdf = new SC_Pdf(); |
---|
204 | $objPdf->setTableColor("CCCCCC", "F0F0F0", "D1DEFE"); |
---|
205 | |
---|
206 | // ÅÚÂæ¤È¤Ê¤ëPDF¥Õ¥¡¥¤¥ë¤Î»ØÄê |
---|
207 | $objPdf->setTemplate(PDF_DIR . "total.pdf"); |
---|
208 | |
---|
209 | $disp_sdate = sfDispDBDate($sdate, false); |
---|
210 | $disp_edate = sfDispDBDate($edate, false); |
---|
211 | |
---|
212 | $arrText['title_block'] = $title; |
---|
213 | $arrText['date_block'] = "$disp_sdate-$disp_edate"; |
---|
214 | $arrImage['graph_block'] = GRAPH_DIR . $image; |
---|
215 | |
---|
216 | // ʸËö¤Î\n¤òºï½ü¤¹¤ë |
---|
217 | $table = ereg_replace("\n$", "", $table); |
---|
218 | $arrRet = split("\n", $table); |
---|
219 | $page_max = intval((count($arrRet) / 35) + 1); |
---|
220 | |
---|
221 | for($page = 1; $page <= $page_max; $page++) { |
---|
222 | if($page > 1) { |
---|
223 | // 2¥Ú¡¼¥¸°Ê¹ß |
---|
224 | $start_no = 35 * ($page - 1) + 1; |
---|
225 | } else { |
---|
226 | // ³«»Ï¥Ú¡¼¥¸ |
---|
227 | $start_no = 1; |
---|
228 | } |
---|
229 | |
---|
230 | $arrText['page_block'] = $page . " / " . $page_max; |
---|
231 | $objPdf->setTextBlock($arrText); |
---|
232 | $objPdf->setImageBlock($arrImage); |
---|
233 | // ¥Ö¥í¥Ã¥¯ÃͤÎÆþÎÏ |
---|
234 | $objPdf->writeBlock(); |
---|
235 | // ºÇ½ª¥Ú¡¼¥¸¤Î¤ß¡¢¾¦ÉÊÊ̽¸·×¤Ï¹ç·×¤¬¤Ê¤¤¤Î¤ÇºÇ½ª¹Ô¤Î¿§¤òÊѹ¹¤·¤Ê¤¤¡£ |
---|
236 | if($page == $page_max && $_POST['page'] != 'products') { |
---|
237 | $last_color_flg = true; |
---|
238 | } else { |
---|
239 | $last_color_flg = false; |
---|
240 | } |
---|
241 | $objPdf->writeTableCenter($table, 500, $arrColSize, $arrAlign, 35, $start_no, $last_color_flg); |
---|
242 | $objPdf->closePage(); |
---|
243 | } |
---|
244 | |
---|
245 | // PDF¤Î½ÐÎÏ |
---|
246 | $objPdf->output(); |
---|
247 | } |
---|
248 | |
---|
249 | /* ¥»¥Ã¥·¥ç¥ó¤ËÆþÎÏ´ü´Ö¤òµÏ¿¤¹¤ë */ |
---|
250 | function lfSaveDateSession() { |
---|
251 | if($_POST['form'] == 1) { |
---|
252 | $_SESSION['total']['startyear_m'] = $_POST['search_startyear_m']; |
---|
253 | $_SESSION['total']['startmonth_m'] = $_POST['search_startmonth_m']; |
---|
254 | } |
---|
255 | |
---|
256 | if($_POST['form'] == 2) { |
---|
257 | $_SESSION['total']['startyear'] = $_POST['search_startyear']; |
---|
258 | $_SESSION['total']['startmonth'] = $_POST['search_startmonth']; |
---|
259 | $_SESSION['total']['startday'] = $_POST['search_startday']; |
---|
260 | $_SESSION['total']['endyear'] = $_POST['search_endyear']; |
---|
261 | $_SESSION['total']['endmonth'] = $_POST['search_endmonth']; |
---|
262 | $_SESSION['total']['endday'] = $_POST['search_endday']; |
---|
263 | } |
---|
264 | } |
---|
265 | |
---|
266 | /* ¥Ç¥Õ¥©¥ë¥ÈÃͤμèÆÀ */ |
---|
267 | function lfGetDateDefault() { |
---|
268 | $year = date("Y"); |
---|
269 | $month = date("m"); |
---|
270 | $day = date("d"); |
---|
271 | |
---|
272 | $list = $_SESSION['total']; |
---|
273 | |
---|
274 | // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤Ë³«»Ï·îÅÙ¤¬Êݸ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ |
---|
275 | if($_SESSION['total']['startyear_m'] == "") { |
---|
276 | $list['startyear_m'] = $year; |
---|
277 | $list['startmonth_m'] = $month; |
---|
278 | } |
---|
279 | |
---|
280 | // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤Ë³«»ÏÆüÉÕ¡¢½ªÎ»ÆüÉÕ¤¬Êݸ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ |
---|
281 | if($_SESSION['total']['startyear'] == "" && $_SESSION['total']['endyear'] == "") { |
---|
282 | // Åö·î¤ÎËöÆü¤òµá¤á¤ë |
---|
283 | $last_day = date("d", mktime(0, 0, 0, $month + 1, 0, $year)); |
---|
284 | |
---|
285 | // 1¥ö·îÁ°¤òµá¤á¤ë |
---|
286 | $day_sec = 3600 * 24; |
---|
287 | list($syear, $smonth, $sday) = split("/", date("Y/m/d", (mktime(0, 0, 0, $month, $day, $year) - ($day_sec * $last_day)))); |
---|
288 | $list['startyear'] = $syear; |
---|
289 | $list['startmonth'] = $smonth; |
---|
290 | $list['startday'] = $sday; |
---|
291 | |
---|
292 | // ½ªÎ»Æü¤Ï¸½ºß¤ÎÆüÉÕ¤Î1ÆüÁ°¡Ê¥Ð¥Ã¥Á½¸·×¤¬Á°Æü¤Þ¤Ç¤Î¤¿¤á¡Ë |
---|
293 | $list['endmonth'] = $month; |
---|
294 | $list['endyear'] = $year; |
---|
295 | $list['endday'] = date("d", (mktime(0, 0, 0, $month, $day, $year) - $day_sec)); |
---|
296 | } |
---|
297 | |
---|
298 | return $list; |
---|
299 | } |
---|
300 | |
---|
301 | /* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */ |
---|
302 | function lfInitParam() { |
---|
303 | global $objFormParam; |
---|
304 | |
---|
305 | // ¥Ç¥Õ¥©¥ë¥ÈÃͤμèÆÀ |
---|
306 | $arrList = lfGetDateDefault(); |
---|
307 | |
---|
308 | // ·îÅÙ½¸·× |
---|
309 | $objFormParam->addParam("·îÅÙ", "search_startyear_m", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startyear_m']); |
---|
310 | $objFormParam->addParam("·îÅÙ", "search_startmonth_m", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startmonth_m']); |
---|
311 | // ´ü´Ö½¸·× |
---|
312 | $objFormParam->addParam("³«»ÏÆü", "search_startyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startyear']); |
---|
313 | $objFormParam->addParam("³«»ÏÆü", "search_startmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startmonth']); |
---|
314 | $objFormParam->addParam("³«»ÏÆü", "search_startday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startday']); |
---|
315 | $objFormParam->addParam("½ªÎ»Æü", "search_endyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endyear']); |
---|
316 | $objFormParam->addParam("½ªÎ»Æü", "search_endmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endmonth']); |
---|
317 | $objFormParam->addParam("½ªÎ»Æü", "search_endday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endday']); |
---|
318 | |
---|
319 | // hidden¥Ç¡¼¥¿¤Î¼èÆÀÍÑ |
---|
320 | $objFormParam->addParam("", "page"); |
---|
321 | $objFormParam->addParam("", "type"); |
---|
322 | } |
---|
323 | |
---|
324 | /* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */ |
---|
325 | function lfCheckError() { |
---|
326 | global $objFormParam; |
---|
327 | // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ |
---|
328 | $arrRet = $objFormParam->getHashArray(); |
---|
329 | $objErr = new SC_CheckError($arrRet); |
---|
330 | $objErr->arrErr = $objFormParam->checkError(); |
---|
331 | |
---|
332 | // Æüì¹àÌÜ¥Á¥§¥Ã¥¯ |
---|
333 | if($_POST['form'] == 1) { |
---|
334 | $objErr->doFunc(array("·îÅÙ", "search_startyear_m"), array("ONE_EXIST_CHECK")); |
---|
335 | } |
---|
336 | |
---|
337 | if($_POST['form'] == 2) { |
---|
338 | $objErr->doFunc(array("´ü´Ö", "search_startyear", "search_endyear"), array("ONE_EXIST_CHECK")); |
---|
339 | } |
---|
340 | |
---|
341 | $objErr->doFunc(array("·îÅÙ", "search_startyear_m", "search_startmonth_m"), array("ALL_EXIST_CHECK")); |
---|
342 | $objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE")); |
---|
343 | $objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE")); |
---|
344 | $objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM")); |
---|
345 | return $objErr->arrErr; |
---|
346 | } |
---|
347 | |
---|
348 | /* ÀÞ¤ìÀþ¥°¥é¥Õ¤ÎºîÀ® */ |
---|
349 | function lfGetGraphLine($arrResults, $keyname, $type, $xtitle, $ytitle, $sdate, $edate) { |
---|
350 | |
---|
351 | $ret_path = ""; |
---|
352 | |
---|
353 | // ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£ |
---|
354 | if(count($arrResults) > 0) { |
---|
355 | |
---|
356 | // ¥°¥é¥Õ¤ÎÀ¸À® |
---|
357 | $arrList = sfArrKeyValue($arrResults, $keyname, "total"); |
---|
358 | |
---|
359 | // °ì»þ¥Õ¥¡¥¤¥ë̾¤Î¼èÆÀ |
---|
360 | $pngname = lfGetGraphPng($type); |
---|
361 | |
---|
362 | $path = GRAPH_DIR . $pngname; |
---|
363 | |
---|
364 | // ¥é¥Ù¥ëɽ¼¨¥¤¥ó¥¿¡¼¥Ð¥ë¤òµá¤á¤ë |
---|
365 | $interval = intval(count($arrList) / 20); |
---|
366 | if($interval < 1) { |
---|
367 | $interval = 1; |
---|
368 | } |
---|
369 | $objGraphPie = new SC_GraphPie(); |
---|
370 | $objGraphLine = new SC_GraphLine(); |
---|
371 | |
---|
372 | // ÃͤΥ»¥Ã¥È |
---|
373 | $objGraphLine->setData($arrList); |
---|
374 | $objGraphLine->setXLabel(array_keys($arrList)); |
---|
375 | |
---|
376 | // ¥é¥Ù¥ë²óž(ÆüËܸìÉÔ²Ä) |
---|
377 | if($keyname == "key_day"){ |
---|
378 | $objGraphLine->setXLabelAngle(-45); |
---|
379 | } |
---|
380 | |
---|
381 | // ¥¿¥¤¥È¥ë¥»¥Ã¥È |
---|
382 | $objGraphLine->setXTitle($xtitle); |
---|
383 | $objGraphLine->setYTitle($ytitle); |
---|
384 | |
---|
385 | // ¥á¥¤¥ó¥¿¥¤¥È¥ëºîÀ® |
---|
386 | list($sy, $sm, $sd) = split("[/ ]" , $sdate); |
---|
387 | list($ey, $em, $ed) = split("[/ ]" , $edate); |
---|
388 | $start_date = $sy . "ǯ" . $sm . "·î" . $sd . "Æü"; |
---|
389 | $end_date = $ey . "ǯ" . $em . "·î" . $ed . "Æü"; |
---|
390 | $objGraphLine->drawTitle("½¸·×´ü´Ö¡§" . $start_date . " - " . $end_date); |
---|
391 | |
---|
392 | // ¥°¥é¥ÕÉÁ²è |
---|
393 | $objGraphLine->drawGraph(); |
---|
394 | $objGraphLine->outputGraph(false, $path); |
---|
395 | |
---|
396 | // ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹ |
---|
397 | $ret_path = GRAPH_URL . $pngname; |
---|
398 | } |
---|
399 | return $ret_path; |
---|
400 | } |
---|
401 | |
---|
402 | // ±ß¥°¥é¥Õ¤ÎºîÀ® |
---|
403 | function lfGetGraphPie($arrResults, $keyname, $type, $title = "", $sdate = "", $edate = "") { |
---|
404 | |
---|
405 | $ret_path = ""; |
---|
406 | |
---|
407 | // ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£ |
---|
408 | if(count($arrResults) > 0) { |
---|
409 | // ¥°¥é¥Õ¤ÎÀ¸À® |
---|
410 | $arrList = sfArrKeyValue($arrResults, $keyname, "total", GRAPH_PIE_MAX, GRAPH_LABEL_MAX); |
---|
411 | |
---|
412 | // °ì»þ¥Õ¥¡¥¤¥ë̾¤Î¼èÆÀ |
---|
413 | $pngname = lfGetGraphPng($type); |
---|
414 | $path = GRAPH_DIR . $pngname; |
---|
415 | |
---|
416 | // ¥°¥é¥Õ²èÁü¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤À¤±ºîÀ®¤¹¤ë |
---|
417 | if(!file_exists($path)) { |
---|
418 | $objGraphPie = new SC_GraphPie(); |
---|
419 | |
---|
420 | /* ¥Ç¥Ð¥Ã¥°É½¼¨ÍÑ by naka |
---|
421 | foreach($arrList as $key => $val) { |
---|
422 | $objGraphPie->debugPrint("key:$key val:$val"); |
---|
423 | } |
---|
424 | */ |
---|
425 | |
---|
426 | // ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë |
---|
427 | $objGraphPie->setData($arrList); |
---|
428 | // ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë |
---|
429 | $objGraphPie->setLegend(array_keys($arrList)); |
---|
430 | |
---|
431 | print($sdate); |
---|
432 | |
---|
433 | // ¥á¥¤¥ó¥¿¥¤¥È¥ëºîÀ® |
---|
434 | list($sy, $sm, $sd) = split("[/ ]" , $sdate); |
---|
435 | list($ey, $em, $ed) = split("[/ ]" , $edate); |
---|
436 | $start_date = $sy . "ǯ" . $sm . "·î" . $sd . "Æü"; |
---|
437 | $end_date = $ey . "ǯ" . $em . "·î" . $ed . "Æü"; |
---|
438 | $objGraphPie->drawTitle("½¸·×´ü´Ö¡§" . $start_date . " - " . $end_date); |
---|
439 | |
---|
440 | // ±ß¥°¥é¥ÕÉÁ²è |
---|
441 | $objGraphPie->drawGraph(); |
---|
442 | |
---|
443 | // ¥°¥é¥Õ¤Î½ÐÎÏ |
---|
444 | $objGraphPie->outputGraph(false, $path); |
---|
445 | } |
---|
446 | // ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹ |
---|
447 | $ret_path = GRAPH_URL . $pngname; |
---|
448 | } |
---|
449 | return $ret_path; |
---|
450 | } |
---|
451 | |
---|
452 | // ËÀ¥°¥é¥Õ¤ÎºîÀ® |
---|
453 | function lfGetGraphBar($arrResults, $keyname, $type, $xtitle, $ytitle, $sdate, $edate) { |
---|
454 | $ret_path = ""; |
---|
455 | |
---|
456 | // ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£ |
---|
457 | if(count($arrResults) > 0) { |
---|
458 | // ¥°¥é¥Õ¤ÎÀ¸À® |
---|
459 | $arrList = sfArrKeyValue($arrResults, $keyname, "total", GRAPH_PIE_MAX, GRAPH_LABEL_MAX); |
---|
460 | |
---|
461 | // °ì»þ¥Õ¥¡¥¤¥ë̾¤Î¼èÆÀ |
---|
462 | $pngname = lfGetGraphPng($type); |
---|
463 | $path = GRAPH_DIR . $pngname; |
---|
464 | |
---|
465 | // ¥°¥é¥Õ²èÁü¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤À¤±ºîÀ®¤¹¤ë |
---|
466 | if(!file_exists($path)) { |
---|
467 | $objGraphBar = new SC_GraphBar(); |
---|
468 | |
---|
469 | foreach(array_keys($arrList) as $val) { |
---|
470 | $arrKey[] = ereg_replace("¡Á", "-", $val); |
---|
471 | } |
---|
472 | |
---|
473 | // ¥°¥é¥ÕÉÁ²è |
---|
474 | $objGraphBar->setXLabel($arrKey); |
---|
475 | $objGraphBar->setXTitle($xtitle); |
---|
476 | $objGraphBar->setYTitle($ytitle); |
---|
477 | $objGraphBar->setData($arrList); |
---|
478 | |
---|
479 | // ¥á¥¤¥ó¥¿¥¤¥È¥ëºîÀ® |
---|
480 | $arrKey = array_keys($arrList); |
---|
481 | list($sy, $sm, $sd) = split("[/ ]" , $sdate); |
---|
482 | list($ey, $em, $ed) = split("[/ ]" , $edate); |
---|
483 | $start_date = $sy . "ǯ" . $sm . "·î" . $sd . "Æü"; |
---|
484 | $end_date = $ey . "ǯ" . $em . "·î" . $ed . "Æü"; |
---|
485 | $objGraphBar->drawTitle("½¸·×´ü´Ö¡§" . $start_date . " - " . $end_date); |
---|
486 | |
---|
487 | $objGraphBar->drawGraph(); |
---|
488 | $objGraphBar->outputGraph(false,$path); |
---|
489 | } |
---|
490 | |
---|
491 | // ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹ |
---|
492 | $ret_path = GRAPH_URL . $pngname; |
---|
493 | } |
---|
494 | return $ret_path; |
---|
495 | } |
---|
496 | |
---|
497 | // ¥°¥é¥ÕÍѤÎPNG¥Õ¥¡¥¤¥ë̾ |
---|
498 | function lfGetGraphPng($keyname) { |
---|
499 | if($_POST['search_startyear_m'] != "") { |
---|
500 | $pngname = sprintf("%s_%02d%02d.png", $keyname, substr($_POST['search_startyear_m'],2), $_POST['search_startmonth_m']); |
---|
501 | } else { |
---|
502 | $pngname = sprintf("%s_%02d%02d%02d_%02d%02d%02d.png", $keyname, substr($_POST['search_startyear'], 2), $_POST['search_startmonth'], $_POST['search_startday'], substr($_POST['search_endyear'],2), $_POST['search_endmonth'], $_POST['search_endday']); |
---|
503 | } |
---|
504 | return $pngname; |
---|
505 | } |
---|
506 | |
---|
507 | // ²ñ°÷¡¢Èó²ñ°÷½¸·×¤ÎWHEREʬ¤ÎºîÀ® |
---|
508 | function lfGetWhereMember($col_date, $sdate, $edate, $type, $col_member = "customer_id") { |
---|
509 | // ¼èÆÀÆüÉդλØÄê |
---|
510 | if($sdate != "") { |
---|
511 | if ($where != "") { |
---|
512 | $where.= " AND "; |
---|
513 | } |
---|
514 | $where.= " $col_date >= '". $sdate ."'"; |
---|
515 | } |
---|
516 | |
---|
517 | if($edate != "") { |
---|
518 | if ($where != "") { |
---|
519 | $where.= " AND "; |
---|
520 | } |
---|
521 | $where.= " $col_date < date('" . $edate ."')+1"; |
---|
522 | } |
---|
523 | |
---|
524 | // ²ñ°÷¡¢Èó²ñ°÷¤ÎȽÄê |
---|
525 | switch($type) { |
---|
526 | // Á´ÂÎ |
---|
527 | case 'all': |
---|
528 | break; |
---|
529 | case 'member': |
---|
530 | if ($where != "") { |
---|
531 | $where.= " AND "; |
---|
532 | } |
---|
533 | $where.= " $col_member <> 0"; |
---|
534 | break; |
---|
535 | case 'nonmember': |
---|
536 | if ($where != "") { |
---|
537 | $where.= " AND "; |
---|
538 | } |
---|
539 | $where.= " $col_member = 0"; |
---|
540 | break; |
---|
541 | default: |
---|
542 | break; |
---|
543 | } |
---|
544 | |
---|
545 | return array($where, $arrval); |
---|
546 | } |
---|
547 | |
---|
548 | /** ²ñ°÷Ê̽¸·× **/ |
---|
549 | function lfGetOrderMember($type, $sdate, $edate, $objPage, $graph = true) { |
---|
550 | global $arrSex; |
---|
551 | |
---|
552 | list($where, $arrval) = lfGetWhereMember('create_date', $sdate, $edate, $type); |
---|
553 | |
---|
554 | // ²ñ°÷½¸·×¤Î¼èÆÀ |
---|
555 | $col = "COUNT(*) AS order_count, SUM(total) AS total, int8(AVG(total)) AS total_average, order_sex"; |
---|
556 | $from = "dtb_order"; |
---|
557 | $objQuery = new SC_Query(); |
---|
558 | $objQuery->setGroupBy("order_sex"); |
---|
559 | |
---|
560 | $tmp_where = $where . " AND customer_id <> 0 AND delete = 0 "; |
---|
561 | $arrRet = $objQuery->select($col, $from, $tmp_where, $arrval); |
---|
562 | |
---|
563 | // ²ñ°÷¹ØÆþ¤Ç¤¢¤ë¤³¤È¤òµÏ¿¤¹¤ë¡£ |
---|
564 | $max = count($arrRet); |
---|
565 | for($i = 0; $i < $max; $i++) { |
---|
566 | $arrRet[$i]['member_name'] = '²ñ°÷'.$arrSex[$arrRet[$i]['order_sex']]; |
---|
567 | } |
---|
568 | $objPage->arrResults = $arrRet; |
---|
569 | |
---|
570 | // Èó²ñ°÷½¸·×¤Î¼èÆÀ |
---|
571 | $tmp_where = $where . " AND customer_id = 0 AND delete = 0 "; |
---|
572 | $arrRet = $objQuery->select($col, $from, $tmp_where, $arrval); |
---|
573 | // Èó²ñ°÷¹ØÆþ¤Ç¤¢¤ë¤³¤È¤òµÏ¿¤¹¤ë¡£ |
---|
574 | $max = count($arrRet); |
---|
575 | for($i = 0; $i < $max; $i++) { |
---|
576 | $arrRet[$i]['member_name'] = 'Èó²ñ°÷'.$arrSex[$arrRet[$i]['order_sex']]; |
---|
577 | } |
---|
578 | |
---|
579 | $objPage->arrResults = array_merge($objPage->arrResults, $arrRet); |
---|
580 | |
---|
581 | // ±ß¥°¥é¥Õ¤ÎÀ¸À® |
---|
582 | if($graph) { |
---|
583 | $image_key = "member"; |
---|
584 | $objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "member_name", $image_key, "(Çä¾åÈæΨ)", $sdate, $edate); |
---|
585 | } |
---|
586 | |
---|
587 | return $objPage; |
---|
588 | } |
---|
589 | |
---|
590 | /** ¾¦ÉÊÊ̽¸·× **/ |
---|
591 | function lfGetOrderProducts($type, $sdate, $edate, $objPage, $graph = true) { |
---|
592 | list($where, $arrval) = lfGetWhereMember('create_date', $sdate, $edate, $type); |
---|
593 | |
---|
594 | $sql = "SELECT product_id, T1.product_code, T2.name, T1.products_count, T1.order_count, T1.price, T1.total "; |
---|
595 | $sql.= "FROM ( "; |
---|
596 | $sql.= "SELECT product_id, product_code, price, "; |
---|
597 | $sql.= "COUNT(*) AS order_count, "; |
---|
598 | $sql.= "SUM(quantity) AS products_count, "; |
---|
599 | $sql.= "(price * sum(quantity)) AS total "; |
---|
600 | $sql.= "FROM dtb_order_detail WHERE order_id IN (SELECT order_id FROM dtb_order WHERE $where ) "; |
---|
601 | $sql.= "GROUP BY product_id, product_code, price "; |
---|
602 | $sql.= ") "; |
---|
603 | $sql.= "AS T1 LEFT JOIN dtb_products AS T2 USING (product_id) WHERE T2.name IS NOT NULL AND status = 1 ORDER BY T1.total DESC "; |
---|
604 | |
---|
605 | if($_POST['mode'] != "csv") { |
---|
606 | $sql.= "LIMIT " . PRODUCTS_TOTAL_MAX; |
---|
607 | } |
---|
608 | |
---|
609 | $objQuery = new SC_Query(); |
---|
610 | $objPage->arrResults = $objQuery->getall($sql, $arrval); |
---|
611 | |
---|
612 | // ±ß¥°¥é¥Õ¤ÎÀ¸À® |
---|
613 | if($graph) { |
---|
614 | $image_key = "products_" . $type; |
---|
615 | $objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "name", $image_key, "(Çä¾åÈæΨ)", $sdate, $edate); |
---|
616 | } |
---|
617 | |
---|
618 | return $objPage; |
---|
619 | } |
---|
620 | |
---|
621 | /** ¿¦¶ÈÊ̽¸·× **/ |
---|
622 | function lfGetOrderJob($type, $sdate, $edate, $objPage, $graph = true) { |
---|
623 | global $arrJob; |
---|
624 | |
---|
625 | list($where, $arrval) = lfGetWhereMember('T2.create_date', $sdate, $edate, $type); |
---|
626 | |
---|
627 | $sql = "SELECT job, count(*) AS order_count, SUM(total) AS total, int8(AVG(total)) AS total_average "; |
---|
628 | $sql.= "FROM dtb_customer AS T1 LEFT JOIN dtb_order AS T2 USING ( customer_id ) WHERE $where AND T2.delete = 0"; |
---|
629 | $sql.= "GROUP BY job ORDER BY total DESC"; |
---|
630 | |
---|
631 | $objQuery = new SC_Query(); |
---|
632 | $objPage->arrResults = $objQuery->getall($sql, $arrval); |
---|
633 | |
---|
634 | $max = count($objPage->arrResults); |
---|
635 | for($i = 0; $i < $max; $i++) { |
---|
636 | $job_key = $objPage->arrResults[$i]['job']; |
---|
637 | if($job_key != "") { |
---|
638 | $objPage->arrResults[$i]['job_name'] = $arrJob[$job_key]; |
---|
639 | } else { |
---|
640 | $objPage->arrResults[$i]['job_name'] = "̤²óÅú"; |
---|
641 | } |
---|
642 | } |
---|
643 | |
---|
644 | // ±ß¥°¥é¥Õ¤ÎÀ¸À® |
---|
645 | if($graph) { |
---|
646 | $image_key = "job_" . $type; |
---|
647 | $objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "job_name", $image_key, "(Çä¾åÈæΨ)", $sdate, $edate); |
---|
648 | } |
---|
649 | |
---|
650 | return $objPage; |
---|
651 | } |
---|
652 | |
---|
653 | /** ǯÂåÊ̽¸·× **/ |
---|
654 | function lfGetOrderAge($type, $sdate, $edate, $objPage, $graph = true) { |
---|
655 | |
---|
656 | list($where, $arrval) = lfGetWhereMember('order_date', $sdate, $edate, $type, "member"); |
---|
657 | |
---|
658 | $sql = "SELECT SUM(order_count) AS order_count, SUM(total) AS total, start_age, end_age "; |
---|
659 | $sql.= "FROM dtb_bat_order_daily_age WHERE $where "; |
---|
660 | $sql.= "GROUP BY start_age, end_age ORDER BY start_age, end_age"; |
---|
661 | |
---|
662 | $objQuery = new SC_Query(); |
---|
663 | $objPage->arrResults = $objQuery->getall($sql, $arrval); |
---|
664 | |
---|
665 | $max = count($objPage->arrResults); |
---|
666 | for($i = 0; $i < $max; $i++) { |
---|
667 | if($objPage->arrResults[$i]['order_count'] > 0) { |
---|
668 | $objPage->arrResults[$i]['total_average'] = intval($objPage->arrResults[$i]['total'] / $objPage->arrResults[$i]['order_count']); |
---|
669 | } |
---|
670 | $start_age = $objPage->arrResults[$i]['start_age']; |
---|
671 | $end_age = $objPage->arrResults[$i]['end_age']; |
---|
672 | if($start_age != "" || $end_age != "") { |
---|
673 | if($end_age != 999) { |
---|
674 | $objPage->arrResults[$i]['age_name'] = $start_age . "¡Á" . $end_age . "ºÐ"; |
---|
675 | } else { |
---|
676 | $objPage->arrResults[$i]['age_name'] = $start_age . "ºÐ¡Á"; |
---|
677 | } |
---|
678 | } else { |
---|
679 | $objPage->arrResults[$i]['age_name'] = "̤²óÅú"; |
---|
680 | } |
---|
681 | } |
---|
682 | |
---|
683 | // ËÀ¥°¥é¥Õ¤ÎÀ¸À® |
---|
684 | if($graph) { |
---|
685 | $image_key = "age_" . $type; |
---|
686 | $xtitle = "(ǯÎð)"; |
---|
687 | $ytitle = "(Çä¾å¹ç·×)"; |
---|
688 | $objPage->tpl_image = lfGetGraphBar($objPage->arrResults, "age_name", $image_key, $xtitle, $ytitle, $sdate, $edate); |
---|
689 | } |
---|
690 | |
---|
691 | return $objPage; |
---|
692 | } |
---|
693 | |
---|
694 | /** ´ü´ÖÊ̽¸·× **/ |
---|
695 | function lfGetOrderTerm($type, $sdate, $edate, $objPage, $graph = true) { |
---|
696 | |
---|
697 | $tmp_col = "sum(total_order) as total_order, sum(men) as men, sum(women) as women,"; |
---|
698 | $tmp_col.= "sum(men_member) as men_member, sum(men_nonmember) as men_nonmember,"; |
---|
699 | $tmp_col.= "sum(women_member) as women_member, sum(women_nonmember) as women_nonmember,"; |
---|
700 | $tmp_col.= "sum(total) as total, int8(avg(total_average)) as total_average"; |
---|
701 | $objQuery = new SC_Query(); |
---|
702 | |
---|
703 | switch($type) { |
---|
704 | // ·îÊÌ |
---|
705 | case 'month': |
---|
706 | $col = $tmp_col . ",key_month"; |
---|
707 | $objQuery->setgroupby("key_month"); |
---|
708 | $objQuery->setOrder("key_month"); |
---|
709 | $objPage->keyname = "key_month"; |
---|
710 | $objPage->tpl_tail = "·î"; |
---|
711 | $from = "dtb_bat_order_daily"; |
---|
712 | $xtitle = "(·îÊÌ)"; |
---|
713 | $ytitle = "(Çä¾å¹ç·×)"; |
---|
714 | break; |
---|
715 | // ǯÊÌ |
---|
716 | case 'year': |
---|
717 | $col = $tmp_col . ",key_year"; |
---|
718 | $objQuery->setgroupby("key_year"); |
---|
719 | $objQuery->setOrder("key_year"); |
---|
720 | $objPage->keyname = "key_year"; |
---|
721 | $objPage->tpl_tail = "ǯ"; |
---|
722 | $from = "dtb_bat_order_daily"; |
---|
723 | $xtitle = "(ǯÊÌ)"; |
---|
724 | $ytitle = "(Çä¾å¹ç·×)"; |
---|
725 | break; |
---|
726 | // ÍËÆüÊÌ |
---|
727 | case 'wday': |
---|
728 | $col = $tmp_col . ",key_wday, wday"; |
---|
729 | $objQuery->setgroupby("key_wday, wday"); |
---|
730 | $objQuery->setOrder("wday"); |
---|
731 | $objPage->keyname = "key_wday"; |
---|
732 | $objPage->tpl_tail = "ÍËÆü"; |
---|
733 | $from = "dtb_bat_order_daily"; |
---|
734 | $xtitle = "(ÍËÆüÊÌ)"; |
---|
735 | $ytitle = "(Çä¾å¹ç·×)"; |
---|
736 | break; |
---|
737 | // »þ´ÖÊÌ |
---|
738 | case 'hour': |
---|
739 | $col = $tmp_col . ",hour"; |
---|
740 | $objQuery->setgroupby("hour"); |
---|
741 | $objQuery->setOrder("hour"); |
---|
742 | $objPage->keyname = "hour"; |
---|
743 | $objPage->tpl_tail = "»þ"; |
---|
744 | $from = "dtb_bat_order_daily_hour"; |
---|
745 | $xtitle = "(»þ´ÖÊÌ)"; |
---|
746 | $ytitle = "(Çä¾å¹ç·×)"; |
---|
747 | break; |
---|
748 | default: |
---|
749 | $col = "*"; |
---|
750 | $objQuery->setOrder("key_day"); |
---|
751 | $objPage->keyname = "key_day"; |
---|
752 | $from = "dtb_bat_order_daily"; |
---|
753 | $xtitle = "(ÆüÊÌ)"; |
---|
754 | $ytitle = "(Çä¾å¹ç·×)"; |
---|
755 | break; |
---|
756 | } |
---|
757 | |
---|
758 | |
---|
759 | // ¼èÆÀÆüÉդλØÄê |
---|
760 | if($sdate != "") { |
---|
761 | if ($where != "") { |
---|
762 | $where.= " AND "; |
---|
763 | } |
---|
764 | $where.= " order_date >= '". $sdate ."'"; |
---|
765 | } |
---|
766 | |
---|
767 | if($edate != "") { |
---|
768 | if ($where != "") { |
---|
769 | $where.= " AND "; |
---|
770 | } |
---|
771 | $where.= " order_date < date('" . $edate ."')+1"; |
---|
772 | } |
---|
773 | |
---|
774 | // ¸¡º÷·ë²Ì¤Î¼èÆÀ |
---|
775 | $objPage->arrResults = $objQuery->select($col, $from, $where, $arrval); |
---|
776 | |
---|
777 | // ÀÞ¤ìÀþ¥°¥é¥Õ¤ÎÀ¸À® |
---|
778 | if($graph) { |
---|
779 | $image_key = "term_" . $type; |
---|
780 | $objPage->tpl_image = lfGetGraphLine($objPage->arrResults, $objPage->keyname, $image_key, $xtitle, $ytitle, $sdate, $edate); |
---|
781 | } |
---|
782 | |
---|
783 | // ¸¡º÷·ë²Ì¤¬0¤Ç¤Ê¤¤¾ì¹ç |
---|
784 | if(count($objPage->arrResults) > 0) { |
---|
785 | // ºÇ½ª½¸·×¹Ô¼èÆÀ¤¹¤ë |
---|
786 | $col = $tmp_col; |
---|
787 | $objQuery = new SC_Query(); |
---|
788 | $arrRet = $objQuery->select($col, $from, $where, $arrval); |
---|
789 | $arrRet[0][$objPage->keyname] = "¹ç·×"; |
---|
790 | $objPage->arrResults[] = $arrRet[0]; |
---|
791 | } |
---|
792 | |
---|
793 | // Ê¿¶ÑÃͤη׻» |
---|
794 | $max = count($objPage->arrResults); |
---|
795 | for($i = 0; $i < $max; $i++) { |
---|
796 | if($objPage->arrResults[$i]['total_order'] > 0) { |
---|
797 | $objPage->arrResults[$i]['total_average'] = intval($objPage->arrResults[$i]['total'] / $objPage->arrResults[$i]['total_order']); |
---|
798 | } |
---|
799 | } |
---|
800 | |
---|
801 | return $objPage; |
---|
802 | } |
---|
803 | |
---|
804 | ?> |
---|