
<?php 

session_start();
include 'includes/header.php';
require_once("lib/helper.php");
// $sub_id=$_COOKIE["company_detail_id"];
// print_r($_GET['company_detail_id']);exit;

 ?>
<style>
  .form-anf-modal .close-btn{
        padding: 6px 30px;
  }
	th:nth-child(1), td:nth-child(1){
		width: 6%;
	}
  th:last-child, td:last-child{
		width: 20%;
	}
</style>
<body>

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




      <div id="page-content-wrapper">
        <div class="page-content inset">
          
        <div class="main">
 


 <div class="heading-banner">
  <div class="card-header card-header-warning report-header">
   <div class="row captured-data data-report">
    
   
    
     <?php
     
           if(isset($_SESSION["company_detail_id"]))
          {
              
             $id=$_SESSION["company_detail_id"];
             $detail=$obj->select( "*","gbca_company_detail_master as gbca RIGHT JOIN gbca_company_master as mas ON gbca.company_detail_name=mas.company_id RIGHT JOIN gbca_section_master as sec ON gbca.section_id=sec.section_id ","company_detail_id= '$id'");
            
           
          }else
          {
              $sub_id= $_COOKIE["company_detail_id"];
           $detail=$obj->select( "*","gbca_company_detail_master as gbca RIGHT JOIN gbca_company_master as mas ON gbca.company_detail_name=mas.company_id RIGHT JOIN gbca_section_master as sec ON gbca.section_id=sec.section_id ","company_detail_id= '$sub_id'");
           
               
          }
           
           ?>
           
            <div class="col-md-7">
       <h2>Report Card for Eligibility Test  of the Income Tax Act, 1961.</h2>
     </div>
	 <div class="col-md-3 wizard-formdiv">
	<a href='pdffiles/<?php echo $detail[0]['company_detail_document'];?>' download><button  title="Export as PDF" type="button" class="report-btn" style="float: right;" >Export as PDF</button></a>	
	<button href="#" title="Export as Excel" onClick="location.href='export_to_excel_22e.php?status=1'" type="button" class="report-btn"style="float: right;">Export as EXCEL</button>
     </div>
     
     <div class="col-md-12">
                 <h1><?= $detail[0]["company_name"]; ?></h1>

               </div>
               <div class="col-md-6">
                 <h5><?= $detail[0]["section_name"]; ?></h5>
               </div>
               <div class="col-md-6">
                 <h5>Date: <?=date('d F Y')?></h5>
               </div>
               <div class="col-md-6">
                 <h5>Made By: <?= $detail[0]["company_detail_maker_name"]; ?></h5>
               </div>
               <div class="col-md-6">
                 <h5>Checked By: <?= $detail[0]["company_detail_checker_name"]; ?></h5>
               </div>
   </div>
 </div>
 </div>
 <!-- End Navbar -->
 
 
 
 
<div class="content wizard-formdiv">
   <div class="container-fluid2">
 
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-body report-card">
                    <div class="report-title">
                    <div class="row">
                        
                    <?php
                    if($detail[0]["company_type_name"] == "private-company" || $detail[0]["company_detail_substantially_interested"] =="No" )
                    {
                        ?>
                       <div class="col-md-12 mt-3">
                
                    <h5>Sec 2(22)(e) is Applicable to you. Please refer to the following Party-wise Checklist for your ready reference.</h5>
                       </div> 
                       <?php
                    }
                    else
                    {
                      ?>
                      <div class="row">
                        <div class="col-md-12 mt-3">
                    
                    <h5>Sec 2(22)(e) is not Applicable to you. You can give loans to any person</h5>
                       </div>  
                      <?php
                    }
                    ?>
                    
                      
                        
                    <div class="col-md-12">
                        <p>A.List of Shareholders to whom the company cannot extend any Loan or Advance</p>



                        <?php
                        if(isset($_SESSION["company_detail_id"]))
                        {
                            $id=$_SESSION["company_detail_id"];
                           $company_arr = $obj->select("*,gbca_company_shareholding_name,gbca_company_shareholding_percentage","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$id' AND  gbca_company_shareholding_percentage >=10 AND gbca_company_shareholding_excel_type='1' and gbca_company_shareholding_status='1'");
                                // echo "<pre>";print_r($company_arr);echo "</pre>";exit;
                              //print_r($company_arr);
                          $type_of_concern_company_arr = $obj->select("*","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$id' and gbca_company_shareholding_type_of_concern = 'company' and gbca_company_shareholding_status='1'");

                          $type_of_concern_other_than_company_arr = $obj->select("*","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$id'  and gbca_company_shareholding_status='1' and gbca_company_shareholding_excel_type=2 AND (gbca_company_shareholding_type_of_concern !='Company' and gbca_company_shareholding_type_of_concern != '' AND gbca_company_shareholding_percentage!= '0' AND (gbca_company_shareholding_list_of_concern!='' OR gbca_company_shareholding_list_of_concern!=Null))");   
                        }
                        else
                        {
    $company_arr = $obj->select("*,gbca_company_shareholding_name,gbca_company_shareholding_percentage","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$sub_id' AND  gbca_company_shareholding_percentage >=10 AND gbca_company_shareholding_excel_type='1' and gbca_company_shareholding_status='1'");
                                // echo "<pre>";print_r($company_arr);echo "</pre>";exit;
                              //print_r($company_arr);
                          $type_of_concern_company_arr = $obj->select("*","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$sub_id' and gbca_company_shareholding_type_of_concern = 'company' and gbca_company_shareholding_status='1'");

                          $type_of_concern_other_than_company_arr = $obj->select("*","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$sub_id'  and gbca_company_shareholding_status='1' and gbca_company_shareholding_excel_type=2 AND (gbca_company_shareholding_type_of_concern !='Company' and gbca_company_shareholding_type_of_concern != '' AND gbca_company_shareholding_percentage!= '0' AND (gbca_company_shareholding_list_of_concern!='' OR gbca_company_shareholding_list_of_concern!=Null))");    
                        }
                                ?>
                        
                        <table cellpadding="0" cellspacing="0">
							<thead>
								<tr>
									<th scope="col">Sr. No.</th>
									<th scope="col">Name of the Shareholder </th>
									<th scope="col">% Eq. Shareholding </th>
								</tr>
							</thead>
							<tbody>
								<?php

                            if(is_array($company_arr))
                            {
                              $i = 1;
                              foreach($company_arr as $company)
                              {
                                ?>
								<tr>
									<td><?php echo $i; ?></td>
									<td><?php echo $company['gbca_company_shareholding_name'];?></td>
									<td><?php echo $company['gbca_company_shareholding_percentage']; ?></td>
								</tr>
								<?php
                                    $i++;

                                  }
                                }
                                else
                                { ?>
                                <tr><td colspan="3" style="text-align:center">No Data Inserted.</td></tr>
                                <?php }?>
								
							</tbody>
						</table>
                    </div>

                    <div class="col-md-12">
                        <p>B. List of Concerns, being companies, to whom you cannot extend any Loan or Advance </p>
                    <table cellpadding="0" cellspacing="0">
							<thead>
								<tr>
									<th scope="col">Sr. No.</th>
									<th scope="col">Name of the Concern</th>
                  <th scope="col">Substantial Interest of </th>
									<th scope="col">% Shareholding / % Interest </th>
								</tr>
							</thead>
							<tbody>
								<?php

                            if(is_array($type_of_concern_company_arr))
                            {
                              $i = 1;
                              foreach($type_of_concern_company_arr as $type_of_concern_company)
                              {
                                ?>
								<tr>
									<td><?php echo $i; ?></td>
									<td><?php echo $type_of_concern_company['gbca_company_shareholding_type_of_concern'];?></td>
                  <td><?php echo $type_of_concern_company['gbca_company_shareholding_name'];?></td>
									<td><?php echo $type_of_concern_company['gbca_company_shareholding_percentage']; ?></td>
								</tr>
								<?php
                                    $i++;

                                  }
                                } 
                                 else
                                { ?>
                                <tr><td colspan="4" style="text-align:center">No Data Inserted.</td></tr>
                                <?php }?>
								
							</tbody>
						</table>
                    </div>

                    <div class="col-md-12">
                    <p>C. List of Parties to whom the company can not advance Loan or Provide any Security or Give any guarantee in respect of loan taken by such party without any conditions</p>
						<table cellpadding="0" cellspacing="0">
							<thead>
								<tr>
									<th scope="col">Sr. No.</th>
									<th scope="col">Name of the Concern</th>
                  <th scope="col">Substantial Interest of </th>
                  <th scope="col">% Shareholding / % Interest </th>
								</tr>
							</thead>
							<tbody>
								<?php

                            if(is_array($type_of_concern_other_than_company_arr))
                            {
                              $i = 1;
                              foreach($type_of_concern_other_than_company_arr as $type_of_concern_other_than_company)
                              {
                                ?>
								<tr>
									<td><?php echo $i; ?></td>
                  <td><?php echo $type_of_concern_other_than_company['gbca_company_shareholding_type_of_concern'];?></td>
									<td><?php echo $type_of_concern_other_than_company['gbca_company_shareholding_name'];?></td>
									<td><?php echo $type_of_concern_other_than_company['gbca_company_shareholding_percentage']; ?></td>
									
								</tr>
								<?php
                                    $i++;

                                  }
                                } 
                                 else
                                { ?>
                                <tr><td colspan="4" style="text-align:center">No Data Inserted.</td></tr>
                                <?php }?>
                                </tbody>
						</table>
                    </div>
                    <div class="col-md-12">
                  <div class="col-md-12">
                        <div class="pull-right">
     <!-- <button href="#" type="button" id="drftBtn">Download</button> -->
     <button onclick="window.print()"  type="button">Print</button>
     </div>

     <!-- <a href="javascript:window.print()" class="button print">Print Page</a> -->
  
                    </div>
        </div>            
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
</div>
 


<footer class="footer">
    <div class="container-fluid">
     <p>GBCA & Associates LLP, Chartered Accountants. © 2021 All Rights Reserved. Powered by OneRoof Technologies LLP.</p>
   </div>
   </footer>
   </div>
   

        </div>
      </div>



</div>
</body>
</html>
