Exemple #1
0
def printReferral(om_gui):
    '''prints a referal letter controlled by referal.xml file'''
    # TODO this file should really be in the sql database
    if om_gui.pt.serialno == 0:
        om_gui.advise("no patient selected", 1)
        return
    desc = om_gui.ui.referralLettersComboBox.currentText()
    # todo re-enable this
    # if "Ortho" in desc:
    #    orthoWizard(om_gui)
    #    return
    html = referral.getHtml(desc, om_gui.pt)
    Dialog = QtGui.QDialog()  # ,  QtCore.Qt.WindowMinimizeButtonHint)
    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()
        docsprinted.add(referred_pt.serialno, "referral (html)", html)
        referred_pt.addHiddenNote("printed", "referral")
        om_gui.updateHiddenNotesLabel()

        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)
Exemple #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 = 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)
Exemple #3
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 = 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 printReferral(om_gui):
    '''
    prints a referal letter
    '''
    if om_gui.pt.serialno == 0:
        om_gui.advise("no patient selected", 1)
        return
    desc = om_gui.ui.referralLettersComboBox.currentText()

    html = referral.getHtml(desc, om_gui.pt)
    dl = CorrespondenceDialog(html, om_gui.pt, preformatted=False, parent=None)
    dl.show()
    if dl.exec_():
        letter = letterprint.letter(dl.text)
        if letter.printpage():
            docsprinted.add(dl.pt.serialno,
                            "%s referral (html)" % desc,
                            dl.text)
            dl.pt.addHiddenNote("printed", "referral")

            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)

        return True
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)
Exemple #6
0
def printReferral(om_gui):
    '''prints a referal letter controlled by referal.xml file'''
    # TODO this file should really be in the sql database
    if om_gui.pt.serialno == 0:
        om_gui.advise("no patient selected", 1)
        return
    desc = om_gui.ui.referralLettersComboBox.currentText()
    # todo re-enable this
    # if "Ortho" in desc:
    #    orthoWizard(om_gui)
    #    return
    html = referral.getHtml(desc, om_gui.pt)
    Dialog = QtGui.QDialog()  # ,  QtCore.Qt.WindowMinimizeButtonHint)
    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()
        docsprinted.add(referred_pt.serialno, "referral (html)", html)
        referred_pt.addHiddenNote("printed", "referral")
        om_gui.updateHiddenNotesLabel()

        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)
Exemple #7
0
def printReferral(om_gui):
    '''
    prints a referal letter
    '''
    if om_gui.pt.serialno == 0:
        om_gui.advise("no patient selected", 1)
        return
    desc = om_gui.ui.referralLettersComboBox.currentText()

    html = referral.getHtml(desc, om_gui.pt)
    dl = CorrespondenceDialog(html, om_gui.pt, preformatted=False, parent=None)
    dl.show()
    if dl.exec_():
        letter = letterprint.letter(dl.text)
        if letter.printpage():
            docsprinted.add(dl.pt.serialno, "%s referral (html)" % desc,
                            dl.text)
            dl.pt.addHiddenNote("printed", "referral")

            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)

        return True
Exemple #8
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)
Exemple #9
0
def printAccountsTable(om_gui):
    '''
    print the table
    '''
    # - set a pointer for readability
    table = om_gui.ui.accounts_tableWidget
    rowno = table.rowCount()
    memo_col = table.columnCount() - 1
    if rowno == 0:
        om_gui.advise(_("Nothing to print - have you loaded the table?"), 1)
        return()
    total = 0
    html = '''<html><body><table border="1">
    <tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th>
    <th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>''' % (_('Dent'),
                                                            _('SerialNo'),
                                                            _('Cset'),
                                                            _('Name'),
                                                            _('Status'),
                                                            _("Last tx"),
                                                            _('Complete'),
                                                            _('Amount'),
                                                            _('Memo'))
    for row in range(rowno):
        if row % 2 == 0:
            html += '<tr bgcolor="#eeeeee">'
        else:
            html += '<tr>'
        for col in (0, 1, 2, 3, 4, 5, 6, 7, memo_col):
            item = table.item(row, col)
            if item:
                if col == 1:
                    html += '<td align="right">%s</td>' % item.text()
                elif col == 7:
                    money = localsettings.pencify(item.text())
                    money_str = localsettings.formatMoney(money)
                    html += '<td align="right">%s</td>' % money_str
                    total += money
                else:
                    html += '<td>%s</td>' % item.text()
            else:
                html += '<td> </td>'
        html += '</tr>\n'

    html += '''<tr>
    <td colspan="7" align="right"><b>%s</b></td>
    <td align="right"><b>%s</b></td><td></td>
    </tr></table></body></html>''' % (_('TOTAL'),
                                      localsettings.formatMoney(total))

    myclass = letterprint.letter(html, parent=om_gui)
    myclass.printpage()
Exemple #10
0
def htmlEditor(om_gui, type="", html="", version=0):
    '''
    raise a dialog to print an html editor
    '''
    dl = CorrespondenceDialog(html, om_gui.pt, preformatted=False, parent=None)
    dl.show()

    if dl.exec_():
        letter = letterprint.letter(dl.text)
        if letter.printpage():
            if dl.has_edits:
                docsprinted.add(dl.pt.serialno, "%s(html)" % type, dl.text,
                                version + 1)
        return True
Exemple #11
0
def htmlEditor(om_gui, type="", html="", version=0):
    '''
    raise a dialog to print an html editor
    '''
    Dialog = QtGui.QDialog(om_gui)
    dl = Ui_enter_letter_text.Ui_Dialog()
    dl.setupUi(Dialog)
    dl.textEdit.setHtml(html)
    if Dialog.exec_():
        html = dl.textEdit.toHtml()
        myclass = letterprint.letter(html)
        myclass.printpage()

        html = str(dl.textEdit.toHtml().toAscii())

        docsprinted.add(om_gui.pt.serialno, "%s (html)"% type, html, version+1)
        return True
def htmlEditor(om_gui, type="", html="", version=0):
    '''
    raise a dialog to print an html editor
    '''
    dl = CorrespondenceDialog(html, om_gui.pt, preformatted=False, parent=None)
    dl.show()

    if dl.exec_():
        letter = letterprint.letter(dl.text)
        if letter.printpage():
            if dl.has_edits:
                docsprinted.add(
                    dl.pt.serialno,
                    "%s(html)" % type,
                    dl.text,
                    version + 1
                )
        return True
Exemple #13
0
def orthoWizard(om_gui):
    '''prints a referal letter controlled by referal.xml file'''
    desc = om_gui.ui.referralLettersComboBox.currentText()
    html = referral.getHtml(desc, om_gui.pt)

    Dialog = QtGui.QDialog(om_gui)
    dl = Ui_ortho_ref_wizard.Ui_Dialog()
    dl.setupUi(Dialog)
    dl.notes_textEdit.setHtml(html)
    if Dialog.exec_():
        html = dl.textEdit.toHtml()
        myclass = letterprint.letter(html)
        myclass.printpage()
        docsprinted.add(om_gui.pt.serialno, "referral (html)", html)
        om_gui.pt.addHiddenNote("printed", "referral")
        if om_gui.ui.prevCorres_treeWidget.isVisible():
            om_gui.docsPrintedInit()
        om_gui.updateHiddenNotesLabel()
Exemple #14
0
def htmlEditor(om_gui, type="", html="", version=0):
    '''
    raise a dialog to print an html editor
    '''
    Dialog = QtGui.QDialog(om_gui)
    dl = Ui_enter_letter_text.Ui_Dialog()
    dl.setupUi(Dialog)
    dl.textEdit.setHtml(html)
    if Dialog.exec_():
        html = dl.textEdit.toHtml()
        myclass = letterprint.letter(html)
        myclass.printpage()

        html = str(dl.textEdit.toHtml().toAscii())

        docsprinted.add(om_gui.pt.serialno, "%s (html)" % type, html,
                        version + 1)
        return True
Exemple #15
0
def orthoWizard(om_gui):
    '''prints a referal letter controlled by referal.xml file'''
    desc = om_gui.ui.referralLettersComboBox.currentText()
    html = referral.getHtml(desc, om_gui.pt)

    Dialog = QtGui.QDialog(om_gui)
    dl = Ui_ortho_ref_wizard.Ui_Dialog()
    dl.setupUi(Dialog)
    dl.notes_textEdit.setHtml(html)
    if Dialog.exec_():
        html = dl.textEdit.toHtml()
        myclass = letterprint.letter(html)
        myclass.printpage()
        docsprinted.add(om_gui.pt.serialno, "referral (html)", html)
        om_gui.pt.addHiddenNote("printed", "referral")
        if om_gui.ui.prevCorres_treeWidget.isVisible():
            om_gui.docsPrintedInit()
        om_gui.updateHiddenNotesLabel()
def printAccountsTable(om_gui):
    '''
    print the table
    '''
    #-- set a pointer for readability
    table = om_gui.ui.accounts_tableWidget
    rowno = table.rowCount()
    if rowno == 0:
        om_gui.advise(_("Nothing to print - have you loaded the table?"), 1)
        return()
    total = 0
    html = '<html><body><table border="1">'
    html += _('''<tr><th>Dent</th><th>SerialNo</th><th>Cset</th>
<th>FName</th><th>Sname</th><th>DOB</th><th>Memo</th><th>Last Appt</th>
<th>Last Bill</th><th>Type</th><th>Number</th><th>Complete</th>
<th>Amount</th></tr>''')
    for row in range(rowno):
        if row % 2 == 0:
            html += '<tr bgcolor="#eeeeee">'
        else:
            html += '<tr>'
        for col in range(13):
            item = table.item(row, col)
            if item:
                if col == 1:
                    html += '<td align="right">%s</td>' % item.text()
                elif col == 12:
                    money = localsettings.pencify(item.text())
                    money_str = localsettings.formatMoney(money)
                    html += '<td align="right">%s</td>' % money_str
                    total += money
                else:
                    html += '<td>%s</td>' % item.text()
            else:
                html += '<td> </td>'
        html += '</tr>\n'

    html += '<tr><td colspan="11"></td><td><b>' + _('TOTAL') + '''</b></td>
        <td align="right"><b>%s</b></td></tr></table></body></html>''' % (
        localsettings.formatMoney(total))

    myclass = letterprint.letter(html)
    myclass.printpage()
Exemple #17
0
def printAccountsTable(om_gui):
    '''
    print the table
    '''
    #-- set a pointer for readability
    table = om_gui.ui.accounts_tableWidget
    rowno = table.rowCount()
    if rowno == 0:
        om_gui.advise(_("Nothing to print - have you loaded the table?"), 1)
        return ()
    total = 0
    html = '<html><body><table border="1">'
    html += _('''<tr><th>Dent</th><th>SerialNo</th><th>Cset</th>
<th>FName</th><th>Sname</th><th>DOB</th><th>Memo</th><th>Last Appt</th>
<th>Last Bill</th><th>Type</th><th>Number</th><th>Complete</th>
<th>Amount</th></tr>''')
    for row in range(rowno):
        if row % 2 == 0:
            html += '<tr bgcolor="#eeeeee">'
        else:
            html += '<tr>'
        for col in range(13):
            item = table.item(row, col)
            if item:
                if col == 1:
                    html += '<td align="right">%s</td>' % item.text()
                elif col == 12:
                    money = int(float(item.text()) * 100)
                    money_str = localsettings.formatMoney(money)
                    html += '<td align="right">%s</td>' % money_str
                    total += money
                else:
                    html += '<td>%s</td>' % item.text()
            else:
                html += '<td> </td>'
        html += '</tr>\n'

    html += '<tr><td colspan="11"></td><td><b>' + _('TOTAL') + '''</b></td>
        <td align="right"><b>%s</b></td></tr></table></body></html>''' % (
        localsettings.formatMoney(total))

    myclass = letterprint.letter(html)
    myclass.printpage()