<?php

/*------------------------------------------------------------------------
# com_invoices - Invoice Manager for Joomla
# ------------------------------------------------------------------------
# author				Germinal Camps
# copyright 			Copyright (C) 2012 - 2016 JoomlaThat.com. All Rights Reserved.
# @license				http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: 			http://www.joomlathat.com
# Technical Support:	Forum - http://www.joomlathat.com/support
-------------------------------------------------------------------------*/

//no direct access
defined('_JEXEC') or die('Restricted access.');

jimport( 'joomla.application.component.view');

class InvoicesViewInvoices extends JViewLegacy
{
    public $_path = array(
        'template' => array(),
        'helper' => array()
    );

	function display($tpl = null)
	{
		$mainframe = JFactory::getApplication();
		$uri	= JFactory::getURI();

		$pathway	= $mainframe->getPathway();
		$document	= JFactory::getDocument();

		$params = JComponentHelper::getParams( 'com_invoices' );

		$items		=  $this->get( 'Data');
		$quotes		=  $this->get( 'Quotes');
		$pagination =  $this->get('Pagination');
		$currencies		= InvoicesHelper::getCurrencies();

		$this->assignRef('items',		$items);
		$this->assignRef('quotes',		$quotes);
		$this->assignRef('pagination', $pagination);
		$this->assignRef('params', $params);
		$this->assignRef('currencies', $currencies);

		$filter_order     = $mainframe->getUserStateFromRequest( 'filter_order', 'filter_order', 'i.invoice_date', 'cmd' );
    $filter_order_Dir = $mainframe->getUserStateFromRequest( 'filter_order_Dir', 'filter_order_Dir', 'desc', 'word' );

		$lists['date_in']     = $this->get( 'DateIn');
		$lists['date_out']    = $this->get( 'DateOut');
		$lists['order']     = $filter_order;
		$lists['order_Dir'] = $filter_order_Dir;

		$this->assignRef( 'lists',	$lists );

		JHtmlBehavior::framework();
		JHTML::_('behavior.modal');

		$document->addStyleSheet( $uri->base() . 'components/com_invoices/assets/styles.css');
		$document->addScript( $uri->base() . 'components/com_invoices/assets/slide.js');

		$this->setLayout($params->get('layout', 'default'));

		parent::display($tpl);
	}

}
?>
