| Current Path : /var/www/html/mmishra/icure/patient/ |
| Current File : /var/www/html/mmishra/icure/patient/bills.inc |
<h3 align='left'>Bill Submission</h3>
<center>
<?php
$tbl = 'bills';
$billno = $_REQUEST["billno"];
$regno = $_REQUEST["regno"];
if ($_POST["submit"] == 'SAVE' && $user) {
$billdate = $_POST["billdate"];
$billamount = $_POST["billamount"];
$shopname = $_POST["shopname"];
$dateverification = $_POST["dateverification"];
$datesubmission = $_POST["datesubmission"];
if (mysql_num_rows(mysql_query("select * from $tbl where bill_no=$billno"))) {
mysql_query("update $tbl set reg_no=$regno,bill_date='$billdate',bill_amount=$billamount,shop_name='$shopname',
date_verification='$dateverification',date_submission='$datesubmission' where bill_no=$billno");
} else {
mysql_query("insert into $tbl(bill_no,reg_no,bill_date,bill_amount,shop_name,date_verfication,date_submission,
date_creation,date_updation,login_id)
values($billno,$regno,'$billdate',$billamount,'$shopname','$dateverification','$datesubmission',now(),now(),'$user')");
}
$billno = 0;
}
if ($_REQUEST["del"] == 1) {
mysql_query("delete from $tbl where bill_no=$billno");
$billno = 0;
}
?>
<table border='1' width='80%'>
<tr><th>Sr</th><th>BillNo</th><th>Bill Date</th><th>Amount</th><th>Shop Name</th><th>RegNo</th>
<th>Verification Date<th>Submission Date</th><td align='center'>Action</td></tr>
<?php
if (!$billno) {
echo "<tr><td>+</td>
<td align='center'><input type='text' name='billno' value='' size='10'></td>
<td align='center'><input type='text' name='billdate' value='".date("Y-m-d")."' size='10'></td>
<td align='center'><input type='text' name='billamount' value='0.00' size='10'></td>
<td align='center'><input type='text' name='shopname' value='' size='30'></td>
<td align='center'><input type='text' name='regno' value='' size='10'></td>
<td align='center'><input type='text' name='dateverification' value='".date("Y-m-d")."' size='10'></td>
<td align='center'><input type='text' name='datesubmission' value='".date("Y-m-d")."' size='10'></td>
<td align='center'><input type='submit' name='submit' value='SAVE'></td></tr>";
} else {
echo "<tr><td colspan='9'><a href='?pg=$pg&billno='>+</a></td></tr>";
}
$rs = mysql_query("select * from $tbl where login_id='$user' order by bill_no");
while ($o = mysql_fetch_object($rs)) {
$i++;
echo "<tr><td>$i</td>";
if ($billno == $o->bill_no) {
echo "<td align='center'><input type='text' name='billno' value='$o->bill_no' size='10'></td>
<td align='center'><input type='text' name='billdate' value='$o->bill_date' size='10'></td>
<td align='center'><input type='text' name='billamount' value='$o->bill_amount' size='10'></td>
<td align='center'><input type='text' name='shopname' value='$o->shop_name' size='30'></td>
<td align='center'><input type='text' name='regno' value='$o->reg_no' size='10'></td>
<td align='center'><input type='text' name='dateverification' value='$o->date_verification' size='10'></td>
<td align='center'><input type='text' name='datesubmission' value='$o->date_submission' size='10'></td>
<td nowrap align='center'><input type='submit' name='submit' value='SAVE'>
<a href='?pg=$pg&del=1&billno=$billno'>x</a></td>";
} else {
echo "<td><a href='?pg=$pg&billno=$o->bill_no'>$o->bill_no</a></td>
<td>$o->bill_date</td><td>$o->bill_amount</td><td>$o->shop_name</td>
<td><a href='?pg=$pg®no=$o->reg_no'>$o->reg_no</a></td>
<td>$o->date_verification</td><td>$o->date_submission</td>";
}
echo "</tr>";
}
?>
</table>
<?php
if ($regno) {
$heads = array('Registrations','Medications');
echo "<h3 align='center'>Treatment Record of Registration No.: $regno</h3>";
$sqls = array("select reg_no,concat(reg_date,' ',reg_time) as dated,concat(dr_name,' (',specialization,')') as doctor,a.login_id as staff from registrations a, doctors b where a.dr_id=b.dr_id and reg_no=$regno",
"select med_name,qty,a.login_id as staff from medications as a, medicines as b where a.med_id=b.med_id and reg_no=$regno");
echo patient_name($regno);
$no = 0;
foreach ($sqls as $sql) {
echo "<p align='left'><b>".$heads[$no]."</b></p>";
$no++;
echo list_tabledata($sql);
}
}
?>
</center>