<div class="card">
            <div class="card-body">
              <h5 class="card-title"><a href="new-invoice.php" class="btn btn-primary"><i class="bi bi-shield-plus me-1"></i> New Invoice</a></h5>
              <!-- Bordered Table -->
              <table class="table table-bordered">
                <thead>
                  <tr>
                    <th scope="col">Invoice Number</th>
                    <th scope="col">CustomerName</th>
                    <th scope="col">Item</th>
                    <th scope="col">Invoice Status</th>
                    <th scope="col">Due Date</th>
                    <th scope="col">Action</th>
                  </tr>
                </thead>
                <tbody>
<?php 
error_reporting(E_ALL);
$myStatement = $dbConn->prepare("SELECT i.invoiceNumber, i.dueDate, i.customerName, i.invoiceStatus, t.description, t.price, t.quantity, t.amount, t.id as invoice_item_id FROM tblinvoices i INNER JOIN tblinvoice_items t ON i.id = t.invoice_id");
$myStatement->execute();
$results = $myStatement->fetchAll(PDO::FETCH_ASSOC);
$cnt=1;
if($myStatement->rowCount() > 0){
foreach($results as $result){?> 
                  <tr>
        <td><?php echo $result['invoiceNumber'];?></td>
        <td><?php echo $result['customerName'];?></td>
        <td><?php echo $result['description'];?></td>
        <td><center><?php if ($result['invoiceStatus'] == 0) {?>
          <span class="badge bg-warning">Pending</span>
        <?php }else{?>
          <span class="badge bg-success">Paid</span>
        <?php }?></center></td>
        <td><?php echo $result['dueDate'];?></td>
        <td><a href="sales-edit-invoices.php?id=<?php echo htmlentities($result['invoice_item_id']);?>" class="btn btn-primary"><i class="bi bi-pencil-square me-1"></i></a>
          <a href="#" class="btn btn-info"><i class="bi bi-eye me-1"></i></a>
          <a href="#" class="btn btn-success"><i class="bi bi-envelope me-1"></i></a>
        <a href="functions/invoice_actioning.php?del=<?php echo htmlentities($result['invoice_item_id']);?>" onclick="return confirm('Are you sure you want to Delete this Record?');" class="btn btn-danger"><i class="bi bi-trash"></i></a></td>
                  </tr>
 <?php $cnt=$cnt+1;}} ?>

                  
                </tbody>
              </table>
              <!-- End Bordered Table -->

            </div>
          </div>
