<head>
<?php include("../../include/dbconnect.php");

  foreach($_POST as $p=>$t)
  {
     $_POST[$p] = trim($t);
  }

  $myCompany = $_POST['Company'];

$filename = 'templedger';

//	$query= "truncate table $filename2";
//	mysqli_query($conn,$query) or die(mysqli_error());
?>
<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>
<title>Receipt</title>
</head>
<body background="images/blater01.gif" topmargin=0>
<center> 
<table border=0 cellpadding=3 cellspacing=4 width="640" bgcolor="#E6E6FF">
  <tr> 
    <td  colspan="100%"  bgcolor="#93BEE2"><b><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif">Company</font></b></td>


<form name='myForm01' method='POST' action='<?=$_SERVER['PHP_SELF']?>'>


<tr>
<td style="padding:3px;" colspan=2 class="tdhead" ><b>Select Company</b></td>
<td >
  
  <SELECT name='Company'   onChange="javascript:submit();">
    <?
	// Pull all the data from Catcode master & populate it
	
	$stQuery = mysqli_query($conn,"select distinct compcode,name from company  order by name");


	
	
     echo "<option selected value=\" 0\"> Select Company ";
    while($row = mysqli_fetch_row($stQuery))
    {

		$temp = $row[1];
        if(isset($myCompany) && preg_match("/" . preg_quote($myCompany, '/') . "/", $row[0]))
	    {
            echo "<option selected value=\"$row[0]\">$temp";
        }
        else{
            echo "<option value=\"$row[0]\">$temp";
        }
    }
?>
  </SELECT></td>

</form>
<form name='myform2' method='POST' action='gl_editview.php?myHead=0' >

<input type="hidden" name="compcode" value="<?=$myCompany?>" > 

      <td width="67" height="31" align="left" ><b><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif">Profit Center</font></b></td>
      <td colspan="3" >  <select name='branch' >
          <?php 
$result= mysqli_query($conn," select distinct code,name from branches where compcode = '$myCompany' order by name")or die( mysqli_error() );
      while ( $row1= mysqli_fetch_row($result))
      {
	  	{
			echo "<option value=\"$row1[0]\">$row1[1]";
	  	}
  	 }
?>
      </select> </td></tr>
	

	
   


<input type="hidden" name="status" value="NEW">

<input type="hidden" name="mdt" value="">


  <table cellpading=0 cellspacing=10 width= 50>
    <tr> 
      <td> <blockquote> <input type =submit name="submit" value = "Submit"></blockquote></td>
  </table>
</table>
</form>
<font size=1> 
<br><br><font size=1><center><a href= "javascript:window.close();">Close Window</a></center></font>
</font> 
