95 lines
3.9 KiB
PHP
95 lines
3.9 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 Master', 'SAVE', 'save_ambulance_list.php');
|
|
$noOfRows = $_POST['count_items'];
|
|
error_log("rows: " . $noOfRows);
|
|
// $dis_agncy = $_POST['dis_agncy'];
|
|
|
|
//echo "hello".$noOfRows;
|
|
$audit_id = $_REQUEST['audit_id'];
|
|
$finding_type = $_REQUEST['finding_type'];
|
|
$finding_detail = $_REQUEST['finding_detail'];
|
|
$auditor_remark = $_REQUEST['auditor_remark'];
|
|
$representative_remarks = $_REQUEST['representative_remarks'];
|
|
$representative_status = $_REQUEST['representative_status'];
|
|
$target_fix_date = $_REQUEST['target_fix_date'];
|
|
$remarks = $_REQUEST['remarks'];
|
|
|
|
|
|
$modified_by= $_SESSION['user_id'];
|
|
$audit_name = $_REQUEST['audit_name'];
|
|
$audit_name = $_REQUEST['audit_name'];
|
|
$location = $_REQUEST['location'];
|
|
$start_date_time = $_REQUEST['start_date_time'];
|
|
$end_date_time = $_REQUEST['end_date_time'];
|
|
$auditor_name = $_REQUEST['auditor_name'];
|
|
$representative_name = $_REQUEST['representative_name'];
|
|
$audit_remarks = $_REQUEST['audit_remarks'];
|
|
$audit_id = $_REQUEST['audit_id'];
|
|
|
|
$id = $_REQUEST['audit_id'];
|
|
error_log($id."iiiiiiiid");
|
|
if (!empty($id)) {
|
|
$sqlCSR = "UPDATE `health_audit` SET `audit_name`='$audit_name',`audit_details`='$audit_details',`location`='$location',`start_date_time`='$start_date_time',`end_date_time`='$end_date_time',`auditor_name`='$auditor_name',`representative_name`='$representative_name',`audit_remarks`='$audit_remarks',`modified_by`='$modified_by' WHERE `id`='$id'";
|
|
error_log($sqlCSR."if 1st");
|
|
}else{
|
|
$sqlCSR = "INSERT INTO `health_audit`(`audit_name`,`audit_details`, `location`, `start_date_time`, `end_date_time`, `auditor_name`, `representative_name`, `audit_remarks`, `modified_by`) VALUES ('$audit_name','$audit_details','$location','$start_date_time','$end_date_time','$auditor_name','$representative_name','$audit_remarks','$modified_by')";
|
|
error_log($sqlCSR."else 1st");
|
|
}
|
|
|
|
error_log($sqlCSR." CSR");
|
|
|
|
$result = mysqli_query($conn, $sqlCSR);
|
|
|
|
if(empty($id)){
|
|
$cid = mysqli_insert_id($conn);
|
|
} else {
|
|
$cid = $id;
|
|
}
|
|
|
|
|
|
|
|
$query_initial = "";
|
|
$endquery = "";
|
|
begin();
|
|
$id = $_REQUEST['idd'];
|
|
error_log($id2."dipak");
|
|
// if (!empty($id)) {
|
|
// $query_initial = "update ";
|
|
// $endquery = " where id = '" . $id . "' ";
|
|
// } else {
|
|
// $query_initial = "insert into ";
|
|
// $id = $_REQUEST['client_name'];
|
|
// }
|
|
for ($i = 0; $i < $noOfRows; $i++) {
|
|
|
|
|
|
if (!empty(${"audit_detail_id$i"})) {
|
|
$query ="UPDATE health_audit_details set audit_id = '$cid', finding_type = '" . ${"finding_type$i"} . "', finding_detail = '" . ${"finding_detail$i"} . "',modified_by = '" . $_SESSION['user_id'] . "' , auditor_remark = '" . ${"auditor_remark$i"} . "' , representative_remarks = '" . ${"representative_remarks$i"} . "' , representative_status = '" . ${"representative_status$i"} . "', target_fix_date = '" . ${"target_fix_date$i"} . "', remarks = '" . ${"remarks$i"} . "' WHERE `id`='".${"audit_detail_id$i"}."'";
|
|
|
|
error_log($query."IF QUERY2");
|
|
|
|
}else{
|
|
$query ="INSERT INTO health_audit_details set audit_id = '$cid', finding_type = '" . ${"finding_type$i"} . "', finding_detail = '" . ${"finding_detail$i"} . "',modified_by = '" . $_SESSION['user_id'] . "' , auditor_remark = '" . ${"auditor_remark$i"} . "' , representative_remarks = '" . ${"representative_remarks$i"} . "' , representative_status = '" . ${"representative_status$i"} . "', target_fix_date = '" . ${"target_fix_date$i"} . "', remarks = '" . ${"remarks$i"} . "'";
|
|
error_log($query."ELSE QUERY2");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!$result = @mysqli_query($conn, $query)) {
|
|
rollback();
|
|
exit(error_log(mysqli_error($conn)));
|
|
}
|
|
}
|
|
commit(); |