Example #1
0
 /**
  * Sort collection
  * 
  * @return collection
  */
 protected function _prepareCollection()
 {
     if ($this->getCollection()) {
         $this->_sortCollection($this->getCollection());
     }
     return parent::_prepareCollection();
 }
 /**
  * prepare columns for this grid
  *
  * @return Magestore_Inventorysupplyneeds_Block_Adminhtml_Inventorysupplyneeds_Grid
  */
 protected function _prepareColumns()
 {
     $this->addColumn('product_sku', array('header' => Mage::helper('inventoryplus')->__('SKU'), 'align' => 'left', 'width' => '80px', 'index' => 'sku'));
     $helperClass = $this->getHelperClass();
     $warehouseSelected = $helperClass->getWarehouseSelected();
     if (count($warehouseSelected) > 1) {
         foreach ($warehouseSelected as $warehouseId) {
             $this->addColumn('avg_qty_ordered_' . $warehouseId, array('header' => Mage::helper('inventoryplus')->__('Qty. sold/day'), 'align' => 'right', 'index' => 'avg_qty_ordered_' . $warehouseId, 'type' => 'number'));
             $this->addColumn('total_qty_ordered_' . $warehouseId, array('header' => Mage::helper('inventoryplus')->__('Total Sold'), 'align' => 'right', 'index' => 'total_qty_ordered_' . $warehouseId, 'type' => 'number'));
             $this->addColumn('available_qty_' . $warehouseId, array('header' => Mage::helper('inventoryplus')->__('Avail. Qty'), 'align' => 'right', 'index' => 'available_qty_' . $warehouseId, 'type' => 'number'));
             $this->addColumn('in_purchasing_' . $warehouseId, array('header' => Mage::helper('inventoryplus')->__('In Purchasing'), 'align' => 'right', 'sortable' => false, 'filter' => false, 'width' => '80px', 'index' => 'in_purchasing_' . $warehouseId));
             $this->addColumn('out_of_stock_date_' . $warehouseId, array('header' => Mage::helper('inventoryplus')->__('Out-of-stock Date'), 'align' => 'left', 'index' => 'out_of_stock_date_' . $warehouseId, 'type' => 'date'));
             $this->addColumn('supplyneeds_' . $warehouseId, array('header' => Mage::helper('inventoryplus')->__('Supply Needs'), 'align' => 'right', 'index' => 'purchase_more_' . $warehouseId, 'type' => 'number'));
         }
     }
     $this->addColumn('avg_qty_ordered', array('header' => Mage::helper('inventoryplus')->__('Qty. sold/day'), 'align' => 'right', 'index' => 'avg_qty_ordered', 'type' => 'number'));
     $this->addColumn('total_qty_ordered', array('header' => Mage::helper('inventoryplus')->__('Total Sold'), 'align' => 'right', 'index' => 'total_qty_ordered', 'type' => 'number'));
     $this->addColumn('total_available_qty', array('header' => Mage::helper('inventoryplus')->__('Avail. Qty'), 'align' => 'right', 'index' => 'total_available_qty', 'type' => 'number'));
     $this->addColumn('in_purchasing', array('header' => Mage::helper('inventoryplus')->__('Qty On Order'), 'align' => 'right', 'index' => 'in_purchasing', 'sortable' => false, 'filter' => false, 'width' => '80px'));
     $this->addColumn('out_of_stock_date', array('header' => Mage::helper('inventoryplus')->__('Out-of-stock Date'), 'align' => 'left', 'index' => 'out_of_stock_date', 'type' => 'date'));
     $this->addColumn('supplyneeds', array('header' => Mage::helper('inventoryplus')->__('Supply Needs'), 'align' => 'right', 'index' => 'purchase_more', 'type' => 'number'));
     return parent::_prepareColumns();
 }