Beispiel #1
0
def populateAccountsTable(om_gui):
    rows = accounts.details()
    om_gui.ui.accounts_tableWidget.clear()
    om_gui.ui.accounts_tableWidget.setSortingEnabled(False)
    om_gui.ui.accounts_tableWidget.setRowCount(len(rows))
    headers = ("Dent", "Serialno", "", "First", "Last", "DOB", "Memo",
               "Last Appt", "Last Bill", "Type", "Number", "T/C", "Fees", "A",
               "B", "C")

    om_gui.ui.accounts_tableWidget.setColumnCount(len(headers))
    om_gui.ui.accounts_tableWidget.setHorizontalHeaderLabels(headers)
    om_gui.ui.accounts_tableWidget.verticalHeader().hide()
    rowno = 0
    total = 0
    for row in rows:
        for col in range(len(row)):
            d = row[col]
            if d is not None or col == 11:
                item = QtGui.QTableWidgetItem()
                if col == 0:
                    item.setText(localsettings.ops.get(d))
                elif col in (5, 7, 8):
                    item.setData(QtCore.Qt.DisplayRole,
                                 QtCore.QVariant(QtCore.QDate(d)))
                elif col == 12:
                    total += d
                    #--jump through hoops to make the string sortable!
                    money = QtCore.QVariant(
                        QtCore.QString("%L1").arg(float(d / 100), 8, "f", 2))

                    item.setData(QtCore.Qt.DisplayRole, money)
                    item.setTextAlignment(QtCore.Qt.AlignRight
                                          | QtCore.Qt.AlignVCenter)

                    # item.setText(localsettings.formatMoney(d))

                elif col == 11:
                    if d > 0:
                        item.setText("N")
                    else:
                        item.setText("Y")
                else:
                    item.setText(str(d).title())
                om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
        for col in range(13, 16):
            item = QtGui.QTableWidgetItem()
            item.setCheckState(QtCore.Qt.Unchecked)
            om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
        rowno += 1
    om_gui.ui.accounts_tableWidget.sortItems(7, QtCore.Qt.DescendingOrder)
    om_gui.ui.accounts_tableWidget.setSortingEnabled(True)
    # om_gui.ui.accounts_tableWidget.update()
    for i in range(om_gui.ui.accounts_tableWidget.columnCount()):
        om_gui.ui.accounts_tableWidget.resizeColumnToContents(i)
    om_gui.ui.accountsTotal_doubleSpinBox.setValue(total / 100)
Beispiel #2
0
def populateAccountsTable(om_gui):
    rows = accounts.details()
    om_gui.ui.accounts_tableWidget.clear()
    om_gui.ui.accounts_tableWidget.setSortingEnabled(False)
    om_gui.ui.accounts_tableWidget.setRowCount(len(rows))
    headers = ("Dent", "Serialno", "", "First", "Last", "DOB", "Memo",
    "Last Appt", "Last Bill", "Type", "Number", "T/C", "Fees", "A", "B",
    "C")

    om_gui.ui.accounts_tableWidget.setColumnCount(len(headers))
    om_gui.ui.accounts_tableWidget.setHorizontalHeaderLabels(headers)
    om_gui.ui.accounts_tableWidget.verticalHeader().hide()
    rowno = 0
    total = 0
    for row in rows:
        for col in range(len(row)):
            d = row[col]
            if d != None or col == 11:
                item = QtGui.QTableWidgetItem()
                if col == 0:
                    item.setText(localsettings.ops.get(d))
                elif col in (5, 7, 8):
                    item.setData(QtCore.Qt.DisplayRole,
                    QtCore.QVariant(QtCore.QDate(d)))
                elif col == 12:
                    total += d
                    #--jump through hoops to make the string sortable!
                    money = QtCore.QVariant(QtCore.QString("%L1").\
                    arg(float(d/100), 8, "f", 2))

                    item.setData(QtCore.Qt.DisplayRole, money)
                    item.setTextAlignment(
                    QtCore.Qt.AlignRight|QtCore.Qt.AlignVCenter)

                    #item.setText(localsettings.formatMoney(d))

                elif col == 11:
                    if d > 0:
                        item.setText("N")
                    else:
                        item.setText("Y")
                else:
                    item.setText(str(d).title())
                om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
        for col in range(13, 16):
            item = QtGui.QTableWidgetItem()
            item.setCheckState(QtCore.Qt.Unchecked)
            om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
        rowno += 1
    om_gui.ui.accounts_tableWidget.sortItems(7, QtCore.Qt.DescendingOrder)
    om_gui.ui.accounts_tableWidget.setSortingEnabled(True)
    #om_gui.ui.accounts_tableWidget.update()
    for i in range(om_gui.ui.accounts_tableWidget.columnCount()):
        om_gui.ui.accounts_tableWidget.resizeColumnToContents(i)
    om_gui.ui.accountsTotal_doubleSpinBox.setValue(total / 100)
Beispiel #3
0
def populateAccountsTable(om_gui):
    om_gui.advise(_("Loading Accounts Table"))
    om_gui.wait()
    rows = accounts.details()
    om_gui.ui.accounts_tableWidget.clear()
    om_gui.ui.accounts_tableWidget.setSortingEnabled(False)
    om_gui.ui.accounts_tableWidget.setRowCount(len(rows))
    headers = (_("Dent"), _("Serialno"), "", _("First"), _("Last"),
               _("DOB"), _("Memo"), _("Last Tx"), _("Last Bill"), _("Type"),
               _("Number"), _("T/C"), _("Fees"), "A", "B", "C")

    om_gui.ui.accounts_tableWidget.setColumnCount(len(headers))
    om_gui.ui.accounts_tableWidget.setHorizontalHeaderLabels(headers)
    om_gui.ui.accounts_tableWidget.verticalHeader().hide()
    om_gui.ui.accounts_tableWidget.horizontalHeader().setStretchLastSection(
        True)
    rowno = 0
    total = 0
    for row in rows:
        for col in range(len(row)):
            d = row[col]
            if d is not None or col == 11:
                item = QtGui.QTableWidgetItem()
                if col == 0:
                    item.setText(localsettings.ops.get(d))
                elif col in (5, 7, 8):
                    item.setData(QtCore.Qt.DisplayRole, QtCore.QDate(d))
                elif col == 12:
                    total += d
                    # item.setText(localsettings.formatMoney(d))
                    # jump through hoops to make the string sortable!
                    money = "%.02f" % float(d / 100)
                    item.setData(QtCore.Qt.DisplayRole, money.rjust(8, " "))
                    item.setTextAlignment(
                        QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
                elif col == 11:
                    if d is None:
                        item.setText(_("Under Treatment"))
                    else:
                        item.setData(QtCore.Qt.DisplayRole, QtCore.QDate(d))
                else:
                    item.setText(str(d).title())
                om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
        for col in range(13, 16):
            item = QtGui.QTableWidgetItem()
            item.setCheckState(QtCore.Qt.Unchecked)
            om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
        rowno += 1
    om_gui.ui.accounts_tableWidget.sortItems(7, QtCore.Qt.DescendingOrder)
    om_gui.ui.accounts_tableWidget.setSortingEnabled(True)
    # om_gui.ui.accounts_tableWidget.update()
    for i in range(om_gui.ui.accounts_tableWidget.columnCount()):
        om_gui.ui.accounts_tableWidget.resizeColumnToContents(i)
    om_gui.ui.accountsTotal_doubleSpinBox.setValue(total / 100)
    om_gui.wait(False)
Beispiel #4
0
def populateAccountsTable(om_gui):
    dl = AccountsLoaderDialog(om_gui)
    if not dl.exec_():
        return
    om_gui.advise(_("Loading Accounts Table"))
    om_gui.wait()
    rows = accounts.details(greater_than=dl.show_debts,
                            amount=dl.min_amount,
                            extra_conditions=dl.conditions,
                            extra_values=dl.values)
    om_gui.ui.accounts_tableWidget.clear()
    om_gui.ui.accounts_tableWidget.setSortingEnabled(False)
    om_gui.ui.accounts_tableWidget.setRowCount(len(rows))

    headers = [
        _("Dent"),
        _("Serialno"), "",
        _("Name"),
        _("Status"),
        _("Last Tx"),
        _("T/C")
    ]
    if dl.show_debts:
        headers.extend(
            [_("Fees"),
             _("Last Bill"),
             _("Type"),
             _("Number"), "A", "B", "C"])
    else:
        headers.append(_("Credit"))
    headers.append(_("Memo"))

    om_gui.ui.accounts_tableWidget.setColumnCount(len(headers))
    om_gui.ui.accounts_tableWidget.setHorizontalHeaderLabels(headers)
    om_gui.ui.accounts_tableWidget.verticalHeader().hide()
    om_gui.ui.accounts_tableWidget.horizontalHeader().setStretchLastSection(
        True)
    total = 0
    om_gui.ui.accounts_tableWidget.setSortingEnabled(False)

    for rowno, row in enumerate(rows):
        for col, val in enumerate(row):
            if col in (8, 9, 10) and not dl.show_debts:
                continue
            if val is not None:
                item = QtWidgets.QTableWidgetItem()
                if col == 0:
                    item.setText(localsettings.ops.get(val))
                elif col in (5, 8):
                    item.setData(QtCore.Qt.DisplayRole, QtCore.QDate(val))
                elif col == 6:
                    if not val:
                        item.setText(_("Under Treatment"))
                    else:
                        item.setData(QtCore.Qt.DisplayRole, QtCore.QDate(val))
                elif col == 7:
                    if dl.show_debts:
                        total += val
                        item.setForeground(QtGui.QBrush(QtCore.Qt.red))
                        money = "%.02f" % float(val / 100)
                    else:
                        total += -val
                        item.setForeground(QtGui.QBrush(QtCore.Qt.darkBlue))
                        money = "%.02f" % float(-val / 100)
                    item.setData(QtCore.Qt.DisplayRole, money.rjust(8, " "))
                    item.setTextAlignment(QtCore.Qt.AlignRight
                                          | QtCore.Qt.AlignVCenter)
                else:
                    item.setText(str(val))
                gui_col = col
                if col == 11:
                    gui_col = 14 if dl.show_debts else 8
                om_gui.ui.accounts_tableWidget.setItem(rowno, gui_col, item)
        if dl.show_debts:
            for col in range(11, 14):
                item = QtWidgets.QTableWidgetItem()
                item.setCheckState(QtCore.Qt.Unchecked)
                om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
    om_gui.ui.accounts_tableWidget.sortItems(5, QtCore.Qt.DescendingOrder)
    om_gui.ui.accounts_tableWidget.setSortingEnabled(True)
    for i in range(om_gui.ui.accounts_tableWidget.columnCount()):
        om_gui.ui.accounts_tableWidget.resizeColumnToContents(i)
    om_gui.ui.accountsTotal_doubleSpinBox.setValue(total / 100)
    om_gui.wait(False)
    om_gui.ui.printSelectedAccounts_pushButton.setEnabled(dl.show_debts)
Beispiel #5
0
def populateAccountsTable(om_gui):
    dl = AccountsLoaderDialog(om_gui)
    if not dl.exec_():
        return
    om_gui.advise(_("Loading Accounts Table"))
    om_gui.wait()
    rows = accounts.details(greater_than=dl.show_debts,
                            amount=dl.min_amount,
                            extra_conditions=dl.conditions,
                            extra_values=dl.values)
    om_gui.ui.accounts_tableWidget.clear()
    om_gui.ui.accounts_tableWidget.setSortingEnabled(False)
    om_gui.ui.accounts_tableWidget.setRowCount(len(rows))

    headers = [_("Dent"), _("Serialno"), "", _("Name"), _("Status"),
               _("Last Tx"), _("T/C")]
    if dl.show_debts:
        headers.extend([_("Fees"), _("Last Bill"), _("Type"), _("Number"),
                        "A", "B", "C"])
    else:
        headers.append(_("Credit"))
    headers.append(_("Memo"))

    om_gui.ui.accounts_tableWidget.setColumnCount(len(headers))
    om_gui.ui.accounts_tableWidget.setHorizontalHeaderLabels(headers)
    om_gui.ui.accounts_tableWidget.verticalHeader().hide()
    om_gui.ui.accounts_tableWidget.horizontalHeader().setStretchLastSection(
        True)
    total = 0
    om_gui.ui.accounts_tableWidget.setSortingEnabled(False)

    for rowno, row in enumerate(rows):
        for col, val in enumerate(row):
            if col in (8, 9, 10) and not dl.show_debts:
                continue
            if val is not None:
                item = QtWidgets.QTableWidgetItem()
                if col == 0:
                    item.setText(localsettings.ops.get(val))
                elif col in (5, 8):
                    item.setData(QtCore.Qt.DisplayRole, QtCore.QDate(val))
                elif col == 6:
                    if not val:
                        item.setText(_("Under Treatment"))
                    else:
                        item.setData(QtCore.Qt.DisplayRole, QtCore.QDate(val))
                elif col == 7:
                    if dl.show_debts:
                        total += val
                        item.setForeground(QtGui.QBrush(QtCore.Qt.red))
                        money = "%.02f" % float(val / 100)
                    else:
                        total += -val
                        item.setForeground(QtGui.QBrush(QtCore.Qt.darkBlue))
                        money = "%.02f" % float(-val / 100)
                    item.setData(QtCore.Qt.DisplayRole, money.rjust(8, " "))
                    item.setTextAlignment(
                        QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
                else:
                    item.setText(str(val))
                gui_col = col
                if col == 11:
                    gui_col = 14 if dl.show_debts else 8
                om_gui.ui.accounts_tableWidget.setItem(rowno, gui_col, item)
        if dl.show_debts:
            for col in range(11, 14):
                item = QtWidgets.QTableWidgetItem()
                item.setCheckState(QtCore.Qt.Unchecked)
                om_gui.ui.accounts_tableWidget.setItem(rowno, col, item)
    om_gui.ui.accounts_tableWidget.sortItems(5, QtCore.Qt.DescendingOrder)
    om_gui.ui.accounts_tableWidget.setSortingEnabled(True)
    for i in range(om_gui.ui.accounts_tableWidget.columnCount()):
        om_gui.ui.accounts_tableWidget.resizeColumnToContents(i)
    om_gui.ui.accountsTotal_doubleSpinBox.setValue(total / 100)
    om_gui.wait(False)
    om_gui.ui.printSelectedAccounts_pushButton.setEnabled(dl.show_debts)