<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title><?= $refnumber.' - '.$name ?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <?php echoIf($conf['design']['googlefontlink'], '<link href="%v" rel="stylesheet" type="text/css" media="all" />') ?>
        <link href="user_templates/pdf/pdf.css" rel="stylesheet" type="text/css" media="all" />
        <style type="text/css">
            html, body
            {
                font-family: <?php echoIf($conf['design']['fontname'], "'%v', ");?>Arial, Helvetica, sans-serif;
            }
            a,
            a:link,
            a:visited,
            .heading,
            table.table th,
            tr.total td,
            .colored
            {
                color: <?= $conf['design']['color']; ?>
            }
        </style>
    </head>
    <body>

        <div class="header">
            <table>
                <tr>
                    <td align="right">
                        <span class="big"><?= $conf['company'] ?></span><br/>
                        <? echoIf($conf['company_addition'], '<span class="small">%v</span><br/>') ?>
                        <? echoIf($conf['address']['web'],'<a href="%v" target="_blank">%v</a> - '); echoIf($conf['mail']['replyto'], '<a href="mailto:%v">%v</a>') ?>
                    </td>
                    <td width="100" align="right">
                        <img src="<?= $conf['design']['logo'] ?>" alt="Logo" />
                    </td>
                </tr>
            </table>
        </div>

        <div class="footer">
            <p class="page less"><?= $refnumber ?> - Seite </p>
        </div>

        <div class="intro">
            <p><!-- Address Block -->
                <?
                    echoIf($project['client']['companyname'],'%v<br/>');
                    valFromKey($project['client']['contact_gender'], array('m'=>'Herr', 'f' => 'Frau'), '%v ');
                    echoIf($project['client']['contact_firstname'],'%v ');
                    echoIf($project['client']['contact_lastname'],'%v<br/>');
                    echoIf($project['client']['street_no'],'%v<br/>');
                    echoIf($project['client']['street_additional'],'%v<br/>');
                    echoIf($project['client']['zip'],'%v ');
                    echoIf($project['client']['city'],'%v<br/>');
                    echoIf($project['client']['country'],'%v');
                ?>
            </p>
            <p class="right">
                <? echoIf($conf['address']['city'],'%v, den '); ?>
                <? echo formatDate($date) ?>
            </p>
            <p class="big">
                <? valFromKey($type,
                                array(
                                    'offer' => 'Angebotsreferenz',
                                    'contract' => 'Vertragsreferenz',
                                    'acceptance' => 'Abnahmereferenz',
                                    'invoice' => 'Rechnungsnummer',
                                    'reminder' => 'Zahlungserinnerung'
                                 ),
                                 '%v: ') ?>
                <?= $refnumber ?>
            </p>
        </div>

        <?php if($type != 'contract') { ?>
        <div class="content">
            <p>
                <? valFromKey($project['client']['contact_gender'],
                    array(
                        'm'=>'Sehr geehrter Herr '.$project['client']['contact_lastname'],
                        'f' => 'Sehr geehrte Frau '.$project['client']['contact_lastname'],
                        '__default' => 'Sehr geehrte Damen und Herren'),
                    '%v,<br/>'
                    ); ?>
            </p>
            <?= $content ?>
        </div>

        <div class="legal">
            <hr/>
            <p class="less">
                <span class="big"><?= $conf['company'] ?></span><br/>
                <? echoIf($conf['company_addition'], '<span class="small">%v</span><br/>') ?>
            </p>
            <table class="less">
                <tr>
                    <td width="33%" class="top" rowspan="2">
                        <? echoIf($conf['address']['street'], '%v<br/>') ?>
                        <? echoIf($conf['address']['zip'], '%v ') ?>
                        <? echoIf($conf['address']['city'], '%v<br/>') ?>
                        <? echoIf($conf['address']['country'], '%v<br/>') ?>

                    </td>
                    <td class="top" width="34%">
                        <? echoIf($conf['address']['telephone'], 'Tel.: %v<br/>') ?>
                        <? echoIf($conf['address']['fax'], 'Fax: %v<br/>') ?>
                    </td>
                    <td class="top">
                        <? echoIf($conf['address']['web'], 'Web: <a href="%v" target="_blank">%v</a><br/>') ?>
                        <? echoIf($conf['mail']['replyto'], 'Mail: <a href="mailto:%v">%v</a><br/>') ?>
                    </td>
                </tr>
                <tr>
                    <td class="top" colspan="2">
                        <? echoIf($conf['pricing']['umsatzsteuerid'], 'USt-ID: %v<br/>') ?>
                        <? echoIf($conf['pricing']['steuernummer'], 'Steuernummer: %v<br/>') ?>
                    </td>
                </tr>
            </table>
        </div>
        <?php }
            else
            {
              echo($content)  ;
            } ?>
    </body>
</html>