Project Report of Electricity Billing System
Page - 66
$cond;
$rs = mysql_query($SQL) or die(mysql_error());
header("Location:../bill-report.php?msg=$msg");
}
#########Function for delete bill##########3
function delete_bill()
{
/////////Delete the record//////////
$SQL="DELETE FROM bill WHERE bill_id = $_REQUEST[bill_id]";
mysql_query($SQL) or die(mysql_error());
header("Location:../bill-report.php?msg=Deleted Successfully.");
}
?>
Project Report of Electricity Billing System
Page - 67
Coding for Booking.php
include_once("../includes/db_connect.php");
include_once("../includes/functions.php");
if($_REQUEST[act]=="save_book")
{
save_book();
exit;
}
if($_REQUEST[act]=="delete_book")
{
delete_book();
exit;
}
if($_REQUEST[act]=="get_report")
Project Report of Electricity Billing System
Page - 68
{
get_report();
exit;
}
###Code for save book#####
function save_book()
{
$R=$_REQUEST;
/// Get the room details ///////
$SQL = "SELECT * FROM room WHERE room_id = '$R[book_room_id]'";
$rs = mysql_query($SQL) or die(mysql_error());
$data = mysql_fetch_assoc($rs);
/// Date and amount calculation //////
$dStart = new DateTime($R[book_from_date]);
Project Report of Electricity Billing System
Page - 69
$dEnd = new DateTime($R[book_to_date]);
$dDiff = $dStart->diff($dEnd);
$totalDays = $dDiff->days;
$totalAmount = $totalDays * $R[book_no_rooms] * $data['room_fare'];
if($dDiff->format('%R') == "-")
{
die("From date should me smaller than current date.");
}
if($R[book_id])
{
$statement = "UPDATE `book` SET";
$cond = "WHERE `book_id` = '$R[book_id]'";
$msg = "Data Updated Successfully.";
}
else
|