Beispiel #1
0
    /**
     * Generate a daily summary for the overview page
     * @return array
     */
    protected function getDailySummary()
    {
        $strBuffer = '
<div class="tl_formbody_edit be_iso_overview">
<fieldset class="tl_tbox">
<legend style="cursor: default;">' . $GLOBALS['TL_LANG']['ISO_REPORT']['24h_summary'] . '</legend>';
        $arrAllowedProducts = \Isotope\Backend\Product\Permission::getAllowedIds();
        $objOrders = \Database::getInstance()->prepare("\n            SELECT\n                c.id AS config_id,\n                c.name AS config_name,\n                c.currency,\n                COUNT(DISTINCT o.id) AS total_orders,\n                SUM(i.tax_free_price * i.quantity) AS total_sales,\n                SUM(i.quantity) AS total_items\n            FROM tl_iso_product_collection o\n            LEFT JOIN tl_iso_product_collection_item i ON o.id=i.pid\n            LEFT OUTER JOIN tl_iso_config c ON o.config_id=c.id\n            WHERE o.type='order' AND o.order_status>0 AND o.locked>=?\n                " . Report::getProductProcedure('i', 'product_id') . "\n                " . Report::getConfigProcedure('o', 'config_id') . "\n            GROUP BY config_id\n        ")->execute(strtotime('-24 hours'));
        if (!$objOrders->numRows) {
            $strBuffer .= '
<p class="tl_info" style="margin-top:10px">' . $GLOBALS['TL_LANG']['ISO_REPORT']['24h_empty'] . '</p>';
        } else {
            $i = -1;
            $strBuffer .= '
<br>
<table class="tl_listing">
<tr>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['shop_config'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['currency'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['orders#'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['products#'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['sales#'] . '</th>
</tr>';
            while ($objOrders->next()) {
                $strBuffer .= '
<tr class="row_' . ++$i . ($i % 2 ? 'odd' : 'even') . '">
    <td class="tl_file_list">' . $objOrders->config_name . '</td>
    <td class="tl_file_list">' . $objOrders->currency . '</td>
    <td class="tl_file_list">' . $objOrders->total_orders . '</td>
    <td class="tl_file_list">' . $objOrders->total_items . '</td>
    <td class="tl_file_list">' . Isotope::formatPrice($objOrders->total_sales) . '</td>
</tr>';
            }
            $strBuffer .= '
</table>';
        }
        $strBuffer .= '
</fieldset>
</div>';
        return $strBuffer;
    }