<?php include "layouts/menu.php"; ?>
  <script type="text/javascript">
    function PrintElem(elem)
    {
        Popup($(elem).html());
    }
    function Popup(data) 
    {
        var mywindow = window.open('', 'my div', 'height=400,width=600');
        
        /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
        
        mywindow.document.write(data);
        
        mywindow.print();
        mywindow.close();
        return true;
    }
</script>
  <?php $hpl=$_REQUEST['hpl'];?>
  <?php $fid=$_REQUEST['fid'];?>
         <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
                    <h1 class="page-header">Dues Deletion</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Details
                        </div>
                        <div class="panel-body">
                            <div class="row">
     <div id="mydiv">
  <input type="button" value="Print" onclick="PrintElem('#mydiv')"  style="margin:20px;">
  
   <div class="alert alert-info">Weekly Due Details</div>
  
                    <form name="form1" method="post" action="" enctype="multipart/form-data">
						<?php
						$qry=mysqli_query($conn, "select * from duser where mfin='$mfin' &&  fid='$fid'");
						?>
					<?php 
					$row=mysqli_fetch_array($qry)
					?>
					<table border="0" align="center" cellspacing="0" cellpadding="10" style="table-layout: fixed;" width="500">
					<col width="100px">
					<tbody style="color:#FF0080;background:white;">
      					<tr>
						<td style="background-color:#FFAAAA;">Hpl</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['hpl'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Name</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['name'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Due Month</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['no'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Due Date</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['duedate'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Pay Date</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['paydate'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Pay Month</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['paymnt'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Total Paid Month</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['payyr'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Default Days</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['dfaultdate'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Fine</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['fine'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Balance</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['bal'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Total Amount</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['amt'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;"></td>						
						<td style="background-color:#FFD4FF;"><button type="submit" class="btn btn-default" name="s1">***XXX***</button></td>
						</tr>
						
						
							<div class="alert alert-warning"><?php
							if(isset($_POST['s1']))
							{
								extract($_POST);
								$qry=mysqli_query($conn, "select * from duser where mfin='$mfin' &&  fid='$fid'");
								$n=mysqli_num_rows($qry);
								if($n==0)
									{
										echo"Already Deleted";
									}
								else		
									{
										$delete=mysqli_query($conn, "delete from duser where mfin='$mfin' &&  fid='$fid'");
										if($delete)
										{
										echo"Deleted";
										}
										else
										{
										echo "Try Again";
										}
									}
							}			
							
						   
								
?></div>
						
						
																
					</tbody>
					<?php
					
				
			?>			
					</table>
					</form>
          
</div>
 
 
</div>
</div></div>
</div></div></div> <?php include "layouts/footer.php"; ?></body></html>