def UpdateData(self): if self.doctor_id is None: return query = "select * from booked_appointment where id_staff = %d \ and date >= '%s' and date < '%s'" \ % ( int(self.doctor_id), \ IsoDate(self.Date), \ IsoDate(self.AddDays(self.days, self.Date)) ) #print query patquery = "select * from v_basic_person where id = %d" cur = self.db.cursor() #for the appointment pc = self.db.cursor() #for the patient cur.execute(query) dates = cur.fetchall() index = gmPG.cursorIndex(cur) for date in dates: pc.execute(patquery % int(date[index["id_patient"]])) patients = gmPG.dictResult(pc) if len(patients): patient = patients[0] else: print "Failed to update cell! ID was %s: " % date[ index["id_patient"]] return self.UpdateCell(date[index["date"]].date, date[index["time"]].strftime("%H:%M:%S"), date[index["booked_duration"]], patient)
def UpdateData(self): if self.doctor_id is None: return query = "select * from booked_appointment where id_staff = %d \ and date >= '%s' and date < '%s'" \ % ( int(self.doctor_id), \ IsoDate(self.Date), \ IsoDate(self.AddDays(self.days, self.Date)) ) #print query patquery = "select * from v_active_persons where id = %d" cur = self.db.cursor() #for the appointment pc = self.db.cursor() #for the patient cur.execute(query) dates = cur.fetchall() index = gmPG.cursorIndex(cur) for date in dates: pc.execute(patquery % int(date[index["id_patient"]])) patients = gmPG.dictResult(pc) if len(patients): patient = patients[0] else: print "Failed to update cell! ID was %s: " % date[ index["id_patient"]] return self.UpdateCell(date[index["date"]].date, date[index["time"]].strftime("%H:%M:%S"), date[index["booked_duration"]], patient)
def __init__(self, parent, doctor=None): wxPanel.__init__(self, parent, -1) self.dbpool = gmPG.ConnectionPool() self.db = self.dbpool.GetConnection('appointments') cur = self.db.cursor() cur.execute(doctorquery) self.doctors = gmPG.dictResult(cur) #print self.doctors self.doctor = doctor self.doctorindex = {} #to look up a doctor's id depending on the index in the combo box #as combo box Set/Get client data seems buggy self.szrMain = wxBoxSizer(wxVERTICAL) self.szrTopRow = wxBoxSizer(wxHORIZONTAL) session_interval = 15 self.schedule = gmScheduleGrid.ScheduleGrid( self, session_interval=session_interval) self.szrButtons = wxBoxSizer(wxHORIZONTAL) self.szrMain.AddSizer(self.szrTopRow, 0, wxGROW | wxALIGN_TOP | wxLEFT | wxRIGHT, 5) self.szrMain.AddWindow(self.schedule, 1, wxGROW | wxALIGN_CENTER_VERTICAL, 3) self.szrMain.AddSizer(self.szrButtons, 0, wxALIGN_TOP | wxLEFT | wxRIGHT, 1) txt = wxStaticText(self, -1, _("with:"), wxDefaultPosition, wxDefaultSize, 0) self.szrTopRow.AddWindow(txt, 0, wxALIGN_CENTER_VERTICAL, 5) self.cbStaffSelection = wxComboBox(self, ID_COMBO_STAFF, "", wxDefaultPosition, wxSize(70, -1), [], wxCB_DROPDOWN) EVT_COMBOBOX(self, ID_COMBO_STAFF, self.OnStaffSelected) self.szrTopRow.AddWindow(self.cbStaffSelection, 1, wxGROW | wxALIGN_CENTER_VERTICAL, 5) self.FillComboStaff(self.doctors) if self.doctor is not None: #print "Setting Doctor", self.doctor self.SetDoctor(self.doctor) #print "Blocking days for ", self.doctor self.BlockDays(self.doctor) self.SetSizer(self.szrMain) self.SetAutoLayout(true) self.szrMain.Fit(self) self.szrMain.SetSizeHints(self) self.schedule.GoToDateTime()
def GetPatientByName(self, surname, firstname=None): cur = self.db.cursor() if firstname is not None: qstr = pat_by_names_query % (surname, firstname) #print qstr cur.execute(qstr) else: qstr = pat_by_surnames_query % surname #print qstr cur.execute(qstr) result = gmPG.dictResult(cur) n = len(result) if n == 0: return self.NewPatient(surname, firstname) else: return self.ChoosePatient(result)
def __init__(self, parent, doctor = None): wxPanel.__init__(self, parent, -1) self.dbpool=gmPG.ConnectionPool() self.db = self.dbpool.GetConnection('appointments') cur = self.db.cursor() cur.execute(doctorquery); self.doctors=gmPG.dictResult(cur); #print self.doctors self.doctor=doctor self.doctorindex = {} #to look up a doctor's id depending on the index in the combo box #as combo box Set/Get client data seems buggy self.szrMain = wxBoxSizer(wxVERTICAL) self.szrTopRow = wxBoxSizer(wxHORIZONTAL) session_interval = 15 self.schedule = gmScheduleGrid.ScheduleGrid(self, session_interval=session_interval) self.szrButtons = wxBoxSizer(wxHORIZONTAL) self.szrMain.AddSizer(self.szrTopRow, 0, wxGROW|wxALIGN_TOP|wxLEFT|wxRIGHT, 5 ) self.szrMain.AddWindow(self.schedule, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 3 ) self.szrMain.AddSizer(self.szrButtons, 0, wxALIGN_TOP|wxLEFT|wxRIGHT, 1 ) txt = wxStaticText( self, -1, _("with:"), wxDefaultPosition, wxDefaultSize, 0 ) self.szrTopRow.AddWindow( txt, 0, wxALIGN_CENTER_VERTICAL, 5 ) self.cbStaffSelection = wxComboBox( self, ID_COMBO_STAFF, "", wxDefaultPosition, wxSize(70,-1), [] , wxCB_DROPDOWN ) EVT_COMBOBOX(self, ID_COMBO_STAFF, self.OnStaffSelected) self.szrTopRow.AddWindow( self.cbStaffSelection, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ) self.FillComboStaff(self.doctors) if self.doctor is not None: #print "Setting Doctor", self.doctor self.SetDoctor(self.doctor) #print "Blocking days for ", self.doctor self.BlockDays(self.doctor) self.SetSizer(self.szrMain) self.SetAutoLayout(true) self.szrMain.Fit(self) self.szrMain.SetSizeHints(self) self.schedule.GoToDateTime()