Exemplo n.º 1
0
    def retranslateUi(self, add_contract):
        _translate = QtCore.QCoreApplication.translate
        add_contract.setWindowTitle(
            _translate("add_contract", "Добавление договора"))
        self.label.setText(_translate("add_contract", "Шифр договора"))
        self.start_date_line.setInputMask(
            _translate("add_contract", "00.00.0000"))
        self.end_date_line.setInputMask(
            _translate("add_contract", "00.00.0000"))
        self.label_2.setText(_translate("add_contract", "Дата начала"))
        self.label_3.setText(_translate("add_contract", "Дата окончания"))
        self.label_6.setText(_translate("add_contract", "Комната"))
        self.label_7.setText(_translate("add_contract", "Стоимость"))
        mas = dbd.buffer()
        room_mas = dbd.list_of_empty_rooms_by_sex(
            dbd.search_student_by_id(mas[0][0])[1]['Пол'],
            dbd.search_student_by_id(mas[0][0])[1]['Общежитие'])
        i = 0
        for fac in room_mas:
            self.RoomBox.addItem(f"{fac[1]}")
            i += 1
        self.add_contract_btn.setText(_translate("add_contract", "Добавить"))
        self.back_to_add_client_btn.setText(
            _translate("add_contract", "Вернуться к добавлению клиента"))

        i = dbd.list_of_facilities()[1]
        for j in range(0, i):
            self.CostBox.addItem(
                f"{dbd.list_of_facilities()[0][j][0]} - {dbd.list_of_facilities()[0][j][1]}"
            )
Exemplo n.º 2
0
 def take_student_id(self):
     # Вытаскивает из буфера и заполняет поля данными
     mas = dbd.buffer()
     for person in mas:
         key = person[0]
         code_n = self.code_line.text()
         date_start = self.start_date_line.text()
         date_end = self.end_date_line.text()
         room = self.RoomBox.currentText()
         cost = self.CostBox.currentText().split("- ")[1]
         facility = self.CostBox.currentText().split(" -")[0]
         sex = str(person[1]['Пол'])
     dbd.add_contract(key,
                      date_start,
                      date_end,
                      room,
                      cost,
                      facility,
                      sex,
                      code=code_n)
     from success import Ui_Error
     self.window = QtWidgets.QMainWindow()
     self.ui = Ui_Error()
     self.ui.setupUi(self.window)
     self.window.show()
Exemplo n.º 3
0
    def edit(self):
        # Мне тоже больно что addres с двумя d, но исправлять больнее
        # Функция редактирования
        mas = dbd.buffer()
        for person in mas:

            d = 1
            serial_n = self.serial_line.text()
            number_n = self.number_line.text()
            addres_n = self.addres_line.text()
            phone_n = self.phone_line.text()
            educ_form_n = self.Form_box.currentText()
            sex_n = self.SexBox.currentText()
            hostel_n = self.HostelNumber.currentText()

            while d != 0:
                fio_n = self.FIO_line.text()
                d = dbd.try_get_fio(fio_n)
                if d == 1:
                    self.FIO_line.clear()

                    break
            if person[1]['Общежитие'] != '':
                if person[1]['Комната'] != '' and person[1]['Комната'] != 'queue':
                    way=''
                    #way = "dormitory" + str(person[1]['Общежитие']) + "/" + "rooms" + "/" + str(
                     #   person[1]['Комната']) + "/" + "members"
                else:
                    way = "dormitory" + str(person[1]['Общежитие']) + "/" + "rooms" + "/" + "queue"

            else:
                way = "queue"

            break
        if d == 0:
            room = 'queue'
            dbd.add_student_buffer(person[0], fio_n, phone_n, serial_n + number_n, addres_n, educ_form_n, sex_n, room, hostel_n)
            dbd.edit_student(person[0],way,fio_n,phone_n,serial_n + number_n,addres_n,educ_form_n,sex_n, str(hostel_n))
            from success_action import Ui_Error
            self.window = QtWidgets.QMainWindow()
            self.ui = Ui_Error()
            self.ui.setupUi(self.window)
            self.window.show()

        else:
            from error import Ui_Error
            self.window = QtWidgets.QMainWindow()
            self.ui = Ui_Error()
            self.ui.setupUi(self.window)
            self.window.show()
Exemplo n.º 4
0
 def red(self):
     # Вытаскивает из буфера и заполняет поля данными
     mas = dbd.buffer()
     for person in mas:
         self.FIO_line.setText(person[1]["ФИО"])
         self.serial_line.setText(person[1]["Паспорт"][:4])
         self.number_line.setText(person[1]["Паспорт"][4:])
         self.addres_line.setText(person[1]["Адрес регистрации"])
         self.phone_line.setText(person[1]["Телефон"])
         self.Form_box.setCurrentText(person[1]["Форма обучения"])
         self.SexBox.setCurrentText(person[1]["Пол"])
         self.HostelNumber.setCurrentText(person[1]["Общежитие"])
         if person[1]["Комната"] != '' and person[1]["Комната"] != 'queue':
             self.SexBox.setEnabled(False)
             self.HostelNumber.setEnabled(False)
Exemplo n.º 5
0
    def edit_contract(self):
        # Мне тоже больно что addres с двумя d, но исправлять больнее
        # Функция редактирования
        mas = dbd.buffer()
        for person in mas:
            d = 1
            c = 1
            serial_n = self.serial_line.text()
            number_n = self.number_line.text()
            addres_n = self.addres_line.text()
            phone_n = self.phone_line.text()
            educ_form_n = self.Form_box.currentText()
            sex_n = self.SexBox.currentText()
            hostel_n = self.HostelNumber.currentText()
            с = str(hostel_n)
            while c != 0:
                fio_n = self.FIO_line.text()
                c = dbd.try_get_fio(fio_n)
                if c == 1:
                    self.FIO_line.clear()

                    break
            while d != 0:
                hostel = self.HostelNumber.currentText()
                d = dbd.try_get_hostel(hostel)
                if d == 1:
                    self.HostelNumber.setCurrentIndex(0)

                    break

            if person[1]['Общежитие'] != '':
                if person[1]['Комната'] != '' and person[1]['Комната'] != 'queue':
                    room = person[1]['Комната']
                    way = room

                    # way = "dormitory" + str(person[1]['Общежитие']) + "/" + "rooms" + "/" + str(
                    #   person[1]['Комната']) + "/" + "members"
                else:
                    way = "dormitory" + str(person[1]['Общежитие']) + "/" + "rooms" + "/" + "queue"
                    room = 'queue'

            else:
                way = "queue"
                room = 'queue'

                break
            if c == 0:
                if d == 0:
                    if sex_n == "Мужской" or sex_n == "Женский":


                        dbd.add_student_buffer(person[0], fio_n, phone_n, serial_n + number_n, addres_n, educ_form_n, sex_n,
                                               room, hostel_n)
                        dbd.edit_student(person[0], way, fio_n, phone_n, serial_n + number_n, addres_n, educ_form_n, sex_n,
                                         str(hostel_n))
                        from red_contract_2 import Ui_red_contract_2
                        self.window = QtWidgets.QMainWindow()
                        self.ui = Ui_red_contract_2()
                        self.ui.setupUi(self.window)
                        self.window.show()


            else:
                from error import Ui_Error
                self.window = QtWidgets.QMainWindow()
                self.ui = Ui_Error()
                self.ui.setupUi(self.window)
                self.window.show()
Exemplo n.º 6
0
    def set_code(self):

        mas = dbd.buffer()
        for person in mas:
            key = person[0]
            self.code_line.setText(dbd.get_students_contract_num(key))