<?php include 'includes/header.php'; ?>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.23/css/dataTables.bootstrap4.min.css">
<style type="text/css">
  .add-form-btn {
    position: absolute;
    right: 0px;
    background: #e68f39;
    padding: 10px 0 10px 20px;
    border-radius: 4px;
    margin-top: 6%;
    font-size: 15px;
    box-shadow: 0 4px 20px 0 rgb(0 0 0 / 14%), 0 7px 10px -5px rgb(230 143 57 / 40%);
}
</style>
<body>
 

<div id="wrapper" class="active">  
      <!-- Sidebar -->
            <!-- Sidebar -->
            <?php include 'includes/sidebar.php'; ?>

          
      <!-- Page content -->
      <div id="page-content-wrapper">
        <div class="page-content inset">
        <div class="main">
  <a class="out-btn" href="logout.php">Sign out</a>
  <div class="content con-1">
    <div class="container-fluid">
     <div class="row dashboard-stats">
  
  <div class="dash-table-header dash1">
   <div class="card-header card-header-warning first-sec">
    <div class="row"></div>
      <div class="col-md-10">
        <h4>Section 2(22)(e) Status</h4>
      </div>
    </div>
  </div>
   </div>
  
   <div class="container table-responsive dash-table-stats"> 
  <!-- <a href="#" class="am-btn-dash" data-toggle="modal" data-target="#add-newform" rel="tooltip" title="" data-original-title="Add New Form"><i class="fa fa-plus" aria-hidden="true"></i></a> -->
 <table class="table table-bordered table-hover display" id="table_id1">
  <thead class="thead-dark">
   <tr>
    <th scope="col">Sr.No</th>
    <th scope="col">Preparation Date</th>
    <th scope="col">Company Name</th>
    <th scope="col">Financial Year</th>
    <th scope="col">Maker</th>
    <th scope="col">Checker</th>
    <th scope="col">Status</th>
    <!-- <th scope="col">Last Edited On</th> -->
    <th scope="col">Action</th>
  </tr>
</thead>
<tbody>
  <?php
  $company_arr = $obj->select("date_format(str_to_date(company_detail_preparation_date, '%Y-%m-%d'),' %d %M %Y') as date,gcdm.company_detail_id,gcdm.company_detail_name,gcdm.company_detail_preparation_date,gcdm.company_detail_financial_year,gcdm.company_detail_maker_name,gcdm.company_detail_checker_name,gcdm.company_detail_status,gcdm.company_detail_document,gsm.section_name,com.company_name","gbca_company_detail_master as gcdm inner join gbca_section_master as gsm on gcdm.section_id = gsm.section_id INNER JOIN gbca_company_master as com ON gcdm.company_detail_name=com.company_id "," gcdm.section_id='2' AND company_detail_status != '2' order by gcdm.company_detail_id desc");

    if(is_array($company_arr))
    {
    $i = 1;
    foreach($company_arr as $company)
    {
      ?>

  <tr>
  <td><?php echo $i; ?></td>
  <td style="width:20%"><?php echo $company['date']; ?></td>
  <td style="width:20%"><?php echo $company['company_name'];?></td>
  <td style="width:20%"><?php echo $company['company_detail_financial_year'];?></td>
  <td><?php echo $company['company_detail_maker_name'];?></td>
  <td><?php echo $company['company_detail_checker_name'];?></td>
  <td><?php if($company['company_detail_status'] =='0')
            { echo "Pending"; }
            else { echo "Completed"; }?></td>
 
  <td class="action-icons">
 <?php if($company['section_id'] == '1')
  {
  ?>
  <a href="section-a.php?company_edit_id=<?php echo $company['company_detail_id']; ?>"><i class="fa fa-pencil" aria-hidden="true" rel="tooltip" title="" data-original-title="Edit"></i>
  </a>
  <?php 
  }
  else
  {
  ?>
   <a href="section-list-2(22)(e).php?company_detail_id=<?php echo $company['company_detail_id']; ?>"><i class="fa fa-pencil" aria-hidden="true" rel="tooltip" title="" data-original-title="Edit"></i>
  </a> 
  <?php   }  ?>
 <?php if($company['company_detail_status'] =='1'){ ?>
 <?php 
        if(file_exists('pdffiles/'.$company['company_detail_document']) && $company['company_detail_document']!="")
        {
                    ?>
  <a href="pdffiles/<?php echo $company['company_detail_document'];?>" target="_blank"><i class="fa fa-eye" aria-hidden="true" rel="tooltip" title="" data-original-title="View"></i></a>
  <a href="pdffiles/<?php echo $company['company_detail_document'];?>" download><i class="fa fa-download" aria-hidden="true" rel="tooltip" title="" data-original-title="Download"></i>
  </a>
  <?php
    }
    else
    {
        
    }
    }  ?>
  <a href="#"onclick="javascript:delete_record(<?php echo $company['company_detail_id']; ?>);"><i class="fa fa-trash" aria-hidden="true" rel="tooltip" title="" data-original-title="Remove"></i>
  </a>
</td>
<?php
 $i++;
  }
  } ?>
</tr>
</tbody>
</table>
<!-- <div class="table-footer">
  <p>Showing 1 to 10 of 10 entries</p>
  <ul class="pagination">
   <li><a href="#" class="prev">< Prev</a></li>
   <li class="pageNumber active"><a href="#">1</a></li>
   <li class="pageNumber"><a href="#">2</a></li>
   <li class="pageNumber"><a href="#">3</a></li>
   <li class="pageNumber"><a href="#">4</a></li>
   <li class="pageNumber"><a href="#">5</a></li>
   <li class="pageNumber"><a href="#">6</a></li>
   <li><a href="#" class="next">Next ></a></li>
 </ul>
</div> -->
</div>
</div>
  </div>
  <footer class="footer">
   <div class="container-fluid">
    <p>GBCA & Associates, Chartered Accountants. © 2021 All Rights Reserved. Powered by OneRoof Technologies LLP.</p>
  </div>
  </footer>
  </div>
  
        </div>
      </div>
      
    </div>
<!-- Wrapper -->

<!-- Sticky icon  -->
<div class="float-sm">
  <div class="fl-fl float-pn">
  <i class="fa fa-plus" aria-hidden="true"></i>
    <a href="" data-toggle="modal" data-target="#add-newform">Add New Form</a>
  </div>
</div>
 <!-- Sticky icon end  -->

<?php include 'includes/footer.php'; ?>
<script src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.23/js/dataTables.bootstrap4.min.js"></script>
<script type="text/javascript">
  $(document).ready( function () {
    $('#table_id1').DataTable();
} );
</script>

<!-- menu toggle new -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> -->
<script>
  $('.collapseToggle').on('click', function() {
	$(".sidebar").toggleClass('sidebar--Collapse');
	$('.main').toggleClass('main--slide');	$('#toggleIcon').toggleClass('rotate');
});
</script>
<!-- menu toggle new -->
</body>

</html>
<script type="text/javascript">
function delete_record(company_detail_id)
  {
    var result = confirm("Want to delete this information?");
    if (result) {
      var formdata= new FormData();
      formdata.append('company_detail_id',company_detail_id);
      $.ajax({
        type:"post",
        data: formdata,
        processData: false,
        contentType: false,
        url:"ajax/company_delete.php",
        success:function(msg)
        {
         msg=msg.trim();
         
         var res = JSON.parse(msg);
          if(res['n'] == 1)
          {
            location.href='section-2(22)E.php';
            return false;
          }
          
          else
          {
            alert("error");
            return false;
          }
          },
          error:function(b)
          {
            console.log("error");  
            return false; 
          }
        });

    }
  }
</script>
