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

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

  $myCompany = $_POST['Company'];



//	$query= "truncate table $filename";
//	mysqli_query($conn,$query) or die(mysqli_error());
?>

<link rel="stylesheet" type="text/css" href="../../include/StyleCalender.css"> 
<script type="text/javascript" language="javascript" src="../../include/CalendarControl.js"></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 width="67" height="31" align="left" ><b><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif">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></tr>
  <tr>
  

</form>
<form name='myform2' method='POST' action='check.php'  target="_blank">
  <?
// Pull all the data from Cat master & populate it




?>
<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">Branch</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>

	
   



		<tr>
        	<tr><td ><div align="left"><font face="Arial, Helvetica, sans-serif">Select Month & Year</font>
        </div></td>
			<td>
				<input type="text"  name="month_year" id="dpMonthYear" value="" style="width:80px;"  readonly />

				&nbsp;<img  alt="Month/Year Picker" onClick="showCalendarControl('dpMonthYear');" 
				 src="../../images/cal.gif" />
			</td>
		</tr>  



		

<tr>


      <td width="67" height="31" align="left" ><b><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif">Accounting Year &nbsp;</font> </div></td>
		<td width="357" class="small_site_font_black" > 		
		
<?
	$result = mysqli_query($conn,"select distinct account_year from ledger order by account_year desc ") or die(mysqli_error());
	?>
	<select name="account_year">
	<?
	while($row = mysqli_fetch_row($result))
	{
          echo "<option value='$row[0]'>";
	  echo $row[0];
	  echo "\n";	
	}
?>
</select>
</td></tr>



<tr>

  <table cellpading=0 cellspacing=10 width= 50>
    <tr> 
      <td> <blockquote> <input type =submit name="submit" value = "Submit"></blockquote></td>
  </table>
</table>

<font size=1> 
<br><br><font size=1><center><a href= "javascript:window.close();">Close Window</a></center></font>
</font> 





                                                                             
</body>
</form>











