
<?php include 'includes/header.php';
require_once("lib/helper.php");
session_start();

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

    width: 6%;

  }

  th:nth-child(4), td:nth-child(4){

    width: 20%;

  }
  /*.tooltip:hover .tooltiptext {
  visibility: visible;
}*/
</style>
<body> 
<div id="wrapper" class="active">  
    
     <?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">


     <?php
     
           if(isset($_SESSION["company_edit_id"]))
          {
              $id=$_SESSION["company_edit_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 Companies Act, 2013</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" >Export as PDF</button></a>
						<button href="#" title="Export as Excel" onClick="location.href='export_to_excel.php?status=1'" type="button" class="report-btn">Export as EXCEL</button>

     </div>
               <div class="col-md-12 col-12">
                 <h1><?= $detail[0]["company_name"]; ?></h1>

               </div>
               <div class="col-md-6 col-6">
                 <h5><?= $detail[0]["section_name"]; ?></h5>
               </div>
               <div class="col-md-6 col-6">
                 <h5>Date: <?=date('d F Y')?></h5>
               </div>
               <div class="col-md-6 col-6">
                 <h5>Made By: <?= $detail[0]["company_detail_maker_name"]; ?></h5>
               </div>
               <div class="col-md-6 col-6">
                 <h5>Checked By: <?= $detail[0]["company_detail_checker_name"]; ?></h5>
               </div>
            <?php
          }
          ?>



   </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">
    
                    
                   
                    <div class="col-md-12 mt-5">
                        <p>A. List of Parties to whom the company cannot advance any Loan or Provide any Security and Give any guarantee in respect of loan taken by such party</p>

                        <?php
                         if(isset($_SESSION["company_edit_id"]))
                        {
                            $id=$_SESSION["company_edit_id"];
                          $company_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 1 THEN 'Holding Companies'
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'
    WHEN sub_company_type_id = 4 THEN 'Managing Director'
    WHEN sub_company_type_id = 5 THEN 'Whole time directors'
    WHEN sub_company_type_id = 6 THEN 'Director of an Company'
    WHEN sub_company_type_id = 7 THEN 'Relative of directors'
    WHEN sub_company_type_id = 8 THEN 'Partner of directors in any firm (incl. LLP)'
     WHEN sub_company_type_id = 9 THEN 'Firm (incl. LLP) in which director is a partner'
    WHEN sub_company_type_id = 10 THEN 'Firm (incl. LLP) in which relative of director is a partner'
    WHEN sub_company_type_id = 11 THEN 'Private Companies in which director is a director'
    WHEN sub_company_type_id = 12 THEN 'Private Companies in which director is a Member'
    WHEN sub_company_type_id = 13 THEN 'Director of holding company'
    WHEN sub_company_type_id = 14 THEN 'Companies / LLPs wherein director either singly or jointly with other directors of lending company has 25%'
    WHEN sub_company_type_id = 15 THEN 'any directors of lending company'
    WHEN sub_company_type_id = 16 THEN 'Given Loan to'
    WHEN sub_company_type_id = 17 THEN 'Loan Represented as Book debt'
    WHEN sub_company_type_id = 18 THEN 'Guarantee Given in respect of Loan taken by'
    ELSE 'Security Provided to'
END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$id' AND (sub_company_type_id=6 OR sub_company_type_id=7 OR sub_company_type_id=8 OR sub_company_type_id=10 OR sub_company_type_id=13)");
                              // echo "<pre>";print_r($company_arr);echo "</pre>";
                              //print_r($company_arr);
                          $loan_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'ELSE 'Security Provided to' END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$id' AND sub_company_type_id=2");

                            $wholly_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'ELSE 'Security Provided to' END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$id' AND sub_company_type_id=3");

    $parties_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 1 THEN 'Holding Companies'
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'
    WHEN sub_company_type_id = 4 THEN 'Managing Director'
    WHEN sub_company_type_id = 5 THEN 'Whole time directors'
    WHEN sub_company_type_id = 6 THEN 'Director of an Company'
    WHEN sub_company_type_id = 7 THEN 'Relative of directors'
    WHEN sub_company_type_id = 8 THEN 'Partner of directors in any firm (incl. LLP)'
     WHEN sub_company_type_id = 9 THEN 'Firm (incl. LLP) in which director is a partner'
    WHEN sub_company_type_id = 10 THEN 'Firm (incl. LLP) in which relative of director is a partner'
    WHEN sub_company_type_id = 11 THEN 'Private Companies in which director is a director'
    WHEN sub_company_type_id = 12 THEN 'Private Companies in which director is a Member'
    WHEN sub_company_type_id = 13 THEN 'Director of holding company'
    WHEN sub_company_type_id = 14 THEN 'Companies / LLPs wherein director either singly or jointly with other directors of lending company has 25%'
    WHEN sub_company_type_id = 15 THEN 'any directors of lending company'
    WHEN sub_company_type_id = 16 THEN 'Given Loan to'
    WHEN sub_company_type_id = 17 THEN 'Loan Represented as Book debt'
    WHEN sub_company_type_id = 18 THEN 'Guarantee Given in respect of Loan taken by'
    ELSE 'Security Provided to'
END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$id' AND (sub_company_type_id=4 OR sub_company_type_id=5 OR sub_company_type_id=11 OR sub_company_type_id=12 OR sub_company_type_id=14 OR sub_company_type_id=15)");

                             
                               $given_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 1 THEN 'Holding Companies'
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'
    WHEN sub_company_type_id = 4 THEN 'Managing Director'
    WHEN sub_company_type_id = 5 THEN 'Whole time directors'
    WHEN sub_company_type_id = 6 THEN 'Director of an Company'
    WHEN sub_company_type_id = 7 THEN 'Relative of directors'
    WHEN sub_company_type_id = 8 THEN 'Partner of directors in any firm (incl. LLP)'
     WHEN sub_company_type_id = 9 THEN 'Firm (incl. LLP) in which director is a partner'
    WHEN sub_company_type_id = 10 THEN 'Firm (incl. LLP) in which relative of director is a partner'
    WHEN sub_company_type_id = 11 THEN 'Private Companies in which director is a director'
    WHEN sub_company_type_id = 12 THEN 'Private Companies in which director is a Member'
    WHEN sub_company_type_id = 13 THEN 'Director of holding company'
    WHEN sub_company_type_id = 14 THEN 'Companies / LLPs wherein director either singly or jointly with other directors of lending company has 25%'
    WHEN sub_company_type_id = 15 THEN 'any directors of lending company'
    WHEN sub_company_type_id = 16 THEN 'Given Loan to'
    WHEN sub_company_type_id = 17 THEN 'Loan Represented as Book debt'
    WHEN sub_company_type_id = 18 THEN 'Guarantee Given in respect of Loan taken by'
    ELSE 'Security Provided to'
END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$id' AND (sub_company_type_id=16 OR sub_company_type_id=17 OR sub_company_type_id=18 OR sub_company_type_id=19)");
  
                        }
                        else
                        {
                            $sub_id=$_COOKIE["company_detail_id"];
                         $company_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 1 THEN 'Holding Companies'
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'
    WHEN sub_company_type_id = 4 THEN 'Managing Director'
    WHEN sub_company_type_id = 5 THEN 'Whole time directors'
    WHEN sub_company_type_id = 6 THEN 'Director of an Company'
    WHEN sub_company_type_id = 7 THEN 'Relative of directors'
    WHEN sub_company_type_id = 8 THEN 'Partner of directors in any firm (incl. LLP)'
     WHEN sub_company_type_id = 9 THEN 'Firm (incl. LLP) in which director is a partner'
    WHEN sub_company_type_id = 10 THEN 'Firm (incl. LLP) in which relative of director is a partner'
    WHEN sub_company_type_id = 11 THEN 'Private Companies in which director is a director'
    WHEN sub_company_type_id = 12 THEN 'Private Companies in which director is a Member'
    WHEN sub_company_type_id = 13 THEN 'Director of holding company'
    WHEN sub_company_type_id = 14 THEN 'Companies / LLPs wherein director either singly or jointly with other directors of lending company has 25%'
    WHEN sub_company_type_id = 15 THEN 'any directors of lending company'
    WHEN sub_company_type_id = 16 THEN 'Given Loan to'
    WHEN sub_company_type_id = 17 THEN 'Loan Represented as Book debt'
    WHEN sub_company_type_id = 18 THEN 'Guarantee Given in respect of Loan taken by'
    ELSE 'Security Provided to'
END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$sub_id' AND (sub_company_type_id=6 OR sub_company_type_id=7 OR sub_company_type_id=8 OR sub_company_type_id=10 OR sub_company_type_id=13)");
                              // echo "<pre>";print_r($company_arr);echo "</pre>";
                              //print_r($company_arr);
                          $loan_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'ELSE 'Security Provided to' END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$sub_id' AND sub_company_type_id=2");

                            $wholly_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'ELSE 'Security Provided to' END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$sub_id' AND sub_company_type_id=3");

    $parties_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 1 THEN 'Holding Companies'
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'
    WHEN sub_company_type_id = 4 THEN 'Managing Director'
    WHEN sub_company_type_id = 5 THEN 'Whole time directors'
    WHEN sub_company_type_id = 6 THEN 'Director of an Company'
    WHEN sub_company_type_id = 7 THEN 'Relative of directors'
    WHEN sub_company_type_id = 8 THEN 'Partner of directors in any firm (incl. LLP)'
     WHEN sub_company_type_id = 9 THEN 'Firm (incl. LLP) in which director is a partner'
    WHEN sub_company_type_id = 10 THEN 'Firm (incl. LLP) in which relative of director is a partner'
    WHEN sub_company_type_id = 11 THEN 'Private Companies in which director is a director'
    WHEN sub_company_type_id = 12 THEN 'Private Companies in which director is a Member'
    WHEN sub_company_type_id = 13 THEN 'Director of holding company'
    WHEN sub_company_type_id = 14 THEN 'Companies / LLPs wherein director either singly or jointly with other directors of lending company has 25%'
    WHEN sub_company_type_id = 15 THEN 'any directors of lending company'
    WHEN sub_company_type_id = 16 THEN 'Given Loan to'
    WHEN sub_company_type_id = 17 THEN 'Loan Represented as Book debt'
    WHEN sub_company_type_id = 18 THEN 'Guarantee Given in respect of Loan taken by'
    ELSE 'Security Provided to'
END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$sub_id' AND (sub_company_type_id=4 OR sub_company_type_id=5 OR sub_company_type_id=11 OR sub_company_type_id=12 OR sub_company_type_id=14 OR sub_company_type_id=15)");

                             
                               $given_arr = $obj->select("*,CASE
    WHEN sub_company_type_id = 1 THEN 'Holding Companies'
    WHEN sub_company_type_id = 2 THEN 'Subsidiary Companies'
    WHEN sub_company_type_id = 3 THEN 'Wholly Owned Subidiary Companies'
    WHEN sub_company_type_id = 4 THEN 'Managing Director'
    WHEN sub_company_type_id = 5 THEN 'Whole time directors'
    WHEN sub_company_type_id = 6 THEN 'Director of an Company'
    WHEN sub_company_type_id = 7 THEN 'Relative of directors'
    WHEN sub_company_type_id = 8 THEN 'Partner of directors in any firm (incl. LLP)'
     WHEN sub_company_type_id = 9 THEN 'Firm (incl. LLP) in which director is a partner'
    WHEN sub_company_type_id = 10 THEN 'Firm (incl. LLP) in which relative of director is a partner'
    WHEN sub_company_type_id = 11 THEN 'Private Companies in which director is a director'
    WHEN sub_company_type_id = 12 THEN 'Private Companies in which director is a Member'
    WHEN sub_company_type_id = 13 THEN 'Director of holding company'
    WHEN sub_company_type_id = 14 THEN 'Companies / LLPs wherein director either singly or jointly with other directors of lending company has 25%'
    WHEN sub_company_type_id = 15 THEN 'any directors of lending company'
    WHEN sub_company_type_id = 16 THEN 'Given Loan to'
    WHEN sub_company_type_id = 17 THEN 'Loan Represented as Book debt'
    WHEN sub_company_type_id = 18 THEN 'Guarantee Given in respect of Loan taken by'
    ELSE 'Security Provided to'
END as sub_company_name","gbca_sub_company_mapping","company_detail_id='$sub_id' AND (sub_company_type_id=16 OR sub_company_type_id=17 OR sub_company_type_id=18 OR sub_company_type_id=19)");
   
                        }
                                ?>
                        
                        <table cellpadding="0" cellspacing="0">
							<thead>
								<tr>
									<th scope="col">Sr. No.</th>
									<th scope="col">Parties</th>
									<th scope="col">Nature of relation </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['sub_company_type_name'];?></td>
									<td><?php echo $company['sub_company_name']; ?></td>
								</tr>
								<?php
                                    $i++;

                                  }
                                } ?>
								
							</tbody>
						</table>
                    </div>

                    <div class="col-md-12">
                        <p>B. List of Parties to whom the company cannot advance any Loan but can Provide any Security or Give any guarantee in respect of loan taken by such party</p>
                    <table cellpadding="0" cellspacing="0">
							<thead>
								<tr>
									<th scope="col">Sr. No.</th>
									<th scope="col">Parties</th>
									<th scope="col">Nature of relation </th>
								</tr>
							</thead>
							<tbody>
								<?php

                            if(is_array($loan_arr))
                            {
                              $i = 1;
                              foreach($loan_arr as $loan)
                              {
                                ?>
								<tr>
									<td><?php echo $i; ?></td>
									<td><?php echo $loan['sub_company_type_name'];?></td>
									<td><?php echo $loan['sub_company_name']; ?></td>
								</tr>
								<?php
                                    $i++;

                                  }
                                } ?>
								
							</tbody>
						</table>
                    </div>

                    <div class="col-md-12">
                    <p>C. List of Parties to whom the company can 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">Parties</th>
									<th scope="col">Nature of relation </th>
									<th scope="col">Remark </th>
								</tr>
							</thead>
							<tbody>
								<?php

                            if(is_array($wholly_arr))
                            {
                              $i = 1;
                              foreach($wholly_arr as $wholly)
                              {
                                ?>
								<tr>
									<td><?php echo $i; ?></td>
									<td><?php echo $wholly['sub_company_type_name'];?></td>
									<td><?php echo $wholly['sub_company_name']; ?></td>
									<td></td>
								</tr>
								<?php
                                    $i++;

                                  }
                                } ?>
							</tbody>
						</table>
                    </div>

                    <div class="col-md-12">
                        <p>D. List of Parties to whom the company can advance Loan or Provide any Security or Give any guarantee in respect of loan taken by such party provided certain conditions are met. (If such conditions are not met, the transaction shall be treated as non-compliant)</p>
    					<table cellpadding="0" cellspacing="0">
							<thead>
								<tr>
									<th scope="col">Sr. No.</th>
									<th scope="col">Parties</th>
									<th scope="col">Nature of relation </th>
									<th scope="col">Condition</th>
								</tr>
							</thead>
							<tbody>
																<?php

                            if(is_array($parties_arr))
                            {
                              $i = 1;
                              foreach($parties_arr as $parties)
                              {
                                ?>
								<tr>
									<td><?php echo $i; ?></td>
									<td><?php echo $parties['sub_company_type_name'];?></td>
									<td><?php echo $parties['sub_company_name']; ?></td>
									<td></td>
								</tr>
								<?php
                                    $i++;

                                  }
                                } ?>

							</tbody>
						</table>
                    </div>
                    <div class="col-md-12">
                        <p>E. List of Parties with whom the company has already undertaken specified transactions which require due attention of the management as the same may either be not in compliance with the provisions or may require to fulfill one or the other condition to comply with the provisions of Sec 185 of the Companies Act, 2013 (unless the borrower is Wholly Owned Subsidiary).</p>
						<table cellpadding="0" cellspacing="0">

							<thead>
								<tr>
									<th scope="col">Sr. No.</th>
									<th scope="col">Parties</th>
									<th scope="col">Nature of relation </th>
									<th scope="col">Transaction Type
                               </th>
								</tr>
							</thead>
							<tbody>
							
								<?php

                            if(is_array($given_arr))
                            {
                              $i = 1;
                              foreach($given_arr as $given)
                              {
                                ?>
								<tr>
									<td><?php echo $i; ?></td>
									<td><?php echo $given['sub_company_type_name'];?></td>
									<td><?php echo $given['sub_company_transaction_relation']; ?></td>
									<td><?php echo $given['sub_company_name']; ?></td>
									
								</tr>
								<?php
                                    $i++;

                                  }
                                } ?>
							</tbody>
						</table>
                        <div class="pull-right">
     <!-- <button href="#" type="button" id="drftBtn">Download</button> -->

     <iframe src="report.php" style="display:none;" name="frame"></iframe>

    <!-- <input type="button" onclick="frames['frame'].print()" value="printletter"> -->

      <!--<button onclick="frames['frame'].print()"  type="button">Print</button> -->
      <button onclick="window.print()"  type="button">Print</button> 
   <!-- <script>
     
     function doPrint() {
    window.print();            
    document.location.href = "report.php"; 
}
   </script> -->
     <!-- <a href="javascript:window.print()" class="button print">Print Page</a> -->
   </div>
                    </div>
                    
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
</div>
 


<footer class="footer no-print">
    <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>
</body>
</html>
