// JavaScript Docume function main() { tmpId = document.getElementById('patientid').value; if (tmpId == document.getElementById('idnow').value) { } else { ajax_sum = new sack(); ajax_sum.method = "POST"; ajax_sum.setVar("id",tmpId); ajax_sum.requestFile = 'ajaxsummary.php'; ajax_sum.onCompletion = function(){sumDone(tmpId);}; ajax_sum.runAJAX(); // Execute AJAX function } } function familyAdd (tmpId,tmpVal) { if (!document.getElementById("patientid").value > 0) return; val = tmpVal.split("#"); // alert (tmpVal+"#"+val[3]+"#"+document.getElementById("patientid").value); ajaxRelatnSave = new sack(); ajaxRelatnSave.method = "POST"; ajaxRelatnSave.setVar("id1",val[2]); ajaxRelatnSave.setVar("id2",document.getElementById("patientid").value); ajaxRelatnSave.requestFile = "ajaxRelatnAdd.php"; ajaxRelatnSave.onCompletion = function(){ajaxRelatnAdded(document.getElementById("patientid").value,ajaxRelatnSave.response);}; ajaxRelatnSave.runAJAX(); // Execute AJAX function } function ajaxRelatnAdded(tmpid,tmpResponse){ refreshRelatn (tmpid); } function refreshRelatn (tmpid) { //alert (tmpid); ajaxRelatnRefresh = new sack(); ajaxRelatnRefresh.method = "POST"; ajaxRelatnRefresh.setVar("id",tmpid); ajaxRelatnRefresh.requestFile = "ajaxRelatnView.php"; ajaxRelatnRefresh.onCompletion = function(){relatnShow(ajaxRelatnRefresh.response);}; ajaxRelatnRefresh.runAJAX(); // Execute AJAX function } function relatnShow (tmpResp){ var tmpArray = new Array; tmpArray = tmpResp.split("|"); var tmpListHTML = new Array ; for (i=0; iX "+tmpArrayNow[0]+" "+tmpArrayNow[1]+" "+tmpArrayNow[2]+" "+tmpArrayNow[3]+"
"); } document.getElementById("familylist").innerHTML = tmpListHTML.join(""); document.getElementById("family").value =""; } function relationDelete(tmpId) { ajaxRelatnDel = new sack(); ajaxRelatnDel.method = "POST"; ajaxRelatnDel.setVar("id",tmpId); ajaxRelatnDel.requestFile = "ajaxRelatnDel.php"; ajaxRelatnDel.onCompletion = function(){refreshRelatn(document.getElementById("patientid").value)}; ajaxRelatnDel.runAJAX(); // Execute AJAX function } function sumDone (tmpId) { var tmpSum = document.getElementById('oldconsultlist'); var tmpDetail = document.getElementById('oldconsultdetail'); tmpHistoryPairs = ajax_sum.response.split("|") var tmpHis = new Array(); var tmpConsult = new Array(); tmpHis.push (""); tmpConsult.push (""); if (tmpHistoryPairs.length > 0 && tmpHistoryPairs[0].length >4) { for (i=0;iX"); //tmpHis.push (tmpItemDetails[0]+ " X"); tmpHis.push (""); tmpConsult.push (""); } } tmpSum.innerHTML = ""; tmpDetail.innerHTML = tmpConsult.join(""); document.getElementById('idnow').value= tmpId; loadPatient(tmpId); updateNote(tmpId); updateAddress(tmpId); } function loadPatient(tmpId) { ajax_pat = new sack(); ajax_pat.method = "POST"; ajax_pat.setVar("id",tmpId); ajax_pat.requestFile = 'ajaxpatget.php'; ajax_pat.onCompletion = function(){updatePatDone(ajax_pat.response);}; ajax_pat.runAJAX(); // Execute AJAX function } function updatePatDone (tmpResp) { if (tmpResp == "null") { } else { tmpPatDetail = tmpResp.split("::"); document.getElementById("idfn").value = tmpPatDetail[0]; document.getElementById("idsn").value = tmpPatDetail[1]; document.getElementById("iddob").value = tmpPatDetail[2]; document.getElementById("idtel").value = tmpPatDetail[3]; } } function updateNote(tmpId) { ajax_details = new sack(); ajax_details.requestFile = 'ajaxhistory.php?tmp='+Math.round(99999*Math.random())+'&id=' + tmpId; // Specifying which file to get ajax_details.onCompletion = function(){updateNoteDone();}; ajax_details.runAJAX(); // Execute AJAX function } function updateNoteDone () { var tmpHistory = document.getElementById('historyabc'); var tmpHistoryPairs = ajax_details.response.split("|"); var tmpHis = new Array(); if (tmpHistoryPairs.length > 0) { for (i=0;i"); } } function updateAddress(tmpId) { var ajax_addrupdate = new sack(); ajax_addrupdate.method = "POST"; ajax_addrupdate.setVar("id",tmpId); ajax_addrupdate.setVar("fn","id"); ajax_addrupdate.requestFile = 'ajaxdoctorget.php'; ajax_addrupdate.onCompletion = function(){doctorgetdone(ajax_addrupdate.response);}; ajax_addrupdate.runAJAX(); // Execute AJAX function} } function updateAddressAll() { var ajax_all = new sack(); ajax_all.method = "POST"; ajax_all.setVar("id","123"); ajax_all.setVar("fn","all"); ajax_all.requestFile = 'ajaxdoctorget.php'; ajax_all.onCompletion = function(){doctorgetdone(ajax_all.response);}; ajax_all.runAJAX(); // Execute AJAX function} } function doctorgetdone(tmpResp) { if (tmpResp == "null") { } else { var tmpAddrString = tmpResp.split("|"); if (tmpAddrString.length > 0) { var tmpAddr = new Array(); for (i=0;i"+tmpAddrDetails[1]+". "+tmpAddrDetails[2]+" "+tmpAddrDetails[3]+" "+tmpAddrDetails[4]); } document.getElementById('addrhere').innerHTML = tmpAddr.join("
"); } } } function selectAddr(tmpAddrString) { var tmpAddr = tmpAddrString.split("::"); document.getElementById("letterTo").value = tmpAddr[1]+". "+tmpAddr[2]+" "+tmpAddr[3]; document.getElementById("letterAddress").value = tmpAddr[4]; document.getElementById("letterTel").value = tmpAddr[5]; document.getElementById("letterFax").value = tmpAddr[6]; } function displayConsult(tmpI) { var Consult = window.open('','Consult','scrollbars=1,width=400,height=600'); Consult.document.clear(); Consult.document.write(unescape(document.getElementById(tmpI).innerHTML)); //Consult.focus(); } function displayConsult2(tmpI) { //document.getElementById('oldconsult').innerHTML = unescape(document.getElementById(tmpI.value).innerHTML).replace(/\r|\n|\r\n/g, ""); var Consult = window.open('','Consult','scrollbars=1,width=400,height=600'); Consult.document.writeln(unescape(document.getElementById(tmpI.value).innerHTML)); } function showTab(tmpTab) { //document.getElementById('tabnotes').style.display="none"; document.getElementById('tabconsults').style.display="none"; document.getElementById('tabsummary').style.display="none"; document.getElementById('tabletters').style.display="none"; document.getElementById('tabbill').style.display="none"; document.getElementById(tmpTab).style.display="block"; } function addNote() { tmpId = document.getElementById('patientid').value; tmpNote = document.getElementById('note').value; ajax_note = new sack(); ajax_note.method = "POST"; ajax_note.setVar("id",tmpId); ajax_note.setVar("note",tmpNote); ajax_note.requestFile = 'ajaxaddnote.php'; ajax_note.onCompletion = function(){addNoteDone(tmpId);}; ajax_note.runAJAX(); // Execute AJAX function } function addNoteDone (tmpId) { updateNote(tmpId); } function whitepage(tmpKW) { var ajax_yp = new sack(); ajax_yp.method = "POST"; ajax_yp.setVar("kw",tmpKW); ajax_yp.setVar("loc","NSW"); ajax_yp.requestFile = 'ajaxyellowpages.php'; ajax_yp.onCompletion = function(){yellowpageDone(ajax_yp.response);}; ajax_yp.runAJAX(); // Execute AJAX function} } function yellowpageDone(tmpPage) { var tmpAddrs = tmpPage.split("|"); var tmpAddr = new Array(); if (tmpAddrs.length > 0) { for (i=0;i"+tmpAddrs[i].replace(/\::/g," ")+" "); } document.getElementById("selectDr").innerHTML = tmpAddr.join("
"); } } function addAddr(tmpId,tmpAddress) { tmpPairs = tmpAddress.split("::"); var tmpName = ucwords(trim(tmpPairs[3]).split("Dr")[0]); var tmpSN = tmpName.split(" ")[0]; var tmpFN = tmpName.split(tmpSN)[1]; var tmpTel = trim(tmpPairs[18]+tmpPairs[19]); var tmpFax = trim(tmpPairs[20]+tmpPairs[21]); var tmpAddr = trim(tmpPairs[22]+tmpPairs[23]+tmpPairs[24]+tmpPairs[25]+tmpPairs[26]+tmpPairs[27]+tmpPairs[28]+tmpPairs[29]); document.getElementById("letterTo").value = "Dr. "+tmpFN+" "+tmpSN; document.getElementById("letterAddress").value = tmpAddr; document.getElementById("letterTel").value = tmpTel; document.getElementById("letterFax").value = tmpFax; } function ucwords (str) { // http://kevin.vanzonneveld.net // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) // + improved by: Waldo Malqui Silva // + bugfixed by: Onno Marsman // * example 1: ucwords('kevin van zonneveld'); // * returns 1: 'Kevin Van Zonneveld' // * example 2: ucwords('HELLO WORLD'); // * returns 2: 'HELLO WORLD' return (str+'').replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase( ); } ); } function updateBill () { var allMarks = document.getElementById("div_img").getElementsByTagName("div"); var container = document.getElementById('billings'); container.innerHTML = ""; var bottleNo = 0; for (var i = 0; i < allMarks.length; i++) { tmpAction = document.getElementById("plan"+allMarks[i].id.replace("div_mark","")).value ; if (document.getElementById("done"+allMarks[i].id.replace("div_mark","")).checked){ switch (tmpAction) { case "Excision": bottleNo ++; //container.innerHTML = container.innerHTML + "Bottle #"+bottleNo+": "+window.opener.document.getElementById("desc"+allMarks[i].id.replace("div_mark","")).value+". "+window.opener.document.getElementById("ddx"+allMarks[i].id.replace("div_mark","")).value+". "+tmpPathNotes+" (Excision)
"; container.value = container.value + "312 "+document.getElementById("loc"+allMarks[i].id.replace("div_mark","")).value+"\r"; break; case "Punch excision": bottleNo ++; container.value = container.value + "312 "+document.getElementById("loc"+allMarks[i].id.replace("div_mark","")).value+"\r"; //container.innerHTML = container.innerHTML + "Bottle #"+bottleNo+": "+window.opener.document.getElementById("desc"+allMarks[i].id.replace("div_mark","")).value+". "+window.opener.document.getElementById("ddx"+allMarks[i].id.replace("div_mark","")).value+". "+tmpPathNotes+" (Punch excision)
"; break; case "Shave biopsy": bottleNo ++; container.value = container.value + "30071 "+document.getElementById("loc"+allMarks[i].id.replace("div_mark","")).value+"\r"; break; case "Biopsy": bottleNo ++; container.value = container.value + "30071 "+document.getElementById("loc"+allMarks[i].id.replace("div_mark","")).value+"\r"; break; case "Currette and Cauterise": bottleNo ++; container.value = container.value + "3019 "+document.getElementById("loc"+allMarks[i].id.replace("div_mark","")).value+"\r"; break; case "Currette": bottleNo ++; container.value = container.value + "30071 "+document.getElementById("loc"+allMarks[i].id.replace("div_mark","")).value+"\r"; break; default: break; } } } } function addDoctor() { var tmpDrName = trim(document.getElementById("letterTo").value); var tmpDrAddr = document.getElementById("letterAddress").value; var tmpDrTel = document.getElementById("letterTel").value; var tmpDrFax = document.getElementById("letterFax").value; var tmpDrSN = tmpDrName.split(" ")[tmpDrName.split(" ").length-1]; var tmpDrFN = (tmpDrName.split(".").length >1)? trim(tmpDrName.split(".")[1].split(tmpDrSN)[0]) : trim(tmpDrName.split(tmpDrSN)[0]); var tmpTitle = (tmpDrName.split(".").length >1)? trim(tmpDrName.split(".")[0]) : "Dr"; var ajax_dr = new sack(); ajax_dr.method = "POST"; ajax_dr.setVar("ti",tmpTitle); ajax_dr.setVar("fn",tmpDrFN); ajax_dr.setVar("sn",tmpDrSN); ajax_dr.setVar("ad",tmpDrAddr); ajax_dr.setVar("te",tmpDrTel); ajax_dr.setVar("fa",tmpDrFax); ajax_dr.setVar("id",document.getElementById("patientid").value); ajax_dr.requestFile = 'ajaxdoctoradd.php'; ajax_dr.onCompletion = function(){doctoradddone(ajax_dr.response);}; ajax_dr.runAJAX(); // Execute AJAX function} } function doctoradddone(tmpDrId) { updateAddress(document.getElementById("patientid").value); } function updatePatient() { if (document.getElementById("patientid").value.length > 2) { var ajax_idr = new sack(); ajax_idr.method = "POST"; ajax_idr.setVar("id",document.getElementById("patientid").value); ajax_idr.setVar("fn",document.getElementById("idfn").value); ajax_idr.setVar("sn",document.getElementById("idsn").value); ajax_idr.setVar("dob",document.getElementById("iddob").value); ajax_idr.setVar("tel",document.getElementById("idtel").value); ajax_idr.requestFile = 'ajaxpatupdate.php'; ajax_idr.onCompletion = function(){patupdatedone(ajax_idr.response);}; ajax_idr.runAJAX(); // Execute AJAX function} } } function patupdatedone(tmpResp) { }