<!DOCTYPE html>
<html>

<head>
    <title></title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="Asset/font-awesome.min.css">
    <style type="text/css">
        table {
            border-collapse: collapse;
            width: 100%;
        }

        th,
        td {
            text-align: left;
            border: 1px solid #ccc;
        }

        td {
            padding: 2px;
        }

        tbody tr:nth-child(odd) {
            background: #eee;
        }
    </style>
</head>

<body style="font-family:FontAwesome; margin:5%">
    <div>
        <div style="padding-bottom: 5%">
            <h1 style='float:left'><b>Detailed Itemized Report</b></h1><br style="clear:both;">
        </div>
        <div style="width: 100%;overflow: hidden;">
            <div style="float: left; line-height:50%">
                <h3>Company Name : {{config.company_name}}</h3>
                <h3>Time From : {{datetime_start}}</h3>
                <h3>Time To : {{datetime_end}}</h3>
            </div>
        </div>

        <div>
            {{#each category}}
            <div style="line-height:40px;padding:12px; margin-top:5%;overflow:hidden;text-align: center;font-size:16px;font-weight: 500;border:1px solid rgb(202,203,204);">
                <div style="float:left;width:40%;text-align: left; font-size:20px; font-weight:bold;">{{name}}</div>
                <div style="float:left;width:25%">Category Total&nbsp:&nbsp&nbsp S${{subtotal}}</div>
                <div style="float:left;width:25%;text-align: right;">{{percent}}%</div>
            </div>
            <table style="font-size:18px;width: 100%; text-align:left;">
                <col width="40%">
                <col width="20%">
                <col width="20%">
                <col width="20%">
                <thead>
                    <tr style="font-size:18px;">
                        <th>Item Name</th>
                        <th>Quantity</th>
                        <th>Unit Price</th>
                        <th>Item Total</th>
                    </tr>
                </thead>
                <tbody>
                    {{#each item}}
                    <tr>
                        <td>{{name}}</td>
                        <td>{{Sum 'quantity' invoice_line_close}}</td>
                        <td>{{price}}</td>
                        <td>{{Sum 'subtotal' invoice_line_close}}</td>
                    </tr>
                    {{/each}}
                </tbody>
            </table>
            {{/each}}
        </div>
        <div style="float:right; font-size:18px; font-weight:bold;margin-top:10%;width:40%;min-width:350px">
            <table>
                <col width="60%">
                <col width="40%">
                <tr>
                    <td>Total Tax</td>
                    <td>S$ &nbsp;&nbsp;{{Sum 'tax' invoice_close}}</td>
                </tr>
                <tr>
                    <td>Total Service Charge</td>
                    <td>S$ &nbsp;&nbsp;{{Sum 'service_charge' invoice_close}}</td>
                </tr>
                <tr>
                    <td>Total Discount</td>
                    <td>S$ &nbsp;&nbsp;{{discount}}</td>
                </tr>
                <tr>
                    <td>Total rounding</td>
                    <td>S$ &nbsp;&nbsp;{{Sum 'rounding' invoice_close}}</td>
                </tr>
                <tr>
                    <td>Total</td>
                    <td>S$ &nbsp;&nbsp;{{Sum 'grand_total' invoice_close}}</td>
                </tr>
                {{#each payment}}
                <tr>
                    <td>{{name}} Payment Subtotal</td>
                    <td>S$ &nbsp;&nbsp;{{subtotal}}</td>
                </tr>
                {{/each}}
            </table>
        </div>
    </div>
</body>

</html>
