Ejemplo n.º 1
0
    def setData(self, index, value, role=QtCore.Qt.EditRole):
        column = index.column()
        row = index.row()
        if not variantEq(self.data(index, role), value):
            if column == 1:
                QtCore.QObject.parent(self).checkReturnBlank(
                    row, column,
                    QtCore.QObject.parent(self).tblBlankActionsMoving, self)
                result = CInDocTableModel.setData(self, index, value, role)
                QtCore.QObject.parent(self).checkDoubleNumber(
                    forceInt(value), row, column,
                    QtCore.QObject.parent(self).tblBlankActionsMoving, self)
                return CInDocTableModel.setData(self, index, value, role)

            elif column == 2:
                QtCore.QObject.parent(self).checkReturnBlank(
                    row, column,
                    QtCore.QObject.parent(self).tblBlankActionsMoving, self)
                result = CInDocTableModel.setData(self, index, value, role)
                QtCore.QObject.parent(self).checkDoubleNumber(
                    forceInt(value), row, column,
                    QtCore.QObject.parent(self).tblBlankActionsMoving, self)
                return CInDocTableModel.setData(self, index, value, role)

            elif column == 3:
                self._cols[4].orgStructureId = forceRef(value)
                return CInDocTableModel.setData(self, index, value, role)

            elif column == 5:
                QtCore.QObject.parent(self).checkReturnBlank(
                    row, column,
                    QtCore.QObject.parent(self).tblBlankActionsMoving, self)
                result = CInDocTableModel.setData(self, index, value, role)
                result = CInDocTableModel.setData(self, index, value, role)
                if result:
                    QtCore.QObject.parent(self).updateActionsBlankParty()
                return result

            elif column == 6:
                QtCore.QObject.parent(self).checkReturnBlank(
                    row, column,
                    QtCore.QObject.parent(self).tblBlankActionsMoving, self)
                result = CInDocTableModel.setData(self, index, value, role)
                result = CInDocTableModel.setData(self, index, value, role)
                if result:
                    QtCore.QObject.parent(self).updateActionsBlankParty()
                return result

            elif column == 8:
                QtCore.QObject.parent(self).checkReturnBlank(
                    row, column,
                    QtCore.QObject.parent(self).tblBlankActionsMoving, self)
                result = CInDocTableModel.setData(self, index, value, role)
                if result:
                    QtCore.QObject.parent(self).updateActionsBlankParty()
                return result

            return CInDocTableModel.setData(self, index, value, role)

        return True
Ejemplo n.º 2
0
 def setData(self, index, value, role=QtCore.Qt.EditRole):
     column = index.column()
     row = index.row()
     self.updateRetiredList()
     if not variantEq(self.data(index, role), value):
         personColIndex = self.getColIndex('person_id')
         sceneColIndex = self.getColIndex('scene_id')
         visitTypeColIndex = self.getColIndex('visitType_id')
         if column == personColIndex:  # врач
             eventEditor = QtCore.QObject.parent(self)
             personId = forceRef(value)
             if not eventEditor.checkClientAttendaceEE(personId):
                 return False
         if column in [personColIndex, sceneColIndex,
                       visitTypeColIndex]:  # врач, место или тип
             result = CInDocTableModel.setData(self, index, value, role)
             if result:
                 item = self.items()[row]
                 item.setValue('service_id',
                               toVariant(self.getExactServiceId(item)))
                 self.emitCellChanged(
                     row, self.getColIndex('service_id'))  # услуга
             return result
         else:
             return CInDocTableModel.setData(self, index, value, role)
     else:
         return True
Ejemplo n.º 3
0
 def setData(self, index, value, role=QtCore.Qt.EditRole):
     column = index.column()
     row = index.row()
     if not variantEq(self.data(index, role), value):
         if column == 2:  # специальность
             specialityId = forceRef(value)
             if not specialityId:
                 self.cols()[3].setFilter(u'')
             else:
                 self.cols()[3].setFilter(u'speciality_id = %s' %
                                          (specialityId))
             result = CInDocTableModel.setData(self, index, value, role)
             return result
         if column == 3:  # сотрудник
             personId = forceRef(value)
             if not personId:
                 self.cols()[2].setFilter(u'')
             else:
                 self.cols()[2].setFilter(
                     u'id IN (SELECT DISTINCT speciality_id FROM vrbPersonWithSpeciality WHERE id = %s)'
                     % (personId))
             result = CInDocTableModel.setData(self, index, value, role)
             return result
         return CInDocTableModel.setData(self, index, value, role)
     else:
         return True
Ejemplo n.º 4
0
    def setData(self, index, value, role=QtCore.Qt.EditRole):
        column = index.column()
        row = index.row()
        if not variantEq(self.data(index, role), value):
            if column == 0:  # код МКБ
                newMKB = forceString(value)
                if not newMKB:
                    specifiedMKB = ''
                    specifiedCharacterId = None
                    specifiedTraumaTypeId = None
                else:
                    acceptable, specifiedMKB, specifiedMKBEx, specifiedCharacterId, specifiedTraumaTypeId = QtCore.QObject.parent(
                        self).specifyDiagnosis(newMKB)
                    if not acceptable:
                        return False
                value = toVariant(specifiedMKB)
                result = CInDocTableModel.setData(self, index, value, role)
                #self.emitResultChanged(item.value('result_id'))
                self.emitResultChanged(self.items()[row].value('result_id'))
                if result:
                    self.updateCharacterByMKB(row, specifiedMKB,
                                              specifiedCharacterId)
                    self.updateTraumaType(row, specifiedMKB,
                                          specifiedTraumaTypeId)
                return result
            if column == 1:  # доп. код МКБ
                newMKB = forceString(value)
                if not newMKB:
                    pass
                else:
                    acceptable = QtCore.QObject.parent(self).checkDiagnosis(
                        newMKB, True)
                    if not acceptable:
                        return False
                value = toVariant(newMKB)
                result = CInDocTableModel.setData(self, index, value, role)
                return result

            return CInDocTableModel.setData(self, index, value, role)
        else:
            return True