<?php  
require_once("../lib/db_functions.php");
// print_r($_POST);
require_once 'dompdf/autoload.inc.php';
          use Dompdf\Dompdf;
           $dompdf = new Dompdf();
$response = array();  
	
   $company_edit_id = $obj->data_filter($_POST['company_detail_id']);
  $type_company     = $obj->data_filter($_POST['company-select']);
   $substantial_interest= $obj->data_filter($_POST['substantial_interest']);
  
	$financ_year      = $obj->data_filter($_POST['finan-year']);
	$other      = $obj->data_filter($_POST['other_company_name']);
	$cut_off          = $obj->data_filter(date("Y-m-d",strtotime($_POST['date'])));
	if($company_edit_id != "")
	{
	    setcookie($cookie_name, $cookie_value, time() - (60 * 60), "/");
	    $_SESSION["company_detail_id"] = $company_edit_id;

	     $section_arr = $obj_dba_func->set_section_22e1('',$company_edit_id,$type_company,$financ_year,$other,$cut_off,$substantial_interest);
           
        if($section_arr['n'] == 1)
		{
		   
			$response['n']   = 2;
			$response['msg'] = "step1 success"; 
			

	   }
	   else
	   {
	     
			$response['n']   = 0;
			$response['msg'] = "step1 success";   
	   }
	   
	   if($section_arr["success"] == 3)
        {
              	 
      	  $report = $obj->select("*","gbca_company_detail_master","(company_type_name='private-company' OR company_detail_substantially_interested='No') And  company_detail_id='$company_edit_id'");
                   
              	 $company_arr = $obj->select("*,gbca_company_shareholding_name,gbca_company_shareholding_percentage","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$company_detail_id' AND  gbca_company_shareholding_percentage >=10 AND gbca_company_shareholding_excel_type='1' and gbca_company_shareholding_status='1'");
                               
                              //print_r($company_arr);
                          $type_of_concern_company_arr = $obj->select("*","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$company_detail_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='$company_detail_id' and gbca_company_shareholding_type_of_concern != 'company' and gbca_company_shareholding_status='1' and gbca_company_shareholding_excel_type='2'"); 

              	 	
              	 if(!empty($report))
                {
                    
                $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'");
                
           
              $section=$detail[0]["section_name"];
              $company_name=trim($detail[0]["company_name"]);
              $preparation=date("d F Y");
              $maker=$detail[0]["company_detail_maker_name"];
              $checker=$detail[0]["company_detail_checker_name"];
              $today_date=date("d M Y");
              $date=$detail[0]["company_detail_preparation_date"];
           
              $time=time();
                // $res='';
                     $res .='<!DOCTYPE html><html><head><style>table{width:100%;}th, td{padding:10px;}th{background: rgba(20,133,204,0.2);}table, th, td{border: 1px solid black; border-collapse: collapse; text-align:left;}</style></head><body><table style="border:none"><tr style="border:none"> <td style="border:none"><img src="../assets/img/logo.png" style="height: 70px;" alt="logo"></td><td style="border:none"><h3 style="color:#483D8B;"><u>Report Card for Eligibility Test of Section 2(22)e of the Income Tax Act, 1961</u></h3></td></tr></table><br/><table style="border:none"><tr style="border:none"><td style="border:none"><b>'. $company_name.'</b></td><td style="border:none"><b>'.$date.'</b></td></tr><tr style="border:none"> <td style="border:none"><b>'. $maker.'</b></td><td style="border:none"><b>'. $checker.'</b></td></tr></table><br/>';
               
               
                 $res .='<p>A. List of Shareholders to whom the company cannot extend any Loan or Advance</p><table> <tr><th>Sr. No.</th><th>Name of the Shareholder</th><th>% Eq. Shareholding</th></tr>';
                 
                  if(is_array($company_arr))
                  {
                      $i = 1;
                  foreach($company_arr as $company)
                  {
                 
                 $res .='<tr><td>'.$i.'</td><td>'.$company["gbca_company_shareholding_name"].'</td><td>'.$company["gbca_company_shareholding_percentage"].'</td></tr>';
                 
                   $i++;
                  }
                  }else
                  {
                    $res .='<tr><td colspan="3" style="text-align:center">No Data Inserted.</td></tr>';  
                  }
                 
                 $res .='</table><br/><p>B. List of Concerns, being companies, to whom you cannot extend any Loan or Advancey</p><table> <tr><th>Sr. No.</th><th>Name of the Concern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                 
                  if(is_array($type_of_concern_company_arr))
                  {
                      $i = 1;
                  foreach($type_of_concern_company_arr as $type_of_concern_company)
                  {
                 
                     $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_percentage"].'</td></tr>';
                     
                      $i++;
                  }
                  }else
                  {
                    $res .='<tr><td colspan="4" style="text-align:center">No Data Inserted.</td></tr>';   
                  }
                     
                    $res .='</table><br/><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><tr><th>Sr. No.</th> <th>Name of the Concern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                    
                     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)
                  {
                  
                    
                        $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_percentage"].'</td></tr>';
                  }
                  }else
                  {
                     $res .='<tr><td  colspan="4" style="text-align:center">No Data Inserted.</td></tr>';    
                  }
    
                 
                  $res .='</table><br/>'; 
		 
		   $paper = 'A4';
				$orientation = 'orientation';
                 $company_name= str_replace(" ","_",$company_name);
				$filename =$company_name.'_'.$time.'.pdf';
				$dompdf->set_paper($paper,$orientation);
				$dompdf->load_html($res);
				$dompdf->render();
				$output = $dompdf->output();
				$file_to_save = '../pdffiles/'.$filename;
				file_put_contents($file_to_save, $output);
				$file = $file_to_save;
				$file_size = filesize($file);
				$handle = fopen($file, "r");
				$content = fread($handle, $file_size);
				fclose($handle);
                
               	$destination_url = '../pdffiles/';
                	
                $documents = $obj_dba_func->store_pdf($company_detail_id,'',$filename); 
                  $response['n']   = 1;
				  $response['msg'] = "applicable";
                }
              	else
                {
               		
                 
                    // print_r('applicable');
                    $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'");
           
              $section=$detail[0]["section_name"];
              $company_name=trim($detail[0]["company_name"]);
              $preparation=date("d F Y");
              $maker=$detail[0]["company_detail_maker_name"];
              $checker=$detail[0]["company_detail_checker_name"];
              $today_date=date("d M Y");
              $date=$detail[0]["company_detail_preparation_date"];
           
              $time=time();
                // $res='';
                     $res .='<!DOCTYPE html><html><head><style>table{width:100%;}th, td{padding:10px;}th{background: rgba(20,133,204,0.2);}table, th, td{border: 1px solid black; border-collapse: collapse; text-align:left;}</style></head><body><table style="border:none"><tr style="border:none"> <td style="border:none"><img src="../assets/img/logo.png" style="height: 70px;" alt="logo"></td><td style="border:none"><h3 style="color:#483D8B;"><u>Report Card for Eligibility Test of Section 2(22)e of the Income Tax Act, 1961</u></h3></td></tr></table><br/><table style="border:none"><tr style="border:none"><td style="border:none"><b>'. $company_name.'</b></td><td style="border:none"><b>'.$date.'</b></td></tr><tr style="border:none"> <td style="border:none"><b>'. $maker.'</b></td><td style="border:none"><b>'. $checker.'</b></td></tr></table><br/>';
               
               
                 $res .='<p>A. List of Shareholders to whom the company cannot extend any Loan or Advance</p><table> <tr><th>Sr. No.</th><th>Name of the Shareholder</th><th>% Eq. Shareholding</th></tr>';
                 
                //   if(is_array($company_arr))
                //   {
                //       $i = 1;
                //   foreach($company_arr as $company)
                //   {
                 
                //  $res .='<tr><td>'.$i.'</td><td>'.$company["gbca_company_shareholding_name"].'</td><td>'.$company["gbca_company_shareholding_percentage"].'</td></tr>';
                 
                //   $i++;
                //   }
                //   }else
                //   {
                    $res .='<tr><td colspan="3" style="text-align:center">No Data Inserted.</td></tr>';  
                //   }
                 
                 $res .='</table><br/><p>B. List of Concerns, being companies, to whom you cannot extend any Loan or Advancey</p><table> <tr><th>Sr. No.</th><th>Name of the Comncern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                 
                //   if(is_array($type_of_concern_company_arr))
                //   {
                //       $i = 1;
                //   foreach($type_of_concern_company_arr as $type_of_concern_company)
                //   {
                 
                //      $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_percentage"].'</td></tr>';
                     
                //       $i++;
                //   }
                //   }else
                //   {
                    $res .='<tr><td colspan="4" style="text-align:center">No Data Inserted.</td></tr>';   
                //   }
                     
                    $res .='</table><br/><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><tr><th>Sr. No.</th> <th>Name of the Concern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                    
                //      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)
                //   {
                  
                    
                //         $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_percentage"].'</td></tr>';
                //         $i++;
                //   }
                //   }else
                //   {
                     $res .='<tr><td  colspan="4" style="text-align:center">No Data Inserted.</td></tr>';    
                //   }
    
                 
                  $res .='</table><br/>'; 
		 
		   $paper = 'A4';
				$orientation = 'orientation';
                $company_name= str_replace(" ","_",$company_name);
				$filename =$company_name.'_'.$time.'.pdf';
				$dompdf->set_paper($paper,$orientation);
				$dompdf->load_html($res);
				$dompdf->render();
				$output = $dompdf->output();
				$file_to_save = '../pdffiles/'.$filename;
				file_put_contents($file_to_save, $output);
				$file = $file_to_save;
				$file_size = filesize($file);
				$handle = fopen($file, "r");
				$content = fread($handle, $file_size);
				fclose($handle);
                
               	$destination_url = '../pdffiles/'; 
                	
                $documents = $obj_dba_func->store_pdf($company_detail_id,'',$filename); 
             

                	$response['n']   = 3;
					$response['msg'] = "not applicable";
                
                }
              }
	   
	}
	 else
	 {
     unset($_SESSION["company_detail_id"]);
	if(isset($_COOKIE["company_detail_id"]))
	{	
				
	$company_detail_id=$_COOKIE["company_detail_id"];
		$section_arr = $obj_dba_func->set_section_22e1($company_detail_id,'',$type_company,$financ_year,$other,$cut_off,$substantial_interest);   
   if($section_arr['n'] == 1)
	 {
	 	$response['n']   = 1;
	 	$response['msg'] ="step1 success";
	 	
	 }
	 else
	 {
	 	$response['n']   = 0;
	 	$response['msg'] ="step1 success";
	 }
	 if($section_arr["success"]== 3)
              {
              	// print_r('in success');
              	 $report=$obj->select( "*","gbca_company_detail_master","(company_type_name='private-company' or company_detail_substantially_interested='No') And  company_detail_id=$company_detail_id");

                    // print_r($report); 
              	 $company_arr = $obj->select("*,gbca_company_shareholding_name,gbca_company_shareholding_percentage","gbca_company_shareholding_master","gbca_company_shareholding_company_id='$company_detail_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='$company_detail_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='$company_detail_id' and gbca_company_shareholding_type_of_concern != 'company' and gbca_company_shareholding_status='1' and gbca_company_shareholding_excel_type='2'"); 

              	 	
              	 if(is_array($report))
                {
                          $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 ");
           
              $section=$detail[0]["section_name"];
              $company_name=trim($detail[0]["company_name"]);
              $preparation=date("d F Y");
              $maker=$detail[0]["company_detail_maker_name"];
              $checker=$detail[0]["company_detail_checker_name"];
              $today_date=date('d M Y');
              $date=$detail[0]["company_detail_preparation_date"];
           
              $time=time();
                // $res='';
                     $res .='<!DOCTYPE html><html><head><style>table{width:100%;}th, td{padding:10px;}th{background: rgba(20,133,204,0.2);}table, th, td{border: 1px solid black; border-collapse: collapse; text-align:left;}</style></head><body><table style="border:none"><tr style="border:none"> <td style="border:none"><img src="../assets/img/logo.png" style="height: 70px;" alt="logo"></td><td style="border:none"><h3 style="color:#483D8B;"><u>Report Card for Eligibility Test of Section 2(22)e of the Income Tax Act, 1961</u></h3></td></tr></table><br/><table style="border:none"><tr style="border:none"><td style="border:none"><b>'. $company_name.'</b></td><td style="border:none"><b>'.$date.'</b></td></tr><tr style="border:none"> <td style="border:none"><b>'. $maker.'</b></td><td style="border:none"><b>'. $checker.'</b></td></tr></table><br/>';
               
               
                 $res .='<p>A. List of Shareholders to whom the company cannot extend any Loan or Advance</p><table> <tr><th>Sr. No.</th><th>Name of the Shareholder</th><th>% Eq. Shareholding</th></tr>';
                 
                  if(is_array($company_arr))
                  {
                      $i = 1;
                  foreach($company_arr as $company)
                  {
                 
                 $res .='<tr><td>'.$i.'</td><td>'.$company["gbca_company_shareholding_name"].'</td><td>'.$company["gbca_company_shareholding_percentage"].'</td></tr>';
                 
                   $i++;
                  }
                  }else
                  {
                    $res .='<tr><td colspan="3" style="text-align:center">No Data Inserted.</td></tr>';  
                  }
                 
                 $res .='</table><br/><p>B. List of Concerns, being companies, to whom you cannot extend any Loan or Advancey</p><table> <tr><th>Sr. No.</th><th>Name of the Concern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                 
                  if(is_array($type_of_concern_company_arr))
                  {
                      $i = 1;
                  foreach($type_of_concern_company_arr as $type_of_concern_company)
                  {
                 
                     $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_percentage"].'</td></tr>';
                     
                      $i++;
                  }
                  }else
                  {
                    $res .='<tr><td colspan="4" style="text-align:center">No Data Inserted.</td></tr>';   
                  }
                     
                    $res .='</table><br/><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><tr><th>Sr. No.</th> <th>Name of the Concern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                    
                     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)
                  {
                  
                    
                        $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_percentage"].'</td></tr>';
                  }
                  }else
                  {
                     $res .='<tr><td  colspan="4" style="text-align:center">No Data Inserted.</td></tr>';    
                  }
    
                 
                  $res .='</table><br/>'; 
		 
		   $paper = 'A4';
				$orientation = 'orientation';
               $company_name= str_replace(" ","_",$company_name);
				$filename =$company_name.'_'.$time.'.pdf';
				$dompdf->set_paper($paper,$orientation);
				$dompdf->load_html($res);
				$dompdf->render();
				$output = $dompdf->output();
				$file_to_save = '../pdffiles/'.$filename;
				file_put_contents($file_to_save, $output);
				$file = $file_to_save;
				$file_size = filesize($file);
				$handle = fopen($file, "r");
				$content = fread($handle, $file_size);
				fclose($handle);
                
               	$destination_url = '../pdffiles/';
                	
                $documents = $obj_dba_func->store_pdf($company_detail_id,'',$filename); 
                  $response['n']   = 1;
				  $response['msg'] = "applicable";
                }
              	else
                {
               		
                 
                    // print_r('applicable');
                    $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 ");
           
              $section=$detail[0]["section_name"];
              $company_name=$detail[0]["company_name"];
              $preparation=date("d F Y");
              $maker=$detail[0]["company_detail_maker_name"];
              $checker=$detail[0]["company_detail_checker_name"];
              $today_date=date('d M Y');
              $date=$detail[0]["company_detail_preparation_date"];
           
              $time=time();
                // $res='';
                     $res .='<!DOCTYPE html><html><head><style>table{width:100%;}th, td{padding:10px;}th{background: rgba(20,133,204,0.2);}table, th, td{border: 1px solid black; border-collapse: collapse; text-align:left;}</style></head><body><table style="border:none"><tr style="border:none"> <td style="border:none"><img src="../assets/img/logo.png" style="height: 70px;" alt="logo"></td><td style="border:none"><h3 style="color:#483D8B;"><u>Report Card for Eligibility Test of Section 2(22)e of the Income Tax Act, 1961</u></h3></td></tr></table><br/><table style="border:none"><tr style="border:none"><td style="border:none"><b>'. $company_name.'</b></td><td style="border:none"><b>'.$date.'</b></td></tr><tr style="border:none"> <td style="border:none"><b>'. $maker.'</b></td><td style="border:none"><b>'. $checker.'</b></td></tr></table><br/>';
               
               
                 $res .='<p>A. List of Shareholders to whom the company cannot extend any Loan or Advance</p><table> <tr><th>Sr. No.</th><th>Name of the Shareholder</th><th>% Eq. Shareholding</th></tr>';
                 
                //   if(is_array($company_arr))
                //   {
                //       $i = 1;
                //   foreach($company_arr as $company)
                //   {
                 
                //  $res .='<tr><td>'.$i.'</td><td>'.$company["gbca_company_shareholding_name"].'</td><td>'.$company["gbca_company_shareholding_percentage"].'</td></tr>';
                 
                //   $i++;
                //   }
                //   }else
                //   {
                    $res .='<tr><td colspan="3" style="text-align:center">No Data Inserted.</td></tr>';  
                //   }
                 
                 $res .='</table><br/><p>B. List of Concerns, being companies, to whom you cannot extend any Loan or Advancey</p><table> <tr><th>Sr. No.</th><th>Name of the Comncern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                 
                //   if(is_array($type_of_concern_company_arr))
                //   {
                //       $i = 1;
                //   foreach($type_of_concern_company_arr as $type_of_concern_company)
                //   {
                 
                //      $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_company["gbca_company_shareholding_percentage"].'</td></tr>';
                     
                //       $i++;
                //   }
                //   }else
                //   {
                    $res .='<tr><td colspan="4" style="text-align:center">No Data Inserted.</td></tr>';   
                //   }
                     
                    $res .='</table><br/><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><tr><th>Sr. No.</th> <th>Name of the Concern</th><th>Substantial Interest of</th><th>% Shareholding / % Interest</th></tr>';
                    
                //      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)
                //   {
                  
                    
                //         $res .='<tr><td>'.$i.'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_type_of_concern"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_name"].'</td><td>'.$type_of_concern_other_than_company["gbca_company_shareholding_percentage"].'</td></tr>';
                //         $i++;
                //   }
                //   }else
                //   {
                     $res .='<tr><td  colspan="4" style="text-align:center">No Data Inserted.</td></tr>';    
                //   }
    
                 
                  $res .='</table><br/>'; 
		 
		   $paper = 'A4';
				$orientation = 'orientation';
                $company_name= str_replace(" ","_",$company_name);
				$filename =$company_name.'_'.$time.'.pdf';
				$dompdf->set_paper($paper,$orientation);
				$dompdf->load_html($res);
				$dompdf->render();
				$output = $dompdf->output();
				$file_to_save = '../pdffiles/'.$filename;
				file_put_contents($file_to_save, $output);
				$file = $file_to_save;
				$file_size = filesize($file);
				$handle = fopen($file, "r");
				$content = fread($handle, $file_size);
				fclose($handle);
                
               	$destination_url = '../pdffiles/'; 
                	
                $documents = $obj_dba_func->store_pdf($company_detail_id,'',$filename); 
             

                	$response['n']   = 3;
					$response['msg'] = "not applicable";
                
                }
              }
	
	}
}
 	
echo json_encode($response);

?>