200 lines
9.0 KiB
PHP
200 lines
9.0 KiB
PHP
|
<table class="table table-striped table-bordered table-hover" style="width:100%;border:1px;">
|
||
|
<tr bgcolor="#eeeeee">
|
||
|
<td width="2%"><b>Sr</b></td>
|
||
|
<td width="10%"><b>Medicine Name</b></td>
|
||
|
<td width="7%"><b>Dose Frequency</b></td>
|
||
|
<td width="7%"><b>Timing</b></td>
|
||
|
<td width="5%"><b>Admin. Route</b></td>
|
||
|
<td width="7%"><b>Duration</b></td>
|
||
|
<td width="9%"><b>Dose Qty</b></td>
|
||
|
<td width="7%"><b>Total Qty</b></td>
|
||
|
<td width="12%"><b>Available Qty</b></td>
|
||
|
<td width="15%"><b>Qty Issued</b></td>
|
||
|
</tr>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
$sql_treatment = "select * from treatment where appointment_id='" . $appointment_id . "' and is_display!='N'";
|
||
|
$res_treatment = mysqli_query($conn, $sql_treatment);
|
||
|
$count = 0;
|
||
|
$num_rows_treatment_count = mysqli_num_rows($res_treatment);
|
||
|
|
||
|
$old_ohc_id = getFieldFromTable('ohc_type_id', 'employee_appointment', 'appointment_id', $appointment_id);
|
||
|
|
||
|
while ($row_treatment = mysqli_fetch_array($res_treatment)) {
|
||
|
$item_id = $row_treatment['item_id'];
|
||
|
$srno = $count + 1;
|
||
|
$unit_id = getFieldFromTable("unit_id", "tbl_items", "item_id", $item_id);
|
||
|
// $ohc_type_id=getFieldFromTable("ohc_type_id", "employee_appointment", "appointment_id", $appointment_id);
|
||
|
$current_stock = getStockQtyAtDispensaryLevel($item_id, $ohc_type_id);
|
||
|
// error_log('available_qty: '.$available_qty);
|
||
|
$issued_qty = $row_treatment['issued_qty'];
|
||
|
|
||
|
$form_name_query = "select mf.is_qty_fixed from tbl_items tb left join medicine_form mf on tb.item_form_id = mf.form_id where tb.item_id='" . $item_id . "'";
|
||
|
|
||
|
error_log("checking if its qty is fixed or not " . $form_name_query);
|
||
|
|
||
|
$form_name_result = mysqli_query($conn, $form_name_query);
|
||
|
$form_name_qty = mysqli_fetch_assoc($form_name_result);
|
||
|
$is_qty_fixed = $form_name_qty['is_qty_fixed'];
|
||
|
|
||
|
?>
|
||
|
<tr>
|
||
|
<td><?php echo $srno ?></td>
|
||
|
<td><input id="treatment_item_<?php echo $count; ?>" name="treatment_item<?php echo $count; ?>" value='<?php echo $row_treatment['item_id'] ?>' type="hidden">
|
||
|
<input type="hidden" name="treatment_id<?php echo $count; ?>" id="treatment_id_<?php echo $count; ?>" value="<?php echo $row_treatment['treatment_id'] ?>">
|
||
|
<?php echo getItemWithFormName($item_id) ?>
|
||
|
</td>
|
||
|
|
||
|
<td><input id="treatment_item_dosage_<?php echo $count; ?>" name="treatment_item_dosage<?php echo $count; ?>" value='<?php echo $row_treatment['frequency_id'] ?>' type="hidden"><?php echo strtoupper(getTableFieldValue('medicine_frequency', 'frequency_description', 'frequency_id', $row_treatment['frequency_id'], '')); ?>
|
||
|
</td>
|
||
|
|
||
|
<td><input id="timings_<?php echo $count; ?>" name="timings<?php echo $count; ?>" value='<?php echo $row_treatment['timing_id'] ?>' type="hidden"><?php echo strtoupper(getTableFieldValue("medicine_timings", "medicine_timing", "timing_id", $row_treatment['timing_id'])); ?>
|
||
|
</td>
|
||
|
|
||
|
<td><input id="treatment_item_dosage_category_<?php echo $count; ?>" name="treatment_item_dosage_category<?php echo $count; ?>" value='<?php echo $row_treatment['dosage_category_id'] ?>' type="hidden"><?php echo strtoupper(getTableFieldValue('dosage_category', 'dosage_category', 'dosage_category_id', $row_treatment['dosage_category_id'])) ?>
|
||
|
</td>
|
||
|
|
||
|
<td><input type="hidden" name="treatment_item_days<?php echo $count; ?>" id="treatment_item_days_<?php echo $count; ?>" value='<?php echo $row_treatment['for_days'] ?>' /><?php echo $row_treatment['for_days'] ?>Days</td>
|
||
|
<td><input type="hidden" class="form-control" style="height:25px;font-size:12px;width: 45px" name="dose_qty<?php echo $count; ?>" id="dose_qty<?php echo $count; ?>" value="<?php echo $row_treatment['item_qty'] ?>" /><?php echo $row_treatment['item_qty'] ?></td>
|
||
|
|
||
|
<td>
|
||
|
<?php
|
||
|
if ($is_qty_fixed != null && $is_qty_fixed != '' && $is_qty_fixed == 'YES') {
|
||
|
echo "1";
|
||
|
} else {
|
||
|
echo $row_treatment['item_qty'] * $row_treatment['for_days'] * getTableFieldValue('medicine_frequency', 'qty', 'frequency_id', $row_treatment['frequency_id'], '');
|
||
|
} ?>
|
||
|
</td>
|
||
|
<td><input type="hidden" name="current_stock<?php echo $count; ?>" value="<?php echo $current_stock ?>" id="current_stock_<?php echo $count; ?>" /><?php echo $current_stock ?> <?php echo $unitMap[$unit_id] ?>
|
||
|
</td>
|
||
|
<td>
|
||
|
<div class="input-group"><input type="number" class="form-control" min="0" name="treatment_item_qtygvn<?php echo $count; ?>" id="treatment_item_qtygvn_<?php echo $count; ?>" value="<?php echo $issued_qty ?>" onchange="checkQty()"><span class="input-group-addon"> <i style="height: 5px"><?php echo $unitMap[$unit_id] ?></i><span></div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
$count++;
|
||
|
}
|
||
|
$sql_treatment = "select * from treatment_external where appointment_id='" . $appointment_id . "'";
|
||
|
|
||
|
$result_for_treatment_external = mysqli_query($conn, $sql_treatment);
|
||
|
$num_rows_treatment_external = @mysqli_num_rows($result_for_treatment_external);
|
||
|
if ($num_rows_treatment_external) {
|
||
|
?>
|
||
|
<tr>
|
||
|
|
||
|
<td align="center" colspan="7"><b>Additional Treatments Recommended</b></td>
|
||
|
</tr>
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
while ($row_treatment = mysqli_fetch_array($result_for_treatment_external)) {
|
||
|
$srno = $count + 1;
|
||
|
?>
|
||
|
|
||
|
<tr>
|
||
|
<td><?php echo $srno ?></td>
|
||
|
<td><?php echo $row_treatment['item_name'] ?></td>
|
||
|
<td><?php echo $row_treatment['dosage'] ?></td>
|
||
|
<td><?php echo getTableFieldValue("medicine_timings", "medicine_timing", "timing_id", $row_treatment['timing']) ?>
|
||
|
</td>
|
||
|
<td><?php echo strtoupper(getTableFieldValue('dosage_category', 'dosage_category', 'dosage_category_id', $row_treatment['dosage_category_id'])) ?>
|
||
|
</td>
|
||
|
<td><?php echo $row_treatment['for_days'] ?>Days</td>
|
||
|
<td><?php echo $row_treatment['item_qty'] ?></td>
|
||
|
</tr>
|
||
|
|
||
|
<?php
|
||
|
$count++;
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
<tfoot>
|
||
|
<tr><input type="hidden" name="count_treatment_item" id="count_treatment_item" value="<?php echo $count; ?>" /><input type="hidden" name="count_treatment_item_old" id="count_treatment_item_old" value="<?php echo $count; ?>" /></tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
<script>
|
||
|
// Save & Update
|
||
|
function validate() {
|
||
|
var appointment_date = $('#appointment_date').val();
|
||
|
if (appointment_date == '') {
|
||
|
BootstrapDialog.alert('Please Enter Appointment Name.!!!');
|
||
|
return false;
|
||
|
}
|
||
|
var complaints = $('#complaints').val();
|
||
|
if (complaints == '') {
|
||
|
BootstrapDialog.alert('Please Enter Complaints.!!!');
|
||
|
return false;
|
||
|
}
|
||
|
save_appointment();
|
||
|
}
|
||
|
|
||
|
function toCheckItemStock() {
|
||
|
|
||
|
var counter = $("#count_treatment_item").val();
|
||
|
for (var i = 0; i < counter; i++) {
|
||
|
var treatment_qty = $("#treatment_item_total_" + i).val();
|
||
|
var issued_qty = $("#treatment_item_qtygvn_" + i).val();
|
||
|
if (issued_qty == null || issued_qty == '') {
|
||
|
issued_qty = 0;
|
||
|
}
|
||
|
/* if(issued_qty>treatment_qty){
|
||
|
BootstrapDialog.alert(' Issue Qty should be less than or equal to Treatment Qty .!!!');
|
||
|
|
||
|
return false;
|
||
|
}*/
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
function save_appointment() {
|
||
|
$.ajax({
|
||
|
url: 'dispensary_save_opd.php',
|
||
|
type: "POST",
|
||
|
data: $("#opd_form").serialize(),
|
||
|
success: function(data) {
|
||
|
var data = $.parseJSON(data);
|
||
|
//alert(data);
|
||
|
if (data.appointment_id != null) {
|
||
|
$("#appointment_id").val(data.appointment_id);
|
||
|
$("#appointment_id_pdf").val(data.appointment_id);
|
||
|
}
|
||
|
|
||
|
BootstrapDialog.alert('Details Saved Successfully.');
|
||
|
//loadAppointmentHistory('<?php echo $_REQUEST['flex_opd_id'] ?>');
|
||
|
//return;
|
||
|
window.location.reload();
|
||
|
},
|
||
|
error: function(data) {
|
||
|
BootstrapDialog.alert('Error Saving Details');
|
||
|
//return;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
<?php //include('search_template.php');
|
||
|
if ($old_ohc_id != $_SESSION['current_ohcttype']) { ?>
|
||
|
var num_rows_treatment_count = <?php echo $num_rows_treatment_count ?>;
|
||
|
disableTreatmentTable(num_rows_treatment_count);
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
|
||
|
function disableTreatmentTable(num_rows_treatment) {
|
||
|
console.log("row " + num_rows_treatment);
|
||
|
|
||
|
for (let row_count = 0; row_count < num_rows_treatment; row_count++) {
|
||
|
console.log(row_count);
|
||
|
document.getElementById('treatment_item_qtygvn_' + row_count).readOnly = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
});
|
||
|
</script>
|