ESH/save_ambulance_details.php
2024-10-23 18:28:06 +05:30

44 lines
2.0 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
include('log_entry.php');
error_log("Start Printing Request Attributes");
$requestStr = "";
foreach ($_REQUEST as $key => $value) {
$requestStr .= $key . " : " . $value . "\n";
error_log($key . " : " . $value . "<br />\r\n");
}
error_log("End Printing Request Attributes");
save_log($requestStr, 'Ambulance Move', 'SAVE', 'save_ambulance_details.php');
$noOfRows = $_POST['count_items'];
$dis_agncy = $_POST['dis_agncy'];
//ech "hello".$noOfRows;
//$waste_id = $_POST['waste_id'];
//echo $ambulance_id;
//echo $procurement_refno;
$query_initial = "";
$endquery = "";
begin();
if (!empty($ambulance_usage_id)) {
$query_initial = "update ";
$endquery = " where ambulance_usage_id = '" . $ambulance_usage_id . "' ";
} else {
$query_initial = "insert into ";
}
$dateENTRY = $_REQUEST['ambulance_date'];
$query = $query_initial . " ambulance_usage_details set usage_date=STR_TO_DATE('" . $dateENTRY . "','%d/%m/%Y'),paramedic_id='" . $_REQUEST['paramedic_id_str'] . "', driver_id ='" . $_REQUEST['ambulance_driver'] . "',city_id ='" . $city . "',ambulance_from = '" . $_REQUEST['ambulance_from'] . "',ambulance_to ='" . $_REQUEST['ambulance_to'] . "',ambulance_out_km='" . $_REQUEST['ambulance_out_km'] . "',ambulance_in_km='" . $_REQUEST['ambulance_in_km'] . "',ambulance_total_km='" . $_REQUEST['ambulance_total_km'] . "',ambulance_out_time='" . $_REQUEST['ambulance_out_time'] . "',ambulance_in_time='" . $_REQUEST['ambulance_in_time'] . "',duty_type='" . $_REQUEST['ambulance_duty'] . "',ambulance_used='" . $_REQUEST['ambulance_used'] . "',ambulance_details='" . $_REQUEST['ambulance_details'] . "',ambulance_id='" . $_REQUEST['ambulance_number'] . "',modified_by = '" . $_SESSION['user_id'] . "' ,patient_id = '" . $_REQUEST['patient_name'] . "',ohc_type_id='" . $_SESSION['current_ohcttype'] . "' " . $endquery;
//echo $query;
error_log($query);
if (!$result = mysqli_query($conn, $query)) {
rollback();
exit(mysqli_error($conn));
}
commit();