<?php

$where = " WHERE 1=1";
$next_page_condition = "";


if($_REQUEST['hide_top']){
	$next_page_condition.="&hide_top=1";
}
if($_REQUEST['hide_left']){
	$next_page_condition.="&hide_left=1";
}

$qot_id = $_REQUEST['id'];

$query = "SELECT * FROM quotation where id  = '".$qot_id."' ";
$sql= mysqli_query($conn,$query);
$result= mysqli_num_rows($sql);
$row = mysqli_fetch_assoc($sql);
$row = utility::validate_crypt_data($row);
$customer_name = $gsi->getCustomerById($row['customer_id']);
$part_number =  $row['part_number'];
$part_description =  $row['part_description']; 
$drawing_issue =  $row['drawing_issue']; 
$model_number =  $row['model_number'];
$volume =  $row['volume']; 
$quotation_number =  $row['quotation_number']; 

$sql_feasibility= "SELECT * FROM quot_feasibility WHERE quot_id ='".$qot_id."' ";
$result_feasibility = mysqli_query($conn,$sql_feasibility);
$row_feasibility = mysqli_fetch_array($result_feasibility);
$row_feasibility = utility::validate_crypt_data($row_feasibility);
$risk_assessment_comments  = $row_feasibility['risk_assessment_comments'];
$feasibility_assessment_comment  = $row_feasibility['feasibility_assessment_comment'];

$hide_button  = $_REQUEST['hide_top'];
if($hide_button == 1){
	$hide ="hide";
}else{
	$hide ="";
}

?>

<style type="text/css">
@page {
   margin: 0;
   /* size: landscape; */
   size: potrait; /* DIN A4 standard, Europe */
}

@media print{
	.bgblack{
		background-color: #000;
	}
	
	.font50print40{
		font-size:40px;
	}
	
	.content-wrapper, .right-side {
		background-color: #fff;
	}
	.box {
		border-top: 0 solid #d2d6de !important;
		box-shadow: none !important;
	}
	p{
		white-space: inherit !important;
	}
	
	.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
        float: left;
   }
   .col-sm-12 {
        width: 100%;
   }
   .col-sm-11 {
        width: 91.66666667%;
   }
   .col-sm-10 {
        width: 83.33333333%;
   }
   .col-sm-9 {
        width: 75%;
   }
   .col-sm-8 {
        width: 66.66666667%;
   }
   .col-sm-7 {
        width: 58.33333333%;
   }
   .col-sm-6 {
        width: 50%;
   }
   .col-sm-5 {
        width: 41.66666667%;
   }
   .col-sm-4 {
        width: 33.33333333%;
   }
   .col-sm-3 {
        width: 25%;
   }
   .col-sm-2 {
        width: 16.66666667%;
   }
   .col-sm-1 {
        width: 8.33333333%;
   }
}

.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
        float: left;
   }
   .col-sm-12 {
        width: 100%;
   }
   .col-sm-11 {
        width: 91.66666667%;
   }
   .col-sm-10 {
        width: 83.33333333%;
   }
   .col-sm-9 {
        width: 75%;
   }
   .col-sm-8 {
        width: 66.66666667%;
   }
   .col-sm-7 {
        width: 58.33333333%;
   }
   .col-sm-6 {
        width: 50%;
   }
   .col-sm-5 {
        width: 41.66666667%;
   }
   .col-sm-4 {
        width: 33.33333333%;
   }
   .col-sm-3 {
        width: 25%;
   }
   .col-sm-2 {
        width: 16.66666667%;
   }
   .col-sm-1 {
        width: 8.33333333%;
   }
   .new-page {
	page-break-before: always;
}


</style>
<div class="col-lg-12 <?php $hide?> hide" style="">
  <?if($_SERVER['HTTP_HOST'] =="localhost"){?>
		 <button type="button" id="back" name="back" value="back"  style="float:right; margin-top:-1%;margin-bottom:8px;" class="btn btn-success <?=$hide;?>"><a href="<?=$config->frontEndURL?>/admin/quotation_management/index?page=feasibility_sheet_pdf&id=<?=$_REQUEST['id'];?>&hide_top=1&hide_left=1" target="_blank" style="color:white;">Generate PDF</a></button>
	<?}else{?>
		<button type="button" id="back" name="back" value="back"  style="float:right; color:white; margin-top:-1%;margin-bottom:8px;" class="btn btn-success <?=$hide;?>"><a href="<?=$config->frontEndURL;?>quotation_feasibility_sheet_pdf.php?id=<?=$_REQUEST['id'];?>&pdf_name=feasibility_sheet_pdf" target="_blank"> <i class="fa fa-fw fa-file-pdf"></i>Download PDF</a></button>
	<?}?>
	
</div>

<?php
if (
    $_REQUEST['page'] != 'view_quotation_progress' && 
    $_REQUEST['page'] != 'front_sheet_pdf' && 
    $_REQUEST['page'] != 'procured_sheet_pdf'
) {
    include('front_sheet_pdf.php'); 
}
?>

<?php
if (
    $_REQUEST['page'] != 'view_quotation_progress' && 
    $_REQUEST['page'] != 'front_sheet_pdf' && 
    $_REQUEST['page'] != 'procured_sheet_pdf'
) {
    include('procured_sheet_pdf.php'); 
}
?>
<div class="container-fluid" id="print_section">
  <div class="new-page">
    <div class="row justify-content-center">
        <div class="col-lg-10">
            <div class=" border-4 border">
                <div class="card-body">
				    <h3 class="text-center font-weight-bold mb-1">Contract Feasibility</h3>
					<p class="text-center font-weight-bold mb-0">"A" Rated QAF's only</p>
                    <div class="row pb-2 p-2">
                        <div class="col-sm-6">
							 <p class="mb-0"><strong>Thermotec Plastics Ltd</strong></p>
							 <p class="mb-0">Unit 8A, Electra Park Ind Est</p>
							 <p class="mb-0">Electric Avenue</p>
							 <p class="mb-0">Witton, Birmingham.</p>
							 <p>B6 7EB</p>	 
							 <p class="mb-0">Tel: 0121 327 7800</p>
							 <p>Fax: 0121 327 4799</p>	
                        </div>
                        <div class="col-sm-6 text-right">
							 <p class="mb-0">Thermo 710</p>
							 <p>Issue 1</p>
                        </div>
                    </div>
					<div class="row pb-2 p-2">
                        <div class="col-sm-12">
							<div class="row">
								<div class="col-sm-5 text-left">Date:</div>
								<div class="col-sm-7"><?php echo date("d-m-Y") ?></div>
							</div>
							<div class="row">
								<div class="col-sm-5 text-left">Part Number:</div>
								<div class="col-sm-7"><?php echo $part_number;?></div>
							</div>
							<div class="row">
								<div class="col-sm-5 text-left">Part Description:</div>
								<div class="col-7"><?php echo $part_description;?></div>
							</div>
							<div class="row">
								<div class="col-sm-5 text-left">Customer:</div>
								<div class="col-sm-7"><?php echo $customer_name;?></div>
							</div>
							<div class="row">
								<div class="col-sm-5 text-left">QAF Reference:</div>
								<div class="col-sm-7"><?php echo $quotation_number;?></div>
							</div>
						</div>
                    </div>
					<div class="row pb-2 p-2" style="width:100%; float:left; margin-top:15px;">
					  <div class="col-sm-12">
						   <p class="mb-0">RISK ASSESSMENT / COMMENTS (Consider any risks to the Company or Customer)</p>
						   <p><?php echo $risk_assessment_comments;?></p>
						   
						   <p class="mb-0" style="margin-top:10px;">FEASIBILITY ASSESSMENTS/COMMENTS (Consider any feasibility issues for the company of customer)</p>
						   <p><?php echo $feasibility_assessment_comment;?></p>
					  </div>   
                    </div>
               </div>
            </div>
        </div>
    </div>
</div>
</div>