Mage_Reports_Model_Mysql4_Refunded_Collection Class Reference

Inheritance diagram for Mage_Reports_Model_Mysql4_Refunded_Collection:

Mage_Sales_Model_Entity_Order_Collection Mage_Eav_Model_Entity_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 setDateRange ($from, $to)
 setStoreIds ($storeIds)
 getSelectCountSql ()


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

getSelectCountSql (  ) 

Get SQL for get record count

Returns:
Varien_Db_Select

Reimplemented from Varien_Data_Collection_Db.

Definition at line 88 of file Collection.php.

00089     {
00090         $countSelect = clone $this->getSelect();
00091         $countSelect->reset(Zend_Db_Select::ORDER);
00092         $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
00093         $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
00094         $countSelect->reset(Zend_Db_Select::COLUMNS);
00095         $countSelect->reset(Zend_Db_Select::GROUP);
00096         $countSelect->reset(Zend_Db_Select::HAVING);
00097         $countSelect->from("", "count(*)");
00098         $sql = $countSelect->__toString();
00099         return $sql;
00100     }

setDateRange ( from,
to 
)

Definition at line 38 of file Collection.php.

00039     {
00040         $this->_reset()
00041             ->addAttributeToSelect('*')
00042             ->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to))
00043             ->addExpressionAttributeToSelect('orders', 'COUNT({{total_refunded}})', array('total_refunded'));
00044 
00045         $this->getSelect()
00046             ->where('base_total_refunded>0')
00047             ->group('("*")')
00048             ->having('orders > 0');
00049 
00050         return $this;
00051     }

setStoreIds ( storeIds  ) 

Definition at line 53 of file Collection.php.

00054     {
00055         $vals = array_values($storeIds);
00056         if (count($storeIds) >= 1 && $vals[0] != '') {
00057             $this->addAttributeToFilter('store_id', array('in' => (array)$storeIds))
00058                 ->addExpressionAttributeToSelect(
00059                     'refunded',
00060                     'SUM({{base_total_refunded}})',
00061                     array('base_total_refunded'))
00062                 ->addExpressionAttributeToSelect(
00063                     'online_refunded',
00064                     'SUM({{base_total_online_refunded}})',
00065                     array('base_total_online_refunded'))
00066                 ->addExpressionAttributeToSelect(
00067                     'offline_refunded',
00068                     'SUM({{base_total_offline_refunded}})',
00069                     array('base_total_offline_refunded'));
00070         } else {
00071             $this->addExpressionAttributeToSelect(
00072                     'refunded',
00073                     'SUM({{base_total_refunded}}*{{base_to_global_rate}})',
00074                     array('base_total_refunded', 'base_to_global_rate'))
00075                 ->addExpressionAttributeToSelect(
00076                     'online_refunded',
00077                     'SUM({{base_total_online_refunded}}*{{base_to_global_rate}})',
00078                     array('base_total_online_refunded', 'base_to_global_rate'))
00079                 ->addExpressionAttributeToSelect(
00080                     'offline_refunded',
00081                     'SUM({{base_total_offline_refunded}}*{{base_to_global_rate}})',
00082                     array('base_total_offline_refunded', 'base_to_global_rate'));
00083         }
00084 
00085         return $this;
00086     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:37 2009 for Magento by  doxygen 1.5.8