<?php

/*------------------------------------------------------------------------
# com_finances - Invoice Manager for Joomla
# ------------------------------------------------------------------------
# author        Germinal Camps
# copyright       Copyright (C) 2012 JoomlaContentStatistics.com. All Rights Reserved.
# @license        http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites:       http://www.JoomlaContentStatistics.com
# Technical Support:  Forum - http://www.JoomlaContentStatistics.com/forum
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');

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

$sep = $params->get("csvsep",";");
$rowsep = "\n";

?><?php echo JText::_('INVOICE_NUM'); ?><?php echo $sep; ?><?php echo JText::_('CONTACT'); ?><?php echo $sep; ?><?php echo JText::_('EMAIL'); ?><?php echo $sep; ?><?php echo JText::_('LINKED_TO_JOOMLA_USER'); ?><?php echo $sep; ?><?php echo JText::_('DUE_DATE'); ?><?php echo $sep; ?><?php echo JText::_('PAYMENT_DATETIME'); ?><?php echo $sep; ?><?php echo JText::_('PAYMENT_AMOUNT'); ?><?php echo $sep; ?><?php echo JText::_('PAYMENT_TYPE'); ?><?php echo $sep; ?><?php echo JText::_('STATUS'); ?><?php echo $sep; ?><?php echo $rowsep; ?><?php
  $k = 0;
  for ($i=0, $n=count( $this->items ); $i < $n; $i++) {
    $row = &$this->items[$i];

	   $subtotal += $row->payment_amount ;

    ?><?php echo $row->invoice_num; ?><?php echo $sep; ?><?php echo $row->contact_name; ?><?php echo $sep; ?><?php echo $row->to_email; ?><?php echo $sep; ?><?php echo $row->username; ?><?php echo $sep; ?><?php if($row->payment_duedate != "0000-00-00 00:00:00"){echo $row->payment_duedate;} ?><?php echo $sep; ?><?php if($row->payment_datetime != "0000-00-00 00:00:00"){ echo $row->payment_datetime;} ?><?php echo $sep; ?><?php echo InvoicesHelper::format_simple($row->payment_amount); ?><?php echo $sep; ?><?php echo $row->payment_type; ?><?php echo $sep; ?><?php echo $payment_status[$thestatus]; ?><?php echo $sep; ?><?php echo $rowsep; ?><?php


    $k = 1 - $k;
  }
  ?>
