* @copyright 2007-2012 PrestaShop SA * @version Release: $Revision: 14002 $ * @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() { global $cookie; $this->table = 'invoice'; $this->optionTitle = $this->l('Invoice options'); $this->_fieldsOptions = 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', 'PS_PROFORM_PREFIX' => array('title' => $this->l('Proform prefix:'), 'desc' => $this->l('Prefix pouzity pro proforma faktury'), 'size' => 6, 'type' => 'textLang'), 'PS_PROFORM_START_NUMBER' => array('title' => $this->l('Proform number:'), 'desc' => $this->l('Pristi proforma faktura zacne s timto cislem a kazda dalsi bude s o jedna vetsim. Nastavte 0 pokud chcete zachovat stavajici cislo (#').(Order::getLastProformNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval'), 'cols' => 40, 'rows' => 8) ); parent::__construct(); } public function displayForm($isMainTab = true) { global $currentIndex, $cookie; $statuses = OrderState::getOrderStates($cookie->id_lang); $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 GROUP BY id_order_state'); $statusStats = array(); foreach ($result as $row) $statusStats[$row['id_order_state']] = $row['nbOrders']; echo '