Beispiel #1
0
    def OpenLink(self, ID):

        listboxid = self.diarylistbox.GetSelection()

        linktype = GetLinkType(self.diarylistbox.htmllist[listboxid][8])

        linkid = self.diarylistbox.htmllist[listboxid][9]

        if linktype == "client":

            clientsettings = clientmethods.ClientSettings(
                self.localsettings, linkid)
            clientpanel = clientmethods.ClientPanel(self.notebook,
                                                    clientsettings)
            self.notebook.AddPage(clientpanel)

        elif linktype == "animal":

            animalsettings = animalmethods.AnimalSettings(
                self.localsettings, False, linkid)
            animalpanel = animalmethods.AnimalPanel(self.notebook,
                                                    animalsettings)
            self.notebook.AddPage(animalpanel)

        elif linktype == "appointment":

            appointmentsettings = appointmentmethods.AppointmentSettings(
                self.localsettings, False, linkid)
            appointmentpanel = appointmentmethods.AppointmentPanel(
                self.notebook, appointmentsettings)
            self.notebook.AddPage(appointmentpanel)
Beispiel #2
0
def CreateRandomOperation(connection, animalid, localsettings):

    appointmentdata = appointmentmethods.AppointmentSettings(
        localsettings, animalid, False)

    time = "09:00:00"

    date = datetime.date.today()

    randno = int(random.random() * 300)

    if int(random.random() * 1000) < 500:

        randno = randno * -1
        appointmentdata.problem = GetRandomProblem()
        appointmentdata.notes = GetRandomNotes(True)
        appointmentdata.plan = GetRandomPlan()

    timedelta = datetime.timedelta(days=randno)
    date = date + timedelta

    date = miscmethods.GetSQLDateFromDate(date)

    appointmentdata.date = date

    appointmentdata.time = time
    appointmentdata.reason = GetRandomOpReason()

    appointmentdata.operation = 1

    dbmethods.WriteToAppointmentTable(connection, appointmentdata)
Beispiel #3
0
    def CreateAppointmentFromMenu(self, ID):

        appointmentsettings = appointmentmethods.AppointmentSettings(
            self.localsettings, self.selectedappointmentdata.animaldata.ID,
            False)
        appointmentpanel = appointmentmethods.AppointmentPanel(
            self.notebook, appointmentsettings)
        appointmentpanel.parent = self
        wx.CallAfter(self.notebook.AddPage, appointmentpanel)
Beispiel #4
0
    def EditVetForm(self, ID):

        panel = ID.GetEventObject().panel

        listbox = panel.listbox

        notebook = self.GetGrandParent().GetParent()

        appointmentid = listbox.htmllist[listbox.GetSelection()][3]

        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)
        stayingid = appointmentdata.staying
        animalid = appointmentdata.animalid

        today = datetime.date.today()

        appointmentdate = miscmethods.GetDateFromSQLDate(appointmentdata.date)

        if appointmentdate != today:

            appointmentdata.staying = 0
            appointmentdata.done = 1
            appointmentdata.withvet = 0

            appointmentdata.Submit(True)

            miscmethods.ShowMessage(self.GetLabel("animalstayedmessage"), self)

            appointmentdata = appointmentmethods.AppointmentSettings(
                self.localsettings, animalid, False)
            appointmentdata.reason = self.GetLabel("overnightstaylabel")
            appointmentdata.time = str(datetime.datetime.today().time())[:5]
            appointmentdata.arrived = 1
            appointmentdata.withvet = 1
            appointmentdata.staying = stayingid

            appointmentdata.Submit()

        vetform = vetmethods.VetForm(notebook, appointmentdata,
                                     self.localsettings, self)

        notebook.AddPage(vetform)
Beispiel #5
0
    def VetVisit(self, ID):

        appointmentid = self.selectedappointmentdata.ID
        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)

        self.RefreshLists()

        vetpanel = vetmethods.VetForm(self.notebook, appointmentdata,
                                      self.localsettings, self)
        vetpanel.viewappointmentspanel = self
        self.notebook.AddPage(vetpanel)
Beispiel #6
0
    def AppointmentSelected(self, ID=False):

        #print "Appointment Selected!"

        busy = wx.BusyCursor

        parent = ID.GetEventObject()

        listboxid = parent.GetParent().GetSelection()
        appointmentid = parent.GetParent().htmllist[listboxid][0]

        selectedappointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)

        self.notarrivedlistbox.SetSelection(-1)
        self.waitinglistbox.SetSelection(-1)
        self.withvetlistbox.SetSelection(-1)
        self.donelistbox.SetSelection(-1)

        parent.GetParent().SetSelection(listboxid)

        if self.notarrivedlistbox.GetSelection() > -1:
            self.withvetbutton.Disable()
            self.arrivedbutton.Enable()
            self.donebutton.Disable()
        elif self.waitinglistbox.GetSelection() > -1:
            self.withvetbutton.Enable()
            self.arrivedbutton.Disable()
            self.donebutton.Disable()
        elif self.withvetlistbox.GetSelection() > -1:
            self.withvetbutton.Disable()
            self.arrivedbutton.Disable()
            self.donebutton.Enable()
        else:
            self.withvetbutton.Disable()
            self.arrivedbutton.Disable()
            self.donebutton.Disable()

        appointmenthtml = miscmethods.GetAppointmentHtml(
            selectedappointmentdata)

        self.detailswindow.SetPage(appointmenthtml)

        self.selectedappointmentdata = selectedappointmentdata

        del busy

        parent.GetParent().SetFocus()
Beispiel #7
0
def CreateRandomAppointment(connection, animalid, localsettings):

    appointmentdata = appointmentmethods.AppointmentSettings(
        localsettings, animalid, False)

    openfrom = localsettings.openfrom
    openfrom = int(openfrom[:2]) * 60 + int(openfrom[3:5])

    opento = localsettings.opento
    opento = int(opento[:2]) * 60 + int(opento[3:5])

    time = opento - openfrom

    time = int(random.random() * time) + openfrom

    time = miscmethods.GetTimeFromMinutes(time)

    if random.random() * 10 > 5:
        time = time[:-1] + "0"
    else:
        time = time[:-1] + "5"

    date = datetime.date.today()

    randno = int(random.random() * 300)

    if int(random.random() * 1000) < 500:

        randno = randno * -1
        appointmentdata.problem = GetRandomProblem()
        appointmentdata.notes = GetRandomNotes(True)
        appointmentdata.plan = GetRandomPlan()

    timedelta = datetime.timedelta(days=randno)
    date = date + timedelta

    date = miscmethods.GetSQLDateFromDate(date)

    appointmentdata.date = date

    appointmentdata.time = time + ":00"
    appointmentdata.reason = GetRandomReason()

    appointmentdata.operation = 0

    dbmethods.WriteToAppointmentTable(connection, appointmentdata)
Beispiel #8
0
    def Discharge(self, ID):

        panel = ID.GetEventObject().panel

        listbox = panel.listbox

        notebook = self.GetGrandParent().GetParent()

        appointmentid = listbox.htmllist[listbox.GetSelection()][3]

        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)

        appointmentdata.staying = 0

        appointmentdata.Submit()

        listbox.RefreshList()
Beispiel #9
0
    def EditAppointment(self, ID):

        try:

            listboxid = ID.GetEventObject().GetParent().GetSelection()
            appointmentid = ID.GetEventObject().GetParent(
            ).htmllist[listboxid][0]

        except:

            appointmentid = ID

        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)
        appointmentpanel = appointmentmethods.AppointmentPanel(
            self.notebook, appointmentdata)
        appointmentpanel.viewappointmentspanel = self
        wx.CallAfter(self.notebook.AddPage, appointmentpanel)
Beispiel #10
0
    def EditClient(self, ID):

        panel = ID.GetEventObject().panel

        listbox = panel.listbox

        notebook = self.GetGrandParent().GetParent()

        appointmentid = listbox.htmllist[listbox.GetSelection()][3]

        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)
        clientid = appointmentdata.ownerid

        clientdata = clientmethods.ClientSettings(self.localsettings, clientid)

        clientpanel = clientmethods.ClientPanel(notebook, clientdata)

        notebook.AddPage(clientpanel)
Beispiel #11
0
    def EditAppointment(self, ID):

        kennelcell = ID.GetEventObject().GetParent()

        listboxid = kennelcell.listbox.GetSelection()

        appointmentid = kennelcell.animaldata[listboxid][3]

        notebook = kennelcell.GetGrandParent().GetGrandParent()

        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)

        appointmentpanel = appointmentmethods.AppointmentPanel(
            notebook, appointmentdata)
        appointmentpanel.kennelspanel = kennelcell.GetGrandParent().GetParent()

        #print "kennelspanel = " + str(kennelspanel)

        notebook.AddPage(appointmentpanel)
Beispiel #12
0
    def EditAnimal(self, ID):

        panel = ID.GetEventObject().panel

        listbox = panel.listbox

        notebook = self.GetGrandParent().GetParent()

        appointmentid = listbox.htmllist[listbox.GetSelection()][3]

        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, False, appointmentid)
        animalid = appointmentdata.animalid

        animaldata = animalmethods.AnimalSettings(self.localsettings, False,
                                                  animalid)

        animalpanel = animalmethods.AnimalPanel(notebook, animaldata)

        notebook.AddPage(animalpanel)
Beispiel #13
0
    def CreateAppointment(self, ID=False):

        listboxid = self.listbox.GetSelection()
        animalid = self.listbox.htmllist[listboxid][5]
        vaccinationtype = self.listbox.htmllist[listboxid][2]
        duedate = self.listbox.htmllist[listboxid][4]
        duedate = miscmethods.GetWXDateFromSQLDate(duedate)

        appointmentdata = appointmentmethods.AppointmentSettings(
            self.localsettings, animalid, False)

        notebook = self.GetGrandParent().GetGrandParent()

        appointmentpanel = appointmentmethods.AppointmentPanel(
            notebook, appointmentdata)

        appointmentpanel.reasonentry.SetValue(vaccinationtype)
        appointmentpanel.appointmententry.SetValue(duedate)
        appointmentpanel.RefreshAppointment()

        notebook.AddPage(appointmentpanel)
Beispiel #14
0
def GetAppointmentDetailsHtml(localsettings, appointmentid, short=False):

    appointmentdata = appointmentmethods.AppointmentSettings(
        localsettings, False, appointmentid)

    date = appointmentdata.date
    date = FormatSQLDate(date, localsettings)

    time = FormatTime(appointmentdata.time)

    action = "SELECT * FROM receipt WHERE AppointmentID = " + str(
        appointmentdata.ID)
    results = db.SendSQL(action, localsettings.dbconnection)

    if short == False:

        receipthtml = "<td valign=top align=left width=40%><font size=1><u>" + localsettings.dictionary[
            "receiptlabel"][
                localsettings.language] + "</u><br></font><table width=100%>"

        receipttotal = 0

        for a in results:

            description = unicode(a[2], "utf8")
            price = a[3]

            receipttotal = receipttotal + price

            price = FormatPrice(price)

            receipthtml = receipthtml + "<tr><td align=left valign=top><font size=1>" + description + "</font></td><td align=right valign=top nowrap><font size=1>" + localsettings.dictionary[
                "currency"][
                    localsettings.language] + price + "</font></td></tr>"

        receipttotal = FormatPrice(receipttotal)

        receipthtml = receipthtml + "<tr><td align=left valign=top><font size=1><b>" + localsettings.dictionary[
            "totallabel"][
                localsettings.
                language] + ":</b></font></td><td align=right valign=top nowrap><font size=1><b>" + localsettings.dictionary[
                    "currency"][
                        localsettings.
                        language] + receipttotal + "</b></font></td></tr></table></td>"

    else:

        receipthtml = ""

    if GetDateFromSQLDate(appointmentdata.date) <= datetime.date.today():

        #Appointment is in the past

        if appointmentdata.arrived == 0 and appointmentdata.withvet == 0 and appointmentdata.done == 0:

            #DNA

            arrivaltimehtml = " (" + localsettings.dictionary["dnalabel"][
                localsettings.language] + ")"

        elif appointmentdata.arrivaltime == None:

            #Unknown arrival time

            arrivaltimehtml = ""

        elif appointmentdata.time < appointmentdata.arrivaltime:

            #Arrived late

            arrivaltimehtml = " (" + localsettings.dictionary["latelabel"][
                localsettings.language] + ")"

        else:

            arrivaltimehtml = " (" + localsettings.dictionary["ontimelabel"][
                localsettings.language] + ")"

    else:

        #Appointment has not happened yet

        arrivaltimehtml = ""

    output = "<table width=100% cellpadding=0 cellspacing=0><tr><td valign=top align=left><font color=blue size=1><b>" + date + " " + time + "</b>" + arrivaltimehtml + "</font><font size=1><br>" + localsettings.dictionary[
        "vetlabel"][
            localsettings.
            language] + ": <b>" + appointmentdata.vet + "</b><br></font><font color=red size=1>" + appointmentdata.reason + "</font><br><br><font size=1><u>" + localsettings.dictionary[
                "problemlabel"][
                    localsettings.
                    language] + "</u><br>" + appointmentdata.problem + "<br><u>" + localsettings.dictionary[
                        "noteslabel"][
                            localsettings.
                            language] + "</u><br>" + appointmentdata.notes + "<br><u>" + localsettings.dictionary[
                                "planlabel"][
                                    localsettings.
                                    language] + "</u><br>" + appointmentdata.plan + "</font></td>" + receipthtml + "</tr></table>"

    return output
Beispiel #15
0
    def RefreshLists(self, ID=False):

        date = datetime.datetime.today().strftime("%A %d %B %Y")
        sqldate = datetime.datetime.today().strftime("%Y-%m-%d")
        time = datetime.datetime.today().strftime("%X")[:5]

        action = "SELECT Name FROM staff WHERE Date = \"" + sqldate + "\" AND \"" + time + ":00\" BETWEEN TimeOn AND TimeOff AND Operating = " + str(
            self.operations) + " AND Position = \"" + self.GetLabel(
                "vetpositiontitle") + "\" ORDER BY Name"
        results = db.SendSQL(action, self.localsettings.dbconnection)

        vets = ""
        self.vetlist = []

        for a in results:
            vets = vets + a[0] + ", "
            self.vetlist.append(a[0])
        vets = vets[:-2]

        self.datetimewindow.SetPage(
            "<center><font size=2>" + date +
            "</font><br><font color=blue size=5><b>" + time +
            "</b></font></center><br><font size=1><u>" +
            self.GetLabel("viewappointmentsvetsonlabel") + "</u>: " + vets +
            "</font>")

        for a in (self.notarrivedlistbox, self.waitinglistbox,
                  self.withvetlistbox, self.donelistbox):

            a.RefreshList()
            a.SetSelection(-1)

            if self.selectedappointmentdata != False:

                for b in range(0, len(a.htmllist)):

                    if a.htmllist[b][0] == self.selectedappointmentdata.ID:

                        a.SetSelection(b)
                        a.ScrollToLine(b)
                        self.selectedappointmentdata = appointmentmethods.AppointmentSettings(
                            self.localsettings, False,
                            self.selectedappointmentdata.ID)
                        a.listctrl.SetFocus()

            if a == self.notarrivedlistbox:
                self.notarrivedtotal.SetLabel(
                    self.GetLabel("totallabel") + ": " + str(len(a.htmllist)))
                self.notarrivedsizer.Layout()
            elif a == self.waitinglistbox:
                self.waitingtotal.SetLabel(
                    self.GetLabel("totallabel") + ": " + str(len(a.htmllist)))
                self.waitingsizer.Layout()
            elif a == self.withvetlistbox:
                self.withvettotal.SetLabel(
                    self.GetLabel("totallabel") + ": " + str(len(a.htmllist)))
                self.withvetsizer.Layout()
            elif a == self.donelistbox:
                self.donetotal.SetLabel(
                    self.GetLabel("totallabel") + ": " + str(len(a.htmllist)))
                self.donesizer.Layout()

        if self.notarrivedlistbox.GetSelection() > -1:
            self.withvetbutton.Disable()
            self.arrivedbutton.Enable()
            self.donebutton.Disable()
        elif self.waitinglistbox.GetSelection() > -1:
            self.withvetbutton.Enable()
            self.arrivedbutton.Disable()
            self.donebutton.Disable()
        elif self.withvetlistbox.GetSelection() > -1:
            self.withvetbutton.Disable()
            self.arrivedbutton.Disable()
            self.donebutton.Enable()
        elif self.donelistbox.GetSelection() > -1:
            self.withvetbutton.Disable()
            self.arrivedbutton.Disable()
            self.donebutton.Disable()
        else:
            self.withvetbutton.Disable()
            self.arrivedbutton.Disable()
            self.donebutton.Disable()
            self.detailswindow.SetPage("")