<?php
session_start();
require_once '../../Server/connection.php';
if($_POST){	
  $file_id = $_POST['file_id'];
  $client_id = $_POST['client_id'];
  $entryId = $_POST['entryId'];
  $entryNameId = $_POST['entryNameId'];
  $b_lNo = $_POST['b_lNo'];
  $tra_RefNo = $_POST['tra_RefNo'];
  $consignee = $_POST['consignee'];
  $goods = $_POST['goods'];
  $vesselFlight = $_POST['vesselFlight'];
  $sline = $_POST['sline'];
  $eTa = $_POST['eta'];
  $destination = $_POST['destination'];
  $file_status = $_POST['file_status'];
  $exp_status  = $_POST['exp_status'];
  $upl_status  = $_POST['upl_status'];
  $message = addslashes($_POST['message']);
  $space = " ";
  $eta = date('Y-m-d', strtotime($eTa));
  //$link = "<a href='https://cfms.kreenlogistics.co.tz/'>cfms</a>";	
  
  if($file_status=='Yes'){
		$st = 1;
		$fileCloseDate = date("Y-m-d");
	}else{
		$st = 0;
		$fileCloseDate = '0000-00-00';
	 }
	 
	
  
    $sql = "UPDATE client_files SET client_id = '$client_id',entryId = '$entryId',entryName_id='$entryNameId',b_lNo='$b_lNo',tra_RefNo='$tra_RefNo',consignee='$consignee',vessel_flight='$vesselFlight',sline='$sline',eta='$eta',destination='$destination',goods='$goods',file_closeDate='$fileCloseDate',fileStatus='$st' WHERE file_id = {$file_id}";		

	$result = $conn->query($sql);
	
	if($result){
		
				   
				$_SESSION['success_message'] = "Client File Has Been edited Successfully";
					   header("Location: ../editClientFile.php?i=$file_id");
                             exit();   	  
                 
	
	
	}
	

}