def additionalPrint(self, context, templateId): QtGui.qApp.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) item = self.tblTreeProbe.currentIndex().internalPointer() actionObj = item.action() actionId = actionObj.getId() actionRecord = actionObj.getRecord() eventId = forceRef(actionRecord.value('event_id')) eventInfo = context.getInstance(CEventInfo, eventId) eventActions = eventInfo.actions eventActions._idList = [actionId] eventActions._items = [CCookedActionInfo(context, actionRecord, actionObj)] eventActions._loaded = True action = eventInfo.actions[0] data = { 'event': eventInfo, 'action': action, 'client': eventInfo.client, 'actions': eventActions, 'currentActionIndex': 0, 'tempInvalid': None } QtGui.qApp.restoreOverrideCursor() applyTemplate(self, templateId, data)
def printByTemplate(self, templateId): if self.eventEditor.isDirty() and forceInt( QtGui.qApp.db.translate('rbPrintTemplate', 'id', templateId, 'banUnkeptDate')) == 2: if QtGui.QMessageBox.question( self, u'Внимание!', u'Для печати данного шаблона необходимо сохранить обращение.\nСохранить сейчас?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) != QtGui.QMessageBox.Yes: return if not self.eventEditor.saveData(): return currentAction = self.currentAction() if currentAction: data = getEventContextData(self.eventEditor) eventInfo = data['event'] action = CCookedActionInfo(eventInfo.context, currentAction.getRecord(), currentAction) action.setCurrentPropertyIndex( self.tblAPProps.currentIndex().row()) data['action'] = action data['actions'] = self.tblAPActions.actions() data['currentActionIndex'] = 0 applyTemplate(self.eventEditor, templateId, data)
def on_btnPrint_printByTemplate(self, templateId): context = CInfoContext() data = { 'client': context.getInstance(CClientInfo, self.clientId), 'date': CDateInfo(self.eventDate), 'person': context.getInstance(CPersonInfo, self.personId), 'visits': [], 'actions': self.modelActions.getInfoList(context) } applyTemplate(self, templateId, data)
def on_printByTemplate(self, templateId): context = CInfoContext() if templateId in [printAction.id for printAction in self.btnPrint.additionalActions()]: self.additionalPrint(context, templateId) else: jobTicketId = self.itemId() makeDependentActionIdList([jobTicketId]) presetActions = tuple(self.modelJobTicketProbe.actionList()) jobTicketInfo = context.getInstance(CJobTicketWithActionsInfo, jobTicketId, presetActions=presetActions) data = {'jobTicket': jobTicketInfo} applyTemplate(self, templateId, data)
def on_btnPrintEvent_printByTemplate(self, templateId): context = CInfoContext() eventId = self.getCurrentEventId() eventInfo = context.getInstance(CEventInfo, eventId) tempInvalidInfo = None # self.getTempInvalidInfo(context) data = { 'event': eventInfo, 'client': eventInfo.client, 'tempInvalid': tempInvalidInfo } applyTemplate(self, templateId, data)
def printCurrentAccount(self, templateId): context = CInfoContext() accountInfo = context.getInstance(CAccountInfo, self.currentAccountId) accountInfo.selectedItemIdList = self.modelAccountItems.idList() eventInfo = context.getInstance(CEventInfo, self.eventId) clientInfo = eventInfo.client tempInvalidInfo = context.getInstance(CTempInvalidInfo, None) data = { 'account' : accountInfo, 'event': eventInfo, 'client': clientInfo, 'tempInvalid': tempInvalidInfo } applyTemplate(self, templateId, data)
def printCashOrder(widget, templateId, eventId, date, cashOperationId, sum, cashBox): context = CInfoContext() eventInfo = context.getInstance(CEventInfo, eventId) data = { 'event': eventInfo, 'client': eventInfo.client, 'date': CDateInfo(date), 'cashOperation': context.getInstance(CCashOperationInfo, cashOperationId), 'sum': sum, 'cashBox': cashBox } applyTemplate(widget, templateId, data)
def on_btnPrint_printByTemplate(self, templateId): from Registry.RegistryWindow import getEventInfoByDiagnosis context = CInfoContext() tempInvalidInfo = self.getTempInvalidInfo(context) eventInfo = getEventInfoByDiagnosis(context, self.diagnosisId) data = { 'event': eventInfo, 'client': context.getInstance(CClientInfo, self.clientId, QtCore.QDate.currentDate()), 'tempInvalid': tempInvalidInfo, } applyTemplate(self, templateId, data)
def on_btnPrint_printByTemplate(self, templateId): context = CInfoContext() eventInfo = context.getInstance(CEventInfo, self.eventId) eventActions = eventInfo.actions eventActions._idList = [self.itemId()] eventActions._items = [CCookedActionInfo(context, self.getRecord(), self.action)] eventActions._loaded = True action = eventInfo.actions[0] action.setCurrentPropertyIndex(self.tblProps.currentIndex().row()) data = { 'event': eventInfo, 'action': action, 'client': eventInfo.client, 'actions': eventActions, 'currentActionIndex': 0, 'tempInvalid': None } applyTemplate(self, templateId, data)
def on_btnRequestDocumentPrint_printByTemplate(self, templateId): storeFromId = self.cmbRequestDocumentStoreFrom.itemId() storeToId = self.cmbRequestDocumentStoreTo.itemId() date = self.edtRequestDocumentDate.date( ) if self.chkRequestDocumentDate.isChecked() else None catalog = [] docs = [] try: QtGui.qApp.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) catalog = self._srv.getCatalogItems(flat=True) docs = self._srv.getFlatRequestDocuments(storeFrom=storeToId, storeTo=storeFromId, date=date, positions=True) except CPharmacyServiceException as e: import logging logger = logging.getLogger('requests.packages.urllib3') logger.exception(e) finally: QtGui.qApp.restoreOverrideCursor() ctx = CInfoContext() data = { 'catalog': [ CCatalogItemInfo(ctx, item=catalogItem) for catalogItem in catalog ], 'docs': [ CRequestDocumentInfo(ctx, doc=doc, positions=doc.items) for doc in docs ] } applyTemplate(self, templateId, data)
def on_btnStoreItemsPrint_printByTemplate(self, templateId): storeId = self.cmbStoreItemsStore.itemId() detailed = self.chkStoreItemsDetailed.isChecked() try: QtGui.qApp.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) catalog = self._srv.getCatalogItems(flat=True) items = self._srv.getFlatStoreItems(storeId, detailed=detailed) except: catalog = [] items = [] finally: QtGui.qApp.restoreOverrideCursor() ctx = CInfoContext() data = { 'catalog': [ CCatalogItemInfo(ctx, item=catalogItem) for catalogItem in catalog ], 'items': [CStoreStockItemInfo(ctx, item=storeItem) for storeItem in items] } applyTemplate(self, templateId, data)
def applyPrintTemplate(self, templateId): info = self._additionalPrintInfo info.update(self.eCashRegister.getPrintInfo()) applyTemplate(self, templateId, info)
def on_btnPrint_printByTemplate(self, templateId): context = CInfoContext() actionsInfo = context.getInstance(CActionTableRedactorInfoList, tuple(self._actionIdList)) data = {'actions': actionsInfo} applyTemplate(self, templateId, data)