<?php include("includes/db_config.php"); ?>
<!DOCTYPE html>
<html lang="en" dir="ltr" data-theme="light">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <?php include("includes/css.php");?>
    <style>
        .modal-body .form-label {
            font-weight: 600;
        }

        .viewptdt .form-label {
            font-weight: 600;
        }

        .viewptdt label {
            margin-top: 10px;
        }
    </style>
</head>

<body class="preload-active aside-active aside-mobile-minimized aside-desktop-maximized">
    <div class="holder">
        <?php include("includes/sidebar.php");?>
        <div class="wrapper">
            <?php include("includes/header.php");?>
            <div class="content">
                <div class="container-fluid g-5">
                    <div class="row">
                        <div class="col-12">
                            <div class="portlet">
                               <div class="portlet-header portlet-header-bordered row">
                                     <div class="col-md-10">
                                        <h3 class="portlet-title">Purchase Return</h3>
                                    </div>
                                     <div class="col-md-2"><a href="add-purchase-return.php"> <button class="btn btn-success btn-md">Add Purchase Return</button> </a>
                                    </div>                                    
                                </div>
                                <!-- <div class="portlet-body row">
                                     <div class="col-md-2 mt-2">
                                    <label>Type</label>
                                    <select class="form-control">
                                        <option value="">Select Type</option>
                                        <option value="">Today</option>
                                        <option value="">This Week</option>
                                        <option value="">This Month</option>
                                        <option value="">This Quarter</option>
                                        <option value="">This Year</option>
                                        <option value="">Custom</option>
                                    </select>
                                </div>  
                                <div class="col-md-2 mt-2"> 
                                    <label class="">From Date</label>
                                    <input type="date" placeholder="" class="form-control">
                                </div>
                                <div class="col-md-2 mt-2"> 
                                    <label class="">To Date</label>
                                    <input type="date" placeholder="" class="form-control">
                                </div>
                                <div class="col-md-2 mt-2"> 
                                     <input type="button" value="Find" class="btn btn-success btn-lg" style="margin-top:30px;">
                                </div>
                                   </div> -->
                                   <hr/>
                                   <!--  <div class="portlet-body row mt-3">
                                     <div class="col-md-2 mt-2">
                                     <h4><strong>No. Of Txns :</strong> 1</h4>
                                </div>  
                                 <div class="col-md-4 mt-2">
                                     <h4><strong>Total Purchase Return :</strong> ₹ -3240.00</h4>
                                </div>   
                                 <div class="col-md-4 mt-2">
                                     <h4><strong>Balance Due :</strong> ₹ 4000.00</h4>
                                </div>   
                                   </div>
                                   <hr/> -->
                                <div class="portlet-body mt-3 table-responsive">
                                     <table id="datatable-1" class="table table-bordered table-striped table-hover">
                                        <thead>
                                            <tr>
                                                <th>#</th>
                                                <th>Receipt No</th>
                                                <th>Bill No</th>
                                                <th>Party Name</th>
                                                <th>Date</th> 
                                                 <th style="text-center">Total Amount</th>
                                                 <th style="text-center">Received Amount</th>
                                                <th style="text-center">Balance</th>
                                                <th>
                                                    <center>Action</center>
                                                </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <?php $i=1;
                                        $sqlsl=mysqli_query($conn,"select * from ah_purchase_return_details");
                                         while($resl= mysqli_fetch_array($sqlsl)){
                                         $cid=$resl['customer_id'];
                                         $sqlpt=mysqli_query($conn,"SELECT * from ah_vendor where id='".$cid."'");
                                         $restpy=mysqli_fetch_array($sqlpt); ?>
                                            <tr>
                                                <td><?php echo $i; $i++; ?>.</td>
                                                <td><?= $resl['return_no'];?></td>
                                                <td><?= $resl['bill_no'];?></td>
                                                <td><?= $restpy['party_name'];?></td>
                                                <td><?= $resl['return_date'];?></td>
                                                <td>₹ <?= $resl['balance'];?></td>
                                                <td>₹ <?= $resl['received_amount'];?></td>
                                                <td>₹ <?= $resl['total_amt'];?></td>
                                                 <td>
                                                    <!-- <center> <a href="view-purchase-return.php?id=<?php //echo $resl["id"]; ?>"> <button class="btn btn-success"> <i class="far fa-eye"></i></button></a> -->
                                                       <a href="edit-purchase-return.php?id=<?php echo $resl["id"]; ?>"> <button class="btn btn-primary"> <i class="far fa-edit"></i></button></a>
                                                        <a href="javascript:delete_ptype_by_ID('<?php echo $resl['id'] ?>');" class="btn btn-danger shadow btn-xs sharp"><i class="fa fa-trash"></i></a>
                                                    </center>
                                                </td>
                                            </tr>
                                        <?php } ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

          
            <div class="modal fade" id="modalview" data-bs-backdrop="static">
                <div class="modal-dialog dialog-lg">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title">View Purchase Return Details</h5><button type="button" class="btn btn-label-danger btn-icon" data-bs-dismiss="modal"><i class="fa fa-times"></i></button>
                        </div>

                        <div class="modal-body table-responsive">
                             <table class="table table-bordered">
                                <thead></thead>
                                <tbody>
                                    <tr>
                                        <td><strong>Return No.:</strong></td>
                                        <td>101</td> 
                                        <td><strong>Date:</strong></td>
                                        <td>20-09-2024</td>
                                    </tr>
                                    <tr>
                                        <td><strong>Customer Name:</strong></td>
                                        <td></td> 
                                        <td><strong>Phone No.:</strong></td>
                                        <td></td>
                                    </tr> 
                                    <tr>
                                        <td><strong>Invoice Date:</strong></td>
                                        <td> </td> 
                                        <td><strong>Invoice No.:</strong></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Item Name:</strong></td>
                                        <td> </td> 
                                        <td><strong>Qty.:</strong></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Unit:</strong></td>
                                        <td> </td> 
                                        <td><strong>Rate(Price/Unit):</strong></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Tax Type:</strong></td>
                                        <td> </td> 
                                        <td><strong>Qty.:</strong></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Sub Total(Rate X Qty.):</strong></td>
                                        <td> </td> 
                                        <td><strong>Discount:</strong></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Tax %:</strong></td>
                                        <td> </td> 
                                        <td><strong>Total Amount:</strong></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Paid:</strong></td>
                                        <td> </td> 
                                        <td><strong>Balance Due:</strong></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td><strong>Payment Type:</strong></td>
                                        <td>Cash</td> 
                                        <td><strong>Cheque No.:</strong></td>
                                        <td></td>
                                    </tr>   <!--  
                                    <tr>
                                        <td><strong>Bank Name:</strong></td>
                                        <td> </td> 
                                        <td><strong>Transaction-Id No.:</strong></td>
                                        <td></td>
                                    </tr>   
                                    <tr>
                                        <td><strong>Opening Balance:</strong></td>
                                        <td> </td> 
                                        <td><strong>As On:</strong></td>
                                        <td></td>
                                    </tr> --> 
                                    <tr>
                                        <td><strong>State Of Supply:</strong></td>
                                        <td colspan="3"> </td>  
                                    </tr>   

                                    <tr>
                                        <td><strong>Description:</strong></td>
                                        <td> </td>  
                                        <td><strong>Images:</strong></td>
                                        <td>  <img src="" style="width:60px;">  <img src="" style="width:60px;"></td>
                                    </tr>  
                                </tbody>
                            </table>
                        </div>    
                    </div>
                </div>
            </div>
            <?php include("includes/footer.php");?>
        </div>
    </div>
    <?php include("includes/js.php");?>
<script type="text/javascript">
  function delete_ptype_by_ID(id) {
        if (confirm('Do You Want to Deleting This \nContinue anyway?')) {
            window.location.href = 'delete_purchase_return.php?id=' + id;
        }
    }   
</script>    
</body>

</html>