<?php

/**
 * Class Gnuteca Fine Receipt;
 *
 * @author Eduardo Bonfandini [eduardo@solis.coop.br]
 *
 * @version $Id$
 *
 * \b Maintainers: \n
 * Eduardo Bonfandini [eduardo@solis.coop.br]
 * Jamiel Spezia [jamiel@solis.coop.br]
 * Moises Heberle [moises@solis.coop.br]
 *
 * @since
 * Class created on 28/06/2010
 *
 * \b Organization: \n
 * SOLIS - Cooperativa de Solucoes Livres \n
 * The Gnuteca3 Development Team
 *
 * \b CopyLeft: \n
 * CopyLeft (L) 2010 SOLIS - Cooperativa de Solucoes Livres \n
 *
 * \b License: \n
 * Licensed under GPL (for further details read the COPYING file or http://www.gnu.org/copyleft/gpl.html
 *
 * \b History: \n
 * See history in SVN repository: http://gnuteca.solis.coop.br
 *
 **/

$MIOLO = MIOLO::getInstance();
$MIOLO->uses('/classes/receipt/FineReceiptWork.class.php', 'gnuteca3');

class FineReceipt extends Receipt
{
    public $libraryName;  //$LIBRARY_UNIT_DESCRIPTION
    public $personId;     //$USER_CODE
    public $personName;   //$USER_NAME
    public $date;         //$DATE
    public $operator;     //$OPERATOR

    public function __construct($data, $isPostable = false, $isPrintable = false)
    {
        parent::__construct($data, $isPostable, $isPrintable);
        $this->title = _M('Multa');
        $this->setModel( FINE_RECEIPT, FINE_RECEIPT_WORK,EMAIL_FINE_RECEIPT_SUBJECT, EMAIL_FINE_RECEIPT_CONTENT );
    }

    public function parseData()
    {
        parent::parseData();
        
        $itens = $this->getItens();

        if ( is_array($itens ))
        {
            foreach( $itens as $line => $item )
            {
                $fineTotal = $fineTotal + $item->value;
            }
        }

        $this->setVariable('$TOTAL_FINE_VALUE', GnutecaUtils::moneyFormat($fineTotal) );
    }
}
?>