<?php 
session_start();
ob_start();
error_reporting(0);
include("../../pidbco/pidbjoin.php");
$sujpath="./";
if((!isset($_SESSION['user_name'])) && ($_SESSION['user_name'] == '')){
	header("Location: ../index.php");
} 
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Projects</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>font-awesome/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>font-awesome/ionicons.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>dist/css/skins/_all-skins.min.css">
    <link rel="stylesheet" type="text/css" href="tcal.css" />    
    <script type="text/javascript" src="tcal.js"></script>
<script>



      function tax_register()
    	{
        
		  var taxname = $('#taxname').val();
		  var tax = $('#tax').val();
		  
    		$.ajax({
			type: "POST",
			url: "ajaxmarket8.php",
			data: {
			btn_add_tax: 1,
      taxname : taxname,
      tax     : tax
			},
			cache: true,
			success: function(res)
			{
			    window.location.href="tax-master.php";
			}  
			});
			}

      function edit_tax(tid)
      {
        
      var taxname = $('#taxname').val();
      var tax = $('#tax').val();
      
        $.ajax({
      type: "POST",
      url: "ajaxmarket8.php",
      data: {
      btn_edit_tax: 1,
      taxname : taxname,
      tax     : tax,
      tid     : tid
      },
      cache: true,
      success: function(res)
      {
          window.location.href="tax-master.php";
      }  
      });
      }
    	function delete_tax(tid)
      {
      
        $.ajax({
      type: "POST",
      url: "ajaxmarket8.php",
      data: {
      btn_delete_tax: 1,
      tid     : tid
      },
      cache: true,
      success: function(res)
      {
          window.location.href="tax-master.php";
      }  
      });
      } 
</script>
    
  </head>
  <body class="hold-transition skin-blue sidebar-mini">
     <div class="wrapper">
  <?php include("head.php");
        include("left.php"); ?> 
	 
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper" >
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1 style=" font-size: 22px;"> Tax master
          	<small>- Control panel</small>
          	</h1>
          <ol class="breadcrumb">
            <li><a href="dash_board.php"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active"> Tax master</li> 
          </ol>
        </section>
  <!-- Main content -->
        <section class="content" >
          <div class="row" >
            <div class="col-xs-12" >


  
  <div class="row" style=" margin-top: 20px;">	
<div class="col-md-12" style="" >
	
<form  method="POST">
 <div class="col-md-6"  style="padding-left: 2px; padding-right: 0px;">          
<div class="form-group">
  <input type="text" name="taxname" id="taxname" class="form-control" placeholder="Tax Name"/>  
</div></div>

<div class="col-md-3" style="padding-left: 2px; padding-right: 0px;">         
  <div class="form-group">
  <input type="text" name="tax" id="tax" class="form-control" placeholder="Tax %"/> 
 </div></div>

<div class="col-md-2"  style=" padding-left: 2px; padding-right: 0px; ">					
<div class="form-group">
<?php if(!empty($_GET)){ ?>
  <input type="hidden" name="hidvall" id="hidvall" value="<?php echo $data['order_id']; ?>" />
    <input type="submit" class="btn btn-primary" name="frasubmit" id="frasubmit" value="Update" onclick="edit_tax();" style=" float: right;margin-right: 20px; " /> 
<?php } else { ?>
    <input type="submit" class="btn btn-primary" name="frasubmit" id="frasubmit" value="Submit" onclick="tax_register();" style=" float: right;margin-right: 20px; " />  
<?php } ?> 
</div>
</div>
</form>
 </div></div>



  
  
<div id="marketingdiv123" >


<div class="box" >
   <div class="box-body" style="padding-left: 2px; padding-right: 2px;"">
        <div class="box-body table-responsive no-padding" >
		         	
<table id="example1" class="table table-bordered table-striped" >
<thead >
<tr >
                   	
<th>Tax Name</th>
<th>Tax %</th>
<th>Action</th>
</tr>
</thead>
<tbody>

<?php
    
	
	$sq = mysqli_query($con, "SELECT * FROM `tax_master`");
	$k=1;
	while($rs = mysqli_fetch_array($sq)){
      $tname = $rs['tax_name'];
	  $tax = $rs['tax_per'];	
	 
	?>
   <tr>
   	
   	<td><?php echo $rs['tax_name']; ?></td>
   	<td><?php echo $rs['tax_per']; ?></td>
   	<td>
    
 <!--  &nbsp;  <a href="" data-toggle="modal" data-target="#myModal<?php echo $rt['oid']; ?>" style=" cursor: pointer;"><span class="glyphicon glyphicon-eye-open" style="font-size:14px;"></span></a> &nbsp;                 
    <a onClick="edit_tax1('<?php echo ($rs['tid']); ?>');" style=" cursor: pointer;" ><span class="fa fa-pencil" style="font-size:14px;"></span></a> &nbsp; -->
    <a onClick="delete_tax('<?php echo ($rs['tid']); ?>');" style=" cursor: pointer;" ><span class="fa fa-trash-o" style="font-size:14px;"></span></a> &nbsp;  
  </td>
   </tr>
   <?php $k=$k+1; }  ?>
   
</tbody>
</table>
         		  </div>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
	
	
</div>
	
		
			
			
			








                           
            </div><!-- /.col -->
          </div><!-- /.row -->
        </section><!-- /.content -->
  </div><!-- /.content-wrapper -->
  </div>
	<!-- <?php include("footer.php"); ?> -->
 <!-- jQuery 2.1.4 -->
    <script src="<?php echo $sujpath; ?>plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <!-- Bootstrap 3.3.5 -->
    <script src="<?php echo $sujpath; ?>bootstrap/js/bootstrap.min.js"></script>
    <!-- DataTables -->
	<script src="<?php echo $sujpath; ?>plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<?php echo $sujpath; ?>plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- SlimScroll -->
    <script src="<?php echo $sujpath; ?>plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo $sujpath; ?>plugins/fastclick/fastclick.min.js"></script>
    <!-- AdminLTE App -->
    <script src="<?php echo $sujpath; ?>dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="<?php echo $sujpath; ?>dist/js/demo.js"></script>
    <!-- page script -->
   
    <script>
      $(document).ready(function() {
        $("#example1").DataTable();
      });
      
	function datat(){
	  alert("Data Deleted Successfully.");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
    function datat2(){
	  alert("Data Added Successfully");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
    function datat3(){
	  alert("Updated Successfully");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
   </script>  
   
   
   
  </body>
</html>
