public function getData()
    {
        $this->_query = 'SELECT SQL_CALC_FOUND_ROWS ocr.code, COUNT(ocr.id_cart_rule) as total, SUM(o.total_paid_real) / o.conversion_rate as ca
				FROM ' . _DB_PREFIX_ . 'order_cart_rule ocr
				LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON o.id_order = ocr.id_order
				WHERE o.valid = 1
					' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
					AND o.invoice_date BETWEEN ' . $this->getDate() . '
				GROUP BY ocr.id_cart_rule';
        if (Validate::IsName($this->_sort)) {
            $this->_query .= ' ORDER BY `' . $this->_sort . '`';
            if (isset($this->_direction) && (strtoupper($this->_direction) == 'ASC' ||  strtoupper($this->_direction) == 'DESC')) {
                $this->_query .= ' ' . pSQL($this->_direction);
            }
        }
        if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) {
            $this->_query .= ' LIMIT ' . $this->_start . ', ' . $this->_limit;
        }
        $this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query);
        $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
    }
    public function getData()
    {
        $this->_query = '
		SELECT SQL_CALC_FOUND_ROWS od.name, COUNT(od.id_discount) as total, SUM(o.total_paid_real) / o.conversion_rate as ca
		FROM ' . _DB_PREFIX_ . 'order_discount od
		LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON o.id_order = od.id_order
		WHERE o.valid = 1
		AND o.invoice_date BETWEEN ' . $this->getDate() . '
		GROUP BY od.id_discount';
        if (Validate::IsName($this->_sort)) {
            $this->_query .= ' ORDER BY `' . $this->_sort . '`';
            if (isset($this->_direction) && (strtoupper($this->_direction) == 'ASC' ||  strtoupper($this->_direction) == 'DESC')) {
                $this->_query .= ' ' . pSQL($this->_direction);
            }
        }
        if (($this->_start === 0 or Validate::IsUnsignedInt($this->_start)) and Validate::IsUnsignedInt($this->_limit)) {
            $this->_query .= ' LIMIT ' . $this->_start . ', ' . $this->_limit;
        }
        $this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query);
        $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
    }