def showCheckMesDescription(parent, mesId): if parent.eventEditor is not None: view = CReportViewDialog(parent) view.setWindowTitle(u'ПРОТОКОЛ') view.setText(getMesDescription(parent, mesId)) view.showMaximized() view.exec_()
def on_btnPrint_clicked(self): doc = QtGui.QTextDocument() cursor = QtGui.QTextCursor(doc) format = QtGui.QTextCharFormat() format.setProperty(QtGui.QTextFormat.FontSizeIncrement, QtCore.QVariant(2)) format.setFontWeight(QtGui.QFont.Bold) cursor.setCharFormat(format) if len(self.actionPropertyList) == 1: title = u'Журнал значения свойства "' + self.actionPropertyList[0][ 0].type().name + '"' else: names = [ '"' + actionProperty[0].type().name + '"' for actionProperty in self.actionPropertyList ] title = u'Журнал значения свойств ' + ', '.join( names[:-1]) + u' и ' + names[-1] cursor.insertText(title) cursor.insertBlock() cursor.setCharFormat(QtGui.QTextCharFormat()) cursor.insertText(u'пациент:') cursor.insertBlock() cursor.insertHtml(getClientBanner(self.clientId)) self.tblValues.addContentToTextCursor(cursor) view = CReportViewDialog(self) view.setWindowTitle(u'Журнал значения свойства') view.setText(doc) view.exec_()
def showHtml(widget, name, content, canvases, pageFormat): reportView = CReportViewDialog(widget) reportView.setWindowTitle(name) reportView.setText(content) reportView.setCanvases(canvases) reportView.setPageFormat(pageFormat) reportView.exec_()
def execReportInt(): report = CReportR67DP(self) params = { 'accountId': self.accountId, 'accountItemIdList': self.idList } reportTxt = report.build(params) view = CReportViewDialog(self) view.setWindowTitle(report.title()) view.setText(reportTxt) return view
def buildReport(): dialog = CAccount() dialog.setTitle(u'Сводный реестр услуг') if dialog.exec_(): report = CAccountRegistry(None, True) params = dialog.params() financeDict = params.get('finance', None) financeList = financeDict.keys() reportTxt = report.build( u'типы финансирования: ' + ', '.join([forceString(financeDict[key]) for key in financeList]), params) view = CReportViewDialog() view.setWindowTitle(report.title()) view.setText(reportTxt) view.setQueryText(report.queryText) view.setRepeatButtonVisible(True, buildReport) view.exec_()
def getView(self, report, parent): view = CReportViewDialog(parent) view.setWindowTitle(u'Справка о стоимости лечения') view.setText(report) return view
def showMesDescription(widget, mesId): view = CReportViewDialog(widget) view.setWindowTitle(u'МЭС') view.setText(getMesDescription(mesId)) view.showMaximized() view.exec_()
def printHistory(self): def isLastInBlock(valueIdx, valueRowIdx, valuesCount, valueRowsCount): return (valueIdx == (valuesCount - 1)) and (valueRowIdx == (valueRowsCount - 1)) self.printRowShift = 1 title = u'Стоматологическая история пациента' model = self.model() items = list(model.items()) items.reverse() if not items: return lastDentitionTeeth = self.getLastDentitionTeeth(items) teethAdditional = [('4.8%', [u''], CReportBase.AlignLeft) for col in lastDentitionTeeth[0:16]] tableColumns = [('3%', [u'№'], CReportBase.AlignLeft), ('10%', [u'Дата'], CReportBase.AlignLeft), ('10%', [u'Тип свойства'], CReportBase.AlignLeft) ] + teethAdditional doc = QtGui.QTextDocument() cursor = QtGui.QTextCursor(doc) cursor.setCharFormat(CReportBase.ReportTitle) cursor.insertText(title) cursor.insertBlock() cursor.setCharFormat(CReportBase.ReportSubTitle) cursor.insertText(self.getSubTitle()) cursor.insertBlock() table = createTable(cursor, tableColumns) lenItems = len(items) for iRow, dentition in enumerate(items): record, action, actionId, eventId, isChecked = dentition if isChecked: if action.getType().flatCode == u'dentitionInspection': teethNumber, teethStatusTop, teethStatusLower, teethStateTop, teethStateLower, teethMobilityTop, teethMobilityLower = self.getTeethValues( action) valueRowList = ((teethStatusTop, u'Статус'), (teethMobilityTop, u'Подвижность'), (teethStateTop, u'Состояние'), (teethNumber, u'Номер'), (teethStateLower, u'Состояние'), (teethMobilityLower, u'Подвижность'), (teethStatusLower, u'Статус')) elif action.getType().flatCode == u'parodentInsp': teethNumber, cunealDefectTop, cunealDefectLower, recessionTop, recessionLower, mobilityTop, mobilityLower, pocketDepthTop, pocketDepthLower = self.getParodentTeethValues( action) valueRowList = ((cunealDefectTop, u'Клиновидный дефект'), (recessionTop, u'Рецессия'), (mobilityTop, u'Подвижность'), (pocketDepthTop, u'Глубина кармана'), (teethNumber, u'Номер'), (pocketDepthLower, u'Глубина кармана'), (mobilityLower, u'Подвижность'), (recessionLower, u'Рецессия'), (cunealDefectLower, u'Клиновидный дефект')) values = [(record, 'begDate', u'Осмотр', dentition, valueRowList)] i = table.addRow() begMergeRow = i for valueIdx, (record, dateField, dentitionTypeName, dentitionItem, valueRows) in enumerate(values): i, lastDentitionTeeth = self.checkDentitionEquals( lastDentitionTeeth, dentitionItem, table, i) table.setText(i, 0, iRow + 1) if record: date = forceDate(record.value(dateField)) dateText = ( forceString(date) + '\n' + dentitionTypeName) if date.isValid() else u'' table.setText(i, 1, dateText) for valueRowIdx, (valueRow, rowName) in enumerate(valueRows): self.addRowValues(rowName, table, valueRow, i, len(values), valueRowIdx) if not isLastInBlock(valueIdx, valueRowIdx, len(values), len(valueRows)): i = table.addRow() table.mergeCells(begMergeRow, 0, len(valueRowList), 1) table.mergeCells(begMergeRow, 1, len(valueRowList), 1) if iRow + 1 != lenItems: i = table.addRow() table.mergeCells(i, 0, 1, len(tableColumns)) cursor.movePosition(QtGui.QTextCursor.End) cursor.insertText(self.getResult()) cursor.insertBlock() viewDialog = CReportViewDialog(self) viewDialog.setWindowTitle(title) viewDialog.setRepeatButtonVisible() viewDialog.setText(doc) viewDialog.buttonBox.removeButton( viewDialog.buttonBox.button(QtGui.QDialogButtonBox.Retry)) viewDialog.setWindowState(QtCore.Qt.WindowMaximized) viewDialog.exec_()