Elite Medical Centre | EMR System
`);
}
function saveBill(){
let bills=JSON.parse(localStorage.getItem("bills")||"[]");
bills.push({name:bname.value,service:service.value,amount:amount.value,method:method.value});
localStorage.setItem("bills",JSON.stringify(bills));
loadBills();
}
function loadBills(){
billTable.innerHTML="";
let bills=JSON.parse(localStorage.getItem("bills")||"[]");
let revenue=0,nhif=0;
bills.forEach(b=>{
billTable.innerHTML+=`
| ${b.name} | ${b.service} | ${b.amount} | ${b.method} |
`;
revenue+=Number(b.amount);
if(b.method==="NHIF")nhif++;
});
nhifCases.innerText=nhif;
document.getElementById("revenue").innerText=revenue;
}
function loadData(){loadPatients();loadBills()}
0 Comments