<?php include "header.php"; ?>
<div id="page-wrapper">

            <div class="row">
                <!-- Page Header -->
                <div class="col-lg-12"><script language="JavaScript" src="gen_validatorv4.js"
    type="text/javascript" xml:space="preserve"></script>
<style type="text/css">
<!--
.style2 {font-size: 11px; color:#000}
.style3 {font-weight: bold}
.style4 {
	color: #FF0000;
	font-weight: bold;
}
.style5 {font-weight: bold}
-->
</style><?php
 $date_array = getdate();?><?php
$en=$_POST['en'];
$monthx=$_POST['month'];
$query = "SELECT * FROM add_teachers WHERE sr_no=$en and session='$session' and code='$code'";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");
$a_row=mysql_fetch_row($result);
?> <?php if($numrows==""){
 echo "<tr><td colspan='12' style='border:none; text-align:center'><h3 class='logo2'>Data will be not found in your database</h3></td></tr>";
 echo "<tr><td colspan='12' style='border:none; text-align:center'><a href=\"add_teacher.php\"><img src='images/back2.jpg' /></a></td></tr>";}
 elseif($numrows!=""){?>
<form action="salary_savee.php" method="post" name="myform" target="_blank">
<input type="hidden" name="tocken" value="<?php print"$date_array[year]$date_array[mon]$date_array[mday]$date_array[hours]$date_array[minutes]$date_array[seconds]";?>" />
<input name="monthx" type="text" readonly value="<?php echo $monthx; ?>"/>
<br/><br/><br/><br/>
 <table width="800"  cellspacing="0"  cellpadding="2"  align="center">

  <tr>
    <td colspan="4"  style="border:none;background:url(images/title2.jpg); height:20; color:#990000; background-repeat:repeat-x;">Create Salary</td>
  </tr>
  <tr>
    <td colspan="4" style="border:0px;" align="center" ><table width="600" border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td colspan="4" style="border:0px;" align="center">Bill No.   
            <?php	
$query = "SELECT * FROM salary where session='$session' and code='$code' ORDER BY id ASC";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");
?> 

            <?php
		  $counter = 1;
while ( $a_roww = mysql_fetch_row( $result ) )
 {?>
             <?php $time=$a_roww[0];?>
             
			   <?php
		  $counter++; 
		  }
		  //echo $time;
		  $time=++$time;
		 
		  ?>
            <input type="text" name="id" id="id" value="<?php print"$time";?>" tabindex="1"  readonly="readonly"/>    <input name="post" value="<?php echo $a_row[10];?>" type="text" />  </td>
        </tr>
	  
      <tr>
        <td colspan="4"  align="center"><input name="en" value="<?php echo $a_row[5];?>" type="hidden" /><?php echo $a_row[5];?>
          Staff Name - 
            <?php echo $a_row[7];?> ( <?php echo $a_row[8];?> ) </td>
        </tr>
      

      <tr>
        <td width="16%" ><div align="right">Date</div></td>
        <td colspan="3"><div align="left">
        <select name="day">
          <option><?php echo $date_array[mday];?></option>
		  <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8</option>
          <option>9</option>
          <option>10</option>
          <option>11</option>
          <option>12</option>
          <option>13</option>
          <option>14</option>
          <option>15</option>
          <option>16</option>
          <option>17</option>
          <option>18</option>
          <option>19</option>
          <option>20</option>
          <option>21</option>
		  <option>22</option>
		  <option>23</option>
          <option>24</option>
          <option>25</option>
          <option>26</option>
          <option>27</option>
          <option>28</option>
          <option>29</option>
          <option>30</option>
          <option>31</option>
        </select>
        <select name="month" >
         <option><?php echo $date_array[mon];?></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>
          <option value="11">11</option>
          <option value="12">12</option>
        </select>
        <select name="year" >
        <option value="<?php echo $date_array[year]; ?>"><?php echo $date_array[year]; ?></option>
       </select>Payment Option:<select name="payment_option" onchange="playerOne">
             <option>Cash</option>
          <option>Cheque</option>
          <option>D.D.</option>
        </select>
      </div></td>
        </tr>
      
      <tr>
        <td  ><div align="right" class="style15 style5"></div></td>
        <td width="33%"><div align="left"><span class="style15 style5">Cheque/D.D. Number<br />
              <input type="text" name="dd_cc_no" style="width:150px;"  />
        </span></div></td>
        <td width="30%"><div align="left"><span class="style15 style5">Bank Name</span><br />
            <input type="text" name="bank_name" style="width:150px;"   />
        </div></td>
        <td width="20%"><div align="left"><span class="style15 style5">Branch<br />
              <input type="text" name="Branch" style="width:150px;"  />
        </span></div></td>
      </tr>
      
    </table></td>
  </tr>
  
  <tr>
    <td colspan="4" align="left" >&nbsp;</td>
   </tr>
  <tr bgcolor="#f1f1f1">
    <td valign="top" bgcolor="#FFFF99" >&nbsp;</td>
    <td bgcolor="#FFFF99" >Month</td>
    <td bgcolor="#FFFF99">&nbsp;</td>
    <td bgcolor="#FFFF99"><input type="hidden" name="<?php echo $monthx; ?>" value="paid"><?php echo $monthx; ?></td>
  </tr>
  <tr bgcolor="#f1f1f1">
    <td valign="top" bgcolor="#FFFF99" >&nbsp;</td>
    <td bgcolor="#FFFF99" >Advance Payment</td>
    <td bgcolor="#FFFF99">:</td>
    <td bgcolor="#FFFF99"><?php 
$resultbb = mysql_query("SELECT * FROM salary where sr_no=$en and $monthx='Paid' and session='$session' and code='$code' ORDER BY id ");
?>
 <?php
while ( $a_rowbb = mysql_fetch_array( $resultbb ) )
 {
  $advan+=$a_rowbb['total'];
 ?> 
 
 <?php } echo $advan;?> </td>
  </tr>
  <tr bgcolor="#f1f1f1">
    <td width="693" valign="top" bgcolor="#FFFF99" ><?php echo $i++;?></td>
    <td width="2748" bgcolor="#FFFF99" ><strong>Pay Salary</strong></td>
    <td width="21" bgcolor="#FFFF99"><div align="center"><span ></span></div></td>
   <td width="4786" bgcolor="#FFFF99"><div align="left">
           <span class="style2">Rupees</span> 
          <input type="text" name="psa" style="width:100px;"  value="<?php echo $a_row[51]-$advan; $totalll=$a_row[51];?>" required="required" />
        &nbsp;</div></td>
    </tr>
  
  <tr bgcolor="#FFFF99">
    
    <td colspan="4"></td>
  </tr>
    
     
       <tr>
    <td valign="top" >&nbsp;</td>
    <td  class="style20"><div align="right" >Deduction  </div></td>
    <td ><div align="center" ><strong>:</strong></div></td>
    <td >
      
        <div align="left">
          <input type="text" name="Deduction" style="width:50" />
        </div></td>
    </tr>
	 <tr>
    <td valign="top" >&nbsp;</td>
    <td  class="style20"><div align="right" >Bonus   </div></td>
    <td ><div align="center" ><strong>:</strong></div></td>
    <td >
      
        <div align="left">
          <input type="text" name="bonus" style="width:50" />
         </div></td>
    </tr>
  
     
    <tr>
    <td colspan="2" valign="top" bgcolor="#F8FCFC"  style="border:0px;"><div align="right" class="style33">Note:</div></td><td colspan="2" style="border:0px;"><textarea name="notes" cols="40" rows="2"></textarea></td>
  </tr>
  <tr>
    <td colspan="4" style="border:0px;" bgcolor="#F8FCFC"><div align="center">
      <input type="submit" name="submit" value="Save" style="width:100px;" />
      <input type="reset" name="Submit2" style="width:70px;" value="Clear" />
    </div></td>
    </tr>
  
  <tr>
    <td style="border:0px;" valign="top" >&nbsp;</td>
    <td style="border:0px;" >&nbsp;</td>
    <td style="border:0px;" ><div align="center"><span ></span></div></td>
    <td style="border:0px;" >&nbsp;</td>
    </tr>
</table>
</form>
</div></div></div>
<?php }
include "footer.php"; ?>