<?php include 'includes/header.php'; 
 //session_start();

require_once("lib/helper.php");

$sub_id=$_COOKIE["company_detail_id"];

?>
<!DOCTYPE html>

<html lang="en">
<body>


		<div class="page-container hidden-on-narrow">
			<div class="pdf-page size-a4" style="margin: 0 auto;
			color: #333;
			position: relative;
			background:#fff bottom center no-repeat;
			width: 8.3in; height: auto;">
				<div class="pdf-header" style="position: absolute;
				top: .5in;
				height: .6in;
				left: 30px;
				right: .5in;">
					<span class="company-logo">
						<img src="assets/img/logo.png" style="height: 70px;" alt="logo">
					</span>

				</div>

				<div class="for" style="position: absolute;
				top: 0.3in;
				left: 2.3in;
				width: 59%;
				font-size: 18px;
				color: #254796;
				text-decoration: underline;">
					<h3>Report Card for Eligibility Test of Section 185 of the Companies Act, 2013
					</h3>
				</div>
      <?php
 
                //$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= $sub_id");
          
           {
           ?>


				<div class="pdf-body" style="position: absolute;
				top: 9%;
				bottom: 1.2in;
				left: 0%;
				right: .5in;">
					<div class="from" style="position: absolute;
					top: 1.5in;
					right: .5in;
					width: 2.5in;">
						<h3>Date:<?= $detail[0]["company_detail_cutoff_date"]; ?></h3>
						<h3>Checker:<?= $detail[0]["company_detail_checker_name"]; ?></h3>
			
					</div>
					<div class="co-name" style="position: absolute;
					top: 1.5in;
					left: .5in;
					width: 100%;">
						<h3><?=$detail[0]["company_name"]; ?></h3>
						<h3>Maker:<?=$detail[0]["company_detail_maker_name"]; ?></h3>
						
<?php
             }
            ?>


                 
						
						<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
                          $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" style="width: 100%;
						margin: 0 auto 3em 0;
						border-collapse: collapse;">



							<thead>
								<tr>
									<th scope="col" style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 5%;
		font-size: 0.9em;
		text-align: left;">Sr. No.</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Parties</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Nature of relation </th>
								</tr>
							</thead>
							<tbody>

								<?php

                            if(is_array($company_arr))
                            {
                              $i = 1;
                              foreach($company_arr as $company)
                              {
                                ?>
								<tr>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 5%;
									font-size: 0.9em;
									text-align: left;"><?php echo $i; ?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $company['sub_company_type_name'];?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $company['sub_company_name']; ?></td>
										
								</tr>
									<?php
                                    $i++;

                                  }
                                } ?>
							</tbody>
						</table>
						<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" style="width: 100%;
						margin: 0 auto 3em 0;
						border-collapse: collapse;">
							<thead>

								<tr>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 5%;
		font-size: 0.9em;
		text-align: left;">Sr. No.</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Parties</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Nature of relation </th>
								</tr>
							</thead>
							<tbody>
								<?php

                            if(is_array($loan_arr))
                            {
                              $i = 1;
                              foreach($loan_arr as $loan)
                              {
                                ?>
								<tr>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 5%;
									font-size: 0.9em;
									text-align: left;"><?php echo $i; ?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $loan['sub_company_type_name'];?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $loan['sub_company_name']; ?></td>
								</tr>
									<?php
                                    $i++;

                                  }
                                } ?>
							
							</tbody>
						</table>
						<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" style="width: 100%;
						margin: 0 auto 3em 0;
						border-collapse: collapse;">
							<thead>
								<tr>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 5%;
		font-size: 0.9em;
		text-align: left;">Sr. No.</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Parties</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Nature of relation </th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Remark </th>
								</tr>
							</thead>
							<tbody>

								<?php

                            if(is_array($wholly_arr))
                            {
                              $i = 1;
                              foreach($wholly_arr as $wholly)
                              {
                                ?>
								<tr>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 5%;
									font-size: 0.9em;
									text-align: left;"><?php echo $i; ?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $wholly['sub_company_type_name'];?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $wholly['sub_company_name']; ?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"></td>
								</tr>
								
								<?php
                                    $i++;

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

						<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. <br> (If such conditions are not met, the transaction shall be treated as non-compliant)</p>
						<table cellpadding="0" cellspacing="0" style="width: 100%;
						margin: 0 auto 3em 0;
						border-collapse: collapse;">
							<thead>
								<tr>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 5%;
		font-size: 0.9em;
		text-align: left;">Sr. No.</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Parties</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Nature of relation </th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Condition </th>
								</tr>
							</thead>
							<tbody>
									<?php

                            if(is_array($parties_arr))
                            {
                              $i = 1;
                              foreach($parties_arr as $parties)
                              {
                                ?>
								<tr>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 5%;
									font-size: 0.9em;
									text-align: left;"><?php echo $i; ?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $parties['sub_company_type_name'];?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $parties['sub_company_name']; ?></td>
										<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"></td>
								</tr>
								
								<?php
                                    $i++;

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

						<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 <br> (unless the borrower is Wholly Owned Subsidiary).		</p>
						<table cellpadding="0" cellspacing="0" style="width: 100%;
						margin: 0 auto 3em 0;
						border-collapse: collapse;">
							<thead>
								<tr>
									<th scope="col" style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 5%;
		font-size: 0.9em;
		text-align: left;">Sr. No.</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Parties</th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Nature of relation </th>
									<th scope="col"style="background: rgba(20,133,204,0.2);
									border: 1px solid #CCC;
		padding: 5px;
		width: 20%;
		font-size: 0.9em;
		text-align: left;">Transaction Type </th>
								</tr>
							</thead>
							<tbody>
                               	<?php

                            if(is_array($given_arr))
                            {
                              $i = 1;
                              foreach($given_arr as $given)
                              {
                                ?>

								
								<tr>
									<td scope="col" style="border: 1px solid #CCC;
									padding: 5px;
									width: 5%;
									font-size: 0.9em;
									text-align: left;"><?php echo $i; ?></td>
									<td  scope="col" style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $given['sub_company_type_name'];?></td>
									<td scope="col" style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"><?php echo $given['sub_company_name']; ?></td>
									<td style="border: 1px solid #CCC;
									padding: 5px;
									width: 20%;
									font-size: 0.9em;
									text-align: left;"></td>
									
								</tr>
								<?php
                                    $i++;

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

						<!-- <h3>Maker: Dummy text</h3>
						<h3>Checker: Dummy text</h3> -->
						<h3 style="text-align:right;font-size: 1.07em;">Date of Export:<?=date('d F Y')?></h3>

						</div>

						<div class="data1">

						</div>

					</div>

				</div>
			</div>
			<div class="responsive-message"></div>
		</div>
	</body>