示例#1
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 = 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()
示例#2
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()
示例#3
0
def printEstimate(om_gui):
    if om_gui.pt.serialno == 0:
        om_gui.advise(_("no patient selected"), 1)
        return

    est = estimatePrint.estimate()

    est.setProps(om_gui.pt.title, om_gui.pt.fname, om_gui.pt.sname,
                 om_gui.pt.serialno)

    est.setEsts(estimates.sorted_estimates(om_gui.pt.estimates))

    if est.print_():
        commitPDFtoDB(om_gui, "auto estimate")
        om_gui.pt.addHiddenNote("printed", "estimate")
        om_gui.updateHiddenNotesLabel()
示例#4
0
def printEstimate(om_gui):
    if om_gui.pt.serialno == 0:
        om_gui.advise(_("no patient selected"), 1)
        return

    est = estimatePrint.estimate()

    est.setProps(om_gui.pt.title, om_gui.pt.fname, om_gui.pt.sname,
                 om_gui.pt.serialno)

    est.setEsts(estimates.sorted_estimates(om_gui.pt.estimates))

    if est.print_():
        commitPDFtoDB(om_gui, "auto estimate")
        om_gui.pt.addHiddenNote("printed", "estimate")
        om_gui.updateHiddenNotesLabel()
示例#5
0
            font = QtGui.QFont("Helvetica", 7)
            font.setItalic(True)
            painter.setFont(font)
            option = QtGui.QTextOption(QtCore.Qt.AlignCenter)
            option.setWrapMode(QtGui.QTextOption.WordWrap)
            painter.drawText(
                QtCore.QRectF(0, y, pageRect.width(), 31),
                _("Please note, this estimate may be subject to change if "
                  "clinical circumstances dictate."), option)
        return True


if __name__ == "__main__":

    localsettings.initiate(False)
    from openmolar.dbtools import patient_class
    from openmolar.ptModules import estimates
    pt = patient_class.patient(23664)

    app = QtGui.QApplication([])

    myreceipt = estimate()

    myreceipt.title = pt.title
    myreceipt.fname = pt.fname
    myreceipt.sname = pt.sname
    myreceipt.ourref = pt.serialno
    myreceipt.estItems = estimates.sorted_estimates(pt.estimates)

    myreceipt.print_()
示例#6
0
            font = QtGui.QFont("Helvetica", 7)
            font.setItalic(True)
            painter.setFont(font)
            option = QtGui.QTextOption(QtCore.Qt.AlignCenter)
            option.setWrapMode(QtGui.QTextOption.WordWrap)
            painter.drawText(
                QtCore.QRectF(0, y, pageRect.width(), 31),
                _("Please note, this estimate may be subject to change if "
                  "clinical circumstances dictate."), option)
        return True


if __name__ == "__main__":

    localsettings.initiate(False)
    from openmolar.dbtools import patient_class
    from openmolar.ptModules import estimates
    pt = patient_class.patient(23664)

    app = QtWidgets.QApplication([])

    myreceipt = EstimateLetter()

    myreceipt.title = pt.title
    myreceipt.fname = pt.fname
    myreceipt.sname = pt.sname
    myreceipt.ourref = pt.serialno
    myreceipt.estItems = estimates.sorted_estimates(pt.estimates)

    myreceipt.print_()