mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
53 lines
2.7 KiB
JavaScript
Vendored
53 lines
2.7 KiB
JavaScript
Vendored
|
|
|
|
$(document).ready(function () {
|
|
|
|
$("[id^='add_batch_']").on("click", function (e) {
|
|
e.preventDefault();
|
|
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
|
|
|
$("#div_to_append_"+id).append(`<div class='row appended_div_row' style='border: 2px solid #cbd1da'>
|
|
<div class='col-sm-12' style='padding: 0px;'>
|
|
<input type='hidden' name='item_batch_watcher_id[]' value='0'/>
|
|
<input type='hidden' name='batch_item_id[]' value='${id}'/>
|
|
<input type='hidden' name='batch_drug_id[]' value='0'>
|
|
<div class='hidden_input'>
|
|
<input type='text' name='batch_number[]' class='form-control col-sm-12 new_batch_number_${id}' placeholder='Batch'></div></div>
|
|
<div class='col-sm-12' style='padding: 0px;'>
|
|
<div class='hidden_input'>
|
|
<input type='number' name='batch_unit_cost[]' class='form-control col-md-12 new_batch_unit_cost new_batch_unit_cost_${id}' placeholder='Unit cost'></div></div>
|
|
<div class='col-sm-12' style='padding: 0px;'><div class='hidden_input'><input type='number' name='batch_quantity_balance[]' class='form-control col-md-12 new_batch_qty new_batch_quantity_balance_${id}' placeholder='Quantity'></div></div>
|
|
<div class='col-sm-12' style='padding: 0px;'><div class='hidden_input'><div class='input-group'><input type='text' name='expiry_date[]' autocomplete='off' placeholder='Expiry date' class='form-control col-md-12 expiry_date_input'><span class='input-group-addon'><i class='icon-calender'></i></span></div></div></div>
|
|
</div>`);
|
|
});
|
|
$("[id^='div_to_append_']").on("focus", ".expiry_date_input", function (e) {
|
|
$(this).datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'yyyy-mm-dd'
|
|
});
|
|
});
|
|
|
|
$("[id^='div_to_append_']").on("change keyup", ".new_batch_qty", function (e) {
|
|
var id = /\d+(?=\D*$)/.exec($(this).attr('class'));
|
|
var total_quantity = 0;
|
|
|
|
//for the existing batches
|
|
$(".batch_quantity_balance_"+id).each(function () {
|
|
var batch_qty = $(this).val();
|
|
total_quantity += parseInt(batch_qty);
|
|
});
|
|
|
|
$(".new_batch_quantity_balance_"+id).each(function () {
|
|
var batch_qty = $(this).val();
|
|
total_quantity += parseInt(batch_qty);
|
|
});
|
|
$("#shown_input_"+id).text(total_quantity);
|
|
$("#physical_stock_"+id).val(total_quantity);
|
|
|
|
// var drug_cost = $("#cost_price_"+id).val();
|
|
// var drug_price = $("#non_insured_price_"+id).val();
|
|
// var drug_system_stock = $("#system_stock_"+id).val();
|
|
// calculateDifference(id, drug_cost, drug_price, drug_system_stock);
|
|
});
|
|
}); |