<?php
/**
 * phpaga
 *
 * PDF template: show recipient company name and address
 *
 * This file contains the necessary routines to manage expenses.
 *
 * @author Florian Lanthaler <florian@phpaga.net>
 * @version $Id: recipient.tpl.php 827 2007-07-05 15:05:48Z florian $
 *
 * Copyright (c) 2003, Florian Lanthaler <florian@phpaga.net>
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *    * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in
 *      the documentation and/or other materials provided with the
 *      distribution.
 *
 *    * Neither the name of Florian Lanthaler nor the names of his
 *      contributors may be used to endorse or promote products derived
 *      from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

$recipient = $data["recipient"];

$this->ezSetY(PHPAGA_PDF_POS_Y_RECIPIENT);

if (isset($recipient["bill_person_recipient"]) && strlen($recipient["bill_person_recipient"]))

    $rec = array(array("text" => $recipient["cpn_name"]),
                 array("text" => $recipient["bill_person_recipient"]),
                 array("text" => $recipient["cpn_address"]),
                 array("text" => $recipient["full_location"]));
else

    $rec = array(array("text" => $recipient["cpn_name"]),
                 array("text" => $recipient["cpn_address"]),
                 array("text" => $recipient["full_location"]));

$this->ezTable($rec,
               array("text" => ""),
               '',
               array("xPos" => PHPAGA_PDF_POS_X_RECIPIENT,
                     "xOrientation" => "right",
                     "showHeadings" => 0,
                     'shaded' => 0,
                     "fontSize" => PHPAGA_PDF_FONT_SIZE_BILL,
                     "maxWidth" => PHPAGA_PDF_DOCWIDTH -
                     (2 * PHPAGA_PDF_BORDER_LEFT),
                     "showLines" => 0,
                     'lineCol' => array(0.8, 0.8, 0.8),
                     'outerLineThickness' => 0.3,
                     'innerLineThickness' => 0.3,
                     "cols" =>
                     array("text" =>
                           array("justification" =>
                                 "left")),
                     "protectRows" => 5));

$this->setStrokeColor(0.8,0.8,0.8, 1);
$this->setLineStyle(0.5);

$this->line(PHPAGA_PDF_POS_X_RECIPIENT - 10,
            PHPAGA_PDF_POS_Y_RECIPIENT + 5,
            PHPAGA_PDF_POS_X_RECIPIENT - 10,
            PHPAGA_PDF_POS_Y_RECIPIENT - PHPAGA_PDF_BILL_NEXTLINE * 4);

$this->setStrokeColor(0,0,0, 1);

?>