<odoo>
    <template
        id="pos_daily_report"
        inherit_id="pos_daily_sales_reports.pos_daily_report"
    >
        <xpath
            expr="//t[@id='sales']/table[hasclass('table', 'table-sm')]"
            position="attributes"
        >
            <attribute name="style">display:none;</attribute>
        </xpath>
        <xpath expr="//t[@id='sales']" position="inside">
            <t t-if="sales_report_by_category_only">
                <table class="table table-sm">
                    <thead>
                        <tr>
                            <th>Product Category</th>
                            <th>Quantity</th>
                            <th>Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr t-foreach="products" t-as="category">
                            <td>
                                <t t-esc="category['name']" />
                            </td>
                            <td>
                                <t t-esc="category['qty']" />
                            </td>
                            <td>
                                <t t-if="currency['position']">
                                    <t
                                        t-esc="category['total']"
                                        t-options="{'widget': 'float', 'precision': currency['precision']}"
                                    />
                                    <t t-esc='currency["symbol"]' />
                                </t>
                                <t t-else="">
                                    <t t-esc='currency["symbol"]' />
                                    <t
                                        t-esc="category['total']"
                                        t-options="{'widget': 'float', 'precision': currency['precision']}"
                                    />
                                </t>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>Total</strong>
                            </td>
                            <td>
                                <strong>
                                    <t t-esc="products_info['qty']" />
                                </strong>
                            </td>
                            <td>
                                <t t-if="currency['position']">
                                    <strong>
                                        <t
                                            t-esc='products_info["total"]'
                                            t-options="{'widget': 'float', 'precision': currency['precision']}"
                                        />
                                        <t t-esc='currency["symbol"]' />
                                    </strong>
                                </t>
                                <t t-else="">
                                    <strong>
                                        <t t-esc='currency["symbol"]' />
                                        <t
                                            t-esc='products_info["total"]'
                                            t-options="{'widget': 'float', 'precision': currency['precision']}"
                                        />
                                    </strong>
                                </t>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </t>
            <t t-else="">
                <table class="table table-sm">
                    <thead>
                        <tr>
                            <th>Product Category</th>
                            <th>Product</th>
                            <th>Quantity</th>
                            <th>Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr t-foreach="products" t-as="category">
                            <td style="background-color: #dadada;">
                                <t t-esc="category['name']" />
                            </td>
                            <td style="background-color: #dadada;" />
                            <td style="background-color: #dadada;">
                                <t t-esc="category['qty']" />
                            </td>
                            <td style="background-color: #dadada;">
                                <t t-if="currency['position']">
                                    <t
                                        t-esc="category['total']"
                                        t-options="{'widget': 'float', 'precision': currency['precision']}"
                                    />
                                    <t t-esc='currency["symbol"]' />
                                </t>
                                <t t-else="">
                                    <t t-esc='currency["symbol"]' />
                                    <t
                                        t-esc="category['total']"
                                        t-options="{'widget': 'float', 'precision': currency['precision']}"
                                    />
                                </t>
                            </td>
                            <tr t-foreach="category['products']" t-as="line">
                                <td />
                                <t
                                    t-set="internal_reference"
                                    t-value="line['code'] and '[%s] ' % line['code'] or ''"
                                />
                                <td>
                                    <t t-esc="internal_reference" />
                                    <t t-esc="line['product_name']" />
                                </td>
                                <td>
                                    <t t-esc="line['quantity']" />
                                    <t t-if='line["uom"] != "Units"'>
                                        <t t-esc='line["uom"]' />
                                    </t>
                                </td>
                                <td>
                                    <t t-if="currency['position']">
                                        <t
                                            t-esc='line["total_paid"]'
                                            t-options="{'widget': 'float', 'precision': currency['precision']}"
                                        />
                                        <t t-esc='currency["symbol"]' />
                                    </t>
                                    <t t-else="">
                                        <t t-esc='currency["symbol"]' />
                                        <t
                                            t-esc='line["total_paid"]'
                                            t-options="{'widget': 'float', 'precision': currency['precision']}"
                                        />
                                    </t>

                                    <t t-if='line["discount"] != 0'> Disc: <t
                                            t-esc='line["discount"]'
                                        />% </t>
                                </td>
                            </tr>
                        </tr>
                        <tr>
                            <td style="background-color: #b1b1b1;">
                                <strong>Total</strong>
                            </td>
                            <td style="background-color: #b1b1b1;" />
                            <td style="background-color: #b1b1b1;">
                                <strong>
                                    <t t-esc="products_info['qty']" />
                                </strong>
                            </td>
                            <td style="background-color: #b1b1b1;">
                                <t t-if="currency['position']">
                                    <strong>
                                        <t
                                            t-esc='products_info["total"]'
                                            t-options="{'widget': 'float', 'precision': currency['precision']}"
                                        />
                                        <t t-esc='currency["symbol"]' />
                                    </strong>
                                </t>
                                <t t-else="">
                                    <strong>
                                        <t t-esc='currency["symbol"]' />
                                        <t
                                            t-esc='products_info["total"]'
                                            t-options="{'widget': 'float', 'precision': currency['precision']}"
                                        />
                                    </strong>
                                </t>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </t>
        </xpath>

    </template>
</odoo>
