<?php include "layouts/menu.php"; ?>
		<script type="text/javascript">
	  $(function() {
   $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' });
  });
</script>
<script type="text/javascript">
function zp(n){
return n<10?("0"+n):n;
}
function insertDate(t,format){
var now=new Date();
var DD=zp(now.getDate());
var MM=zp(now.getMonth()+1);
var YYYY=now.getFullYear();
format=format.replace(/DD/,DD);
format=format.replace(/MM/,MM);
format=format.replace(/YYYY/,YYYY);
t.value=format;
}
</script>
    <script>
  $(function() {
   $("#datepicker1").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker2").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
      <script>
  $(function() {
   $("#datepicker8").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker9").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
   <script type="text/javascript">

    function PrintElem(elem)
    {
        Popup($(elem).html());
    }

    function Popup(data) 
    {
        var mywindow = window.open('', 'my div', 'height=400,width=600');
        mywindow.document.write('<html><head><title>INFOSSEL Finance</title>');
        /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
        mywindow.document.write(' <h1 style="color:green;text-align:center;" >INFOSSEL Finance</h1><body >');
        mywindow.document.write(data);
        mywindow.document.write('<h3 style="text-align:right;">Signed by</h3><h3 style="color:blue;text-align:right;">For INFOSSEL Finance</h3></body></html>');

        mywindow.print();
        mywindow.close();

        return true;
    }

</script>
     
	 <?php $did=$_REQUEST['did'];?>
    <?php include "layouts/menu1.php"; ?>

            <!-- Right side column. Contains the navbar and content of the page -->
           <div class="right_col" role="main">
                <!-- Content Header (Page header) -->
                 <section class="content-header">
                    <h1>
                        Dashboard
                        <small>Control panel</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li class="active">Dashboard</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">


                    <!-- top row -->
                    <div class="row">
                        <div class="col-xs-12 connectedSortable">
                            
                        </div><!-- /.col -->
                    </div>
                    <!-- /.row -->
	
                    <!-- Main row -->
                             <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                                     <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">Debit Details</div>
  
                    <form name="form1" method="post" action="" enctype="multipart/form-data">
						<?php
						$qry=mysqli_query($conn, "select * from vdebit where mfin='$mfin' &&  did='$did'");
						?>
					<?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;">Debit</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['debit'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Date</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['date'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Details</td>
						<td style="background-color:#FFD4FF;"><?php echo $row['details'];?></td>
						</tr>
						<tr>
						<td style="background-color:#FFAAAA;">Delete</td>						
						<td style="background-color:#FFD4FF;"><button type="submit" class="btn btn-default" name="s1">Delete</button></td>
						</tr>
						
						
							<div class="alert alert-warning">
							<?php
							if(isset($_POST['s1']))
							{
								extract($_POST);
								$qry=mysqli_query($conn, "select * from vdebit where mfin='$mfin' &&  did='$did'");
								$n=mysqli_num_rows($qry);
								if($n==0)
									{
										echo"Already Deleted";
									}
								else		
									{
										$delete=mysqli_query($conn, "delete from vdebit where mfin='$mfin' &&  did='$did'");
										if($delete)
										{
										echo"Deleted";
										}
										else
										{
										echo "Try Again";
										}
									}
							}			
							
						   
								
?>
							</div>
						
						
																
					</tbody>
					<?php
					
				
			?>			
					</table>
					</form>
          
</div>
 
 
</div>
</div>
</div></div></div></section>
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->


        <!-- jQuery 2.0.2 -->
       <?php include "layouts/footer.php"; ?>

    </body>
</html>