Mage_Reports_Model_Mysql4_Tax_Collection Class Reference

Inheritance diagram for Mage_Reports_Model_Mysql4_Tax_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

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


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

_construct (  ) 

Initialize collection

Reimplemented from Mage_Sales_Model_Entity_Order_Collection.

Definition at line 37 of file Collection.php.

00038     {
00039         parent::_construct();
00040         $this->setRowIdFieldName('tax_id');
00041     }

getSelectCountSql (  ) 

Get SQL for get record count

Returns:
Varien_Db_Select

Reimplemented from Varien_Data_Collection_Db.

Definition at line 74 of file Collection.php.

00075     {
00076         $countSelect = clone $this->getSelect();
00077         $countSelect->reset(Zend_Db_Select::ORDER);
00078         $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
00079         $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
00080         $countSelect->reset(Zend_Db_Select::COLUMNS);
00081         $countSelect->reset(Zend_Db_Select::GROUP);
00082         $countSelect->reset(Zend_Db_Select::HAVING);
00083         $countSelect->from("", "count(DISTINCT e.entity_id)");
00084         $sql = $countSelect->__toString();
00085         return $sql;
00086     }

setDateRange ( from,
to 
)

Definition at line 43 of file Collection.php.

00044     {
00045         $this->_reset();
00046 
00047         $this->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to))
00048             ->addExpressionAttributeToSelect('orders', 'COUNT(DISTINCT({{entity_id}}))', array('entity_id'))
00049             ->getSelect()
00050             ->join(array('tax_table' => $this->getTable('sales/order_tax')), 'e.entity_id = tax_table.order_id')
00051             ->group('tax_table.code')
00052             ->order(array('process', 'priority'));
00053 
00054         return $this;
00055     }

setStoreIds ( storeIds  ) 

Definition at line 57 of file Collection.php.

00058     {
00059         $vals = array_values($storeIds);
00060         if (count($storeIds) >= 1 && $vals[0] != '') {
00061             $this->getSelect()
00062                 ->where('e.store_id in (?)', (array)$storeIds)
00063                 ->from('', array('tax'=>'SUM(tax_table.base_real_amount)'));
00064         } else {
00065             $this->addExpressionAttributeToSelect(
00066                     'tax',
00067                     'SUM(tax_table.base_real_amount*{{base_to_global_rate}})',
00068                     array('base_to_global_rate'));
00069         }
00070 
00071         return $this;
00072     }


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