<?php 

$page_name = "Production-compile";
include ("../navigation/access.php");

if ($permission_num==1) {
		
	
	$table_name = $_SESSION['db_prefix']."_list_places";
    $position_query = "SELECT item_name, emp_id FROM $table_name ORDER BY item_name ASC";
	$arrId3 = array ();
	$arrName3 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId3[$b] = mysql_result($position_result, $b, "emp_id");
		$arrName3[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}	
	
	$table_name = $_SESSION['db_prefix']."_list_area";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId5 = array ();
	$arrName5 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId5[$b] = mysql_result($position_result, $b, "item_name");
		$arrName5[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}

$table_name = $_SESSION['db_prefix']."_compiled_jobs";
$job_query = "SELECT * FROM $table_name WHERE job_card_no = '".$_SESSION['job_card_no']."' ";
$job_result = mySQL_query($job_query);
//$job_card_no = mysql_result($job_result, 0, "job_card_no");
$cust_id = mysql_result($job_result, 0, "cust_id");
$quote_note = mysql_result($job_result, 0, "quote_note");
$order_date = mysql_result($job_result, 0, "date");
$del_date = mysql_result($job_result, 0, "del_date");
$project = mysql_result($job_result, 0, "project");
$project_description = mysql_result($job_result, 0, "project_description");

$b13 = mysql_result($job_result, 0, "value");
$_SESSION['cust_id']=$cust_id;
$_SESSION['order_date']=$order_date;
$_SESSION['project']=$project;

$table_name = $_SESSION['db_prefix']."_mworks_jobs";
$value_query = "SELECT value FROM $table_name WHERE job_card_no = '".$_SESSION['job_card_no']."' ";
$value_result = mySQL_query($value_query);
$value = mysql_result($value_result, 0, "value");

?>

<link rel="stylesheet" href="../css/datepicker.css" type="text/css" />
    <link rel="stylesheet" media="screen" type="text/css" href="../css/layout.css" />

<script type="text/javascript" src="../jscript/jquery.js"></script>
	<script type="text/javascript" src="../jscript/datepicker.js"></script>
    <script type="text/javascript" src="../jscript/eye.js"></script>
    <!--<script type="text/javascript" src="../jscript/utils.js"></script>-->
    <script type="text/javascript" src="../jscript/layout.js?ver=1.0.2"></script>


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

<!--jscript-->
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 
<script language="javascript" src="../jscript/calendar.js"></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_display2">
    <tr>
      <td height="29" align="left" valign="top">Project:</td>
      <td colspan="2" align="left" valign="top"><?php  echo $project;  ?></td>
      <td align="left" valign="top"><?php echo 'Job card no:&nbsp;&nbsp;'.$_SESSION['job_card_no'];  ?></td>
    </tr>
    <tr>
      <td height="28" align="left" valign="top">Description:</td>
      <td colspan="3" align="left" valign="top"><?php  echo $project_description;  ?></td>
      </tr>
    <tr>
      <td height="28" align="left" valign="top"><?php  echo 'Order date:';?></td>
      <td width="106" align="left" valign="top"><?php  echo date("d-m-Y", strtotime($order_date));  ?></td>
      <td width="101" align="left" valign="top"><?php  echo 'Job value'; ?></td>
      <td width="277" align="left" valign="top"><?php   echo number_format($value, 2, '.', ','); ?></td>
    </tr>
    <tr>
      <td height="37" align="left" valign="top">Project period:</td>
      <td colspan="3" align="left" valign="top">
        
        <div id="widget">
          <div id="widgetField" >
            <span>
			<?php echo date("d-m-Y", strtotime($_SESSION['start_date']))?> &divide; <?php echo date("d-m-Y", strtotime($_SESSION['end_date']))?>
            </span>
            <a href="#">Select date range</a>
            </div>
          <div id="widgetCalendar">
            </div>
          </div>
          <input name="start_date_text"  id="start_date_text"  type="hidden" value="<?php echo $_SESSION['start_date'] ?>">
          <input name="end_date_text"  id="end_date_text"  type="hidden" value="<?php echo $_SESSION['end_date'] ?>">        
    </td>
    </tr>
    <tr>
      <td width="146" align="left" valign="top">Project place:</td>
      <td colspan="3" align="left" valign="top">
        <input name="project_no_text" id="project_no_text" type="text" value="<?php echo $_SESSION['project_no'] ?>">&nbsp;&nbsp;
        <select name="project_area_select" class="select120" tabindex="5" >
          <option value="<?php echo $_SESSION['project_area']?>" selected><?php echo $_SESSION['project_area']?></option>
          <?php
        	for ($j = 0; $j < count($arrId5); $j++) {
    		echo "<option value=" . "\"" . $arrId5[$j] . "\"" . ">" . $arrName5[$j] . "</option>";
	}
?>
          </select>
        &nbsp;&nbsp;
        <select name="project_place_select" class="select120" tabindex="6" >
          <option value="<?php echo $_SESSION['project_place']?>" selected><?php echo $_SESSION['project_place']?></option>
          <?php
        	for ($j = 0; $j < count($arrId3); $j++) {
    		echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
	}
?>
          </select></td>
    </tr>
    <tr>
      <td align="left" valign="top">Notes:</td>
      <td colspan="3" align="left" valign="top"><textarea name="notes_text" id="notes_text" cols="45" rows="5" class="text_box"><?php echo $_SESSION['quote_note'] ?></textarea></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, '../production/production_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'] = "production/production_main.php";	?>
<body onLoad="needToConfirm = false; accessdenied(); return false"; >
</body>
<?php }
?>
