<?php
     include('../include/session.php');
         
	 $_SESSION['maintenance_card_no']=$_GET['maintenance_card_no'];
	 $_SESSION['maintenance_no']="";	 
	 $_SESSION['name']="";
	 $_SESSION['start_date']=date("Y-m-d");
	 $_SESSION['end_date']=date("Y-m-d");
	 
	 
	 	$table_name = $_SESSION['db_prefix']."_maintenance_jobs";
	 	$job_query = "SELECT * FROM $table_name WHERE maintenance_card_no = '".$_SESSION['maintenance_card_no']."' ";
		$job_result = mySQL_query($job_query);
	 	
		
		$_SESSION['cust_id']=mysql_result($job_result, 0, "cust_id");
		$_SESSION['order_date']='';
		$_SESSION['project_description'] = mysql_result($job_result, 0, "project_description");
		$_SESSION['project_no'] = mysql_result($job_result, 0, "project_no");
		$_SESSION['project_place'] = mysql_result($job_result, 0, "project_place");
		$_SESSION['project_area'] = mysql_result($job_result, 0, "project_area");
		$_SESSION['start_date'] = mysql_result($job_result, 0, "start_date");
		$_SESSION['value'] = mysql_result($job_result, 0, "value");
		if ($_SESSION['start_date']=='') {$_SESSION['start_date']= date("Y-m-d");}
		$_SESSION['call_out_charge']= mysql_result($job_result, 0, "call_out_charge");
	 	$_SESSION['additional_charge']= mysql_result($job_result, 0, "additional_charge");
		$_SESSION['team'] = mysql_result($job_result, 0, "team");

        $_SESSION['all_total'] = '';
		
		$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['cust_name'] = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$_SESSION['cust_name'] = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}

		
		$table_name = $_SESSION['db_prefix']."_maintenance_job_lines_supply_temp";
		$delete2_query = "DELETE FROM $table_name WHERE  user_name =  '".$_SESSION['username']."' "; 
		execsql($delete2_query);
	 
$_SESSION['error']=0;
$_SESSION['stock_error']=0;
     
?>
<script language="javascript" type="text/javascript">
        <!--
		  window.location="maintenance_closeJobWizbase.php?error=0&p=1&s=0";
        -->
       </script>