<?php 

$page_name = "Maintenance-contract";
include ("../navigation/access.php");

if ($permission_num==1) {
	

$table_name = $_SESSION['db_prefix']."_maintenance_contracts";
$contract_query = "SELECT * FROM $table_name WHERE contract_card_no = '".$_SESSION['contract_card_no']."' ";
$contract_result = mySQL_query($contract_query);

$cust_id = mysql_result($contract_result, 0, "cust_id");
$date = mysql_result($contract_result, 0, "date");
$project = mysql_result($contract_result, 0, "project");
$project_description = mysql_result($contract_result, 0, "project_description");
$project_no = mysql_result($contract_result, 0, "project_no");
$project_area = mysql_result($contract_result, 0, "project_area");
$project_place = mysql_result($contract_result, 0, "project_place");
$value = mysql_result($contract_result, 0, "value");

$_SESSION['cust_id']=$cust_id;
$_SESSION['enquiry_date']=$date;
$_SESSION['project']=$project;
$_SESSION['invoice_amount']=$value;

$_SESSION['project']=$project;
$_SESSION['project_description']=$project_description;

$table_name2 = $_SESSION['db_prefix']."_customer";
		$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$_SESSION['cust_id']."' ";
		$customer_result = mySQL_query($customer_query);
		$customer_num = mysql_num_rows($customer_result);	
		$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$_SESSION['name'] = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$_SESSION['name'] = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}

?>

<!--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>

<?php include('../include/wait.php') 
?>

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="wizard_page_middle_frame">
<form id="form1" name="form1" method="GET" action="">
<div class="wizard_frame">
<?php 
include('../include/customer_block.php');
?>
</div> 
   
<div class="wizard_frame">
  <table width="650" id="table_details_display">
    <tr>
      <td width="126">Date: </td>
      <td width="504"><?php echo date("d-m-Y", strtotime($date))?></td>
    </tr>
    <tr>
      <td>Project:</td>
      <td><?php echo $project ?></td>
    </tr>
    <tr>
      <td>Project description:</td>
      <td><?php echo $project_description ?></td>
    </tr>
    <tr>
      <td>Project place:</td>
      <td><?php echo $project_no.', '. $project_area.', '. $project_place ?></td>
    </tr>
    <tr>
      <td>Value:</td>
      <td>P <?php echo number_format($value, 2, '.', ',') ?></td>
    </tr>
  </table>
</div>     
<div class="wizard_frame">      
  <table width="675" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115"><input name="p" type="hidden" id="p" value="1" />
              <input name="error" type="hidden" id="error" value="0" />
              <input name="s" type="hidden" id="s" value="1" /></td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../maintenance/maintenance_main.php'); " value="Cancel" /></td>
            <td width="110" align="right"><input type="submit" name="next_button" id="next_button" class="imagebutton" value="Next" tabindex="0" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" /></td>
          </tr>
      </table></td>
    </tr>
  </table>
</div>
</form>
</div>
</body>
<?php } else { 
$_SESSION['denied_return'] = "maintenance/maintenance_main.php";	?>
<body onLoad="needToConfirm = false; accessdenied(); return false"; >
</body>
<?php }
?>
