Ejemplo n.º 1
0
 def resetCalendar(self):
     format_normal = QtGui.QTextCharFormat()
     format_normal.setBackground(QtCore.Qt.white)
     AllUsersIDs = searchAllUsersID(self.connection)
     IDCurrentPeriod = getIDCurrentPeriod(self.connection)
     # reseteo dias de empleados
     for idemployee in AllUsersIDs:
         Days = searchDaysAcceptedByID(idemployee[0], self.connection,
                                       IDCurrentPeriod)
         for iday in Days:
             if iday[1] != None:
                 currDay = iday[0]
                 maxDay = iday[1]
                 while currDay <= maxDay:
                     day = QtCore.QDate(currDay.year, currDay.month,
                                        currDay.day)
                     self.ui.employeecalendarWidget.setDateTextFormat(
                         day, format_normal)
                     currDay += datetime.timedelta(1)
             else:
                 day = QtCore.QDate(iday[0].year, iday[0].month,
                                    iday[0].day)
                 self.ui.employeecalendarWidget.setDateTextFormat(
                     day, format_normal)
     # reseteo feriados
     Feriados = getFeriados(self.connection, IDCurrentPeriod)
     for iFeriados in Feriados:
         self.ui.employeecalendarWidget.setDateTextFormat(
             iFeriados[0], format_normal)
     return
Ejemplo n.º 2
0
 def colourFeriados(self):
     format_feriados = QtGui.QTextCharFormat()
     format_feriados.setBackground(QtCore.Qt.blue)
     IDCurrentPeriod = getIDCurrentPeriod(self.connection)
     Feriados = getFeriados(self.connection, IDCurrentPeriod)
     for iFeriados in Feriados:
         self.ui.employeecalendarWidget.setDateTextFormat(
             iFeriados[0], format_feriados)
     return
Ejemplo n.º 3
0
 def showFeriados(self):
     IDCurrentPeriod = getIDCurrentPeriod(self.connection)
     Feriados = getFeriados(self.connection, IDCurrentPeriod)
     self.ui.table_feriados.clearContents()
     self.ui.table_feriados.setRowCount(0)
     for iFeriados in Feriados:
         currentRow = self.ui.table_feriados.rowCount()
         self.ui.table_feriados.setRowCount(currentRow + 1)
         it0 = QtWidgets.QTableWidgetItem(str(iFeriados[0]))
         it0.setFlags(QtCore.Qt.ItemIsEnabled)
         self.ui.table_feriados.setItem(currentRow, 0, it0)
         it1 = QtWidgets.QTableWidgetItem(str(iFeriados[1]))
         it1.setFlags(QtCore.Qt.ItemIsEnabled)
         self.ui.table_feriados.setItem(currentRow, 1, it1)
Ejemplo n.º 4
0
 def calculateRemainingDays(self, IDCurrentPeriod):
     # todo esto para calcular los días restantes.. -_-
     Feriados = getFeriados(self.connection, IDCurrentPeriod)
     Dias = searchDaysForUserByID(self.connection, self.currentUserID,
                                  IDCurrentPeriod)
     DaysTotal = Dias[0][0]
     Absences = searchforAbsenceOrLicenseByUserID(self.connection,
                                                  self.currentUserID,
                                                  IDCurrentPeriod, True)
     DaysAbsences = calculateDays(Absences, Feriados)
     Licenses = searchforAbsenceOrLicenseByUserID(self.connection,
                                                  self.currentUserID,
                                                  IDCurrentPeriod, False)
     DaysLicenses = calculateDays(Licenses, Feriados)
     RestOfDays = DaysTotal - DaysAbsences - DaysLicenses
     return RestOfDays
Ejemplo n.º 5
0
 def showEmployeeStatus(self):
     self.ui.employeeStatustableWidget.clearContents()
     self.ui.employeeStatustableWidget.setRowCount(0)
     IDCurrentPeriod = getIDCurrentPeriod(self.connection)
     AllUsersIDs = searchAllUsersID(self.connection)
     Feriados = getFeriados(self.connection, IDCurrentPeriod)
     for UserID in AllUsersIDs:
         Dias = searchDaysForUserByID(self.connection, UserID[0],
                                      IDCurrentPeriod)
         Nombre = searchNameForUserByID(self.connection, UserID[0])
         currentRow = self.ui.employeeStatustableWidget.rowCount()
         self.ui.employeeStatustableWidget.setRowCount(currentRow + 1)
         it0 = QtWidgets.QTableWidgetItem(
             str(Nombre[0][0] + ' ' + Nombre[0][1]))
         it0.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
         self.ui.employeeStatustableWidget.setItem(currentRow, 0, it0)
         DaysTotal = Dias[0][0]
         it1 = QtWidgets.QTableWidgetItem(str(DaysTotal))
         it1.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
         self.ui.employeeStatustableWidget.setItem(currentRow, 1, it1)
         Absences = searchforAbsenceOrLicenseByUserID(
             self.connection, UserID[0], IDCurrentPeriod, True)
         DaysAbsences = calculateDays(Absences, Feriados)
         it2 = QtWidgets.QTableWidgetItem(str(DaysAbsences))
         it2.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
         self.ui.employeeStatustableWidget.setItem(currentRow, 2, it2)
         Licenses = searchforAbsenceOrLicenseByUserID(
             self.connection, UserID[0], IDCurrentPeriod, False)
         DaysLicenses = calculateDays(Licenses, Feriados)
         it3 = QtWidgets.QTableWidgetItem(str(DaysLicenses))
         it3.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
         self.ui.employeeStatustableWidget.setItem(currentRow, 3, it3)
         RestOfDays = DaysTotal - DaysAbsences - DaysLicenses
         it4 = QtWidgets.QTableWidgetItem(str(RestOfDays))
         it4.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
         self.ui.employeeStatustableWidget.setItem(currentRow, 4, it4)
         color = GREEN if RestOfDays == 0 else YELLOW if RestOfDays > 0 else RED
         it0.setBackground(color)
     return