<% if (allrecs.length > 0) {%>
    <table border="1">
        <tr>
            <th>Order ID</th>
            <th>Customer ID</th>
            <th>Sale Date</th>
            <th>Customer Notes</th>
            <th>Payment Status</th>
        </tr>
        <% allrecs.forEach((recref, index) => { %>
            <tr>
                <td><%= recref.order_id %></td>
                <td><%= recref.customer_id %></td>
                <td><%= new Date(recref.saledate).toLocaleDateString('en-US', { timeZone: 'UTC' }) %></td>
                <td><%= recref.customernotes %></td>
                <td><%= recref.paymentstatus %></td>
                <td><a href='/saleorder/<%= recref.order_id %>/show'>Details</a></td>
                <td><a href='/saleorder/<%= recref.order_id%>/edit'>Edit</a></td>
                <td><a href='/saleorder/<%= recref.order_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='/saleorder/addrecord'>Add New</a> </p>
    