
<?php 
/*if($_SESSION["login"]!="True")
{
	header('Location:./index.php');
}*/




/*if($_SESSION["login"]!="True")
{
	header('Location:./index.php');
}*/

	

						 
	require_once("connectioni.php");
	
	 
?>	


<link rel="stylesheet" href="css/table_min.css" type="text/css"/>	
<link rel="stylesheet" type="text/css" media="all" href="css/jsDatePick_ltr.min.css" />
<script type="text/javascript" src="js/jsDatePick.min.1.3.js"></script>

<script type="text/javascript" language="javascript" src="js/get_cat_description.js"></script>
<script type="text/javascript" language="javascript" src="js/datepickr.js"></script>


<script language="javascript" type="text/javascript">
<!--
/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>

<script type="text/javascript">
function openWin()
{
myWindow=window.open('serach_inv.php','','width=200,height=100');
myWindow.focus();

}
</script>

<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"invdate",
			dateFormat:"%Y-%m-%d"
			/*selectedDate:{				This is an example of what the full configuration offers.
				day:5,						For full documentation about these settings please see the full version of the code.
				month:9,
				year:2006
			},
			yearsRange:[1978,2020],
			limitToToday:false,
			cellColorScheme:"beige",
			dateFormat:"%m-%d-%Y",
			imgPath:"img/",
			weekStartDay:1*/
		});
	};
</script>

</label>
          
<fieldset>
                                                	<legend>
  <div class="text_forheader">Arrival Note Details</div>
                                               	 </legend>             

<form name="form1" id="form1">            
  <table width="100%" border="0"  class=\"form-matrix-table\">
  <tr>
    <td height="41" width="14%"><input type="text"  class="label_purchase" value="ARN No" disabled/></td>
    <td width="15%"><input type="text" name="invno" id="invno" disabled value="" class="text_purchase3" onkeypress="keyset('searchcust',event);"  />
     </td>
    <td width="14%"> <a href="serach_arn.php" onClick="NewWindow(this.href,'mywin','800','700','yes','center');return false" onFocus="this.blur()">
        <input type="button" name="searchinv" id="searchinv" value="SEARCH" class="btn_purchase1" >
      </a></td>
    <td width="14%">&nbsp;</td>
    <td width="12%"><input type="text"  class="label_purchase" value="Entry Date" disabled="disabled"/></td>
    <td width="14%"><input type="date"  name="invdate" id="invdate" value="<?php echo date("Y-m-d"); ?>"   class="text_purchase3"/></td>
    <td width="6%">&nbsp;</td>
    <td width="5%">&nbsp;</td>
    <td width="0%">&nbsp;</td>
  </tr>
  <tr>
    <td><input type="text"  class="label_purchase" value="LC/TT No " disabled="disabled"/></td>
    <td><input id="lc_no" type="text" class="text_purchase3"   /></td>
    <td><input type="text"  class="label_purchase" value="PI No " disabled="disabled"/></td>
    <td><input id="pi_no" name="pi_no" type="text" class="text_purchase3"   /></td>
    <td><input type="text"  class="label_purchase" value="Department" disabled="disabled"/></td>
    <td><select name="department" id="department" onkeypress="keyset('brand',event);" class="text_purchase3">
     
      <?php
        if ($_SESSION["CURRENT_DEP"] != "") {
           $sql="select * from s_stomas where  act='1' and CODE='".$_SESSION["CURRENT_DEP"] ."' order by CODE";
        }else{
          $sql="select * from s_stomas where  act='1'  order by CODE";
        } 
        $result =mysqli_query($GLOBALS['dbinv'],$sql) ; 
        while($row = mysqli_fetch_array($result)){
            if ($row["CODE"]=="1"){
                 echo "<option selected value='".$row["CODE"]."'>".$row["DESCRIPTION"]."</option>";
            }else {
                 echo "<option value='".$row["CODE"]."'>".$row["DESCRIPTION"]."</option>";
            }
        }
        ?>
    </select></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="41"><input type="text"  class="label_purchase" value="PO Date" disabled="disabled"/></td>
    <td><input id="dte_dor" name="dte_dor" type="text"  disabled value="" class="text_purchase3" /></td>
    <td><input type="text"  class="label_purchase" value="Brand " disabled="disabled"/></td>
    <td><input id="brand" name="brand" type="text" onkeypress="keyset('department',event);"  disabled class="text_purchase3" /></td>
    <td><input type="text"  class="label_purchase" value="PO No" disabled="disabled"/></td>
    <td  ><input type="text" name="orderno1" id="orderno1" disabled  value="" onkeypress="keyset('orderdate',event);" class="text_purchase3"/>
     </td>
     <td><a href="search_purord.php?stname=arn" onClick="NewWindow(this.href,'mywin','800','700','yes','center');return false" onFocus="this.blur()"><input type="button" name="searchord" id="searchord" value="SEARCH" class="btn_purchase2" ></a></td>
  </tr>
  <tr>
    <td><input type="text"  class="label_purchase" value="Supplier" disabled/></td>
    <td><input type="text" class="text_purchase2" name="supplier_code" disabled id="supplier_code" onblur="suppno_ind('arn');" onkeypress="keyset('purtype',event);"/>
      <a href="" onClick="NewWindow('serach_supplier.php?stname=arn','mywin','800','700','yes','center');return false" onFocus="this.blur()">
        <input type="button" name="searchcust2" id="searchcust2" value="SEARCH"  class="btn_purchase1">
      </a></td> 
    <td colspan="2"><input size="65" id="supplier_name" name="supplier_name" type="text" disabled onkeypress="keyset('department',event);"    class="text_purchase3" /> 
    
    <td><input type="text"  class="label_purchase" value="Country" disabled="disabled"/></td>
    <td><select class="text_purchase3"  id="country" name="country" disabled onkeypress="keyset('txtUNIT',event);"> 
          <?php $sql="select * from country "; 
        $result =mysqli_query($GLOBALS['dbinv'],$sql) ; 
        while($row = mysqli_fetch_array($result)){
            echo "<option value='".$row["name"]."'>".$row["name"]." </option>";
        }?>
        </select>
      </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="hidden" name="count" id="count"></td></td>
  </tr>
  <tr>
    
    <td height="41"><input type="text"  class="label_purchase" value="CI No" disabled="disabled"/></td>
    <td><input id="invno1" name="invno1" type="text"   onkeypress="keyset('department',event);"    class="text_purchase3" /> 
    <td height="41"><input type="text"  class="label_purchase" value="BL No" disabled="disabled"/></td>
    <td><input id="blno" name="blno" type="text"   onkeypress="keyset('department',event);"    class="text_purchase3" /> 
    <td><input type="text"  class="label_purchase" value="Order By" disabled="disabled"/></td>
    <td><select name="salesrep" id="salesrep" disabled onkeypress="keyset('dte_dor',event);" class="text_purchase3">
      <?php
    	require_once("connectioni.php");
        if ($_SESSION["MANAGER"]!="") { 			 						
            $sql="select * from s_salrep where pactive='1' and manager='".$_SESSION["MANAGER"]."'order by REPCODE"; 
            $result =mysqli_query($GLOBALS['dbinv'],$sql) ; 
            while($row = mysqli_fetch_array($result)){
                echo "<option value='".$row["REPCODE"]."'>".$row["REPCODE"]." ".$row["Name"]."</option>";
            }
         }else if ($_SESSION["CURRENT_REP"]=="") { 			 						
            $sql="select * from s_salrep where pactive='1' order by REPCODE";
            $result =mysqli_query($GLOBALS['dbinv'],$sql) ; 
            while($row = mysqli_fetch_array($result)){
                echo "<option value='".$row["REPCODE"]."'>".$row["REPCODE"]." ".$row["Name"]."</option>";
            }
         } else {
             $sql="select * from s_salrep where pactive='1' and repcode = '" . $_SESSION["CURRENT_REP"] ."' order by REPCODE";
             $result =mysqli_query($GLOBALS['dbinv'],$sql) ; 
             while($row = mysqli_fetch_array($result)){
             echo "<option value='".$row["REPCODE"]."'>".$row["REPCODE"]." ".$row["Name"]."</option>";
             }
         }
    ?>
    </select></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
      <td><input type="text"  class="label_purchase" value="Container Size" disabled="disabled"/></td>
    <td><input type="text" size="15" name="contsize" id="contsize" value="" onkeypress="keyset('creditlimit',event);" class="text_purchase3"/></td>
    <td><input type="text"  class="label_purchase" value="Purchase Type" disabled="disabled"/></td>
    <td>
      <select name="purtype" id="purtype" onkeypress="keyset('vatgroup_0',event);" class="text_purchase3" onchange="assignbrand();">
        <option value='Import'>Import</option>
        <option value='Local'>Local</option>
      </select> </td>
    <td><input type="text"  class="label_purchase" value="ARN Status" disabled="disabled"/></td>
    <td>
	<select name="arpend" id="arpend" class="text_purchase3">
	<option value='0'>Received</option>	
	<option value='1'>Pending</option>
	
	</select>
	</td>
	<td height="10"><a class='btn_purchase2'  onClick="update_arstat();">UPDATE</a></td>
    <td><input type="hidden"  class="label_purchase" value="Cost Centre" disabled="disabled"/></td>
    <td style='visibility:hidden'><select name="costcenter" id="costcenter" onkeypress="keyset('vatgroup_0',event);" class="text_purchase3 " onchange="assignbrand();">
      <option> --Select-- </option>
      <option value='1'>1</option>
      <option value='2'>2</option>
      <option value='3'>3</option>
      <option value='4'>4</option>
      <option value='5'>5</option>
      <option value='6'>6</option>
      <option value='7'>7</option>
      <option value='8'>8</option>
      <option value='9'>9</option>
      <option value='10'>10</option>
    </select></td> 
  </tr>
  <tr>
    
    <td><input type="text"  class="label_purchase" value="Remark" disabled="disabled"/></td>
    <td colspan="3"><textarea name="textarea" id="textarea" cols="45" rows="2" class="text_purchase5"></textarea></td>
   <td><input type="text"  class="label_purchase" value="Invoice Date" disabled="disabled"/></td>
    <td><input type="date"  name="indate" id="indate" value="<?php echo date("Y-m-d"); ?>"   class="text_purchase3"/></td>
    
	 
    
  </tr>
  </table>

  
  <br/>   
<fieldset>               
            
   	<legend><div class="text_forheader">Item Details</div></legend>            
            
  <table width="94%" border="0">
    
  
  <tr>
	<td width="30%" colspan="10">
    <div class="CSSTableGenerator" id="itemdetails" >
<table>
                                                        			<tr>
                              											<td width="70"  background="images/headingbg.gif" ><font color="#FFFFFF">Item Code</font></td>
                              											<td width="300"  background="images/headingbg.gif"><font color="#FFFFFF">Description</font></td>
                              											<td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Order Qty</font></td>
                              											<td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">FOB</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Qty</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Supplier Cost</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Dis 1</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Dis 2</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Dis 3</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Actual Cost</font></td> 
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">List Price</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Cash Price</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Credit Price</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Margin</font></td>
                                                                        <td width="100"  background="images/headingbg.gif"><font color="#FFFFFF">Sub Total</font></td>
                           											</tr>
                   												</table>   </div>                                                 		</td>
                                                		</tr>
  
  <tr>
    <td width="10%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
     <td width="10%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
   <td width="10%">&nbsp;</td>
   <td width="10%">&nbsp;</td>
    </tr>
     </tr>
    <tr> 
     <td width="10%"></td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"><input type="text"  class="label_purchase" value="Sub ARN Value" disabled="disabled"/></td>
    <td width="10%"><font color="#FFFFFF">
      <input type="text" size="20" name="total_value" id="sub_val" value="" disabled onblur="calc1();" style="text-align:right;" class="text_purchase3" onkeypress="keyset('discount',event);"/>
    </font></td>
    </tr>
    
     <tr> 
     <td width="10%"></td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"><input type="text"  class="label_purchase" value="Total Discount " disabled="disabled"/></td>
    <td width="10%"><font color="#FFFFFF">
      <input type="text" size="20" name="total_dis" id="total_dis" value="" disabled  style="text-align:right;" class="text_purchase3" onkeypress="keyset('discount',event);"/>
    </font></td>
    </tr>
    <tr> 
     <td width="10%"></td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"><input type="text"  class="label_purchase" value="Total ARN Value" disabled="disabled"/></td>
    <td width="10%"><font color="#FFFFFF">
      <input type="text" size="20" name="total_value" id="total_value" value="" disabled onblur="calc1();" style="text-align:right;" class="text_purchase3" onkeypress="keyset('discount',event);"/>
    </font></td>
    </tr>
    <tr> 
    <td width="10%"></td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"><input type="text"  class="label_purchase" value="Total Received Quantity" disabled="disabled"/></td>
    <td width="10%"><font color="#FFFFFF">
      <input type="text" size="20" name="total_value" id="total_r_value" value="" disabled   style="text-align:right;"class="text_purchase3" onkeypress="keyset('discount',event);"/>
    </font></td> 
    </tr>
    <tr> 
     <td width="10%"></td>
    <td width="10%"> </td>
    <td width="10%"> </td>
    <td width="10%"> </td> 
     <td width="10%"><input type="text"  class="label_purchase" value="Total Order Quantity" disabled="disabled"/></td>
    <td width="10%"><font color="#FFFFFF">
      <input type="text" size="20" name="total_o_value" id="total_o_value" value="" disabled style="text-align:right;"  class="text_purchase3" onkeypress="keyset('discount',event);"/>
    </font></td> 
    </tr>
</table>
          

</form>        

</fieldset>    
            
            <table width="765" border="0" cellpadding="0">
<tr>
                	<th height="189" colspan="5" align="left" nowrap="nowrap">
              			<div align="left">
              			    <script>new_inv();</script>