Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/admin/
Upload File :
Current File : /home2/wtmwscom/public_html/admin/report_installment.php

<?php 
$title= "Installment Report";
include 'header.php';
if(isset($_GET['uid'])){
    $chk = mysqli_num_rows(mysqli_query($connection, "SELECT name FROM user WHERE login_id = '".$_GET['login_id']."'"));
    if($chk != 1){
        setMessage('Incorrect User Id.', 'alert-msg error');
        redirect('report_installment.php');
        die();
    }
}
?>
<h1>Installment Report</h1>
<?php echo getMessage();?>
    <section id="comments">
        <form action="" method="get">
          <p>
              <input style="float: left;" type="text" name="login_id" value="<?php echo $_GET['login_id'];?>" placeholder="Search by User Id" />
              <input type="submit" name="submit" id="submit" value="submit">
          </p>
        </form>
    </section>
<?php if(isset($_GET['login_id'])){ ?>
    <section>
        <table style="width: 100%;">
          <thead>
            <tr>
              <th>S. No.</th>
              <th>User</th>
              <th>Month</th>
              <th>Amount</th>
              <th>From Date</th>
              <th>To Date</th>
              <th>Status</th>
            </tr>
          </thead>
          <tbody>
            <?php
            $uid = mysqli_fetch_object(mysqli_query($connection, "SELECT uid FROM user WHERE login_id = '".$_GET['login_id']."'"))->uid;
            $result = mysqli_query($connection, "SELECT * FROM `installment` WHERE uid = '".$uid."' ORDER BY `recid` ASC");
            $i=1;
            while ($row = mysqli_fetch_object($result)){
            ?>
                <tr <?php if($i%2){echo "class='light'";}else{echo "class='dark'";}?>>
                  <td><?php echo $i; ?></td>
                  <td><?php echo get_user($uid).' ('.$_GET['login_id'].')';?></td>
                  <td><?php echo $row->month; ?></td>
                  <td><?php echo $row->amount; ?></td>
                  <td><?php echo date("d M, Y", strtotime($row->from_date)); ?></td>
                  <td><?php echo date("d M, Y", strtotime($row->to_date)); ?></td>
                  <td><?php if($row->status == 1){ echo 'Paid';}elseif($row->status == 0){?><button onclick="processApprove(<?php echo $row->recid;?>,<?php echo $row->uid;?>)">Approve</button><?php }?></td>
                </tr>
            <?php 
            $i++;
                }
            ?>
          </tbody>
        </table>
      </section>
<?php } ?>
<script type="text/javascript">
    function processApprove(recid, uid){
        var r = confirm("Do you want to approve Payment of User ID"+uid);
        if(r){
            $.get("process_payment.php",{'recid':recid, 'uid':uid},function(data,status){
            alert(data);
            location.reload();
            });
        }
    }
</script>
<?php include 'footer.php';?>