Ejemplo n.º 1
0
 def setParams(self, params):
     currentDate = QtCore.QDate.currentDate()
     self.edtBegDate.setDate(
         params.get(
             'begDate',
             QtCore.QDate(currentDate.year(), currentDate.month(), 1)))
     self.edtEndDate.setDate(
         params.get(
             'endDate',
             QtCore.QDate(currentDate.year(), currentDate.month(),
                          currentDate.daysInMonth())))
     self.cmbEventType.setValue(params.get('eventTypeId', None))
     self.cmbOrgStructure.setValue(params.get("orgStructureId", None))
     self.cmbPerson.setValue(params.get("personId", None))
     self.cmbSpeciality.setValue(params.get('speciality', None))
Ejemplo n.º 2
0
def selectData(params):
    begDate = params.get('begDate', QtCore.QDate())
    endDate = params.get('endDate', QtCore.QDate())
    personId = params.get('personId', None)
    orgStructureId = params.get('orgStructureId', None)

    stmt = '''
SELECT
    Client.id AS clientId,
    CONCAT_WS(" ", Client.lastName, Client.firstName, Client.patrName) AS fio,
    ActionType.name AS usl,
    rbRefusalReasons.name AS reason
FROM
    Event
    INNER JOIN Client ON Event.client_id = Client.id
    INNER JOIN Action ON Action.event_id = Event.id AND Action.status = 3
    INNER JOIN ActionType ON Action.actionType_id = ActionType.id
    INNER JOIN ActionProperty ON ActionProperty.action_id = Action.id
    INNER JOIN ActionPropertyType ON ActionProperty.type_id = ActionPropertyType.id AND ActionPropertyType.penalty = 666
    INNER JOIN ActionProperty_Reference ON ActionProperty_Reference.id = ActionProperty.id
    INNER JOIN rbRefusalReasons ON rbRefusalReasons.id = ActionProperty_Reference.value
    INNER JOIN Person ON Person.id = Action.setPerson_id
    INNER JOIN OrgStructure ON Person.orgStructure_id = OrgStructure.id
WHERE
    Action.deleted = 0
    AND Person.deleted = 0
    AND Event.deleted = 0
    AND Client.deleted = 0
    AND %s
ORDER BY
    clientId
'''

    db = QtGui.qApp.db
    tablePerson = db.table('Person')
    tblAction = db.table('Action')

    cond = []
    cond.append(tblAction['createDatetime'].dateBetween(begDate, endDate))
    if orgStructureId:
        cond.append(tablePerson['orgStructure_id'].inlist(
            getOrgStructureDescendants(orgStructureId)))
    # else:
    #     cond.append(tablePerson['org_id'].eq(QtGui.qApp.currentOrgId()))
    if personId:
        cond.append(tablePerson['id'].eq(personId))

    return db.query(stmt % (db.joinAnd(cond)))
Ejemplo n.º 3
0
def selectData_PacientDays(params, org_id, bedProfile, o_type, MKB_query):
    stmt = u'''
    SELECT SUM(Event.id), Event.setDate AS e_set, c.id AS c_idd, Event.execDate AS e_exec, et.id AS et_id
        FROM Event
          INNER JOIN EventType et ON Event.eventType_id = et.id
          INNER JOIN Action ON Event.id = Action.event_id
          INNER JOIN ActionType ON Action.actionType_id = ActionType.id
          INNER JOIN ActionPropertyType AS BED_APT ON ActionType.id = BED_APT.actionType_id AND BED_APT.name = 'койка'
          INNER JOIN ActionProperty AS BED_AP ON BED_APT.id = BED_AP.type_id AND BED_AP.action_id = Action.id
          INNER JOIN ActionProperty_HospitalBed AS BED ON BED_AP.id = BED.id
          INNER JOIN OrgStructure_HospitalBed oh ON BED.value = oh.id

          INNER JOIN ActionPropertyType AS OS_APT ON ActionType.id = OS_APT.actionType_id AND OS_APT.name = 'отделение пребывания'
          INNER JOIN ActionProperty AS OS_AP ON OS_APT.id = OS_AP.type_id AND Action.id = OS_AP.action_id
          INNER JOIN ActionProperty_OrgStructure AS OS ON OS_AP.id = OS.id
          INNER JOIN OrgStructure ON OS.value = OrgStructure.id
          INNER JOIN Client c ON Event.client_id = c.id

          INNER JOIN Diagnostic d1 ON Event.id = d1.event_id
          INNER JOIN Diagnosis d ON d1.diagnosis_id = d.id
          INNER JOIN rbDiagnosisType r ON d1.diagnosisType_id = r.id

        WHERE ActionType.name = 'Движение'
          AND OrgStructure.id = %s
          AND %s
          AND OrgStructure.type = %s
          AND OrgStructure.hasHospitalBeds=1
          AND DATE(Event.execDate) >= DATE('%s')
          AND DATE(Event.execDate) <= DATE('%s')
          AND LTRIM(oh.age) LIKE '0г%%' # 0г-17г
          AND Event.deleted = 0
          AND d.deleted=0
          AND Action.deleted = 0
          AND %s
          AND (r.code=01 OR r.code=02)
          GROUP BY Event.id;
        '''

    # AND o.type=%s
    # AND LTRIM(oh.age) LIKE '0%%' # 18г-150г

    db = QtGui.qApp.db
    begDate = params.get('begDate', QtCore.QDate())
    endDate = params.get('endDate', QtCore.QDate())

    return db.query(
        stmt % (org_id, bedProfile, o_type, begDate.toString('yyyy-MM-dd'),
                endDate.toString('yyyy-MM-dd'), MKB_query))
Ejemplo n.º 4
0
def selectData(params):
    stmt = u'''
    SELECT A.cl_id AS cl_id,
    e.id AS eID,
    DATE(e.setDate) AS setDate,
    DATE(e.execDate) AS execDate,
    CONCAT_WS(' - ', DATE(e.setDate), DATE(e.execDate)) AS hospitalization,
    A.FIO_cl AS FIO_cl,
    A.birthdate AS birthdate,
    A.d_MKB AS MKB,
    a1.descr AS descr,
    CONCAT_WS(' ', p.lastName, p.firstName, p.patrName) AS FIO_p
    FROM (
    SELECT diag_MKB.cl_id, diag_MKB.d_MKB, diag_MKB.FIO_cl, diag_MKB.birthdate
      FROM
      (
        SELECT c.id AS cl_id, d.MKB AS d_MKB, CONCAT_WS(' ', c.lastName, c.firstName, c.patrName) AS FIO_cl, c.birthDate AS birthdate
          FROM Client c
          INNER JOIN Event e ON e.client_id = c.id
          INNER JOIN Diagnostic d1 ON d1.event_id = e.id
          INNER JOIN Diagnosis d ON d1.diagnosis_id = d.id
          GROUP BY d.MKB
          HAVING COUNT(*) > 1
          ORDER BY c.id
      ) diag_MKB

      INNER JOIN Event e ON diag_MKB.cl_id = e.client_id
      WHERE e.execDate IS NOT NULL
      GROUP BY e.client_id
      HAVING COUNT(*) > 1
      ) A

      INNER JOIN Event e ON e.client_id = A.cl_id
      INNER JOIN Action act ON e.id = act.event_id
      INNER JOIN ActionType act_type ON act.actionType_id = act_type.id
      INNER JOIN ActionPropertyType a1 ON a1.actionType_id = act_type.id
      INNER JOIN Person p ON p.id = act.person_id
      WHERE act_type.flatCode = 'leaved' AND a1.name='Отделение'
      AND e.execDate IS NOT NULL
      AND DATE(e.setDate) >= DATE('%s')  AND DATE(e.setDate) <= DATE('%s')
      ORDER BY e.client_id, e.setDate;
    '''

    db = QtGui.qApp.db
    begDate = params.get('begDate', QtCore.QDate())
    endDate = params.get('endDate', QtCore.QDate())

    return db.query(stmt % (begDate.toString('yyyy-MM-dd'), endDate.toString('yyyy-MM-dd')))
Ejemplo n.º 5
0
    def update(self):
        if not self.comboBoxDatasets.currentText() == '':
            self.btnDownload.setEnabled(True)
        else:
            self.btnDownload.setEnabled(False)

        self.plainTextEdit.clear()
        data_type = self.data_desc[self.comboBoxDatasets.currentText()]
        self.plainTextEdit.appendPlainText(
            'For full details of source datasets, refer to http://oceancolor.gsfc.nasa.gov/\n'
        )
        self.plainTextEdit.appendPlainText(data_type)

        self.comboBoxRes.clear()

        mindate_sc = QtCore.QDate()
        mindate_sc.setDate(1997, 9, 4)
        maxdate_sc = QtCore.QDate()
        maxdate_sc.setDate(2010, 12, 11)

        mindate_mc = QtCore.QDate()
        mindate_mc.setDate(2002, 7, 4)
        maxdate_mc = QtCore.QDate()
        maxdate_mc = maxdate_mc.currentDate()

        if self.comboBoxDatasets.currentText(
        ) == 'SeaWiFS Chlorophyll Concentration':
            self.comboBoxRes.insertItem(0, '9km')
            self.startDate.setDate(mindate_sc)
            self.startDate.setDateRange(mindate_sc, maxdate_sc)
            self.endDate.setDate(maxdate_sc)
            self.endDate.setDateRange(mindate_sc, maxdate_sc)

        if self.comboBoxDatasets.currentText(
        ) == 'AQUA MODIS Chlorophyll Concentration':
            self.comboBoxRes.insertItems(0, ['9km', '4km'])
            self.startDate.setDate(mindate_mc)
            self.startDate.setDateRange(mindate_mc, maxdate_mc)
            self.endDate.setDate(maxdate_mc)
            self.endDate.setDateRange(mindate_mc, maxdate_mc)

        if self.comboBoxDatasets.currentText(
        ) == 'AQUA MODIS Sea Surface Temperature':
            self.comboBoxRes.insertItems(0, ['9km', '4km'])
            self.startDate.setDate(mindate_mc)
            self.startDate.setDateRange(mindate_mc, maxdate_mc)
            self.endDate.setDate(maxdate_mc)
            self.endDate.setDateRange(mindate_mc, maxdate_mc)
Ejemplo n.º 6
0
 def __init__(self, parent):
     QtGui.QDialog.__init__(self, parent)
     self.setupUi(self)
     CCheck.__init__(self)
     currentDate = QtCore.QDate.currentDate()
     self.dateEdit_1.setDate(QtCore.QDate(currentDate.year(), 1, 1))
     self.dateEdit_2.setDate(currentDate)
Ejemplo n.º 7
0
 def initialise(self):
     self.FirstCheckBox.setCheckState(
         int(self.parent.config.get_config(u'first service', QtCore.Qt.Checked)))
     self.SecondCheckBox.setCheckState(
         int(self.parent.config.get_config(u'second service', QtCore.Qt.Checked)))
     self.ThirdCheckBox.setCheckState(
         int(self.parent.config.get_config(u'third service', QtCore.Qt.Checked)))
     year = QtCore.QDate().currentDate().year()
     if QtCore.QDate().currentDate().month() < 9:
         year -= 1
     toDate = QtCore.QDate(year, 8, 31)
     fromDate = QtCore.QDate(year - 1, 9, 1)
     self.FromDateEdit.setDate(fromDate)
     self.ToDateEdit.setDate(toDate)
     self.FileLineEdit.setText(self.parent.config.get_last_dir(1))
     self.resetWindow()
 def getTimeDate(self):
     tday = datetime.date.today()
     now = datetime.datetime.now()
     self.timeEdit_SetLocalTime.setTime(
         QtCore.QTime(now.hour, now.minute, now.second))
     self.dateEdit_SetLocalDate.setDate(
         QtCore.QDate(tday.year, tday.month, tday.day))
Ejemplo n.º 9
0
 def makeLogEntry(self, entry):
     file = open(self.pathDict["log"], 'a')
     file.write(
         "\n[ {0} :: {1} ]".format(QtCore.QDate().currentDate().toString(),
                                   QtCore.QTime().currentTime().toString()))
     file.write('\n' + entry)
     file.close()
Ejemplo n.º 10
0
    def onActionDataChanged(self, name, value, row=None):
        model = self.tblAPActions.model()
        items = model.items()
        if row is None:
            row = self.tblAPActions.currentIndex().row()
        if 0 <= row < len(items):
            record, action = items[row]
            record.setValue(name, toVariant(value))
            actionTypeId = forceRef(
                record.value('actionType_id')) if record else None
            actionType = CActionTypeCache.getById(
                actionTypeId) if actionTypeId else None

            self.gBoxSupportService.setVisible(False)
            self.btnNextAction.setText(u'Действие')
            self.btnNextAction.setEnabled(False)
            self.btnPlanNextAction.setEnabled(False)

            if actionType.defaultPlannedEndDate == CActionType.dpedBegDatePlusAmount and name in [
                    'amount', 'begDate'
            ]:
                begDate = self.edtAPBegDate.date()
                amountValue = int(self.edtAPAmount.value())
                date = begDate.addDays(amountValue - 1) if (
                    amountValue and begDate.isValid()) else QtCore.QDate()
                self.setEndDate(date, row)
                self.edtAPPlannedEndDate.setDate(date)
    def indicate_redraw(self):
        """
        @brief  デジタル時計を描画.
        """
        #日付を設定.
        theDate = QtCore.QDate(self.m_TinyClockView.year,
                               self.m_TinyClockView.month,
                               self.m_TinyClockView.day)
        self.m_DateTimeEdit.setDate(theDate)

        #時間を設定.
        theTime = QtCore.QTime(self.m_TinyClockView.hour,
                               self.m_TinyClockView.min,
                               self.m_TinyClockView.sec)
        self.m_DateTimeEdit.setTime(theTime)

        #選択を解除.
        self.m_DateTimeEdit.setCurrentSectionIndex(
            self.m_DateTimeEdit.NoSection)

        if (self.__DEBUG):
            print("DigitalClock %02d-%02d-%02d %02d:%02d:%02d") % (
                self.m_TinyClockView.year, self.m_TinyClockView.month,
                self.m_TinyClockView.day, self.m_TinyClockView.hour,
                self.m_TinyClockView.min, self.m_TinyClockView.sec)
Ejemplo n.º 12
0
 def __init__(self):
     self._checkType = None
     self._checkNumber = 0
     self._checkSumm = 0.0
     self._closeType = None
     self._closeDatetime = None
     self._operator = None
     self._deviceLogicalNumber = None
     self._deviceSerialNumber = None
     self._isDeviceFiscal = None
     self._substructure = u''
     self._cashFlowArticle = None
     self._operationTypeId = None
     self._operationTypeName = u''
     self._personName = u''
     self._personINN = u''
     self._personDocumentNumber = None
     self._personDocumentSerial = None
     self._personDocumentType = u''
     self._personDocumentIssuedDate = QtCore.QDate()
     self._personDocumentIssued = u''
     self._isPersonNatural = None
     self._session = None
     self._isExpense = False
     self._description = u''
Ejemplo n.º 13
0
    def populateFields(self, ui, pv_id):
        p = self.getPv(pv_id)
        #db = MySQLdb.connect(host="localhost", user="******", passwd="ringil-87",db="parafarmacie")
        #crs=db.cursor()
        #crs.execute("select * from pv where pv_id={0}".format(pv_id))
        #item= crs.fetchone()
        ui.checkBox_cliente.setCheckState(int(self.fixData(
            p.cliente)))  #item[6]
        ui.text_codice_mmas.setText(str(self.fixData(p.cod_mmas)))  #item[3]
        ui.text_ragione_sociale.setText(unicode(p.ragione_sociale))  #item[8]
        ui.text_note.setPlainText(unicode(p.note))
        ui.text_titolare.setText(unicode(p.titolare))  #item[9]
        ui.text_indirizzo.setText(unicode(p.indirizzo))  #item[11]
        ui.text_cap.setText(str(self.fixData(p.cap)))  #item[12]
        ui.text_comune.setText(unicode(self.fixData(p.comune)))  #item[13]
        ui.text_codice_cliente.setText((self.fixData(p.cod_cliente)))
        ui.text_telefono_2.setText(self.fixData(self.fixData(p.tel2)))
        ui.text_codice_fiscale.setText(self.fixData(p.cf_pi))
        ui.setId(pv_id)
        ui.setTcPotId(self.getTcPotId(pv_id))
        ui.text_provincia.setText(str(self.fixData(p.provincia)))  #item[14]
        ui.text_telefono.setText(str(self.fixData(p.tel1)))  #item[15]
        ui.text_mail.setText(str(self.fixData(p.email)))  #item[21]
        ui.text_sito.setText(str(self.fixData(p.sito)))  #item[20]
        ui.text_fax.setText(str(p.fax))
        data = str(p.data_aggiornamento)  #item[23]
        if p.data_aggiornamento is not None:
            qdate = self.transcodeDate(self.fixData(p.data_aggiornamento))
        else:
            qdate = QtCore.QDate()
        ui.date_aggiornamento.setDate(qdate)

        ui.text_potenziale.setText(str(self.getPotenziale(pv_id)))
Ejemplo n.º 14
0
    def onNoEnter(self):
        no = self.lineEditNo.text()
        sql = """
        SELECT * FROM kwitansi WHERE UPPER (no)=UPPER('%s')
        """ % no
        bar, jum = self.eksekusi(sql)
        self.jum = jum
        if jum == 0:
            self.lineEditDari.setEnabled(True)
            self.lineEditDari.setFocus()
        else:
            tanggal = str(bar[0][0])
            dari = str(bar[0][2])
            oleh = str(bar[0][3])
            sebesar = str(bar[0][4])
            pembayaran = str(bar[0][5])

            hari, bulan, tahun = string.split(tanggal, '/')
            some_date = QtCore.QDate(int(tahun), int(bulan),
                                     int(hari))  #Year, Month, Day
            self.dateEdit.setDate(some_date)
            self.dateEdit.setEnabled(False)
            self.lineEditDari.setText(dari)
            self.lineEditOleh.setText(oleh)
            self.lineEditPembayaran.setText(pembayaran)
            self.lineEditSebesar.setText(sebesar)
            self.lineEditNo.setEnabled(False)
            self.actionEdit.setEnabled(True)
            self.actionDelete.setEnabled(True)
            self.btnCetak.setEnabled(True)
            self.btnCetak.setFocus()
Ejemplo n.º 15
0
 def __init__(self, dialog, sno):
     self.dialog = dialog
     self.setupUi(dialog)
     self.dateEdit.setDate(QtCore.QDate().currentDate())
     self.author_comboBox.addItems(localsettings.allowed_logins)
     self.serialno = sno
     self.author_comboBox.setCurrentIndex(-1)
Ejemplo n.º 16
0
    def __init__(self, drvo, od=None, do=None, parent=None):
        super(BASE_KANAL_DIJALOG, self).__init__(parent)
        self.setupUi(self)

        self.drvo = drvo
        self.izabraniKanal = None

        self.treeView.setModel(self.drvo)
        self.treeView.clicked.connect(self.resolve_tree_click)

        if od:
            datum = QtCore.QDate(od.year, od.month, od.day)
            self.kalendarOd.setSelectedDate(datum)
        if do:
            datum = QtCore.QDate(do.year, do.month, do.day)
            self.kalendarDo.setSelectedDate(datum)
Ejemplo n.º 17
0
def getCond(params):
    db = QtGui.qApp.db

    date           = forceDate(params.get('begDate', QtCore.QDate()))
    insurerHeaderId      = forceRef(params.get('insurerId', None))
    eventProfileId = forceRef(params.get('eventProfileId', None))
    financeId      = forceRef(params.get('financeId', None))

    tableEventProfile   = db.table('rbEventProfile')
    tableContract       = db.table('Contract')
    tableAccount        = db.table('Account')
    tableOrganisation   = db.table('Organisation')

    cond = [tableAccount['settleDate'].dateEq(date), tableAccount['deleted'].eq(0)]
    if insurerHeaderId:
        if forceString(db.translate('Organisation', 'id', insurerHeaderId, 'infisCode')) == '9007':
            cond.append('left(organisation.area, 2) != \'23\'')
        else:
            cond.append(db.joinOr([tableOrganisation['head_id'].eq(insurerHeaderId), tableOrganisation['id'].eq(insurerHeaderId)]))
            cond.append('left(organisation.area, 2) = \'23\'')
    if eventProfileId:
        cond.append(tableEventProfile['id'].eq(eventProfileId))
    if financeId:
        cond.append(tableContract['finance_id'].eq(financeId))
    return cond
Ejemplo n.º 18
0
    def updateAmount(self):
        def getActionLength(countRedDays):
            startDate = self.edtBegDate.date()
            stopDate = self.edtEndDate.date()
            if startDate and stopDate:
                return getEventLengthDays(startDate, stopDate, countRedDays, self.eventTypeId)
            else:
                return 0

        def setAmount(amount):
            self.edtAmount.setValue(amount)

        actionType = self.action.getType()
        if actionType.amountEvaluation == CActionType.actionLength:
            setAmount(actionType.amount * getActionLength(True))
        elif actionType.amountEvaluation == CActionType.actionLengthWithoutRedDays:
            setAmount(actionType.amount * getActionLength(False))
        elif actionType.amountEvaluation == CActionType.actionFilledProps:
            setAmount(actionType.amount * self.action.getFilledPropertiesCount())

        if actionType.defaultPlannedEndDate == CActionType.dpedBegDatePlusAmount:
            begDate = self.edtBegDate.date()
            amountValue = int(self.edtAmount.value())
            date = begDate.addDays(amountValue - 1) if (amountValue and begDate.isValid()) else QtCore.QDate()
            self.edtPlannedEndDate.setDate(date)
        elif actionType.defaultPlannedEndDate == CActionType.dpedBegDatePlusDuration:
            begDate = self.edtBegDate.date()
            durationValue = self.edtDuration.value()
            date = begDate.addDays(durationValue) if begDate.isValid() else QtCore.QDate()
            self.edtPlannedEndDate.setDate(date)
Ejemplo n.º 19
0
    def maintenanceDateChanged(self, equipmentId):
        if bool(equipmentId):
            self.mapBackGroundToId[equipmentId] = (None, QtCore.QDate())
            record = self._recordsCache.get(equipmentId)
            valid = self.isValidMaintenancePeriod(record)
            if not valid:
                self.mapBackGroundToId[equipmentId] = (QtCore.QVariant(),
                                                       QtCore.QDate())
            else:
                startupDate = forceDate(record.value('startupDate'))
                date = self.getLastEquipmentMaintenanceDateFromModel(
                    startupDate)
                backGround, endDate = self.makeBackGround(date, record)
                self.mapBackGroundToId[equipmentId] = (backGround, endDate)

            self.emitDataChanged()
Ejemplo n.º 20
0
    def age_tuple(self):
        '''
        return the age in form (year(int), months(int), isToday(bool))
        '''
        dob = self.value('dob').toDate()
        try:
            today = QtCore.QDate.currentDate()
            nextbirthday = QtCore.QDate(today.year(), dob.month(),dob.day())

            age_years = today.year() - dob.year()

            if nextbirthday > today:
                age_years -= 1
                months = (12 - dob.month()) + today.month()
            else:
                months = today.month() - dob.month()
            if dob.day() > today.day():
                months -= 1

            isToday =  nextbirthday == today

            return (age_years, months, isToday)

        except Exception, e:
            print "error calculating patient's age", e
            return (0,0,False)
Ejemplo n.º 21
0
 def setData(self, index, value, role=QtCore.Qt.EditRole):
     if role == QtCore.Qt.EditRole:
         column = index.column()
         row = index.row()
         if row == len(self.items):
             if value.isNull():
                 return False
             execDateList = self.executionPlan.keys()
             if execDateList:
                 execDate = execDateList[0]
                 self.items.append([QtCore.QTime(), QtCore.QDate(execDate), None])
                 vCnt = len(self.items)
                 vIndex = QtCore.QModelIndex()
                 self.beginInsertRows(vIndex, vCnt, vCnt)
                 self.insertRows(vCnt, 1, vIndex)
                 self.endInsertRows()
             else:
                 return False
         if 0 <= row < len(self.items):
             newTime = value.toTime()
             if newTime.isNull():
                 self.items[row][column] = None
                 self.items[row][2] = None
             else:
                 self.items[row][column] = value.toTime()
                 record = self.items[row][2]
                 if not record:
                     db = QtGui.qApp.db
                     table = db.table('Action_ExecutionPlan')
                     record = table.newRecord()
                 record.setValue('execDate', toVariant(QtCore.QDateTime(self.items[row][1], self.items[row][column])))
                 self.items[row][2] = record
         self.emitCellChanged(row, column)
         return True
     return False
Ejemplo n.º 22
0
    def __init__(self):
        #:
        self.patient_id = None

        #:
        self.title = ""

        #:
        self.last_name = ""

        #:
        self.first_name = ""

        #:
        self.preferred_name = ""

        #:
        self.correspondence_name = ""

        #:
        self.sex = "M"

        #:
        self.dob = QtCore.QDate(1900,1,1)

        #:
        self.status = "Active"

        #:
        self.modified_by = ""

        #:
        self.time_stamp = None
Ejemplo n.º 23
0
 def setParams(self, params):
     self.edtBegDate.setDate(params.get('begDate', QtCore.QDate()))
     self.edtEndDate.setDate(
         params.get('endDate', QtCore.QDate.currentDate()))
     self.cmbWorkOrganisation.setValue(params.get('workOrgId', None))
     self.cmbSex.setCurrentIndex(params.get('sex', 0))
     self.edtAgeFrom.setValue(params.get('ageFrom', 0))
     self.edtAgeTo.setValue(params.get('ageTo', 150))
     areaIdEnabled = bool(params.get('areaIdEnabled', False))
     self.chkArea.setChecked(areaIdEnabled)
     self.cmbArea.setEnabled(areaIdEnabled)
     self.cmbArea.setValue(params.get('areaId', None))
     MKBFilter = params.get('MKBFilter', 0)
     self.cmbMKBFilter.setCurrentIndex(MKBFilter if MKBFilter else 0)
     self.edtMKBFrom.setText(params.get('MKBFrom', 'A00'))
     self.edtMKBTo.setText(params.get('MKBTo', 'Z99.9'))
     MKBExFilter = params.get('MKBExFilter', 0)
     self.cmbMKBExFilter.setCurrentIndex(MKBExFilter if MKBExFilter else 0)
     self.edtMKBExFrom.setText(params.get('MKBExFrom', 'A00'))
     self.edtMKBExTo.setText(params.get('MKBExTo', 'Z99.9'))
     self.cmbPerson.setValue(params.get('personId', None))
     self.cmbSpeciality.setValue(params.get('specialityId', None))
     self.cmbSocStatusType.setValue(params.get('socStatusType', None))
     self.cmbSocStatusClass.setValue(params.get('socStatusClass', None))
     self.cmbRowGrouping.setCurrentIndex(getVal(params, 'rowGrouping', 0))
     self.cmbOrgStructureAttachType.setValue(
         params.get('orgStructureAttachTypeId', None))
Ejemplo n.º 24
0
    def demo_queries(self):
        '''
        return a list of queries to populate a demo database
        '''
        year = QtCore.QDate.currentDate().year()
        date_ = QtCore.QDate(year, 1, 1)
        finish_year = year + 3
        while date_.year() < finish_year:
            if date_.dayOfWeek() < 6:
                start = QtCore.QDateTime(date_, QtCore.QTime(13,0))
                self.record.clearValues()
                self.record.setValue('diary_id', 1)
                self.record.setValue('start', start)
                self.record.setValue('finish', start.addSecs(3600))
                self.record.setValue('etype', 'lunch')
                yield self.record.insert_query
            date_ = date_.addDays(1)

        # now an entry for an exam done on patient one yesterday
        # (or previous work day)
        self.record.clearValues()
        date_ = QtCore.QDate.currentDate().addDays(-1)
        while date_.dayOfWeek() > 6:
            date_ = date_.addDays(-1)
        start = QtCore.QDateTime(date_, QtCore.QTime(9,0))
        self.record.setValue('diary_id', 1)
        self.record.setValue('start', start)
        self.record.setValue('finish', start.addSecs(60*15))
        self.record.setValue('etype', 'appointment')
        yield self.record.insert_query
Ejemplo n.º 25
0
    def onChangeState(self, index, row):
        currentRow = self.tblAPActions.currentIndex().row()
        if self.modelAPActions.items():
            self.onActionDataChanged('status', index)
            for rowNumber in xrange(currentRow + 1,
                                    len(self.modelAPActions.items())):
                actionTypeIdOnRow = forceRef(
                    self.modelAPActions.items()[rowNumber][0].value(
                        'actionType_id'))
                if self.modelAPActions.isMainActionType(actionTypeIdOnRow):
                    break
                self.onActionDataChanged('status', index, rowNumber)

            if index in [2, 4]:
                if not self.edtAPEndDate.date():
                    now = QtCore.QDateTime.currentDateTime()
                    self.setEndDate(now.date())
                    if self.edtAPEndTime.isVisible():
                        self.edtAPEndTime.setTime(now.time())
            elif index in [3]:
                eventPurposeId = self.eventEditor.getEventPurposeId()
                if not (QtGui.qApp.db.translate('rbEventTypePurpose', 'id',
                                                eventPurposeId,
                                                'federalCode = 8')):
                    if QtGui.qApp.userId and QtGui.qApp.userSpecialityId:
                        self.onChangePerson(QtGui.qApp.userId)
                    else:
                        self.onChangePerson(QtGui.qApp.userId)
                        self.cmbAPPerson.setValue(self.cmbAPSetPerson.value())
            elif index in [5, 6]:
                pass
            else:
                self.setEndDate(QtCore.QDate())
Ejemplo n.º 26
0
    def update(self):
        # update the date edit box
        self.dateSet.setDateTime(
            QtCore.QDateTime(
                QtCore.QDate(self.tr.start.year, self.tr.start.month,
                             self.tr.start.day), QtCore.QTime(00, 00, 00)))

        # next update the plot
        # clear the plot if it exists
        if self.ax0 is not None:
            self.ax0.cla()

        # now create the matplotlib plot
        self.ax0 = self.fig0.add_subplot(1, 1, 1)
        self.ax0.plot(self.lc.data.index, self.lc.data['xrsa'], color='red')
        self.ax0.plot(self.lc.data.index, self.lc.data['xrsb'], color='blue')
        self.ax0.set_xlabel(str(self.tr.start))
        self.ax0.set_yscale('log')
        self.ax0.set_ylim(1e-9, 1e-2)
        self.ax0.set_ylabel('Watts m$^{-2}$')
        self.ax0.tick_params(axis='both', labelsize=9)
        self.fig0.autofmt_xdate()

        # now draw it
        self.fig0.canvas.draw()
Ejemplo n.º 27
0
 def get_file_list(self):
     url = str(self.URLlineEdit.text())
     if url == '':
         QtGui.QMessageBox.warning(self, self.tr("Get remote zip content"),
                self.tr("Specify URL please"),
                QtGui.QMessageBox.AcceptRole, QtGui.QMessageBox.Escape);
         return
     
     self.StartpushButton.setDisabled(True)
     
     self.z = ZipFile(url)
     #print z.file_list()
     model = QtGui.QStandardItemModel(0, 4, self)
     model.setHeaderData(0, QtCore.Qt.Horizontal, QtCore.QVariant("File name"))
     model.setHeaderData(1, QtCore.Qt.Horizontal, QtCore.QVariant("Compressed size"))
     model.setHeaderData(2, QtCore.Qt.Horizontal, QtCore.QVariant("Uncompressed size"))
     model.setHeaderData(3, QtCore.Qt.Horizontal, QtCore.QVariant("File date"))
     
     from datetime import date, time
     for filename in self.z.TOC:
         #print type(z.TOC[filename][1])
         compressed_size = self.z.TOC[filename][7]
         uncompressed_size = self.z.TOC[filename][8]
         d = self.z.TOC[filename][9]
         t = self.z.TOC[filename][10]
         
         model = self.add_file_item(model, filename, compressed_size, uncompressed_size,
                 QtCore.QDateTime(QtCore.QDate(d[0],d[1],d[2]), QtCore.QTime(t[0],t[1],t[2])))
         
         self.treeView.setModel(model)
     
     self.StartpushButton.setEnabled(True)
Ejemplo n.º 28
0
    def fillData(self, driver):
        """ TO-DO STORM review"""
        self.ui.stackedWidget.setCurrentIndex(0)
        self.ui.saveButton.setEnabled(False)
        self.ui.deleteButton.setEnabled(False)

        for date in self.ui.calendarWidget.dateTextFormat():
            self.ui.calendarWidget.setDateTextFormat(date,
                                                     QtGui.QTextCharFormat())
        self.selectedDays = {}
        self.icepap_driver = driver
        self.ui.txtName.setText("")
        self.ui.txtDescription.setText("")
        for cfg in self.icepap_driver.historic_cfgs:
            datetime = cfg.date

            #datetime = time.localtime(date)
            #qdate = QtCore.QDate(datetime.tm_year,datetime.tm_mon,datetime.tm_mday)
            qdate = QtCore.QDate(datetime.year, datetime.month, datetime.day)
            cfgdate = qdate.toPyDate().ctime()
            if self.selectedDays.has_key(cfgdate):
                self.selectedDays[cfgdate].append([cfg.date, cfg])
            else:
                format = QtGui.QTextCharFormat()
                format.setBackground(QtGui.QColor(255, 255, 0))
                self.ui.calendarWidget.setDateTextFormat(qdate, format)
                self.selectedDays[cfgdate] = [[cfg.date, cfg]]
        self.daySelected(self.ui.calendarWidget.selectedDate())
Ejemplo n.º 29
0
    def __init__(self, parent):
        CItemEditorBaseDialog.__init__(self, parent, 'TakenTissueJournal')
        self.setupUi(self)

        self.addModels('SamplePreparation',
                       CSamplePreparationInDocTableModel(self))
        self.setModels(self.tblSamplePreparation, self.modelSamplePreparation,
                       self.selectionModelSamplePreparation)

        self.cmbEquipment.setTable('rbEquipment', addNone=True)
        self.cmbTestGroup.setTable('rbTestGroup', addNone=True)

        self.loadLastEquipment()

        self.setWindowTitleEx(u'Пробоподготовка')

        #        self.setupDirtyCather([self.cmbEquipment, self.cmbTestGroup])
        #        self.setIsDirty(False)

        self._tissueIdentifier = None
        self._tissueTypeId = None
        self._datetimeTaken = QtCore.QDate()

        self.actUncheckItems = QtGui.QAction(u'Снять отметки', self)
        self.connect(self.actUncheckItems, QtCore.SIGNAL('triggered()'),
                     self.on_uncheckItems)
        self.tblSamplePreparation.createPopupMenu([self.actUncheckItems])
Ejemplo n.º 30
0
    def __init__(self,
                 title='',
                 date=None,
                 time=None,
                 location='',
                 description='',
                 parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.title = title
        self.date = date
        self.time = time
        self.location = location
        self.description = description

        if self.date == None:
            self.date = QtCore.QDate()
        if self.time == None:
            self.time = QtCore.QTime()

        self.big_font = QtGui.QFont()
        self.big_font.setPointSize(36)

        self.small_font = QtGui.QFont()
        self.small_font.setPointSize(20)

        self.create_display_frame()
        self.create_edit_frame()
        self.update()