Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/iws8/html/ipay/
Upload File :
Current File : /var/www/html/mmishra/iws8/html/ipay/feehead.inc

<h3 align='left'>Fee Heads</h3>
<center>
<?php

$tbl = 'ac_feeheads';
$id = $_REQUEST["id"];

if ($_POST["submit"] == 'SAVE') {
	$headname = $_POST["head_name"];
	$amount = $_POST["amount"];
	if (mysql_num_rows(mysql_query("select * from $tbl where id=$id"))) {
		mysql_query("update $tbl set head_name='$headname',amount=$amount where id=$id");
	} else {
		mysql_query("insert into $tbl(head_name,amount,dated) values('$headname',$amount,now())");
	}

} else if ($_POST["submit"] == 'DELETE') {
	mysql_query("delete from $tbl where id=$id");
}

echo "<table width='70%' border='1' style='border-collapse:collapse'>
<tr><th>Sr</th><th>Head Name</th><th>Amount (INR)</th><th>Dated</th><td align='center'>Action</td></tr>";
echo "<tr><td>+</td>";
if (!$id) {
	echo "<td><input type='text' name='head_name' value='' size='35'></td>
	<td><input type='text' name='amount' value='0' size='15'></td>
	<td>".date("Y-m-d")."</td>
	<td><input type='submit' name='submit' value='SAVE'></td></tr>";
} else {
	echo "<td colspan='4'><a href='?pg=$pg'>Head</a></td></tr>";
} 

$rs = mysql_query("select * from $tbl order by id");
while ($o = mysql_fetch_object($rs)) {
	$i++;
	if ($id == $o->id) {
		echo "<tr><td>$i</td>
		<td><input type='text' name='head_name' value='$o->head_name' size='35'></td>
		<td><input type='text' name='amount' value='$o->amount' size='15'></td>
		<td>$o->dated <input type='hidden' name='id' value='$o->id'></td>
		<td><input type='submit' name='submit' value='SAVE'> <input type='submit' name='submit' value='DELETE'></td></tr>";
	} else {
		echo "<tr><td><a href='?pg=$pg&id=$o->id'>$i</a></td>
		<td>$o->head_name</td><td>$o->amount</td><td>$o->dated</td></tr>";
	}
}
?>

</table>
</center>