function display($tpl = null) { TOOLBAR_enmasse::_SMENU(); TOOLBAR_enmasse::_REPORT(); $task = JRequest::getVar('task'); $dealList = JModel::getInstance('deal', 'enmasseModel')->listConfirmed(); $this->assignRef('dealList', $dealList); $filter = JRequest::getVar('filter'); $this->assignRef('filter', $filter); $dealId = $filter['deal_id']; if (!empty($dealId)) { $deal = JModel::getInstance('deal', 'enmasseModel')->getById($dealId); $this->assignRef('deal', $deal); $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByPdtIdAndStatus($dealId, "Delivered"); for ($count = 0; $count < count($orderItemList); $count++) { $orderItemList[$count]->invtyList = JModel::getInstance('invty', 'enmasseModel')->listByOrderItemId($orderItemList[$count]->id); $orderItemList[$count]->order = JModel::getInstance('order', 'enmasseModel')->getById($orderItemList[$count]->order_id); } $this->assignRef('orderItemList', $orderItemList); } else { $orderItemList = array(); $this->assignRef('orderItemList', $orderItemList); } /// load pagination $pagination = JModel::getInstance('orderItem', 'enmasseModel')->getPagination(); $this->assignRef('pagination', $pagination); parent::display($tpl); }