* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminSlip extends AdminTab { public function __construct() { $this->table = 'order_slip'; $this->className = 'OrderSlip'; $this->edit = true; $this->delete = true; $this->noAdd = true; $this->fieldsDisplay = array( 'id_order_slip' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_order' => array('title' => $this->l('ID Order'), 'width' => 75, 'align' => 'center'), 'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right')); $this->optionTitle = $this->l('Slip'); parent::__construct(); } public function postProcess() { if (Tools::isSubmit('submitPrint')) { if (!Validate::isDate(Tools::getValue('date_from'))) $this->_errors[] = $this->l('Invalid from date'); if (!Validate::isDate(Tools::getValue('date_to'))) $this->_errors[] = $this->l('Invalid end date'); if (!sizeof($this->_errors)) { $orderSlips = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to')); if (count($orderSlips)) Tools::redirectAdmin('pdf.php?slips&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token); $this->_errors[] = $this->l('No order slips found for this period'); } } return parent::postProcess(); } public function display() { global $cookie, $currentIndex; echo '
'; $this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL); $this->displayList(); echo '
'; echo '
'.$this->l('Print PDF').'

'.$this->l('Format: 2007-12-31 (inclusive)').'

'.$this->l('Format: 2008-12-31 (inclusive)').'

 
'; } public function displayListContent($token = NULL) { global $currentIndex, $cookie; $irow = 0; if ($this->_list) foreach ($this->_list AS $tr) { $tr['id_order'] = $this->l('#').sprintf('%06d', $tr['id_order']); echo ''; echo ''; foreach ($this->fieldsDisplay AS $key => $params) echo ''.$tr[$key].''; echo ''; echo ' '.$this->l('View').''; echo ' '.$this->l('Delete').''; echo ''; echo ''; } } }