<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include('../include/session.php');
include ("../navigation/header.php");
include ("../navigation/maintenance_sidebar.php");

	
	$s =  $_GET['s'];
	$p = $_GET['p'];
	$error = $_SESSION['error'];
	$_SESSION['p']=$p;
	$_SESSION['s']=$s;
	
	
	if (isset($_GET['prev_button']) )
	   {
		 $_SESSION['p']= $_SESSION['p']-1;
	   }
		 
	if (isset($_GET['next_button']) )
	  {
		$_SESSION['p']=$_SESSION['p']+1;
	  }
	
		
	if ($s==1) {
		
	}
		
	if($s==2) {
		$_SESSION['invoice_amount']=$_GET['invoice_amount_text'];
		$_SESSION['invoice_no']=$_GET['invoice_no_text'];
		$_SESSION['invoiced_by']=$_GET['invoiced_by_select'];
		$_SESSION['invoice_date']=$_GET['invoice_date'];
		$_SESSION['invoice_notes']=$_GET['invoice_notes_text'];
		
		$table_name = $_SESSION['db_prefix']."_maintenance_invoices";
		$check_query = "SELECT invoice_no  FROM $table_name WHERE invoice_no = '".$_SESSION['invoice_no']."' ";
		$check_result = mySQL_query($check_query);
		$check_num = mysql_num_rows($check_result);
		
		if ($check_num>0) {
			   $_SESSION['invoice_no']='';
			   $_SESSION['error']='1';
			  ?>
              	<script language="javascript" type="text/javascript">
         		 	window.location="maintenance_invoiceJobWizbase.php?p=2&s=";
				</script>
               <?php }
			else {
				$_SESSION['error']='0';
			}				
		}
	

	?>

<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

<!--jscript-->
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>  
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>    





<div class="main_frame">

<div class="page_head_frame">
                <label class="label_page_head">Invoice Maintenance job </label>
</div>               
       <table >
     	<tr>
      	<td >         
        <div class="wizard_paging_frame">
        <table align="left">
          <tr>
            <td width="56"><?php if ($_SESSION['p']==1) { ?>
              <div class="active_step_frame">
                <div class="active_step_head_label">&nbsp;1</div></div>
                <div class="active_step_label">
                  Job details
              </div>
              <?php } else { ?>
              <div class="de_active_step_frame">
                <div class="de_active_step_head_label">&nbsp;1</div></div>
                <div class="de_active_step_label">
                  Job details
              </div>
              <?php } ?></td>
            <td width="72"><?php if ($_SESSION['p']==2) { ?>
              <div class="active_step_frame">
                <div class="active_step_head_label">&nbsp;2</div></div>
                <div class="active_step_label">
                  Invoice details
              </div>
              <?php } else { ?>
              <div class="de_active_step_frame">
                <div class="de_active_step_head_label">&nbsp;2</div></div>
                <div class="de_active_step_label">
                  Invoice details
              </div>
              <?php } ?></td>
            <td width="68"><?php if ($_SESSION['p']==3) { ?>
              <div class="active_step_frame">
                <div class="active_step_head_label">&nbsp;3</div></div>
                <div class="active_step_label">
                 Finish
              </div>
              <?php } else { ?>
              <div class="de_active_step_frame">
                <div class="de_active_step_head_label">&nbsp;3</div></div>
                <div class="de_active_step_label">
                   Finish</div>
              <?php } ?></td>
                  
          </tr>
        </table>
        </div>
        </td>
    </tr>
    <tr>
      <td><?php 
	if ($_SESSION['p']==1) { include("maintenance_invoiceJobWiz1.php"); }
	if ($_SESSION['p']==2) { include("maintenance_invoiceJobWiz2.php"); }
	if ($_SESSION['p']==3) { include("maintenance_invoiceJobWiz3.php"); }
	
	?></td>
    </tr>
  </table>
</div>

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