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()
def update_ptFee(self, arg, userPerforming=True): ''' ptfee has been altered, alter ALL underying data for multiple items - the new fee is what has been inputted / number of items. ''' try: newVal = localsettings.pencify(arg) if self.feesLinked and userPerforming: self.fee_lineEdit.setText(arg) self.update_Fee(arg, False) except ValueError: newVal = 0 for item in self.est_items: item.ptfee = newVal / len(self.est_items) if userPerforming: self.edited_signal.emit()
def customAdd(om_gui, description=None): ''' add 'custom' items ''' if course_module.newCourseNeeded(om_gui): return pt = om_gui.pt courseno = pt.treatment_course.courseno Dialog = QtWidgets.QDialog(om_gui) dl = Ui_customTreatment.Ui_Dialog() dl.setupUi(Dialog) if description: dl.description_lineEdit.setText(description) if Dialog.exec_(): no = dl.number_spinBox.value() descr = dl.description_lineEdit.text() if descr == "": descr = "??" usercode = str(descr.replace(" ", "_"))[:20].upper() fee = localsettings.pencify(str(dl.fee_doubleSpinBox.value())) for i in range(no): pt.treatment_course.custompl += "%s " % usercode custom_txs = "%s %s" % (pt.treatment_course.customcmp, pt.treatment_course.custompl) n = custom_txs.split(" ").count(usercode) hash_ = localsettings.hash_func("%scustom%s%s" % (courseno, n, usercode)) tx_hash = TXHash(hash_) dentid = om_gui.pt.course_dentist add_treatment_to_estimate(om_gui, "custom", usercode, dentid, [tx_hash], itemcode="CUSTO", csetype="P", descr=descr, fee=fee, ptfee=fee) om_gui.update_plan_est()
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()
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()
def customAdd(om_gui, description=None): ''' add 'custom' items ''' if course_module.newCourseNeeded(om_gui): return pt = om_gui.pt courseno = pt.treatment_course.courseno Dialog = QtGui.QDialog(om_gui) dl = Ui_customTreatment.Ui_Dialog() dl.setupUi(Dialog) if description: dl.description_lineEdit.setText(description) if Dialog.exec_(): no = dl.number_spinBox.value() descr = unicode(dl.description_lineEdit.text(), "ascii", "ignore") if descr == "": descr = "??" usercode = str(descr.replace(" ", "_"))[:20].upper() fee = localsettings.pencify(str(dl.fee_doubleSpinBox.value())) for i in range(no): pt.treatment_course.custompl += "%s " % usercode custom_txs = "%s %s" % ( pt.treatment_course.customcmp, pt.treatment_course.custompl) n = custom_txs.split(" ").count(usercode) hash_ = localsettings.hash_func( "%scustom%s%s" % (courseno, n, usercode)) tx_hash = TXHash(hash_) dentid = om_gui.pt.course_dentist add_treatment_to_estimate(om_gui, "custom", usercode, dentid, [tx_hash], itemcode="CUSTO", csetype="P", descr=descr, fee=fee, ptfee=fee) om_gui.update_plan_est()
def print_duplicate(self): amount = self.amount_spinbox.value() myreceipt = receiptPrint.Receipt() myreceipt.setProps(self.pt.title, self.pt.fname, self.pt.sname, self.pt.addr1, self.pt.addr2, self.pt.addr3, self.pt.town, self.pt.county, self.pt.pcde) total = localsettings.pencify(str(amount)) myreceipt.total = total myreceipt.receivedDict = {_("Professional Services"): total} myreceipt.isDuplicate = True myreceipt.dupdate = self.dup_date_edit.date() if myreceipt.print_(): self.pt.addHiddenNote("printed", "%s %.02f" % ( _("duplicate receipt for"), amount)) self.duplicate_printed = True self.accept()