Esempio n. 1
0
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 = standard_letter.getHtml(om_gui.pt)
    dl = CorrespondenceDialog(html, om_gui.pt, parent=None)
    dl.show()

    if dl.exec_():
        letter = letterprint.letter(dl.text)
        if letter.printpage():
            docsprinted.add(dl.pt.serialno,
                            "%s (html)" % dl.letter_description, dl.text)
            dl.pt.addHiddenNote("printed",
                                "%s %s" % (_("letter"), dl.letter_description))
            if dl.pt == om_gui.pt:
                if om_gui.ui.prevCorres_treeWidget.isVisible():
                    om_gui.docsPrintedInit()
                    om_gui.updateHiddenNotesLabel()
            else:
                patient_write_changes.toNotes(dl.pt.serialno,
                                              dl.pt.HIDDENNOTES)
Esempio n. 2
0
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 = standard_letter.getHtml(om_gui.pt)
    dl = CorrespondenceDialog(html, om_gui.pt, parent=None)
    dl.show()

    if dl.exec_():
        letter = letterprint.letter(dl.text)
        if letter.printpage():
            docsprinted.add(dl.pt.serialno,
                            "%s (html)" % dl.letter_description,
                            dl.text)
            dl.pt.addHiddenNote("printed",
                                "%s %s" % (_("letter"), dl.letter_description)
                                )
            if dl.pt == om_gui.pt:
                if om_gui.ui.prevCorres_treeWidget.isVisible():
                    om_gui.docsPrintedInit()
                    om_gui.updateHiddenNotesLabel()
            else:
                dl.pt.toNotes(dl.pt.serialno, dl.pt.HIDDENNOTES)
Esempio n. 3
0
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 = standard_letter.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>%s</b></td>
            <td align="right"><b>%s</b></td></tr>''' % (
                _("TOTAL"), localsettings.formatMoney(pt_total))
        ehtml += "</table>" + "<br />" * 4
        html = html.replace("<br />" * (12), ehtml)
        html += '<p><i>%s</i></p>' % _('Please note, this estimate may '
                                       'be subject to change if clinical '
                                       'circumstances dictate.')

    if htmlEditor(om_gui, type_="cust Estimate", html=html, version=0):
        om_gui.pt.addHiddenNote("printed", "cust estimate")
        om_gui.updateHiddenNotesLabel()