GlenmarkCV ( Xmet Rx Tracker) Calculate Total
This commit is contained in:
parent
bb7519223a
commit
e04d428307
|
|
@ -240,16 +240,28 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).on(
|
$(document).on('input','#field-xmet_group_rx',function () {
|
||||||
'input',
|
|
||||||
'#field-xmet_group_rx',
|
|
||||||
function () {
|
|
||||||
|
|
||||||
this.value = this.value.replace(/[^0-9]/g, '');
|
this.value = this.value.replace(/[^0-9]/g, '');
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let fields=['field-xmet_rx','field-xmet_sr_rx','field-xmet_trio_rx'];
|
||||||
|
function calculateTotal(){
|
||||||
|
let total=0;
|
||||||
|
fields.forEach((nums)=>{
|
||||||
|
let input=document.getElementById(nums).value;
|
||||||
|
total += parseInt(input) ||0;
|
||||||
|
document.getElementById('field-total_xmet_rx').value=total;
|
||||||
|
})
|
||||||
|
console.log("Total is : ",total);
|
||||||
|
}
|
||||||
|
|
||||||
|
fields.forEach((id)=>{
|
||||||
|
document.getElementById(id).addEventListener('input',calculateTotal);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
$(document).on('change', '#field-contact_id', function () {
|
$(document).on('change', '#field-contact_id', function () {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue