<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style type="text/css">
        @page {
            margin: 0px;
        }
        body {
            margin: 0px;
        }
        * {
            font-family: Verdana, Arial, sans-serif;
        }
        a {
            color: #fff;
            text-decoration: none;
        }
        table {
            font-size: x-small;
        }
        tfoot tr td {
            font-weight: bold;
            font-size: x-small;
        }
        .invoice table {
            margin: 15px;
        }
        .invoice table td{
            border: 1px solid #333;
            padding: 5px;
        }
        .invoice h3, .invoice h5 {
            margin-left: 15px;
        }
        .invoice{
            margin:15px;
        }
        .information {
            /*background-color: #FFF;
            color: #333;*/
            background-color: #EA5730;
            color: #FFF;
            font-size: 14px;
        }
        .information pre{
            margin-left: 0px;
        }
        .information .logo {
            margin: 5px;
        }
        .information table, .informations table{
            padding: 10px;
        }
        .informations{
            background-color: #EA5730;
            color: #FFF;
        }
        .page-break {
            page-break-after: always;
        }
    </style>

</head>
<body>
    <div class="information">
        <table width="100%">
            <tr>
                <td align="left" style="width: 50%;"><h3>{{ $com->name }}</h3></td>
                <td align="right" style="width: 50%;"><h3>Allo Sdn. Bhd</h3></td>
            </tr>
            <tr>
                <td align="left" style="width: 50%;">
<pre>
{{ $com->address }}
{{ $com->postcode }}, {{ $com->city }}, {{ $com->state }}
</pre>
                </td>
                <td align="right" style="width: 50%;">
                    <pre>
                        Cyberview Garden Villas, 
                        Persiaran Multimedia, Cyber 7,
                        63000 Cyberjaya, Malaysia
                    </pre>
                </td>
            </tr>
        </table>
    </div>

    <br/>

    <div class="invoice">
        <table width="100%" style="font-size: 15px; font-weight:bold">
            <tr>
                <td style="border: none" >Invoice Number : {{$invoice_no}}</td>
                <td style="border: none" align="right">Issue Date: {{ date("d/m/Y H:i:s") }}</td>
            </tr>
            <tr>
                <td style="border: none">Invoice Claim: {{ $month }} / {{ $year}}</td>
                <td style="border: none" align="right">Invoice Claim Date Range: 01/{{$month}}/{{$year}} - {{cal_days_in_month(CAL_GREGORIAN,$month,$year)}}/{{$month}}/{{$year}}</td>
            </tr>
            @if ($project_type!=null)
            <tr >
                <td colspan="2" style="border: none" >Project Type : {{$project_type}}</td>
            </tr>
            @endif
        </table>
        <table width="100%" cellpadding="0" cellpadding="0">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Contract</th>
                    <th>W/O</th>
                    <th>D/O</th>
                    <th>Activation</th>
                    <th>Name</th>
                    <th>Address</th>
                    <th>Package</th>
                    <th>Retail Price</th>
                    <th>Incentives (%)</th>
                    <th>Incentives (RM)</th>
                    <th>Total Claim</th>
                </tr>
            </thead>
            <tbody>
                <?php $i = 0; $total  = 0;?>
                @foreach($final as $key => $c) 
                    <?php $i++; ?> 
                    <tr>
                        <td>{{ $key+1 }}{{ $c['index'] }}</td>
                        <td>{{ $c['contract'] }}</td>
                        <td>{{ $c['wo'] }}</td>
                        <td>{{ $c['do'] }}</td>
                        <td>{{ $c['activated_dt'] }}</td>
                        <td>{{ $c['name'] }}</td>
                        <td>{{ $c['address'] }}</td>
                        <td>{{ $c['package'] }}</td>
                        <td>{{ $c['retail_price'] }}</td>
                        <td>{{ $c['incentives1']}}</td>
                        <td>{{ $c['incentives2']}}</td>
                        <td>{{ $c['total'] }}</td>
                    </tr>
                @endforeach
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="10"></td>
                    <td align="left">Additional Incentives</td>
                    <td align="left" class="gray">RM {{ $extra }}</td>
                </tr>
                <tr>
                    <td colspan="10"></td>
                    <td align="left">Incentives</td>
                    <td align="left" class="gray">RM {{ $basic_total }}</td>
                </tr>
                <tr>
                    <td colspan="10"></td>
                    <td align="left">Total</td>
                    <td align="left" class="gray">RM {{ $totals }}</td>
                </tr>
                <tr>
                    <td colspan="12" style="border:none"> <p style="color: red" >This is system auto-generated. Payment will be processed within 45 days.</p> </td>
                </tr>
            </tfoot>
        </table>

    <div class="page-break"></div>

        <table width="100%" style>
            <tr>
                <td width="50%">Business Registration Number : {{$com->reg_no}} </td>
                <td width="50%">Contact Number : {{$com->contact}}</td>
            </tr>
            <tr>
                <td colspan="2" style="font-weight: bold ; border:none">Bank Account Details</td>
            </tr>
            <tr>
                <td width="50%">Bank Name : {{$com->bank_name}} </td>
                <td width="50%">Account Number : {{$com->acc_no}}</td>
            </tr>
            <tr>
                <td width="50%">Account Holder Name : {{$com->acc_holder_name}}</td>
                <td width="50%">Finance Email Address : {{$com->fin_email}}</td>
            </tr>
        </table>

        <table width="100%" cellpadding="0" cellpadding="0" style="margin-top: 80px">
            <tr>
                <th align="left" width="100%" colspan="3" >------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <br> *For Internal Use </th>
            </tr>
            <tr>
                <th width="33%">Submitted By</th>
                <th width="33%">Verified By</th>
                <th width="33%">Approved By</th>
            </tr>
            <tr>
                <td height="50"></td>
                <td height="50"></td>
                <td height="50"></td>
            </tr>
            <tr>
                <td>Date:</td>
                <td>Date:</td>
                <td>Date:</td>
            </tr>
            <tr>
                <td>Designation:</td>
                <td>Designation:</td>
                <td>Designation:</td>
            </tr>
        </table>
    </div>

    <div class="informations" style="position: absolute; bottom: 0;">
        <table width="100%">
            <tr style="width: 100%;">
                <td align="left" style="width: 100%;">
                    &copy; Allo Sdn Bhd - All rights reserved.
                </td>
                <!-- <td align="right" style="width: 50%;">
                    Company Slogan
                </td> -->
            </tr>

        </table>
    </div>
</body>
</html>