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

330 lines
13 KiB
PHP

<?php include('techsyn_header.php');
error_reporting(E_ERROR | E_WARNING | E_PARSE);
?>
<!-- Main Content Container for sid and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<!-- <style>
input{
width : '30%'
}
</style> -->
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<?php
?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li class="active">Upload Excel For Vaccination List</li>
<li class="active">Upload Excel</li>
</ul>
<!-- End of breadcrumb -->
</div>
</div>
<div class="box-body" style="overflow: scroll; background-color: white;">
<form action="" method="post" name="frmExcelImport" id="frmExcelImport" enctype="multipart/form-data">
<!-- <div class="panel panel-info" style="margin-top:50px"> -->
<!-- <div class="panel-heading"><b</b></div> -->
<div class="panel-body">
<div class="form-group">
<!-- <div class="col-xs-1">
</div> -->
<div class="col-xs-9">
<?php
$inserts = 0;
$updates = 0;
$vaccine_interm_id = $_REQUEST['vaccine_interm_id'];
$vaccine_interm_id = explode(',', $vaccine_interm_id);
error_log('interm id= ' . $vaccine_interm_id);
?>
<table width="100%">
<tr width="30%" style="background-color: #eeeeee; color:black;">
<td align="center"><strong>Vaccine Name</td>
<td align="center"><strong>1st vaccine Dose</td>
<td align="center"><strong>1st Vaccine Center</td>
<td align="center"><strong>2nd vaccine Dose</td>
<td align="center"><strong>2nd Vaccine Center</td>
<td align="center"><strong>3rd vaccine Dose</td>
<td align="center"><strong>3rd Vaccine Center</td>
<td align="center"><strong>REMARKS</td>
</tr>
<?php
for ($i = 0; $i < count($vaccine_interm_id); $i++) {
if ($vaccine_interm_id[$i] != null || $vaccine_interm_id[$i] != '' || $vaccine_interm_id[$i] != 0) {
$ref_no = '';
?>
<?php $proc_item_sql = "select * from temporary_vaccination_details where id='" . $vaccine_interm_id[$i] . "'";
error_log($proc_item_sql);
$result_item_sql = mysqli_query($conn, $proc_item_sql);
$num = mysqli_num_rows($result_item_sql);
if ($num != 0 || $num != null) {
?>
<tr width="100%">
<?php
while ($row_item_proc = mysqli_fetch_array($result_item_sql)) {
error_log('update_q' . $proc_item_update);
$date = date_create($row_item_proc['usage_date']);
$usage_date = date_format($date, "d-m-Y");
$vaccine_name = getFieldFromTable('vaccine_name', 'vaccine_master', 'id', $row_item_proc['vac_id']);
?>
<td><input style="color: black;" class="form-control" type="text" name="vaccine_name<?php echo $i ?>" id="vaccine_name<?php echo $i ?>" value="<?php echo $vaccine_name ?>">
</td>
<?php
if ($row_item_proc['vac_d1'] == "0000-00-00") {
$vac1 = "";
} else {
$vac1 = $row_item_proc['vac_d1'];
}
?>
<td><input style="color: black;" class="form-control" type="text" name="vac_d1<?php echo $i ?>" id="vac_d1<?php echo $i ?>" value="<?php echo $vac1 ?>">
</td>
<td><input style="color: black;" class="form-control" type="text" name="vac_center1<?php echo $i ?>" id="vac_center1<?php echo $i ?>" value="<?php echo $row_item_proc['vac_center1'] ?>">
</td>
<?php
if ($row_item_proc['vac_d2'] == "0000-00-00") {
$vac2 = "";
} else {
$vac2 = $row_item_proc['vac_d2'];
}
?>
<td><input style="color: black;" class="form-control" type="text" name="vac_d2<?php echo $i ?>" id="vac_d2<?php echo $i ?>" value="<?php echo $vac2 ?>">
</td>
<td><input style="color: black;" class="form-control" type="text" name="vac_center2<?php echo $i ?>" id="vac_center2<?php echo $i ?>" value="<?php echo $row_item_proc['vac_center2'] ?>">
</td>
<?php
if ($row_item_proc['vac_d3'] == "0000-00-00") {
$vac3 = "";
} else {
$vac3 = $row_item_proc['vac_d3'];
}
?>
<td><input style="color: black;" class="form-control" type="text" name="vac_d3<?php echo $i ?>" id="vac_d3<?php echo $i ?>" value="<?php echo $vac3 ?>">
</td>
<td><input style="color: black;" class="form-control" type="text" name="vac_center3<?php echo $i ?>" id="vac_center3<?php echo $i ?>" value="<?php echo $row_item_proc['vac_center3'] ?>">
</td>
<td><input style="color: black;" class="form-control" type="text" name="remarks<?php echo $i ?>" id="remarks<?php echo $i ?>" value="<?php echo $row_item_proc['remarks'] ?>">
</td>
</tr>
<?php
} ?>
<?php }
}
} ?>
</table>
</div>
</div>
</div>
</div>
</form>
<center>
<button type="button" onclick="approve_usage()" name="import" value="1" id="submit" class="btn btn-primary">
Approve</button>
<button type="button" onclick="delete_interm()" name="cancel" id="cancel" class="btn ">
Cancel</button>
</center>
</div>
<?php include('techsyn_footer.php'); ?>
<style>
body {
font-family: Arial;
width: 100%;
}
.outer-container {
background: #F0F0F0;
border: #e0dfdf 1px solid;
padding: 40px 20px;
border-radius: 2px;
}
.btn-submit {
background: #333;
border: #1d1d1d 1px solid;
border-radius: 2px;
color: #f0f0f0;
cursor: pointer;
padding: 5px 20px;
font-size: 0.9em;
}
.tutorial-table {
margin-top: 40px;
font-size: 0.8em;
border-collapse: collapse;
width: 100%;
}
.tutorial-table th {
background: #f0f0f0;
border-bottom: 1px solid #dddddd;
padding: 8px;
text-align: left;
}
.tutorial-table td {
background: #FFF;
border-bottom: 1px solid #dddddd;
padding: 8px;
text-align: left;
}
#response {
padding: 10px;
margin-top: 10px;
border-radius: 2px;
display: none;
}
.success {
background: #c7efd9;
border: #bbe2cd 1px solid;
}
.error {
background: #fbcfcf;
border: #f3c6c7 1px solid;
}
div#response.display-block {
display: block;
}
</style>
<script>
$('#frmExcelImport').on('submit', function(event) {
event.preventDefault();
$.ajax({
url: "upload_excel_procurement_script.php",
method: "POST",
data: new FormData(this),
contentType: false,
processData: false,
dataType: 'json',
success: function(data) {
location.href = 'upload_excel_procurement_script.php';
},
error: function(data) {
BootstrapDialog.alert('Data uploading failed');
}
});
})
function delete_interm() {
let usage_id = <?php $interm_id = $_REQUEST['$vaccine_interm_id'];
$interm_id = explode(',', $interm_id);
echo json_encode($interm_id);
?>;
BootstrapDialog.confirm('Are you sure to Cancel Vaccination Data?', function(result) {
if (result) {
$.ajax({
url: 'delete_temp_vac_pro_upload.php',
type: "POST",
success: function(data) {
BootstrapDialog.alert('Vaccination Deleted Successfully.');
location.href = 'bulk_upload.php';
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Vaccination');
return;
}
});
}
})
}
function approve_usage() {
let usage_id = <?php $interm_id = $_REQUEST['vaccine_interm_id'];
$interm_id = explode(',', $interm_id);
echo json_encode($interm_id);
?>;
BootstrapDialog.confirm('Are you sure to Save ' +
'<?php if ($updates != 0) {
echo 'Update :' . $updates . ',';
} ?>' +
'<?php if ($inserts != 0) {
echo 'Insert :' . $inserts;
} ?>' + ' Vaccination Data ?',
function(result) {
if (result) {
$.ajax({
url: 'upload_excel_vaccine_script.php',
type: "POST",
data: {
usage_id: usage_id,
},
success: function(data) {
BootstrapDialog.alert('Vaccination Data Save Successfully.');
location.href = 'bulk_upload.php';
return;
},
error: function(data) {
BootstrapDialog.alert('Error Vaccination Data ');
return;
}
});
}
});
}
</script>