示例#1
0
    def clearApptButton_clicked(self):
        '''
        user is deleting an appointment
        '''
        def delete_appt():
            if appointments.delete_appt_from_apr(appt):
                self.advise(_("Sucessfully removed appointment"))
            else:
                self.advise(_("Error removing proposed appointment"), 2)

        appt = self.diary_model.selectedAppt

        if appt is None:
            self.advise(_("No appointment selected"))
            return

        if appt.date is None:
            if QtGui.QMessageBox.question(
                    self, _("Confirm"), _("Delete Unscheduled Appointment?"),
                    QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                    QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
                delete_appt()

        elif appt.past:
            delete_appt()

        else:
            message = _("Confirm Delete appointment at")
            message += " %s %s " % (appt.atime,
                                    localsettings.readableDate(appt.date))

            message += _("with") + " %s?" % appt.dent_inits

            if QtGui.QMessageBox.question(
                    self, _("Confirm"), message,
                    QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                    QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:

                if appointments.delete_appt_from_aslot(appt):
                    # todo - if we deleted from the appt book,
                    # we should add to notes
                    print "future appointment deleted - add to notes!!"

                    appointments.made_appt_to_proposed(appt)
                    self.layout_ptDiary()

                #--keep in the patient's diary?

                if QtGui.QMessageBox.question(
                        self, _("Question"),
                        _("Removed from appointment book - keep for rescheduling?"
                          ), QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                        QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
                    # remove from the patients diary
                    if appointments.delete_appt_from_apr(appt):
                        self.advise(_("Sucessfully removed appointment"))
                    else:
                        self.advise(_("Error removing from patient diary"), 2)

        self.layout_ptDiary()
示例#2
0
    def clearApptButton_clicked(self):
        '''
        user is deleting an appointment
        '''
        def delete_appt():
            if appointments.delete_appt_from_apr(appt):
                self.advise(_("Sucessfully removed appointment"))
            else:
                self.advise(_("Error removing proposed appointment"), 2)

        appt = self.diary_model.selectedAppt

        if appt is None:
            self.advise(_("No appointment selected"))
            return

        if appt.date is None:
            if QtGui.QMessageBox.question(self, _("Confirm"),
                                          _("Delete Unscheduled Appointment?"),
                                          QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                                          QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
                delete_appt()

        elif appt.past:
            delete_appt()

        else:
            message = _("Confirm Delete appointment at")
            message += " %s %s " % (appt.atime,
                                    localsettings.readableDate(appt.date))

            message += _("with") + " %s?" % appt.dent_inits

            if QtGui.QMessageBox.question(self, _("Confirm"), message,
                                          QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                                          QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:

                if appointments.delete_appt_from_aslot(appt):
                    # todo - if we deleted from the appt book,
                    # we should add to notes
                    print "future appointment deleted - add to notes!!"

                    appointments.made_appt_to_proposed(appt)
                    self.layout_ptDiary()

                #--keep in the patient's diary?

                if QtGui.QMessageBox.question(self, _("Question"),
                                              _(
                                              "Removed from appointment book - keep for rescheduling?"),
                                              QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                                              QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
                    # remove from the patients diary
                    if appointments.delete_appt_from_apr(appt):
                        self.advise(_("Sucessfully removed appointment"))
                    else:
                        self.advise(_("Error removing from patient diary"), 2)

        self.layout_ptDiary()
示例#3
0
 def postpone_appointment(self):
     LOGGER.warning("cancelling appointment, but keeping for rescheduling")
     if self.delete_from_aslot():
         appointments.made_appt_to_proposed(self.appt)
     self.accept()