Ejemplo n.º 1
0
 /**
  * 
  * @param type $collection
  * @param type $column
  * @return type
  */
 public function filterToptierAffiliateAccount(&$collection, $column)
 {
     $accountTable = Mage::getModel('core/resource')->getTableName('affiliateplus_account');
     $value = $column->getFilter()->getValue();
     if (!isset($value)) {
         return;
     }
     if ($value == 'N/A') {
         $collection->getSelect()->where("{$accountTable}.name IS NULL");
         return;
     }
     $collection->getSelect()->where("{$accountTable}.name = '{$value}'");
 }
Ejemplo n.º 2
0
 /**
  * Callback filter for Warehouse
  * 
  * @param type $collection
  * @param type $column
  * @return type
  */
 public function filterCallback($collection, $column)
 {
     $value = $column->getFilter()->getValue();
     if (!is_null(@$value)) {
         $collection->getSelect()->where('inventory_shipment.warehouse_id = ?', $value);
     }
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Get chart pie data for customer report
  * 
  * @param type $collection
  * @param type $requestData
  * @return string
  */
 public function getCustomerChartPieData($collection, $requestData)
 {
     $collection->getSelect()->order('IFNULL(SUM(main_table.grand_total),0) DESC')->limit(20);
     $reportcode = $requestData['report_radio_select'];
     $i = 0;
     $series = '';
     foreach ($collection as $col) {
         if ($i != 0) {
             $series .= ',';
         }
         $series .= '{name:\'' . $col->getData('customer_firstname') . " " . $col->getData('customer_lastname') . ' (' . $col->getData('telephone') . ')' . '\',y:' . abs($col->getData('sum_grand_total')) . '}';
         $i++;
     }
     $data['series'] = $series;
     return $data;
 }
Ejemplo n.º 4
0
 /**
  * Filter number field
  * 
  * @param type $collection
  * @param type $column
  * @return collection
  */
 protected function _filterNumberCallback($collection, $column)
 {
     $filter = $column->getFilter()->getValue();
     $field = $this->_getRealFieldFromAlias($column->getIndex());
     if (isset($filter['from']) && $filter['from'] != '') {
         $collection->getSelect()->having($field . ' >= ' . $filter['from']);
     }
     if (isset($filter['to']) && $filter['to'] != '') {
         $collection->getSelect()->having($field . ' <= ' . $filter['to']);
     }
     $collection->setIsGroupCountSql(true);
     $collection->setResetHaving(true);
     return $collection;
 }
Ejemplo n.º 5
0
 /**
  * Filter number field
  * 
  * @param type $collection
  * @param type $column
  * @return collection
  */
 protected function _filterNumberCallback($collection, $column)
 {
     $filter = $column->getFilter()->getValue();
     $field = $this->_getRealFieldFromAlias($column->getIndex());
     if (isset($filter['from'])) {
         $collection->getSelect()->having($field . ' >= \'' . $filter['from'] . '\'');
     }
     if (isset($filter['to'])) {
         $collection->getSelect()->having($field . ' <= \'' . $filter['to'] . '\'');
     }
     return $collection;
 }
 /**
  * Filter datetime field
  * 
  * @param type $collection
  * @param type $column
  * @return type
  */
 protected function _filterDateCallback($collection, $column)
 {
     $filter = $column->getFilter()->getValue();
     $field = $this->_getRealFieldFromAlias($column->getIndex());
     if (isset($filter['orig_from'])) {
         $from = date('Y-m-d H:i:s', strtotime($filter['orig_from']));
         $collection->getSelect()->having($field . ' >= \'' . $from . '\'');
     }
     if (isset($filter['orig_to'])) {
         $to = date('Y-m-d H:i:s', strtotime($filter['orig_to']));
         $collection->getSelect()->having($field . ' <= \'' . $to . '\'');
     }
     return $collection;
 }