Beispiel #1
0
 def on_btnAddEvent_clicked(self):
     tableSmpEvents = self.db.table('SmpEvents')
     item = self.tblEvents.model().items()[
         self.tblEvents.currentIndex().row()]
     if forceInt(self.cmbResult.currentIndex()):
         responce = self.exchange.addEvent(
             forceString(item.value('callNumberId')),
             forceInt(self.cmbResult.currentIndex()), self.edtNote.text())
     else:
         QtGui.QMessageBox.warning(self, u'Ошибка',
                                   u'Не выбран результат события')
         return
     if responce:
         recEvent = self.db.getRecordEx(
             tableSmpEvents, '*', tableSmpEvents['callNumberId'].eq(
                 forceString(item.value('callNumberId'))))
         if recEvent:
             recEvent.setValue('result',
                               toVariant(self.cmbResult.currentText()))
             recEvent.setValue('isDone', toVariant(1))
             self.db.updateRecord(tableSmpEvents, recEvent)
             QtGui.QMessageBox.information(self, u'Успешно',
                                           u'Событие успешно добавлено')
             self.loadData()
     else:
         QtGui.QMessageBox.warning(
             self, u'Ошибка', u'При регистрации события возникла ошибка')
Beispiel #2
0
 def build(self, params):
     begDate = params.get('begDate')
     endDate = params.get('endDate')
     doc = QtGui.QTextDocument()
     cursor = QtGui.QTextCursor(doc)
     cursor.setCharFormat(CReportBase.ReportTitle)
     cursor.insertText(self.title())
     cursor.insertBlock()
     self.dumpParams(cursor, params)
     cursor.insertBlock()
     items = self.exchange.getCallListStr(forceString(begDate),
                                          forceString(endDate))
     tableColumns = [('5%', [u'Номер вызова'], CReportBase.AlignLeft),
                     ('5%', [u'Дата вызова'], CReportBase.AlignLeft),
                     ('10%', [u'ФИО'], CReportBase.AlignLeft),
                     ('5%', [u'Пол'], CReportBase.AlignLeft),
                     ('5%', [u'Полных лет'], CReportBase.AlignLeft),
                     ('10%', [u'Телефон'], CReportBase.AlignLeft),
                     ('20%', [u'Диагноз'], CReportBase.AlignLeft),
                     ('15%', [u'Уточненный адрес'], CReportBase.AlignLeft),
                     ('15%', [u'Адрес проживания'], CReportBase.AlignLeft),
                     ('15%', [u'Адрес прописки'], CReportBase.AlignLeft)]
     table = createTable(cursor, tableColumns)
     for record in items:
         i = table.addRow()
         table.setText(i, 0, forceString(record.number))
         table.setText(
             i, 1,
             forceString(record.callDate) + u' ' +
             forceString(record.endReceivingCall)[:8])
         table.setText(
             i, 2,
             forceString(record.lastName) + u' ' +
             forceString(record.name) + u' ' +
             forceString(record.patronymic))
         table.setText(i, 3,
                       u'женский' if forceInt(record.sex) else u'мужской')
         table.setText(
             i, 4,
             forceString(record.ageYears)
             if record.ageYears and forceInt(record.ageYears) > 0 else u'')
         table.setText(i, 5, forceString(record.telephone))
         table.setText(
             i, 6,
             forceString(record.diseaseBasicCode) + u': ' +
             forceString(record.diseaseBasic))
         table.setText(i, 7, forceString(self.getAddrStrCall(record)))
         table.setText(i, 8, forceString(self.getAddrStrLive(record)))
         table.setText(i, 9, forceString(self.getAddrStrProp(record)))
     return doc
Beispiel #3
0
 def getItemFromRecord(self, item):
     return {
         'number':
         forceString(item.number),
         'date':
         forceString(item.callDate) + u' ' +
         forceString(item.endReceivingCall)[:8],
         'fio':
         forceString(item.lastName) + u' ' + forceString(item.name) + u' ' +
         forceString(item.patronymic),
         'sex':
         u'женский' if forceInt(item.sex) else u'мужской',
         'age':
         forceString(item.ageYears)
         if item.ageYears and forceInt(item.ageYears) > 0 else u'',
         'contact':
         forceString(item.telephone)
     }
Beispiel #4
0
 def getAddrStrProp(self, callInfo):
     settlement = u'нас. пункт: ' + forceString(
         callInfo.settlement3) if forceString(callInfo.settlement3) else u''
     street = u', улица: ' + forceString(callInfo.street3) if forceString(
         callInfo.street3) else u''
     house = u', дом: ' + forceString(
         callInfo.house3) if callInfo.house3 and forceInt(
             callInfo.house3) > 0 else u''
     houseFract = u', дробь: ' + forceString(
         callInfo.houseFract3) if callInfo.houseFract3 else u''
     corp = u', корпус: ' + forceString(
         callInfo.building3) if callInfo.building3 else u''
     flat = u', квартира: ' + forceString(
         callInfo.flat3) if callInfo.flat3 else u''
     porch = u', подъезд: ' + forceString(
         callInfo.porch3) if callInfo.porch3 and forceInt(
             callInfo.porch3) > 0 else u''
     floor = u', этаж: ' + forceString(
         callInfo.floor3) if callInfo.floor3 and forceInt(
             callInfo.floor3) > 0 else u''
     return settlement + street + house + houseFract + corp + flat + porch + floor
Beispiel #5
0
 def getAddrStrLive(self, callInfo):
     settlement = u'нас. пункт: ' + forceString(
         callInfo.settlement2) if forceString(callInfo.settlement2) else u''
     street = u', улица: ' + forceString(callInfo.street2) if forceString(
         callInfo.street2) else u''
     house = u', дом: ' + forceString(
         callInfo.house2) if callInfo.house2 and forceInt(
             callInfo.house2) > 0 else u''
     houseFract = u', дробь: ' + forceString(
         callInfo.houseFract2) if callInfo.houseFract2 else u''
     corp = u', корпус: ' + forceString(
         callInfo.building2) if callInfo.building2 else u''
     flat = u', квартира: ' + forceString(
         callInfo.flat2) if callInfo.flat2 else u''
     porch = u', подъезд: ' + forceString(
         callInfo.porch2) if callInfo.porch2 and forceInt(
             callInfo.porch2) > 0 else u''
     floor = u', этаж: ' + forceString(
         callInfo.floor2) if callInfo.floor2 and forceInt(
             callInfo.floor2) > 0 else u''
     return settlement + street + house + houseFract + corp + flat + porch + floor
Beispiel #6
0
 def getAddrStrCall(self, callInfo):
     settlement = u'нас. пункт: ' + forceString(
         callInfo.settlement1) if forceString(callInfo.settlement1) else u''
     street = u', улица: ' + forceString(callInfo.street1) if forceString(
         callInfo.street1) else u''
     house = u', дом: ' + forceString(
         callInfo.house1) if callInfo.house1 and forceInt(
             callInfo.house1) > 0 else u''
     houseFract = u', дробь: ' + forceString(
         callInfo.houseFract1) if callInfo.houseFract1 else u''
     corp = u', корпус: ' + forceString(
         callInfo.building1) if callInfo.building1 else u''
     flat = u', квартира: ' + forceString(
         callInfo.flat1) if callInfo.flat1 else u''
     porch = u', подъезд: ' + forceString(
         callInfo.porch1) if callInfo.porch1 and forceInt(
             callInfo.porch1) > 0 else u''
     floor = u', этаж: ' + forceString(
         callInfo.floor1) if callInfo.floor1 and forceInt(
             callInfo.floor1) > 0 else u''
     return settlement + street + house + houseFract + corp + flat + porch + floor
Beispiel #7
0
 def on_selectionModelEvents_currentChanged(self):
     self.clearData()
     item = self.tblEvents.model().items()[
         self.tblEvents.currentIndex().row()]
     if item:
         if forceInt(item.value('sex')):
             sex = u'Женский'
         else:
             sex = u'Мужской'
         self.edtCallNumber.setText(forceString(item.value('callNumberId')))
         self.dtCallDate.setDate(forceDate(item.value('callDate')))
         self.tmEventTime.setTime(forceTime(item.value('eventTime')))
         self.edtReceiver.setText(forceString(item.value('receiver')))
         self.edtClientFIO.setText(forceString(item.value('fio')))
         self.edtAge.setText(forceString(item.value('age')))
         self.edtSex.setText(sex)
         self.edtContact.setText(forceString(item.value('contact')))
         self.edtAddress.setText(forceString(item.value('address')))
         self.edtCallerName.setText(forceString(item.value('callerName')))
         self.edtUrgency.setText(forceString(item.value('urgencyCategory')))
         self.edtCallType.setText(forceString(item.value('callKind')))
Beispiel #8
0
 def on_btnAprovedEvent_clicked(self):
     tablePerson = self.db.table('Person')
     tableSmp = self.db.table('SmpEvents')
     item = self.tblEvents.model().items()[
         self.tblEvents.currentIndex().row()]
     if item:
         recEvent = self.db.getRecordEx(
             tableSmp, '*', tableSmp['callNumberId'].eq(
                 forceString(item.value('callNumberId'))))
         if recEvent:
             respoce = self.exchange.updEvent(forceInt(
                 recEvent.value('id')))
             if respoce:
                 recUser = self.db.getRecordEx(tablePerson, [
                     tablePerson['lastName'], tablePerson['firstName'],
                     tablePerson['patrName'], tablePerson['id'].eq(
                         QtGui.qApp.userId)
                 ])
                 recEvent.setValue(
                     'eventTime',
                     toVariant(
                         forceString(
                             QtCore.QDateTime.currentDateTime().time()) +
                         ':00'))
                 recEvent.setValue(
                     'receiver',
                     toVariant(
                         forceString(recUser.value('lastName')) + u' ' +
                         forceString(recUser.value('firstName')) + u' ' +
                         forceString(recUser.value('patrName'))))
                 self.db.updateRecord(tableSmp, recEvent)
                 QtGui.QMessageBox.information(self, u'Успешно',
                                               u'Вызов успешно принят')
             else:
                 QtGui.QMessageBox.warning(self, u'Ошибка',
                                           u'Не удалось принять вызов')