* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7310 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminInvoices extends AdminTab { public function __construct() { $this->table = 'invoice'; $this->optionsList = array( 'general' => array( 'title' => $this->l('Invoice options'), 'fields' => array( 'PS_INVOICE' => array('title' => $this->l('Enable invoices:'), 'desc' => $this->l('Select whether or not to activate invoices for your shop'), 'cast' => 'intval', 'type' => 'bool'), 'PS_INVOICE_PREFIX' => array('title' => $this->l('Invoice prefix:'), 'desc' => $this->l('Prefix used for invoices'), 'size' => 6, 'type' => 'textLang'), 'PS_INVOICE_START_NUMBER' => array('title' => $this->l('Invoice number:'), 'desc' => $this->l('The next invoice will begin with this number, and then increase with each additional invoice. Set to 0 if you want to keep the current number (#').(Order::getLastInvoiceNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval'), 'PS_INVOICE_FREE_TEXT' => array('title' => $this->l('Free Text:'), 'desc' => $this->l('This text will appear at the bottom of the invoice'), 'size' => 6, 'type' => 'textareaLang', 'cols' => 40, 'rows' => 8) ), ), ); parent::__construct(); } public function displayForm($isMainTab = true) { $statuses = OrderState::getOrderStates($this->context->language->id); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT COUNT(*) as nbOrders, ( SELECT oh.id_order_state FROM '._DB_PREFIX_.'order_history oh WHERE oh.id_order = o.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1 ) id_order_state FROM '._DB_PREFIX_.'orders o WHERE o.id_shop IN('.implode(', ', $this->context->shop->getListOfID()).') GROUP BY id_order_state'); $statusStats = array(); foreach ($result as $row) $statusStats[$row['id_order_state']] = $row['nbOrders']; echo '