def __init__(self, id):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_teacher_payrate_dialog()
        self.ui.setupUi(self)
        self.id_number = id

        #store payrate
        self.payrate_dict = {}

        self.ui.Add_btn.clicked.connect(self.insert)
        payrate_query = QSqlQuery()
        payrate_query.exec_(
            "select Payname, Payrate from Teacher_Payrate as TP, Payrate as P where \
                             TP.Payrate_id = P.Payrate_id and TP.Teacher_id = %d"
            % id)

        while payrate_query.next():
            self.ui.Payname_comboBox.addItem(payrate_query.value(0))
            self.payrate_dict[payrate_query.value(0)] = float(
                payrate_query.value(1))

        if self.ui.Payname_comboBox.currentText() != '':
            self.ui.Payrate_update_lineEdit.setText(
                str(self.payrate_dict[str(
                    self.ui.Payname_comboBox.currentText())]))
        self.ui.Update_btn.clicked.connect(self.update)
        self.ui.Payname_comboBox.currentIndexChanged.connect(self.update_text)