<% if (allrecs.length > 0) {%>
    <table border="1">
        <tr>
            <th>Order Detail ID</th>
            <th>Order ID</th>
            <th>Product ID</th>
            <th>Sale Price</th>
            <th>Quantity</th>
        </tr>
        <% allrecs.forEach((recref, index) => { %>
            <tr>
                <td><%= recref.orderdetail_id %></td>
                <td><%= recref.order_id %></td>
                <td><%= recref.product_id %></td>
                <td><%= Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(recref.saleprice) %></td>
                <td><%= recref.qty %></td>
                <td><a href='/orderdetail/<%= recref.orderdetail_id %>/show'>Details</a></td>
                <td><a href='/orderdetail/<%= recref.orderdetail_id%>/edit'>Edit</a></td>
                <td><a href='/orderdetail/<%= recref.orderdetail_id %>/delete' onclick="return confirm('Are you sure you want to delete this record?');">Delete</a></td>
            </tr>
        <% }); %>
    </table>
<% } else { %>
    <p>No Records Available</p>
<% } %>
<p> <a href='/orderdetail/addrecord'>Add New</a> </p>
    