@@ 322-351 (lines=30) @@ | ||
319 | return $orderArray; |
|
320 | } |
|
321 | ||
322 | protected function getSalesByMonth($em, $dateTime, array $excludes) |
|
323 | { |
|
324 | // concat... for pgsql |
|
325 | // http://stackoverflow.com/questions/1091924/substr-does-not-work-with-datatype-timestamp-in-postgres-8-3 |
|
326 | $dql = 'SELECT |
|
327 | SUBSTRING(CONCAT(o.order_date, \'\'), 1, 7) AS order_month, |
|
328 | SUM(o.payment_total) AS order_amount, |
|
329 | COUNT(o) AS order_count |
|
330 | FROM |
|
331 | Eccube\Entity\Order o |
|
332 | WHERE |
|
333 | o.del_flg = 0 |
|
334 | AND o.OrderStatus NOT IN (:excludes) |
|
335 | AND SUBSTRING(CONCAT(o.order_date, \'\'), 1, 7) = SUBSTRING(:targetDate, 1, 7) |
|
336 | GROUP BY |
|
337 | order_month'; |
|
338 | ||
339 | $q = $em |
|
340 | ->createQuery($dql) |
|
341 | ->setParameter(':excludes', $excludes) |
|
342 | ->setParameter(':targetDate', $dateTime); |
|
343 | ||
344 | $result = array(); |
|
345 | try { |
|
346 | $result = $q->getSingleResult(); |
|
347 | } catch (NoResultException $e) { |
|
348 | // 結果がない場合は空の配列を返す. |
|
349 | } |
|
350 | return $result; |
|
351 | } |
|
352 | ||
353 | protected function getSalesByDay($em, $dateTime, array $excludes) |
|
354 | { |
|
@@ 353-382 (lines=30) @@ | ||
350 | return $result; |
|
351 | } |
|
352 | ||
353 | protected function getSalesByDay($em, $dateTime, array $excludes) |
|
354 | { |
|
355 | // concat... for pgsql |
|
356 | // http://stackoverflow.com/questions/1091924/substr-does-not-work-with-datatype-timestamp-in-postgres-8-3 |
|
357 | $dql = 'SELECT |
|
358 | SUBSTRING(CONCAT(o.order_date, \'\'), 1, 10) AS order_day, |
|
359 | SUM(o.payment_total) AS order_amount, |
|
360 | COUNT(o) AS order_count |
|
361 | FROM |
|
362 | Eccube\Entity\Order o |
|
363 | WHERE |
|
364 | o.del_flg = 0 |
|
365 | AND o.OrderStatus NOT IN (:excludes) |
|
366 | AND SUBSTRING(CONCAT(o.order_date, \'\'), 1, 10) = SUBSTRING(:targetDate, 1, 10) |
|
367 | GROUP BY |
|
368 | order_day'; |
|
369 | ||
370 | $q = $em |
|
371 | ->createQuery($dql) |
|
372 | ->setParameter(':excludes', $excludes) |
|
373 | ->setParameter(':targetDate', $dateTime); |
|
374 | ||
375 | $result = array(); |
|
376 | try { |
|
377 | $result = $q->getSingleResult(); |
|
378 | } catch (NoResultException $e) { |
|
379 | // 結果がない場合は空の配列を返す. |
|
380 | } |
|
381 | return $result; |
|
382 | } |
|
383 | ||
384 | protected function countNonStockProducts($em) |
|
385 | { |