<head>
<?php 
$page_name = "Production-authorisation";
include ("../navigation/access.php");

if ($permission_num==1) {
$job_no = $_SESSION['job_no'];
$quote='no';
$table_name = $_SESSION['db_prefix']."_captured_cash_sale";
$job_query = "SELECT * FROM $table_name WHERE job_no = '".$job_no."' ";
$job_result = mySQL_query($job_query);
$cust_id = mysql_result($job_result, 0, "cust_id");	

$table_name = $_SESSION['db_prefix']."_captured_cash_sale";
		$job_query = "SELECT *  FROM $table_name WHERE job_no = '".$_SESSION['job_no']."' ";
		$job_result = mySQL_query($job_query);
		$_SESSION['cust_id']=mysql_result($job_result, 0, "cust_id");
		$quote_note=mysql_result($job_result, 0, "quote_note");
		
$table_name = $_SESSION['db_prefix']."_quotations";
		$quote_query = "SELECT seller, designer, company_contact, contact_phone, project_no, project_place, project_description FROM $table_name WHERE quote_no = '".$_SESSION['job_no']."' ";
		$quote_result = mySQL_query($quote_query);
		$b1=mysql_result($quote_result, 0, "seller");
		$b2=mysql_result($quote_result, 0, "designer");
		$b3=mysql_result($quote_result, 0, "company_contact");
		$b4=mysql_result($quote_result, 0, "contact_phone");
		$b5=mysql_result($quote_result, 0, "project_no")." ";
		$b6=mysql_result($quote_result, 0, "project_place");
		$b7=mysql_result($quote_result, 0, "project_description");
		$b10= $b5.$b6;
		 
$table_name = $_SESSION['db_prefix']."_customer";
$customer_query = "SELECT  account_type, comp_name, name_2, title, contact_1  FROM $table_name WHERE  cust_id = '".$_SESSION['cust_id']."' ";
$customer_result = mySQL_query($customer_query);
$a0 = mysql_result($customer_result, 0, "account_type");		 
$a1 = mysql_result($customer_result, 0, "comp_name");	
$a2 = mysql_result($customer_result, 0, "name_2")." ";	
$a3 = mysql_result($customer_result, 0, "title")." ";	
$a4 = mysql_result($customer_result, 0, "contact_1");

if ($a0=="corporate") {
	$_SESSION['name'] = $a1." (".$b3." cell: ".$b4.")";
}
else {
	$_SESSION['name'] = $a3.$a2.$a1;
}

		 
?>
</head>
<?php include('../include/wait.php') ?>
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');">
<div class="page_middle_frame">
<form id="form1" name="form1" method="get" action="cash_authorisationWizbase.php">
  <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" valign="top" >
        <div class="wizard_frame">
        <?php 
		include ('../include/customer_block.php');
		echo '<br>';
		include ('../include/cash_sale_job_block.php')
		?>
        </div></td>
    </tr>
    <tr>
      <td><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" />
              <input name="screen" type="hidden" id="screen" value="0" />
              </td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../sales/sales_main.php');" value="Cancel" /></td>
            <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" tabindex="1" /></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
</div>
</body>
<?php } else { 
    $_SESSION['denied_return'] = "sales/sales_main.php";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>
