<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title></title>
	
	
	 <style>
        
        h1,h2,h3,h4,h5,h6{
            margin: 0;
            padding: 0;
        }
        p{
            margin: 0;
            padding: 0;
        }
        .container7{
            width: 100%;
            margin-right: auto;
            margin-left: auto;
			background-color: #F6F6F6;
			page-break-after: always;
        }
        .brand-section{
           background-color: #0059aa;
           padding: 10px 40px;
		   border: 1px solid gray;
		   height:100px;
        }
		.brand-section1{
           background-color: #F6F6F6;
           padding: 10px 40px;
		   font-size:3px;
		   border: 1px solid gray;
        }
		.wrd{
             text-align: left;
			font-size:12px;
        }
        .logo{
            width: 50%;
        }
		.tbl{
		background-color: #F6F6F6;	
		}

        .row{
            display: flex;
            flex-wrap: wrap;
        }
        .col-6{
            width: 60%;
            flex: 0 0 auto;
			/*background-color: #F6F6F6;*/
        }
        .text-white{
            color: #fff;
			font-size:10px;
        }
		.text-black{
			font-size:10px;
        }
        .company-details{
            float: right;
            text-align: right;
        }
        .body-section{
            padding: 16px;
            border: 1px solid gray;
			background-color: #F6F6F6;
        }
        .heading{
            font-size: 15px;
            margin-bottom: 08px;
        }
        .sub-heading{
            color: #262626;
            margin-bottom: 05px;
			padding-left:6px;
			font-size:7px;
			text-align:justify;
        }
        table{
            background-color: #fff;
            width: 100%;
            border-collapse: collapse;
        }
        table thead tr{
            border: 1px solid #111;
            background-color: #f2f2f2;
        }
        table td {
            vertical-align: middle !important;
            text-align: center;
        }
        table th, table td {
            padding-top: 08px;
            padding-bottom: 08px;
        }
        .table-bordered{
            box-shadow: 0px 0px 5px 0.5px gray;
        }
        .table-bordered td, .table-bordered th {
            border: 1px solid #dee2e6;
        }
        .text-right{
            text-align: end;
        }
        .w-30{
            width: 30%;
			text-align: left;
			font-size:10px;
        }
		.w-35{
            width: 35%;
			text-align: left;
			font-size:10px;
        }
		.w-5{
            width: 5%;
			text-align: left;
			font-size:10px;
        }
		
		.w-10{
            width: 10%;
			text-align: left;
			font-size:10px;
        }
        .float-right{
            float: right;
        }
    </style>

   </head>
   
   <body>
   
   <?php
  $sql81 = "SELECT client_files.vessel_flight,client_files.sline,client_files.eta,client_files.consignee,destination.dest_name,client_files.goods,client_files.file_no,clients.client_fname,clients.client_lname,entrypoint_type.name,entrypoint_name.ent_name,client_files.b_lNo,client_files.tra_RefNo,clients.client_email,clients.client_phone,clients.client_address,clients.client_tin,client_files.file_openDate,client_files.file_closeDate,client_files.fileStatus FROM clients,client_files,entrypoint_type,entrypoint_name,destination WHERE client_files.file_id = {$file_id} and clients.client_id=client_files.client_id and entrypoint_type.entryId=client_files.entryId and entrypoint_name.entryName_id=client_files.entryName_id and destination.dest_id=client_files.dest_id";
				$result81 = $conn->query($sql81);
				while($data81 = mysqli_fetch_array($result81))
							{
							$fileNo = $data81['file_no'];
							$clientName = $data81['client_fname']." ".$data81['client_lname'];
							$entrypoint_type = $data81['name'];
							$entrypoint_name = $data81['ent_name'];
							$B_LNO = $data81['b_lNo'];
							$Tra_RefNo = $data81['tra_RefNo'];
							$Consignee = $data81['consignee'];
							$Vesssel_Flight = $data81['vessel_flight'];
							$sline = $data81['sline'];
							$clientTIN = $data81['client_tin'];
							$eta = $data81['eta'];
							$destination = $data81['dest_name'];
							$goods = $data81['goods'];
							$phoneNumber = $data81['client_phone'];
							$emailAddress = $data81['client_email'];
							$clientAddress = $data81['client_address'];
							$file_openDate = $data81['file_openDate'];
							$file_closeDate = $data81['file_closeDate'];
							$file_status =  $data81['fileStatus'];
				            }
							$fopenDate = date('d-m-Y', strtotime($file_openDate));
							$fcloseDate = date('d-m-Y', strtotime($file_closeDate));
							
							if(empty($file_closeDate)){
							$fileCloseDate == '';	
							}else{
							$fileCloseDate == $fcloseDate;	
							}
							
							if($file_status==0){
							$fstatus  = 'Pending File';
							}else{
							$fstatus  = 'Closed File';	
							}
							
				 $phone = substr($phoneNumber, 3);
	             $phone_number = '0'.$phone;
				 
				 $sql814 = "SELECT * FROM quotation WHERE file_id = {$file_id}";
				$result814 = $conn->query($sql814);
				$num814 = mysqli_num_rows($result814);
				while($data814 = mysqli_fetch_array($result814))
							{
							$quot_id = $data814['quot_id'];
							$currency_id = $data814['currency_id'];
				            }
				 
				 
				 
				 ?>
   
   
   <div class="container7">
        <div class="brand-section">
            <div class="row">
                <div class="col-6">
				
				<?php
			  //global $conn;
			  $sql362a = "SELECT company_details.logo FROM company_details";
              $result362a = $conn->query($sql362a);
			  $num362a = mysqli_num_rows($result362a);
			          if($num362a>0){
              while ($row362a = mysqli_fetch_array($result362a)){
						$image_urla = substr($row362a['logo'], 3);
						echo "<img src = ".$image_urla." width='40%' height='50px'>";
			                }
                            }
			  ?>	
                    <!--<h1 class="text-white">Kreen Logistics</h1>-->
                </div> 
                <div class="col-6">
                    <div class="company-details">
                        <p class="text-white">+255764508508</p>
						<p class="text-white">info@brightvision.co.tz</p>
						<p class="text-white">Plot No. 314/322L</p>
						<p class="text-white">Mbagala Kibondemaji</p>
						<p class="text-white">P O Box 72539</p>
						<p class="text-white">Dar es Salaam</p>
						<p class="text-white">Tanzania</p>
						<p class="text-white">TIN: 108-382-228</p>
						<p class="text-white">VRN: 40023874L</p>
                    </div>
                </div> 
            </div>
        </div>
		
			<div class="brand-section1">
            <div class="row">
			<table border="0" class="tbl" style="width:100%">
			   <tr>
			   <td style="width:100%">
                <div class="col-12">
                    <h1 class="text-black"><center>CUSTOMER FILE</center></h1>
                </div>
				</td>
			   </tr>
			</table>	
				
				
            </div>
        </div>

        <div class="body-section">
            <div class="row">
			   <table border="0" class="tbl" style="width:100%">
			   <tr>
			   <td style="width:60%">
                <div class="col-6">
                    <p class="sub-heading"><b>B/L No:</b><?php print $B_LNO; ?></p>
                    <p class="sub-heading"><b>TRA Ref Number:</b> <?php print $Tra_RefNo; ?> </p>
                    <p class="sub-heading"><b>Customer:</b> <?php print $clientName; ?> </p>
					<p class="sub-heading"><b>Goods:</b> <?php print $goods; ?> </p>
					<p class="sub-heading"><b>S.LINE:</b> <?php print $sline; ?> </p>
					<p class="sub-heading"><b>Destination:</b> <?php print $destination; ?> </p>
					<p class="sub-heading"><b>Entry Point:</b><?php print " "; ?> <b><?php print $entrypoint_name; ?></b></p>
					<p class="sub-heading"><b>Email:</b> <?php print $emailAddress; ?> </p>
					<p class="sub-heading"><b>Address:</b> <?php print $clientAddress; ?> </p>
					
                </div>
				</td>
				<td style="width:40%">
                <div class="col-6">
                    <p class="sub-heading"><b>File No:</b>  <?php print $fileNo; ?></p>
                    <p class="sub-heading"><b>File Status:</b>  <?php print $fstatus; ?> </p>
					<p class="sub-heading"><b>Consignee:</b>  <?php print $Consignee; ?> </p>
					<p class="sub-heading"><b>Vessel/Flight: </b> <?php print $Vesssel_Flight; ?> </p>
					<p class="sub-heading"><b>E.T.A: </b> <?php print $eta; ?>  </p>
					<p class="sub-heading"><b>Tel:</b> <?php print $phone_number; ?> </p>
					<p class="sub-heading"><b>File Open Date: </b> <?php print $fopenDate; ?>  </p>
					<p class="sub-heading"><b>File Close Date: </b> <?php print $fileCloseDate; ?>  </p>
					
                </div>
				</td>
				</tr>
				</table>
            </div>
        </div>
		
		<?php
			$procRequestSql33 = "SELECT * FROM quotation WHERE quot_id= {$quot_id} and file_id={$file_id}";
            $procRequestResult33 = $conn->query($procRequestSql33);
            $count1 = mysqli_num_rows($procRequestResult33);
             if($count1>0){		
			 ?>

        <div class="body-section">
            <h3 class="heading">Quotation</h3>
            <br>
          
            <table class="table-bordered">
                <thead>
                    <tr>
					    <th class="w-5">S/N</th>
                        <th class="w-35">Description</th>
                        <th class="w-30">Amount</th>
                        <th class="w-30">Total</th>
                    </tr>
                </thead>
                <tbody>
				
				<?php
  $procRequestSql = "SELECT * FROM quotation_items WHERE quot_id = {$quot_id}";
  $procRequestResult = $conn->query($procRequestSql);
                    $x = 1;
					$no = 1;
    while($procRequestData = $procRequestResult->fetch_array()){ 

    ?>
				
                    <tr>
					    <td class="wrd"><?php print $no;  ?></td>
                        <td class="wrd"><?php print $procRequestData['services_desc'];  ?></td>
                        <td class="wrd"><?php print number_format($procRequestData['unit_price'],2);  ?></td>
						<td class="wrd"><?php print number_format($procRequestData['amount'],2);  ?></td>
                    </tr>
                    
					
				<?php
				$no++;
}
?>	
					
	
					
                </tbody>
            </table>


        </div>
		
		<?php
			 }
		?>
		
		
		<?php
			$procRequestSql334 = "SELECT * FROM client_files WHERE file_id={$file_id}";
            $procRequestResult334 = $conn->query($procRequestSql334);
            $count2 = mysqli_num_rows($procRequestResult334);
             if($count2>0){		
			 ?>
			 
			 <div class="body-section">
            <h3 class="heading">Customer File Expenses</h3>
            <br>
          
            <table class="table-bordered">
                <thead>
                    <tr>
					    <th class="w-10">S/N</th>
                        <th class="w-45">Bill Payments</th>
                        <th class="w-15">Amount</th>
                        <th class="w-15">Paid By</th>
						<th class="w-15">Currency</th>
                    </tr>
                </thead>
                <tbody>
				
				<?php
  $procRequestSql6 = "SELECT standard_expenses.name,client_fileexpenses.amount,client_fileexpenses.chargeable_to,client_fileexpenses.debitNote FROM standard_expenses,client_fileexpenses WHERE standard_expenses.standardexp_id=client_fileexpenses.standardexp_id and client_fileexpenses.file_id = {$file_id}";
  $procRequestResult6 = $conn->query($procRequestSql6);
                    $x = 1;
					$no = 1;
    while($procRequestData6 = $procRequestResult6->fetch_array()){ 

    ?>
				
                    <tr>
					    <td class="wrd"><?php print $no;  ?></td>
                        <td class="wrd"><?php print $procRequestData6['name'];  ?></td>
                        <td class="wrd"><?php print number_format($procRequestData6['amount'],2);  ?></td>
                        <td class="wrd"><?php print $procRequestData6['chargeable_to'];  ?></td>
						<td class="wrd"><?php print $procRequestData6['debitNote'];  ?></td>
                    </tr>
                    
					
				<?php
				$no++;
}
?>	
					
	
					
                </tbody>
            </table>


        </div>
			 
			 
			 <?php
			 }
			 ?>

             
    </div>
	
	<div style="page-break-inside: avoid;">
	
	
	</div>
   
 		  
</body>
</html>	
			  
		
		
 
  
		
			  
			  
			  
			  
			  
			  
			  
			  
			  
  
		
			  
  
		
			  
			  
			  
		
		
 
  
		
			  
			  
			  
		
		
 
  
		
			  
			  
			  
			  
		
		
 
  
		
			  
			  
			  
			  
			 
			  
			  
			  
			 
 
		
			  
			  
			  
			  
		
 
  	  
			  
			  
			 
			  
			  
			  
			  
				 
				 
   
   