<!--{
    [% 
        pagewidth = 210;
        pageheight = 297;
        server_process_units = 'none';
#        money_signs = 3;
        PROCESS "invoice/default/invoice_template_aux.tt";

        money_format(amount=(billprof.interval_charge), comma='.'); fixfee = aux.val;
        money_format(amount=(zones.totalcost), comma='.'); zonefee = aux.val;
        money_format(amount=(invoice.amount_net), comma='.'); netfee = aux.val;
        money_format(amount=(invoice.amount_vat), comma='.'); vatfee = aux.val;
        money_format(amount=(invoice.amount_total), comma='.'); allfee = aux.val;
        cur = billprof.currency;
        p_start = date_format(thedate=invoice.period_start, format='%Y-%m-%d');
        p_end = date_format(thedate=invoice.period_end, format='%Y-%m-%d');
    -%]
}-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="210mm" height="297mm" viewBox="0 0 595 842" server-process-units="none">

    <!--{ [% MACRO draw_background BLOCK %] }-->
    <g class="page" font-family="Verdana" font-size="8">
        <title>Background</title>


        <text x="56.7"  y="765.45">[% rescontact.company %]</text>
        <text x="56.7"  y="779.625">[% rescontact.street %]</text>
        <text x="56.7"  y="793.8">[% rescontact.postcode %] [% rescontact.city %]</text>
        <text x="56.7"  y="807.975">[% rescontact.country %]</text>

        <text x="538.65" y="765.45" text-anchor="end">Company Reg.Nr.: [% rescontact.comregnum %]</text>
        <text x="538.65" y="779.625" text-anchor="end">VAT.Nr.: [% rescontact.vatnum %]</text>
        <text x="538.65" y="793.8" text-anchor="end">IBAN: [% rescontact.iban %]</text>
        <text x="538.65" y="807.975" text-anchor="end">BIC: [% rescontact.bic %]</text>
        <text x="297.675" y="816.48" text-anchor="middle">Page [% aux.page %]</text>


        <image x="400" y="40" width="144.73686" height="39.07895" xlink:href="data:image/png;base64,[encoded data, 27744 characters]"/>

    </g>
    <!--{ [% END %] }-->

    <g x="0" y="0" class="page">
        <title>Summary</title>
        <!--{ [% draw_background %] }-->

        <text x="79.38" y="170.1" font-family="Verdana" font-size="8">[% custcontact.firstname %] [% custcontact.lastname %]</text>
        <text x="79.38" y="181.44" font-family="Verdana" font-size="8">[% custcontact.street %]</text>
        <text x="79.38" y="192.78" font-family="Verdana" font-size="8">[% custcontact.postcode %] [% custcontact.city %]</text>
        <text x="79.38" y="204.12" font-family="Verdana" font-size="8">[% custcontact.country %]</text>

        <text x="538.65" y="141.75"  text-anchor="end" font-family="Verdana" font-size="8" font-weight="bold">Invoice Nr.</text>
        <text x="538.65" y="153.09"  text-anchor="end" font-family="Verdana" font-size="8">[% invoice.serial %]</text>
        <text x="538.65" y="164.43"  text-anchor="end" font-family="Verdana" font-size="8" font-weight="bold">Customer Nr.</text>
        <text x="538.65" y="175.77"  text-anchor="end" font-family="Verdana" font-size="8">[% customer.external_id %]</text>
        <text x="538.65" y="187.11"  text-anchor="end" font-family="Verdana" font-size="8" font-weight="bold">Invoice Period</text>
        <text x="538.65" y="198.45"  text-anchor="end" font-family="Verdana" font-size="8">[% p_start %] - [% p_end %]</text>
        <text x="538.65" y="209.79"  text-anchor="end" font-family="Verdana" font-size="8" font-weight="bold">Date</text>
        <text x="538.65" y="221.13"  text-anchor="end" font-family="Verdana" font-size="8">[% date_now(format='%Y-%m-%d') %]</text>

        <text x="56.7" y="283.5" font-family="Verdana" font-size="12" font-weight="bold">Your Monthly Statement</text>

        <text x="56.7" y="311.85" font-family="Verdana" font-size="8">Dear Customer,</text>
        <text x="56.7" y="334.53" font-family="Verdana" font-size="8">For our services provided in the period of [% p_start %] to [% p_end %], we invoice the following items:</text>


        <text x="56.7" y="368.55" font-family="Verdana" font-size="8" font-weight="bold">Recurring Fees</text>
        <line x1="62.37" y1="374.22" x2="538.65" y2="374.22" style="stroke:#000000;stroke-width:1;" />
        <text x="62.37" y="385.56" font-family="Verdana" font-size="8" font-weight="bold">Name</text>
        <text text-anchor="end" x="283.5" y="385.56" font-family="Verdana" font-size="8" font-weight="bold">Quantity</text>
        <text text-anchor="end" x="377.055" y="385.56" font-family="Verdana" font-size="8" font-weight="bold">Unit Price</text>
        <text text-anchor="end" x="538.65" y="385.56" font-family="Verdana" font-size="8" font-weight="bold">Total Price in [% cur %]</text>
        <line x1="62.37" y1="391.23" x2="538.65" y2="391.23" style="stroke:#000000;stroke-width:1;" />
        <text x="62.37" y="408.24" font-family="Verdana" font-size="8">[% billprof.name %]</text>
        <text text-anchor="end" x="283.5" y="408.24" font-family="Verdana" font-size="8">1</text>
        <text text-anchor="end" x="377.055" y="408.24" font-family="Verdana" font-size="8">[% fixfee %]</text>
        <text text-anchor="end" x="538.65" y="408.24" font-family="Verdana" font-size="8">[% fixfee %]</text>
        <line x1="62.37" y1="419.58" x2="538.65" y2="419.58" style="stroke:#000000;stroke-width:1;" />
        <text x="62.37" y="430.92" font-family="Verdana" font-size="8" font-weight="bold">Total</text>
        <text text-anchor="end" x="538.65" y="430.92" font-family="Verdana" font-size="8" font-weight="bold">[% fixfee %]</text>
        <line x1="62.37" y1="436.59" x2="538.65" y2="436.59" style="stroke:#000000;stroke-width:1;" />



        <text x="56.7" y="467.775" font-family="Verdana" font-size="8" font-weight="bold">Calls [% invoice.call_direction %] other Customers and Subscribers</text>
        <line x1="62.37" y1="473.445" x2="538.65" y2="473.445" style="stroke:#000000;stroke-width:1;" />
        <text x="62.37" y="484.785" font-family="Verdana" font-size="8" font-weight="bold">Zone</text>
        <text text-anchor="end" x="283.5" y="484.785" font-family="Verdana" font-size="8" font-weight="bold">Quantity</text>
        <text text-anchor="end" x="377.055" y="484.785" font-family="Verdana" font-size="8" font-weight="bold">Usage</text>
        <text text-anchor="end" x="538.65" y="484.785" font-family="Verdana" font-size="8" font-weight="bold">Total Price in [% cur %]</text>
        <line x1="62.37" y1="490.455" x2="538.65" y2="490.455" style="stroke:#000000;stroke-width:1;" />

        <!--{ [% zonelist(fontfamily='Verdana', fontsize=8, startx=62, starty=507, offsety=14, miny=113.4, maxy=709, zones=zones.data, fields=[{name='zone',dx=0},{name='number',dx=221,anchor='end'},{name='duration',dx=99,timestamp2time=1,anchor='end'},{name='customercost',dx=156,money_cents=1,comma='.',money_signs='3',anchor='end'}]) -%] }-->

        <!-- firsty-507 means the first y in the group is at 180mm (507px); mandatory to automatically place the footer after the list -->
        <!--{<g class="list-footer firsty-507 lasty-[% aux.lasty %]">}-->
            <line x1="62.37" y1="510.3" x2="538.65" y2="510.3" style="stroke:#000000;stroke-width:1;" />
            <text x="62.37" y="521.64" font-family="Verdana" font-size="8" font-weight="bold">Total</text>
            <text text-anchor="end" x="538.65" y="521.64" font-family="Verdana" font-size="8" font-weight="bold">[% zonefee %]</text>
            <line x1="62.37" y1="527.31" x2="538.65" y2="527.31" style="stroke:#000000;stroke-width:1;" />
        <!--{</g>}-->
        <!--{[% aux.lasty = aux.lasty + 56.7 %]}-->

        <!--{ [% check_pagebreak(following_height=141.75, miny=141.75, maxy=708.75) %] }-->

        <!-- firsty-558 means the first y in the group is at 197mm (558); mandatory to automatically place the footer after the list -->
        <!--{<g class="list-footer firsty-558 lasty-[% aux.lasty %]">}-->
            <text x="56.7" y="558" font-family="Verdana" font-size="8" font-weight="bold">Summary</text>
            <text text-anchor="end" x="538.65" y="558.495" font-family="Verdana" font-size="8" font-weight="bold">in [% cur %]</text>
            <line x1="62.37" y1="564.165" x2="538.65" y2="564.165" style="stroke:#000000;stroke-width:1;" />
            <text x="62.37" y="575.505" font-family="Verdana" font-size="8" font-weight="bold">Total Summary</text>
            <text text-anchor="end" x="538.65" y="575.505" font-family="Verdana" font-size="8" font-weight="bold">[% netfee %]</text>
            <text x="62.37" y="586.845" font-family="Verdana" font-size="8" font-weight="bold">VAT ([% customer.vat_rate %]%)</text>
            <text text-anchor="end" x="538.65" y="586.845" font-family="Verdana" font-size="8" font-weight="bold">[% vatfee %]</text>
            <line x1="62.37" y1="592.515" x2="538.65" y2="592.515" style="stroke:#000000;stroke-width:1;" />
            <text x="62.37" y="603.855" font-family="Verdana" font-size="8" font-weight="bold">Amount Due</text>
            <text text-anchor="end" x="538.65" y="603.855" font-family="Verdana" font-size="8" font-weight="bold">[% allfee %]</text>
            <line x1="62.37" y1="609.525" x2="538.65" y2="609.525" style="stroke:#000000;stroke-width:1;" />

            <text x="56.7" y="637.875" font-family="Verdana" font-size="8">The amount is automatically charged via SEPA within 30 days using Mandate ID MID12345 and Creditor ID CID12345</text>
            <text x="56.7" y="649.215" font-family="Verdana" font-size="8">from your account with IBAN [% rescontact.iban %] and BIC [% rescontact.bic %].</text>
            <text x="56.7" y="671.895" font-family="Verdana" font-size="8">With best regards,</text>
            <text x="56.7" y="683.235" font-family="Verdana" font-size="8">Your [% rescontact.company %] Service Team</text>
        <!--{</g>}-->

    </g>

    <!--{ [% newpage %] }-->
    <g x="0" y="0" class="page" display="none">
        <title>CallList</title>
        <!--{ [% draw_background %] }-->

        <text x="56.7" y="141.75" font-family="Verdana" font-size="8" font-weight="bold">Call Details</text>
        <line x1="62.37" y1="150.255" x2="538.65" y2="150.255" style="stroke:#000000;stroke-width:1;" />
        <text x="62.37"  y="164.43" font-family="Verdana" font-size="8" font-weight="bold">Start Time</text>
        <text x="164.43"  y="164.43" font-family="Verdana" font-size="8" font-weight="bold">Duration</text>
        <text x="232.47"  y="164.43" font-family="Verdana" font-size="8" font-weight="bold">Destination</text>
        <text x="345.87" y="164.43" font-family="Verdana" font-size="8" font-weight="bold">Zone</text>
        <text x="459.27" y="164.43" font-family="Verdana" font-size="8" font-weight="bold">Total Amount in [% cur %]</text>

        <line x1="62.37" y1="170.1" x2="538.65" y2="170.1" style="stroke:#000000;stroke-width:1;" />

        <!--{ [% calllist(fontfamily='Verdana', fontsize=8, startx=62.37, starty=184.275, offsety=14, miny=113.4, maxy=737, calls=calls, fields=[{name='start_time',dx=0,date_format='%Y-%m-%d %H:%M:%S'},{name='duration',dx=141.175,timestamp2time=1,anchor='end'},{name='destination_user_in',dx=28.35,prefix='+',masklen=10,mask='xxx'},{name='zone',dx=113.4},{name='cost',dx=192.78,money_cents=1,comma='.',anchor='end',money_signs=5}]) -%] }-->
        
    </g>


</svg>
<!-- vim: set tabstop=4 syntax=html expandtab: -->
