Exemple #1
0
    def load(self, cfgDir='.'):
        self._loaded = False
        for fileName in os.listdir(cfgDir):
            if not os.path.isfile(fileName):
                continue
            if os.path.splitext(fileName)[1] != self.ext:
                continue

            s = QtCore.QSettings(fileName, QtCore.QSettings.IniFormat)
            s.setIniCodec(u'utf8')
            for place in s.childGroups():
                self._loaded = True
                s.beginGroup(place)
                placeInfo = self._placesInfo.setdefault(
                    forceStringEx(place), {})
                placeInfo['title'] = forceStringEx(
                    s.value(u'title', defaultValue=u'<Неизвестно>'))
                placeInfo['address'] = forceStringEx(
                    s.value(u'address', defaultValue=u'<Неизвестно>'))
                placeInfo['port'] = forceInt(s.value(u'port', defaultValue=0))
                placeInfo['gateway'] = forceStringEx(
                    s.value(u'gateway', defaultValue=u''))
                placeInfo['offices'] = {}

                s.beginGroup('offices')
                for office in s.childKeys():
                    panelAddrVariant = s.value(office, QtCore.QVariant())
                    if not panelAddrVariant.isNull():
                        placeInfo['offices'][forceStringEx(
                            office)] = panelAddrVariant.toInt()[0]
                s.endGroup()
                s.endGroup()
Exemple #2
0
 def getEquipmentIdList(self):
     db = QtGui.qApp.db
     tableEquipment = db.table('rbEquipment')
     cond = []
     if self.chkName.isChecked():
         name = forceStringEx(self.edtName.text())
         if name:
             cond.append(tableEquipment['name'].like('%'+name+'%'))
     if self.chkReleaseDate.isChecked():
         cond.append(tableEquipment['releaseDate'].dateLe(self.edtReleaseDateTo.date()))
         cond.append(tableEquipment['releaseDate'].dateGe(self.edtReleaseDateFrom.date()))
     if self.chkEquipmentType.isChecked():
         equipmentTypeId = self.cmbEquipmentType.value()
         if equipmentTypeId:
             cond.append(tableEquipment['equipmentType_id'].eq(equipmentTypeId))
     if self.chkModel.isChecked():
         model = forceStringEx(self.edtModel.text())
         if model:
             cond.append(tableEquipment['model'].like('%'+model+'%'))
     if self.chkInventoryNumber.isChecked():
         inventoryNumber = forceStringEx(self.edtInventoryNumber.text())
         if inventoryNumber:
             cond.append(tableEquipment['inventoryNumber'].like('%'+inventoryNumber+'%'))
     if self.chkStatus.isChecked():
         cond.append(tableEquipment['status'].eq(self.cmbStatus.currentIndex()))
     idList = db.getIdList(tableEquipment, 'id', cond)
     return idList
Exemple #3
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue(rbCode, toVariant(forceStringEx(self.edtCode.text())))
     record.setValue('regionalCode',
                     toVariant(forceStringEx(self.edtRegionalCode.text())))
     record.setValue(rbName, toVariant(forceStringEx(self.edtName.text())))
     return record
Exemple #4
0
    def getRecord(self):
        record = CItemEditorBaseDialog.getRecord(self)
        record.setValue(rbCode, toVariant(forceStringEx(self.edtCode.text())))
        record.setValue(rbName, toVariant(forceStringEx(self.edtName.text())))
        modifier = u''

        if self.chkReplaceService.isChecked():
            action = 1
            text = forceStringEx(self.edtReplaceService.text())
            modifier = createModifier(action, text)

        # Этот модификатор может выставляться/сохраняться/применяться вместе с ModifyTailService
        if self.chkModifyHeadService.isChecked():
            action = 2
            text = forceStringEx(self.edtModifyHeadService.text())
            n = forceInt(self.edtModifyHeadService_N.text())
            modifier = createModifier(action, text, n)

        # Этот модификатор может выставляться/сохраняться/применяться вместе с ModifyHeadService
        if self.chkModifyTailService.isChecked():
            action = 3
            text = forceStringEx(self.edtModifyTailService.text())
            n = forceInt(self.edtModifyTailService_N.text())
            if modifier:
                modifier = modifier + u'/' + createModifier(action, text, n)
            else:
                modifier = createModifier(action, text, n)

        # Если было кликнуто ничего или chkNoModifyService, то modifier должен быть равен u''

        record.setValue('serviceModifier', toVariant(modifier))
        return record
Exemple #5
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue(rbCode,       toVariant(forceStringEx(self.edtCode.text())))
     record.setValue(rbName,       toVariant(forceStringEx(self.edtName.text())))
     record.setValue('amount',     toVariant(forceStringEx(self.edtAmount.text())))
     record.setValue('unit',       toVariant(forceStringEx(self.edtUnit.text())))
     return record
Exemple #6
0
    def convertValue(cls, value, typeName='str', return_null=False):
        """Преобразует переданное значение в указанный тип.
        Поддерживаемые типы:
            - 'double' или 'float': Вещественное число. Для преобразование используется forceDouble из library.Utils
            - 'int' или 'n': Целое число. Для преобразование используется forceInt из library.Utils
            - 'ref' или 'r': Ссылка на запись БД. Для преобразование используется forceRef из library.Utils
            - 'date' или 'd': Дата. Значение преобразуется в строку, из которой согласно `defaultDateFormat` в QDate

        :param value: Значение, которое необходимо преобразовать.
        :param typeName: имя типа, в который необходимо преобразовать значение.
        :param return_null: возвращать None для null-значений
        :return: преобразованное значение *value*
        """
        if return_null and value.isNull():
            return None
        typeName = typeName.lower()
        if typeName in ['double', 'float']:
            return forceDouble(value)
        elif typeName in ['int', 'n']:
            return forceInt(value)
        elif typeName in ['ref', 'r']:
            return forceRef(value)
        elif typeName in ['date', 'd']:
            return QtCore.QDate.fromString(forceStringEx(value),
                                           cls.defaultDateFormat)
        return forceStringEx(value)
Exemple #7
0
    def applySearch(self):
        self._code = forceStringEx(self.edtCode.text())
        self._name = forceStringEx(self.edtName.text())
        self._tradeName = forceStringEx(self.edtTradeName.text())
        self._mnn = forceStringEx(self.edtMnn.text())

        db = QtGui.qApp.db
        cond = []
        tableFormulary = db.table('DloDrugFormulary_Item')
        tableTradeNames = db.table('dlo_rbTradeName')
        table = tableFormulary

        if self._code:
            cond.append(tableFormulary['code'].like(self._code))
        if self._name:
            cond.append(tableFormulary['name'].like('%' + self._name + '%'))
        if self._tradeName:
            subCond = [ tableTradeNames['name'].like('%' + self._tradeName + '%') ]
            cond.append(db.joinAnd(subCond))
        if self._mnn:
            cond.append(tableFormulary['mnn'].like('%' + self._mnn + '%'))
        if self._filter and len(self._filter) > 0:
            cond.append(self._filter)
        cond.append(table['isSprPC'].eq(1))
        tableTarget = tableFormulary.leftJoin(tableTradeNames, tableFormulary['tradeName_id'].eq(tableTradeNames['id']))
        idList = db.getIdList(tableTarget, table['id'].name(), cond, [table['name'].name(), table['code'].name()])
        self.tblFormulary.setIdList(idList)
Exemple #8
0
 def on_cmbOffice_currentIndexChanged(self, idx):
     office = forceInt(self.cmbOffice.currentText()) if idx > 0 else 0
     placeCode = forceStringEx(
         self.cmbPlaceName.itemData(self.cmbPlaceName.currentIndex()))
     #        self.cmbOffice.setStyleSheet('color:red;' if not office else '')
     self.edtEQPanelAddress.setText(
         forceStringEx(self._eqConfig.getPanelAddress(placeCode, office)))
Exemple #9
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     getLineEditValue(self.edtCode, record, 'code')
     getLineEditValue(self.edtName, record, 'name')
     getLineEditValue(self.edtShortName, record, 'shortName')
     getLineEditValue(self.edtOKSOName, record, 'OKSOName')
     getLineEditValue(self.edtOKSOCode, record, 'OKSOCode')
     getLineEditValue(self.edtFederalCode, record, 'federalCode')
     getLineEditValue(self.edtRegionalCode, record, 'regionalCode')
     getLineEditValue(self.edtSyncGUID, record, 'syncGUID')
     getRBComboBoxValue(self.cmbLocalService, record, 'service_id')
     getRBComboBoxValue(self.cmbProvinceService, record,
                        'provinceService_id')
     getRBComboBoxValue(self.cmbOtherService, record, 'otherService_id')
     getRBComboBoxValue(self.cmbFundingService, record, 'fundingService_id')
     getComboBoxValue(self.cmbSex, record, 'sex')
     record.setValue(
         'age',
         toVariant(
             composeAgeSelector(self.cmbBegAgeUnit.currentIndex(),
                                forceStringEx(self.edtBegAgeCount.text()),
                                self.cmbEndAgeUnit.currentIndex(),
                                forceStringEx(self.edtEndAgeCount.text()))))
     record.setValue(
         'versSpec',
         toVariant({
             0: '',
             1: 'V004',
             2: 'V015'
         }.get(self.cmbVersSpec.currentIndex(), '')))
     getLineEditValue(self.edtMKBFilter, record, 'mkbFilter')
     return record
Exemple #10
0
    def validatePage(self):
        u"""
            Завершение экспорта. Создание архива и добавление в него файла выгрузки.
        """
        baseName = self.parent.page1.getDbfBaseName()
        zipFileName = self.parent.page1.getZipFileName()
        zipFilePath = os.path.join(forceStringEx(self.parent.getTmpDir()),
                                   zipFileName)

        zf = ZipFile(zipFilePath, 'w', allowZip64=True)
        filePath = os.path.join(forceStringEx(self.parent.getTmpDir()),
                                os.path.basename(baseName))
        zf.write(filePath,
                 os.path.basename(self.parent.page1.getDbfBaseName()),
                 ZIP_DEFLATED)
        zf.close()

        dst = os.path.join(forceStringEx(self.edtDir.text()), zipFileName)
        success, result = QtGui.qApp.call(self, shutil.move,
                                          (zipFilePath, dst))

        if success:
            QtGui.qApp.preferences.appPrefs[
                'ExportR23FLCExportDir'] = toVariant(self.edtDir.text())
        return success
Exemple #11
0
    def onBrowseFileClicked(self):
        if self._isFLC:
            fileName = forceStringEx(QtGui.QFileDialog.getOpenFileName(self,
                                                                       u'Укажите файл для импорта',
                                                                       self.edtFileName.text(),
                                                                       u'Файлы (HS*.zip HT*.zip DP*.zip DV*.zip DO*.zip '
                                                                       u'DS*.zip DU*.zip DF*.zip DD*.zip DR*.zip '
                                                                       u'TS*.zip TT*.zip '
                                                                       u'PHS*.zip PHT*.zip PDP*.zip PDV*.zip '
                                                                       u'PDO*.zip PDS*.zip PDU*.zip PDF*.zip PDD*.zip '
                                                                       u'PDR*.zip PHM*.zip PTS*.zip PTT*.zip'
                                                                       u'VHS*.zip VHT*.zip VDP*.zip VDV*.zip '
                                                                       u'VDO*.zip VDS*.zip VDU*.zip VDF*.zip VDD*.zip '
                                                                       u'VDR*.zip VHM*.zip VTS*.zip VTT*.zip'
                                                                       u'VHS*.xml VHT*.xml VDP*.xml VDV*.xml '
                                                                       u'VDO*.xml VDS*.xml VDU*.xml VDF*.xml VDD*.xml '
                                                                       u'VDR*.xml VHM*.xml VTS*.xml VTT*.xml )'))
        else:
            fileName = forceStringEx(QtGui.QFileDialog.getOpenFileName(self,
                                                                       u'Укажите файл для импорта',
                                                                       self.edtFileName.text(),
                                                                       u'Файлы (HS*.zip HT*.zip DP*.zip DV*.zip DO*.zip '
                                                                       u'DS*.zip DU*.zip DF*.zip DD*.zip DR*.zip '
                                                                       u'TS*.zip TT*.zip '))

        if os.path.isfile(fileName):
            self.edtFileName.setText(fileName)
Exemple #12
0
    def getRecord(self):
        db = QtGui.qApp.db
        record = CItemEditorBaseDialog.getRecord(self)
        getLineEditValue(self.edtCode, record, 'DiagID')
        record.setValue(
            'Prim', QtCore.QVariant('*' if self.chkPrim.isChecked() else ''))
        getTextEditValue(self.edtName, record, 'DiagName')
        if self.cmbMKBSubclass.isEnabled():
            getRBComboBoxValue(self.cmbMKBSubclass, record, 'MKBSubclass_id')
        else:
            record.setValue('MKBSubclass_id', QtCore.QVariant())
        getComboBoxValue(self.cmbCharacters, record, 'characters')
        getComboBoxValue(self.cmbSex, record, 'sex')
        record.setValue(
            'age',
            toVariant(
                composeAgeSelector(self.cmbBegAgeUnit.currentIndex(),
                                   forceStringEx(self.edtBegAgeCount.text()),
                                   self.cmbEndAgeUnit.currentIndex(),
                                   forceStringEx(self.edtEndAgeCount.text()))))
        getSpinBoxValue(self.edtDuration, record, 'duration')
        self.modelServiceSpecialty.saveItems(self.itemId())
        record.setValue('begDate', toVariant(self.edtBegDate.date()))
        record.setValue('endDate', toVariant(self.edtEndDate.date()))
        record.setValue('OMS', toVariant(self.chkOMS.isChecked()))
        record.setValue('MTR', toVariant(self.chkMTR.isChecked()))
        record.setValue('parent_code', toVariant(self.parentCode))

        clearCache()
        return record
Exemple #13
0
def main():
    import sys
    from library.database import connectDataBaseByInfo
    app = CS11mainApp(sys.argv, False, 'S11App.ini', False)
    QtGui.qApp = app
    QtCore.QTextCodec.setCodecForTr(QtCore.QTextCodec.codecForName(u'utf8'))

    connectionInfo = {
        'driverName': 'mysql',
        'host': 'pes',
        'port': 3306,
        'database': 's12',
        'user': '******',
        'password': '******',
        'connectionName': 'vista-med',
        'compressData': True,
        'afterConnectFunc': None
    }
    db = connectDataBaseByInfo(connectionInfo)
    query = db.query(u'''
    SELECT o.organisation_id
    FROM OrgStructure o
    INNER JOIN Person p ON p.orgStructure_id = o.id
    ''')
    if query.first():
        record = query.record()
        print forceStringEx(record.value('organisation_id').toString()), type(
            int(forceStringEx(record.value('organisation_id').toString())))

        QtGui.qApp.currentOrgId = lambda: int(
            forceStringEx(record.value('organisation_id').toString()))
    print '229638_4'

    QtGui.qApp.db = connectDataBaseByInfo(connectionInfo)
    sys.exit(CRCReportList(None).exec_())
Exemple #14
0
 def checkDataEntered(self):
     result = True
     code = forceStringEx(self.edtCode.text())
     name = forceStringEx(self.edtName.text())
     result = result and (code or self.checkInputMessage(u'код', False, self.edtCode))
     result = result and (name or self.checkInputMessage(u'наименование', False, self.edtName))
     return result
Exemple #15
0
 def save(self, outDir, zipName):
     outDir = forceStringEx(outDir)
     try:
         zipFilePath = forceStringEx(
             unicode(os.path.join(outDir, u'%s.zip' % zipName)))
         zf = zipfile.ZipFile(zipFilePath,
                              'w',
                              zipfile.ZIP_DEFLATED,
                              allowZip64=True)
         for reportName in self.documents.keys():
             doc = self.documents[reportName]
             fileName = u''.join([reportName])
             xmlFileName = QtCore.QTemporaryFile(u'%s.xml' % fileName)
             if not xmlFileName.open(QtCore.QFile.WriteOnly):
                 print u'Не удалось открыть временный файл для записи'
                 break
             doc.save(QtCore.QTextStream(xmlFileName), 4,
                      QtXml.QDomNode.EncodingFromDocument)
             xmlFileName.close()
             zf.write(
                 forceStringEx(
                     QtCore.QFileInfo(xmlFileName).absoluteFilePath()),
                 u'%s.xml' % fileName)
             self.documents.pop(reportName)
         zf.close()
     except Exception, e:
         pass
Exemple #16
0
 def save(self):
     fileDir = forceStringEx(
         QtGui.QFileDialog.getExistingDirectory(
             self._parent,
             u'Укажите директорию для сохранения файлов выгрузки',
             forceStringEx(
                 getVal(QtGui.qApp.preferences.appPrefs,
                        'ExportReportConstructor', ''))))
     if not fileDir:
         return
     nameParts = []
     if len(self.idList) == 1:
         nameParts.append(
             forceString(
                 QtGui.qApp.db.translate('rcReport', 'id', self.idList[0],
                                         'name')))
     else:
         nameParts.append(u'ReportExchange')
     nameParts.append(
         forceString(QtCore.QDateTime.currentDateTime().toString(
             'yyyy-MM-dd hh-mm')))
     name = u' '.join(nameParts)
     self._enging.save(fileDir, name)
     QtGui.QMessageBox.information(self._parent, u'Файл сохранен',
                                   u'Файл %s.zip сохранён.' % name,
                                   QtGui.QMessageBox.Ok,
                                   QtGui.QMessageBox.Ok)
     QtGui.qApp.preferences.appPrefs['ExportReportConstructor'] = toVariant(
         fileDir)
Exemple #17
0
 def checkDataEntered(self):
     result = True
     serial = forceStringEx(self.edtNumber.text())
     number = forceStringEx(self.edtNumber.text())
     result = result and (serial or self.checkInputMessage(
         u'серию', False, self.edtSerial))
     result = result and (number or self.checkInputMessage(
         u'номер', False, self.edtNumber))
     result = result and (self.edtDate.date() or self.checkInputMessage(
         u'дату выдачи', False, self.edtDate))
     result = result and (self.cmbPerson.value() or self.checkInputMessage(
         u'выдавшего врача', False, self.cmbPerson))
     if self.tempInvalidId:
         db = QtGui.qApp.db
         tableTempInvalid = db.table('TempInvalid')
         tableTempInvalidDuplicate = db.table('TempInvalidDuplicate')
         record = db.getRecordEx(
             tableTempInvalid, [tableTempInvalid['doctype_id']], [
                 tableTempInvalid['id'].eq(self.tempInvalidId),
                 tableTempInvalid['deleted'].eq(0)
             ])
         if not record:
             return
         docTypeId = forceRef(record.value('doctype_id'))
         result = result and self.checkTempInvalidDuplicateSerialNumber(
             docTypeId)
         result = result and self.checkTempInvalidSerialNumber(docTypeId)
     result = result and self.checkBlankSerialNumberAmount()
     return result
Exemple #18
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue('finance_id', toVariant(self.cmbFinance.value()))
     record.setValue(rbCode, toVariant(forceStringEx(self.edtCode.text())))
     record.setValue(rbName, toVariant(forceStringEx(self.edtName.text())))
     record.setValue('rerun', toVariant(self.chkCanRerun.isChecked()))
     return record
Exemple #19
0
    def applySearch(self):
        self._code = forceStringEx(self.edtCode.text())
        self._name = forceStringEx(self.edtName.text())
        self._tradeName = forceStringEx(self.edtTradeName.text())
        self._mnn = forceStringEx(self.edtMnn.text())

        db = QtGui.qApp.db
        cond = []
        tableFormulary = db.table('vrbDrugFormulary_Item')
        table = tableFormulary

        if self._code:
            cond.append(tableFormulary['code'].like(self._code))
        if self._name:
            cond.append(tableFormulary['name'].like('%' + self._name + '%'))
        if self._tradeName:
            cond.append(
                tableFormulary['tradeName'].like('%' + self._tradeName + '%'))
        if self._mnn:
            cond.append(tableFormulary['mnn'].like('%' + self._mnn + '%'))
        if self._filter and len(self._filter) > 0:
            cond.append(self._filter)
        tableTarget = tableFormulary
        idList = db.getIdList(
            table, tableTarget['id'].name(), cond,
            [tableTarget['name'].name(), tableTarget['code'].name()])
        self.tblFormulary.setIdList(idList)
Exemple #20
0
 def getRecord(self, indexClient):
     record = self.db.record('Client')
     clientLastName = forceStringEx(self.data[u'Фамилия'][indexClient])
     clientFirstName = forceStringEx(self.data[u'Имя'][indexClient])
     clientPatrName = forceStringEx(self.data[u'Отчество'][indexClient])
     clientSex = databaseFormatSex(self.data[u'Пол'][indexClient])
     clientBirthDate = self.data[u'Дата рождения'][indexClient]
     clientOrgStructure = self.data[u'Подразделение'][
         indexClient] if self.data.has_key(u'Подразделение') else ''
     clientFactors = self.data[
         u'Вредные  и  опасные производственные факторы'][
             indexClient] if self.data.has_key(
                 u'Вредные  и  опасные производственные факторы') else ''
     clientInspection = self.data[u'Дата послед. Мед. осмотра'][
         indexClient] if self.data.has_key(
             u'Дата послед. Мед. осмотра'
         ) and self.data[u'Дата послед. Мед. осмотра'][indexClient] else ''
     clientInspection = forceString(clientInspection) if type(
         clientInspection) else forceString(
             forceDate(clientInspection).toString('dd.MM.yyyy'))
     if not clientLastName or not clientFirstName or not clientPatrName or not clientBirthDate:
         self.error['Clients'].append([
             clientLastName, clientFirstName, clientPatrName,
             self.data[u'Пол'][indexClient], clientBirthDate
         ])
         return
     if isinstance(clientBirthDate, (str, unicode)):
         clientBirthDate = QtCore.QDate().fromString(
             clientBirthDate.strip(), 'dd.MM.yyyy')
     clientId = self.db.getRecordEx('Client', ['id'], [
         'concat_ws(lastName, firstName, patrName, sex, birthDate) = concat_ws(%s)'
         % ','.join([
             '\'%s\'' % clientLastName,
             '\'%s\'' % clientFirstName,
             '\'%s\'' % clientPatrName,
             '%s' % (clientSex if clientSex else 'NULL'),
             'date(\'%s\')' % clientBirthDate.toString(QtCore.Qt.ISODate)
         ])
     ])
     record.setValue('id',
                     toVariant(clientId.value('id') if clientId else None))
     record.setValue('lastName', toVariant(clientLastName))
     record.setValue('firstName', toVariant(clientFirstName))
     record.setValue('patrName', toVariant(clientPatrName))
     record.setValue('birthDate', toVariant(clientBirthDate))
     record.setValue('sex', toVariant(clientSex))
     record.setValue(
         'notes',
         toVariant(
             forceStringEx(';'.join([
                 ':'.join([u'Подразделение', clientOrgStructure])
                 if clientOrgStructure else "", ':'.join([
                     u'Вредные  и  опасные производственные факторы',
                     clientFactors
                 ]) if clientFactors else "",
                 ':'.join([u'Дата послед. мед. осмотра', clientInspection])
                 if clientInspection else ""
             ]))))
     return record
Exemple #21
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue('code', toVariant(forceStringEx(self.edtCode.text())))
     record.setValue('name', toVariant(forceStringEx(self.edtName.text())))
     record.setValue('mask', toVariant(forceStringEx(self.edtMask.text())))
     record.setValue('maskEnabled',
                     toVariant(forceBool(self.chkMaskEnabled.isChecked())))
     return record
Exemple #22
0
 def saveData(self):
     self.preferences.address = forceStringEx(self.edtAddress.text())
     self.preferences.postBoxName = forceStringEx(
         self.edtPostBoxName.text())
     self.preferences.compress = self.chkCompress.isChecked()
     self.preferences.sendByDefault = self.chkSendByDefault.isChecked()
     self.preferences.store()
     return True
Exemple #23
0
 def setParams(self, params):
     if isinstance(params, dict):
         reqFileName = forceStringEx(getPref(params, 'reqFile', u''))
         if os.path.isfile(reqFileName ):
             self.edtReqFileName.setText(reqFileName )
         respFileName = forceStringEx(getPref(params, 'respFile', u''))
         if os.path.isfile(respFileName):
             self.edtRespFileName.setText(respFileName)
Exemple #24
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue(rbCode, toVariant(forceStringEx(self.edtCode.text())))
     record.setValue(rbName, toVariant(forceStringEx(self.edtName.text())))
     record.setValue('diet_id', toVariant(self.cmbDiet.value()))
     record.setValue('courtingDiet_id',
                     toVariant(self.cmbCourtingDiet.value()))
     return record
Exemple #25
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue(
         'MKB', QtCore.QVariant(forceStringEx(self.edtMKB.text()))
     )  # getLineEditValue не годится, т.к. edtMKB.text() возвращает unicode а не QString
     record.setValue('MKBEx',
                     QtCore.QVariant(forceStringEx(self.edtMKBEx.text())))
     record.setValue('character_id', toVariant(self.characterId))
     return record
Exemple #26
0
    def applySearch(self):
        self._classId = self.cmbClass.value()
        self._kindId = self.cmbKind.value()
        self._typeId = self.cmbType.value()
        self._code = forceStringEx(self.edtCode.text())
        self._name = forceStringEx(self.edtName.text())
        self._producer = forceStringEx(self.edtProducer.text())
        self._ATC = forceStringEx(self.edtATC.text())
        self._includeAnalogies = self.chkIncludeAnalogies.isChecked()

        db = QtGui.qApp.db
        cond = []
        tableNomenclature = db.table('rbNomenclature')
        table = tableNomenclature

        if self._typeId:
            cond.append(tableNomenclature['type_id'].eq(self._typeId))
        elif self._kindId or self._classId:
            tableType = db.table('rbNomenclatureType')
            table = table.leftJoin(
                tableType, tableType['id'].eq(tableNomenclature['type_id']))
            if self._kindId:
                cond.append(tableType['kind_id'].eq(self._kindId))
            else:
                tableKind = db.table('rbNomenclatureKind')
                table = table.leftJoin(
                    tableKind, tableKind['id'].eq(tableType['kind_id']))
                cond.append(tableKind['class_id'].eq(self._classId))
        if self._code:
            cond.append(tableNomenclature['code'].like(self._code))
        if self._name:
            cond.append(tableNomenclature['name'].like(self._name))
        if self._producer:
            cond.append(tableNomenclature['producer'].like(self._producer))
        if self._ATC:
            cond.append(tableNomenclature['ATC'].like(self._ATC))
        if self._includeAnalogies and cond:
            tableTarget = db.table('rbNomenclature').alias('A')
            table = table.leftJoin(
                tableTarget,
                db.joinOr([
                    db.joinAnd([
                        tableTarget['analog_id'].isNotNull(),
                        tableTarget['analog_id'].eq(
                            tableNomenclature['analog_id'])
                    ]),
                    db.joinAnd([
                        tableTarget['analog_id'].isNull(),
                        tableTarget['id'].eq(tableNomenclature['id'])
                    ])
                ]))
        else:
            tableTarget = tableNomenclature
        idList = db.getIdList(
            table, tableTarget['id'].name(), cond,
            [tableTarget['name'].name(), tableTarget['code'].name()])
        self.tblNomenclature.setIdList(idList)
Exemple #27
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue(rbCode, toVariant(forceStringEx(self.edtCode.text())))
     record.setValue(rbName, toVariant(forceStringEx(self.edtName.text())))
     begTime, endTime = self.edtRangeTime.timeRange(
     ) if self.edtRangeTime else (None, None)
     record.setValue('begTime', toVariant(forceTime(begTime)))
     record.setValue('endTime', toVariant(forceTime(endTime)))
     return record
Exemple #28
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue(rbCode, toVariant(forceStringEx(self.edtCode.text())))
     record.setValue(rbName, toVariant(forceStringEx(self.edtName.text())))
     record.setValue(rbCodeRegional,
                     toVariant(forceStringEx(self.edtCodeRegional.text())))
     record.setValue(rbTypeCause,
                     toVariant(forceInt(self.cmbType.currentIndex())))
     return record
Exemple #29
0
 def getRecord(self):
     record = CItemEditorBaseDialog.getRecord(self)
     record.setValue(rbCode, toVariant(forceStringEx(self.edtCode.text())))
     record.setValue(rbName, toVariant(forceStringEx(self.edtName.text())))
     record.setValue('allow_meals',
                     toVariant(self.chkAllowMeals.isChecked()))
     record.setValue('noCourtingAtReanimation',
                     toVariant(self.chkNoCourting.isChecked()))
     return record
Exemple #30
0
 def onNextActionClicked(self):
     if self.currentState == self.InitState:
         self.currentState = self.ImportState
         try:
             self._engine.process(forceStringEx(self.edtReqFileName.text()),
             forceStringEx(self.edtRespFileName.text()))
         except Exception, e:
             self.currentState = self.InitState
             raise
         self.currentState = self.InitState