<?php session_start(); 
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='signin.php'>Sign in </a> First ";
}
elseif($_SESSION["usertype"]=="Parents")
{
 	echo "You are not Authorized This Page <a href='parents.php'>Back </a> ";
}
else
{
include 'dbc.php';

include 'dbc.php';

$userid=$_SESSION['userid'];

$sql="Select * from chartofaccounts where acc_type='CASH' OR acc_type='BANK' and user_id='$userid'";

$data=mysql_query($sql) or die ("Error:" . mysql_error());

$rows=mysql_num_rows($data);

$sql1="Select * from chartofaccounts where user_id='$userid'";

$data1=mysql_query($sql1) or die ("Error:" . mysql_error());

$rows1=mysql_num_rows($data1);

$rowSQL = mysql_query( "SELECT MAX( tr_no ) AS max FROM `expense_voucher` where user_id='$userid';" );
$row = mysql_fetch_array( $rowSQL );
$largestNumber = $row['max'];
$largestNumber = $largestNumber +1;
?>
<HTML>
<HEAD>
<TITLE>MIND TECH SOLUTION</TITLE>
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-base.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-topbar.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-sidebar.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<style type="text/css">
<!--
.style2 {color: #FFFFFF}
.style3 {font-size: 36px}
.style4 {
	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<script type="text/javascript" src="ddlevelsfiles/ddlevelsmenu.js">

/***********************************************
* All Levels Navigational Menu- (c) Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>
<script type="text/javascript">
function check_data()
{
if(document.getElementById("disc").value=="")
{
alert("Field is Compulsary");
document.getElementById("disc").focus();
}
else if(document.getElementById("amount").value=="")
{
alert("Field is Compulsary");
document.getElementById("amount").focus();
}
else if(document.getElementById("tr_no").value=="")
{
alert("Field is Compulsary");
document.getElementById("tr_no").focus();
}

else
{
document.getElementById("app_form").submit();
}
}
</script>

</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (home final.psd) -->
<TABLE WIDTH=1000 BORDER=0 CELLPADDING=0 CELLSPACING=0 align=center>
  <TR>
    <TD COLSPAN=3 bgcolor="#2365ED"><div align="center"><img src="logo copy.jpg" width="134" height="130"></div></TD>
    <TD COLSPAN=9 bgcolor="#2365ED"><table width="561" border="0" align="left">
	
      <tr>
        <td width="555" height="123" align="center" valign="middle" bgcolor="#2365ED"><p align="center" class="style28"><span class="style37 style3"><strong><h1><font face="Palatino Linotype" color="#FFFFFF"><? echo "" . $_SESSION["userid"]; ?></font></h1></strong></span></p></td>
      </tr>
    </table></TD>
    <TD COLSPAN=2 bgcolor="#2365ED"><a href="http://www.facebook.com"></a></TD>
    <TD><a href="http://www.twitter.com"></a></TD>
    <TD bgcolor="#2365ED"><a href="signin.php">Signout</a><a href="http://www.youtube.com"></a></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED"><div id="ddtopmenubar" class="mattblackmenu">
<?php include("includes/menu.php") ?></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 align=center></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED">&nbsp;</TD>
  </TR>
  
  <style type="text/css">
<!--
.style2 {color: #FFFFFF}
.style4 {	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="26" colspan="16" bgcolor="#000045"><p align="center" class="style36 style2"><strong> Expense Entry form  </strong></p></td>
  </tr>
  <tr>
    <td height="254" colspan="16" valign="top" bgcolor="#FFFF66">
	
      <p>&nbsp;</p>
      <table width="755" border="0" align="center">
                              <?php
include 'dbc.php';


$userid=$_SESSION["userid"];
$today=date("Y-m-d");


$sql = "select * from chartofaccounts where user_id='$userid' ORDER BY acc_name";
$std_ledger=mysql_query($sql) or die("Error : " . mysql_error());
  
echo "<table border=1 width=78% align=center bgcolor=#FFFF66>";
echo "<tr>";

echo "<th bgcolor=yellow> No </th>";
echo "<th bgcolor=yellow> Account Name </th>";
echo "<th bgcolor=yellow> Type </th>";
echo "<th bgcolor=yellow> Acc Symbl </th>";
echo "<th bgcolor=yellow> Cr Amount </th>";


echo "</tr>";
echo "<form name='form_update' method='post' action='expense_voucher_process1.php'>\n";
while ($students = mysql_fetch_array($std_ledger)) {

	echo '<tr>';
	
	echo "<td>{$students['id']}<input type='hidden' name='id[$i]' value='{$students['id']}' /></td>";
	
	echo "<td>{$students['acc_name']}<input type='hidden' name='acc_name[$i]' value='{$students['acc_name']}' /></td>";
echo "<td>{$students['acc_type']}<input type='hidden' name='acc_type[$i]' value='{$students['acc_type']}' /></td>";

	echo "<td>{$students['acc_symb']}<input type='hidden' name='acc_symb[$i]' value='{$students['acc_symb']}' /></td>";
	echo "<td><input type='text' size='20' name='sale_qty[$i]' /></td>";
	
	
	 
	echo '</tr>';
	++$i;
}
?>
<span class="style4">Vocher No  </span>
<input name="v_no" type="text" value="<? echo $largestNumber ?>" readonly/>
<span class="style4">Date  </span>
<input name="vdate" type="text"  value="<? echo $today ?>"/>
<span class="style4">Discription  </span>
<input name="disc" type="text" size="60" /><br><br>
<span class="style4">Voucher Type  </span>
<select name="v_type"> <option>Cash Receipt Voucher</option>
                <option>Bank Receipt Voucher</option>
                <option>Cash Payment Voucher</option>
				<option>Bank Payment Voucher</option>
				
				<option>Genral Voucher</option>
</select>
<span class="style4">Debit Account </span>
<select name="acc_name_dr" id="acc_name_dr">
        <?php

  while($user_data=mysql_fetch_array($data))

  {

  ?>
        <option value="<? echo $user_data['acc_name']; ?>"><? echo $user_data["acc_name"]; ?></option>
        <?php

  }

  ?>
      </select>

<br><br>
<?php
echo '<tr>';
echo "<td><input type='submit' value='submit' /></td>";

echo '</tr>';
echo "</form>";
echo '</table>';
?>

							  </div>
							    </td>
							      
  <td>&nbsp;</td>
      <td>&nbsp;</td>
  </tr>
                            </table>
      <p align="center">&nbsp;</p>
      <p align="center">&nbsp;</p>
    </form></td>
  </tr>
</table>
<table width="78%" align="center" bgcolor="#010044">
<tr>
  <td height="46" colspan="2" bgcolor="#010044">&nbsp;</td>
  <td width="580" rowspan="2" bgcolor="#010044">&nbsp;</td>
</tr>
      <tr>
        <td height="52" bgcolor="#010044">&nbsp;</td>
        <td bgcolor="#010044">&nbsp;</td>
      </tr>
    </table>

</body>
</html>
<?php
}
?>