Prognocis Printable Ledger v3

adds css code to correct page layout, adds letterhead and patient name and chart number, adds print button at bottom of page to print correctly

当前为 2024-11-01 提交的版本,查看 最新版本

// ==UserScript==
// @name         Prognocis Printable Ledger v3
// @namespace    http://www.hands-onortho.com
// @version      2024.11.01.1408
// @description  adds css code to correct page layout, adds letterhead and patient name and chart number, adds print button at bottom of page to print correctly
// @author       mrkrag
// @match        https://handsonortho.prognocis.com/prognocis/scrPrint.jsp?mode=pataccactivity*
// @icon         https://images.squarespace-cdn.com/content/v1/64c7c183cb7ad4611b05dd20/5532a409-6956-49f0-892c-83db654276d8/favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==
// THIS SECTION INSERTS CSS CODE TO GET THE PAGE TO PRINT CORRECTLY INSTEAD OF 150% WIDE
function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}
addGlobalStyle('tr.CLAIM {background-color: lightgray;} table.MAIN {width: 100%;} #Total > td {border-style: solid; border-width: 1px 0px 0px 0px; font-weight: bold;} #printClean{border: 2px solid #1ab26b; color: #1ab26b; font-weight: bold; width: 200px; height: 30px; margin: 20px auto; text-align: center; vertical-align: middle;} #printClean:hover{cursor: pointer; background-color: #1ab26b; color: #ffffff;}');
addGlobalStyle('@media print {#printClean{display: none;}}');
// END INSERT CSS


// THIS SECTION ADDS OUR OWN PRINT BUTTON ON THE RESULTING SCREEN VIEW OF THE LEDGER
var bigdiv = document.createElement("div");
bigdiv.innerHTML = '<div id="printClean" role="button" onclick="window.print()">PRINT CLEANLY</div>';
document.body.appendChild (bigdiv);
// END CUSTOM PRINT BUTTON

// THIS SECTION ADDS LETTERHEAD
let today = new Date().toLocaleDateString()
var ltrhead = document.createElement("table");
ltrhead.setAttribute('width', '100%');
ltrhead.innerHTML = '<tr><td colspan=2 align=center><img src="testdiagrams/handsonortho_letterhead1.gif"></td></tr><tr><td colspan=2 align=center><span style="font-size:14pt; font-weight:bold;">Patient Account Activity as of ' +
today +
'</span></td></tr><tr><td width=50%><b>Patient:</b>&nbsp;<u>' +
    localStorage.getItem('patientName') +
    '</u></td><td width=50% align=right><b>Chart #</b><u>' +
    localStorage.getItem('patientAcct') +
    '</u></td></tr>';
document.body.prepend(ltrhead);
// 10-30-2024 the second field named ptinfo is still null
// END LETTERHEAD