<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--reference to main.css removed-->
<?php
include('../include/session.php');
?>

<?php
$contract_card_no=$_GET['contract_card_no'];

$table_name = $_SESSION['db_prefix']."_maintenance_contracts";
$job_query = "SELECT * FROM $table_name WHERE contract_card_no = '".$contract_card_no."' ";
$job_result = mySQL_query($job_query);
//$maintenance_card_no = mysql_result($job_result, 0, "maintenance_card_no");
$cust_id = mysql_result($job_result, 0, "cust_id");
$quote_note = mysql_result($job_result, 0, "quote_note");
$value = mysql_result($job_result, 0, "value");
$order_date = mysql_result($job_result, 0, "date");
$start_date = mysql_result($job_result, 0, "start_date");
$end_date = mysql_result($job_result, 0, "end_date");
$project_description = mysql_result($job_result, 0, "project_description");
$project = mysql_result($job_result, 0, "project");

$project_no = mysql_result($job_result, 0, "project_no");
$project_place = mysql_result($job_result, 0, "project_place");
$project_area = mysql_result($job_result, 0, "project_area");
$deliver_date = mysql_result($job_result, 0, "start_date");
$cluster = mysql_result($job_result, 0, "cluster");


//$captured = mysql_result($job_result, 0, "captured");
$compiled = mysql_result($job_result, 0, "compiled");
$invoiced = mysql_result($job_result, 0, "invoiced");
$completed = mysql_result($job_result, 0, "completed");


//$table_name = $_SESSION['db_prefix']."_maintenance_job_lines";
//
//$line_query = "SELECT *  FROM $table_name WHERE  maintenance_card_no =  '".$maintenance_card_no."' ";
//$line_result = mySQL_query($line_query);
//$line_num = mysql_num_rows($line_result);



?>
<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

<!--jscript-->
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script>

</head>

<body>
<?php
include ("../navigation/header.php");
$page_name = "Maintenance-main";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/maintenance_sidebar.php");
?>
<div class="main_frame">
  <div class="page_head_frame">
          <table width="650" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="553"><label class="label_page_head">Maintenance contract</label></td>
              <td width="97"><label class="label_quote_no"><?php echo $contract_card_no;  ?></label>
              </td>
            </tr>
          </table>
          </div>
          <div class="page_middle_frame">
<div class="page_inside_frame">
<?php 
include('../include/customer_block.php');
?>
</div>    
<div class="page_inside_frame">
<table width="642" id="table_details_display">
    <tr>
      <td align="left" valign="top">Project:</td>
      <td align="left" valign="top"><?php  echo $project;  ?></td>
      <td align="left" valign="top"><?php echo 'Contract card no:'; ?></td>
      <td align="left" valign="top"><?php echo $contract_card_no;  ?></td>
    </tr>
    <tr>
      <td align="left" valign="top"><?php  echo 'Order date:';?></td>
      <td width="206" align="left" valign="top"><?php  echo date("d-m-Y", strtotime($order_date));  ?></td>
      <td width="158" align="left" valign="top"><?php  echo 'Job value'; ?></td>
      <td width="156" align="left" valign="top"><?php   echo number_format($value, 2, '.', ','); ?></td>
    </tr>
    <tr>
      <td width="122" align="left" valign="top">Project place:</td>
      <td colspan="3" align="left" valign="top"><?php echo $project_no?>&nbsp;&nbsp;<?php echo $project_area?>&nbsp;&nbsp;<?php echo $project_place?></td>
    </tr>
    <tr>
      <td align="left" valign="top">Notes:</td>
      <td colspan="3" align="left" valign="top"><?php echo $quote_note ?></td>
    </tr>
  </table>
<br>
<table width="642" id="table_details_display">
  <tr>
    <td width="118">Cluster:</td>
    <td><?php  echo $cluster;  ?></td>
    </tr>
  <tr>
    <td>Contract  period:</td>
    <td><?php if ($deliver_date!='') {?>
      from: <?php echo date("d-m-Y", strtotime($deliver_date));  ?> to: <?php echo date("d-m-Y", strtotime($end_date));  ?>
      <?php } ?></td>
    </tr>
</table>

</div>  

<div class="page_inside_frame"><br>
<br>
<a href="maintenance_contract_print.php?contract_card_no=<?php echo $contract_card_no ?>" target="_blank"><input name="print_button" type="button" value="Print contract card" class="imagebutton"></a></div>      



   
</div>  
</div>
<?php include ('../navigation/side_bar.php'); ?>


<?php } else {
$_SESSION['denied_return'] = "maintenance/maintenance_main.php";	
include ("../navigation/maintenance_sidebar.php");?>
<body onLoad="accessdenied(); return false">
<?php include ('../navigation/side_bar.php'); ?>
</body>
<?php }
?>
</body>
</html>