def printLetter(om_gui): ''' prints a letter to the patient ''' if om_gui.pt.serialno == 0: om_gui.advise(_("no patient selected"), 1) return html = standardletter.getHtml(om_gui.pt) Dialog = QtGui.QDialog() dl = Ui_enter_letter_text.Ui_Dialog() dl.setupUi(Dialog) dl.textEdit.setHtml(html) referred_pt = om_gui.pt Dialog.show() if Dialog.exec_(): html = dl.textEdit.toHtml() myclass = letterprint.letter(html) myclass.printpage() html = str(html.toAscii()) docsprinted.add(referred_pt.serialno, "std letter (html)", html) referred_pt.addHiddenNote("printed", "std letter") if referred_pt == om_gui.pt: if om_gui.ui.prevCorres_treeWidget.isVisible(): om_gui.docsPrintedInit() else: referred_pt.toNotes(referred_pt.serialno, referred_pt.HIDDENNOTES)
def printLetter(om_gui): ''' prints a letter to the patient ''' if om_gui.pt.serialno == 0: om_gui.advise(_("no patient selected"), 1) return html = standardletter.getHtml(om_gui.pt) Dialog = QtGui.QDialog() dl = Ui_enter_letter_text.Ui_Dialog() dl.setupUi(Dialog) dl.textEdit.setHtml(html) referred_pt = om_gui.pt Dialog.show() if Dialog.exec_(): html = dl.textEdit.toHtml() myclass = letterprint.letter(html) myclass.printpage() html = str(html.toAscii()) docsprinted.add(referred_pt.serialno, "std letter (html)", html) referred_pt.addHiddenNote("printed", "std letter") if referred_pt == om_gui.pt: if om_gui.ui.prevCorres_treeWidget.isVisible(): om_gui.docsPrintedInit() else: referred_pt.toNotes(referred_pt.serialno, referred_pt.HIDDENNOTES)
def customEstimate(om_gui, html=""): ''' prints a custom estimate to the patient ''' if om_gui.pt.serialno == 0: om_gui.advise(_("no patient selected"), 1) return if html == "": html = standardletter.getHtml(om_gui.pt) pt_total = 0 ehtml = "<br />%s"% _( "Estimate for your current course of treatment.") ehtml += "<br />"*4 ehtml += '<table width="400">' #separate into NHS and non-NHS items. sorted_ests = {"N":[], "P":[]} for est in estimates.sorted_estimates(om_gui.pt.estimates): if "N" in est.csetype: sorted_ests["N"].append(est) else: sorted_ests["P"].append(est) for type_, description in ( ("N", _("NHS items")), ("P", _("Private items")) ): if sorted_ests[type_]: ehtml += '<tr><td colspan = "3"><b>%s</b></td></tr>'% ( description) for est in sorted_ests[type_]: pt_total += est.ptfee number = est.number item = est.description amount = est.ptfee mult = "" if number > 1: mult = "s" item = item.replace("*", mult) if "^" in item: item = item.replace("^", "") ehtml += '''<tr><td>%s</td><td>%s</td> <td align="right">%s</td></tr>'''% ( number, item, localsettings.formatMoney(amount)) ehtml += _('''<tr><td></td><td><b>TOTAL</b></td> <td align="right"><b>%s</b></td></tr>''')% localsettings.formatMoney(pt_total) ehtml += "</table>" + "<br />"*4 html = html.replace("<br />"*(12), ehtml) html += _('''<p><i>Please note, this estimate may be subject to change if clinical circumstances dictate.</i></p>''') if htmlEditor(om_gui, type="cust Estimate", html=html, version=0): om_gui.pt.addHiddenNote("printed", "cust estimate") om_gui.updateHiddenNotesLabel()
def customEstimate(om_gui, html=""): ''' prints a custom estimate to the patient ''' if om_gui.pt.serialno == 0: om_gui.advise(_("no patient selected"), 1) return if html == "": html = standardletter.getHtml(om_gui.pt) pt_total = 0 ehtml = "<br />%s" % _( "Estimate for your current course of treatment.") ehtml += "<br />" * 4 ehtml += '<table width="400">' # separate into NHS and non-NHS items. sorted_ests = {"N": [], "P": []} for est in estimates.sorted_estimates(om_gui.pt.estimates): if "N" in est.csetype: sorted_ests["N"].append(est) else: sorted_ests["P"].append(est) for type_, description in (("N", _("NHS items")), ("P", _("Private items"))): if sorted_ests[type_]: ehtml += '<tr><td colspan = "3"><b>%s</b></td></tr>' % ( description) for est in sorted_ests[type_]: pt_total += est.ptfee number = est.number item = est.description amount = est.ptfee mult = "" if number > 1: mult = "s" item = item.replace("*", mult) if "^" in item: item = item.replace("^", "") ehtml += '''<tr><td>%s</td><td>%s</td> <td align="right">%s</td></tr>''' % (number, item, localsettings.formatMoney(amount)) ehtml += _('''<tr><td></td><td><b>TOTAL</b></td> <td align="right"><b>%s</b></td></tr>''') % localsettings.formatMoney(pt_total) ehtml += "</table>" + "<br />" * 4 html = html.replace("<br />" * (12), ehtml) html += _('''<p><i>Please note, this estimate may be subject to change if clinical circumstances dictate.</i></p>''') if htmlEditor(om_gui, type="cust Estimate", html=html, version=0): om_gui.pt.addHiddenNote("printed", "cust estimate") om_gui.updateHiddenNotesLabel()