| Current Path : /var/www/html/mmishra/icure/staff/ |
| Current File : /var/www/html/mmishra/icure/staff/bill.inc |
<h3 align='left'>Bill Receipt</h3>
<center>
<?php
$tbl = 'bills';
$billno = $_REQUEST["billno"];
$regno = $_REQUEST["regno"];
if ($_POST["submit"] == 'SAVE') {
$billamount = $_POST["billamount"];
$billdatetime = $_POST["billdatetime"];
if (mysql_num_rows(mysql_query("select * from $tbl where bill_no=$billno"))) {
mysql_query("update $tbl set reg_no=$regno,bill_amount=$billamount,login_id='$user' where bill_no=$billno");
} else {
mysql_query("insert into $tbl(bill_no,reg_no,bill_amount,bill_date,login_id)
values($billno,$regno,$billamount,'$billdate','$user')");
}
}
if ($_GET["del"] == 1) {
// mysql_query("delete from $tbl where bill_no=$billno");
}
echo "<table border='1' width='80%'>
<tr><th>Sr</th><th>RegNo</th><th>BillNo</th><th>BillAmount</th><th>BillDate</th>
<th>ShopName</th><td align='center'>Action</td></tr>";
if (!$billno) {
echo "<tr><td>+</td>
<td><input type='text' name='regno' value='' size='20'></td>
<td><input type='text' name='billno' value='' size='20'></td>
<td><input type='text' name='billamount' value='0' size='10'></td>
<td><input type='text' name='billdate' value='".date("Y-m-d")."' size='15'></td>
<td><input type='text' name='shopname' value='' size='25'></td>
<td align='center'><input type='submit' name='submit' value='SAVE'></td></tr>";
} else {
echo "<tr><td colspan='7'><a href='?pg=$pg®no=$regno&billno='>+</a></td></tr>";
}
$rs = mysql_query("select * from $tbl order by date_creation desc");
while ($o = mysql_fetch_object($rs)) {
$i++;
echo "<tr><td>$i</td>";
if ($billno == $o->bill_no) {
echo "<td><input type='text' name='regno' value='$o->reg_no' size='20'></td>
<td><input type='text' name='billno' value='$o->bill_no' size='20'></td>
<td><input type='text' name='billamount' value='$o->bill_amount' size='10'></td>
<td><input type='text' name='billdate' value='$o->bill_date' size='15'></td>
<td><input type='text' name='shopname' value='$o->shop_name' size='25'></td>
<td align='center'><input type='submit' name='submit' value='SAVE'></td>";
} else {
echo "<td><a href='?pg=$pg®no=$o->reg_no&billno=$o->bill_no'>$o->reg_no</td>
<td><a href='?pg=$pg®no=$o->reg_no&billno=$o->bill_no'>$o->bill_no</td>
<td>$o->bill_amount</td>
<td>$o->bill_date</td>
<td>$o->shop_name</td>";
}
echo "</tr>";
if (!$regno) $regno = $o->reg_no;
}
echo "</table>";
echo registration_detail($regno);
?>
</center>