<?php include "layouts/menu.php"; ?> <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
              
                <!--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 class="alert alert-info">Register Ledger Details</div>
   <form name="form1" class="form-horizontal" method="post" action="ledger.php" enctype="multipart/form-data">
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Ledger Name</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputPassword3" name="ledger" value="" placeholder="" required>
    </div>
  </div>
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Under</label>
    <div class="col-sm-4">
        <select type="text"  class="form-control" id="inputPassword3" name="under" value="" placeholder="" required>
            <option></option>
            <?php $sql = mysqli_query($conn, "select * from ledgerg where mfin='$mfin'");
			while($row = mysqli_fetch_array($sql)) { ?>
				<option><?php echo $row['ledger']; ?></option>
			<?php } ?>
        </select>
    </div>
  </div>
    <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Opening Balance</label>
    <div class="col-sm-4">
       <input type="text" class="form-control" rows="3" name="openbal" value="" placeholder="">
    </div>
  </div>  
    <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Cr/Dr</label>
    <div class="col-sm-4">
       <select type="text" class="form-control" rows="3" name="yn" value="" placeholder="">
           <option>Cr</option><option>Dr</option> </select>
    </div>
  </div>  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default" name="s1">Save This</button>
    </div>
  </div>
      <div class="alert alert-success">
	 <?php
							if(isset($_POST['s1']))
							{
								extract($_POST);
								$insert=mysqli_query($conn, "insert into ledger(mfin,scode,ledger,under,openbal,yn)
											 values('$mfin','$scode','$ledger','$under','$openbal','$yn')");
								
								if($insert)
								{
									
									echo "Registered Successfully";
									
								}
								else
								{
									echo "Failure";
								}
							}
?>
	  </div>
</form>
</div></div></div></div></div>
    <div class="row">
                <div class="col-lg-12">
     <?php
					
						$qry=mysqli_query($conn, "select * from ledger where mfin='$mfin'");
						$n=mysqli_num_rows($qry);
						if($n==0)
						{
							echo "Nothing To Display";
						}
						else
						
					{ 
						?>
                <!-- Main content -->
              
                         
                                <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">           
                                        <thead>
                                          <tr><th>S.No</th>
												<th>Ledger Name</th>
											<th>Under</th>
												<th>Opening Bal</th>
												<th>-</th>
                                            </tr>
                                        </thead>
									    <tbody>	<?php $ii=0;
					while($row2=mysqli_fetch_array($qry))
						{ $ii++;
					?>
                                    
                                           <tr>
                                                <td><?php echo $ii;?></td>
                                               <td><?php echo $row2['ledger'];?></td>
						<td><?php echo $row2['under'];?></td>
						<td><?php echo $row2['openbal']; ?></td>
							<td><b>
<a href="editledger.php?idd=<?php echo $row2['id'];?>" class="btn btn-info btn-xs" onclick="return confirm('Are you sure WANT TO Edit?');">Edit</a>				

</br><a href="cancelledger.php?idd=<?php echo $row2['id'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></b></td>	
                                            </tr>
                                        
                                        <?php
						}
					}
				
					?>  </tbody>
					                    
                                    </table>		
                                </div><!-- /.box-body -->
                            </div><!-- /.box -->
 
</div>
</div></div>
</div></div></div> 
        <!-- footer content --> 
        <footer>
          <div class="pull-right">
             <a href="https://infossel.com">Infossel Soft Solution</a>
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="vendors/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="vendors/iCheck/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
    <script src="vendors/jszip/dist/jszip.min.js"></script>
    <script src="vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="vendors/pdfmake/build/vfs_fonts.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>

  </body>
</html>