コード例 #1
0
def CreateSettingsTable(connection):

    action = "CREATE TABLE settings (ID int unsigned not null auto_increment primary key, PracticeName varchar(100), OpenFrom varchar(10), OpenTo varchar(10), OperationTime varchar(10), PracticeAddress varchar(250), PracticePostcode varchar(10), PracticeTelephone varchar(20), PracticeEmail varchar(250), PracticeWebsite varchar(250), ShelterID int, MarkupMultiplyBy varchar(10), MarkupRoundTo int, ASMVaccinationID int, PrescriptionFee int)"
    db.SendSQL(action, connection)

    action = "INSERT INTO settings (PracticeName, OpenFrom, OpenTo, OperationTime, PracticeAddress, PracticePostcode, PracticeTelephone, PracticeEmail, PracticeWebsite, ShelterID, MarkupMultiplyBy, MarkupRoundTo, ASMVaccinationID, PrescriptionFee) VALUES (\'Unnamed Surgery\', \'09:00\', \'17:00\', \'09:00\', \"\", \"\", \"\", \"\", \"\", 0, \"1.175\", 5, 0, 0)"
    db.SendSQL(action, connection)
コード例 #2
0
ファイル: staymethods.py プロジェクト: tuksik/evette
    def SubmitKennel(self, ID):

        panel = ID.GetEventObject().GetParent()

        name = panel.nameentry.GetValue()
        description = panel.descriptionentry.GetValue()

        if panel.kennelid == 0:

            action = "INSERT INTO kennel (KennelBlockID, Name, Description) VALUES (" + str(
                self.kennelblockid
            ) + ", \"" + name + "\", \"" + description + "\")"
            db.SendSQL(action, self.localsettings.dbconnection)

            action = "SELECT LAST_INSERT_ID() FROM kennel"
            self.listbox.selectedid = db.SendSQL(
                action, self.localsettings.dbconnection)[0][0]

        else:

            action = "REPLACE INTO kennel (ID, KennelBlockID, Name, Description) VALUES (" + str(
                panel.kennelid) + ", " + str(
                    self.kennelblockid
                ) + ", \"" + name + "\", \"" + description + "\")"
            db.SendSQL(action, self.localsettings.dbconnection)

        dialog = panel.GetParent()
        dialog.Close()

        self.listbox.RefreshList()
コード例 #3
0
def WriteToMediaTable(connection, ID, linktype, linkid, filename, description,
                      filesize, content, uploadedby):

    #linktypes: 0 = client, 1 = animal

    if ID == False:

        action = "INSERT INTO media (LinkType, LinkID, FileName, Description, FileSize, Content, UploadedBy) VALUES (" + str(
            linktype) + ", " + str(
                linkid
            ) + ", \'" + filename + "\', \'" + description + "\', " + str(
                filesize) + ", \'" + MySQLdb.escape_string(
                    content) + "\', \'" + uploadedby + "\')"
        db.SendSQL(action, connection)

        action = "SELECT LAST_INSERT_ID() FROM media"
        ID = db.SendSQL(action, connection)

    else:

        action = "REPLACE INTO media (ID, LinkType, LinkID, FileName, Description, FileSize, Content, UploadedBy) VALUES (" + str(
            ID) + ", " + str(linktype) + ", " + str(
                linkid
            ) + ", \'" + filename + "\', \'" + description + "\', " + str(
                filesize) + ", \'" + MySQLdb.escape_string(
                    content) + "\', \'" + uploadedby + "\')"
        db.SendSQL(action, connection)
コード例 #4
0
def WriteToInvoiceTable(connection,
                        ID,
                        clientid,
                        fromdate,
                        todate,
                        total,
                        body,
                        paid=0):

    if ID == False:

        action = "INSERT INTO invoice (ClientID, FromDate, ToDate, Total, Body, Paid) VALUES (\'" + str(
            clientid) + "\', \'" + fromdate + "\', \'" + todate + "\', " + str(
                total) + ", \'" + body + "\', " + str(paid) + ")"
        db.SendSQL(action, connection)

        action = "SELECT LAST_INSERT_ID() FROM invoice"
        ID = db.SendSQL(action, connection)[0][0]

    else:

        action = "REPLACE INTO invoice (ID, ClientID, FromDate, ToDate, Total, Body, Paid) VALUES (" + str(
            ID) + ", \'" + str(
                clientid
            ) + "\', \'" + fromdate + "\', \'" + todate + "\', " + str(
                total) + ", \'" + body + "\', " + str(paid) + ")"
        db.SendSQL(action, connection)

    return ID
コード例 #5
0
ファイル: diarymethods.py プロジェクト: tuksik/evette
    def EditNote(self, ID):

        title = ""

        listboxid = self.diarylistbox.GetSelection()

        noteid = self.diarylistbox.htmllist[listboxid][0]

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

        if linktype == 1:

            action = "SELECT ClientTitle, ClientSurname FROM client WHERE ID = " + str(
                linkid)
            results = db.SendSQL(action, self.localsettings.dbconnection)

            title = results[0][0] + " " + results[0][1]

        elif linktype == 2:

            action = "SELECT animal.Name, client.ClientSurname, animal.Species FROM animal INNER JOIN client ON animal.OwnerID = client.ID WHERE animal.ID = " + str(
                linkid)
            results = db.SendSQL(action, self.localsettings.dbconnection)

            title = results[0][0] + " " + results[0][1] + " (" + results[0][
                2] + ")"

        diarynotepanel = DiaryNotePanel(self.notebook, self.localsettings,
                                        linktype, linkid, title, noteid, self)
        self.notebook.AddPage(diarynotepanel)
コード例 #6
0
ファイル: attachedfilemethods.py プロジェクト: tuksik/evette
    def SubmitRename(self, ID):

        panel = ID.GetEventObject().GetParent()

        description = panel.nameinput.GetValue()

        listboxid = self.listbox.GetSelection()
        mediaid = self.listbox.htmllist[listboxid][0]

        todaysdate = datetime.date.today()
        todayssqldate = miscmethods.GetSQLDateFromDate(todaysdate)

        uploadedby = todayssqldate + "$$$" + self.localsettings.username

        action = "UPDATE media SET Description = \"" + description + "\" WHERE ID = " + str(
            mediaid)
        db.SendSQL(action, self.localsettings.dbconnection)

        action = "UPDATE media SET uploadedby = \"" + uploadedby + "\" WHERE ID = " + str(
            mediaid)
        db.SendSQL(action, self.localsettings.dbconnection)

        panel.GetParent().Close()

        self.listbox.RefreshList()
コード例 #7
0
def WriteToWeightTable(connection,
                       ID,
                       animalid,
                       date,
                       weight,
                       localsettings,
                       changelog=False):

    currenttime = datetime.datetime.today().strftime("%x %X")
    userid = localsettings.userid

    if ID == False:

        changelog = currenttime + "%%%" + str(userid)

        action = "INSERT INTO weight (Date, AnimalID, Weight, Changelog) VALUES (\'" + date + "\', " + str(
            animalid) + ", " + str(weight) + ", \'" + changelog + "\')"
        db.SendSQL(action, connection)

        action = "SELECT LAST_INSERT_ID() FROM weight"
        ID = db.SendSQL(action, connection)[0][0]

    else:

        changelog = currenttime + "%%%" + str(userid) + "$$$" + changelog

        action = "REPLACE INTO weight (ID, Date, AnimalID, Weight, Changelog) VALUES (" + str(
            ID) + ", \'" + date + "\', " + str(animalid) + ", " + str(
                weight) + ", \'" + changelog + "\')"
        db.SendSQL(action, connection)

    return ID
コード例 #8
0
ファイル: proceduremethods.py プロジェクト: tuksik/evette
	def SubmitProcedure(self, ID):
		
		panel = ID.GetEventObject().GetParent()
		
		name = panel.nameentry.GetValue()
		
		if name == "":
			
			miscmethods.ShowMessage(self.GetLabel("proceduresunnamedproceduremessage"))
			
		else:
			
			description = panel.descriptionentry.GetValue()
			price = panel.priceentry.GetValue()
			price = str(miscmethods.ConvertPriceToPennies(price))
			
			if panel.procedureid > -1:
				
				procedureid = panel.procedureid
				
				action = "REPLACE INTO procedures (ID, Name, Description, Price) VALUES (" + str(procedureid) + ", \"" + name + "\", \"" + description + "\", \"" + price + "\")"
				db.SendSQL(action, self.localsettings.dbconnection)
				
			else:
				
				action = "INSERT INTO procedures (Name, Description, Price) VALUES (\"" + name + "\", \"" + description + "\", \"" + price + "\")"
				db.SendSQL(action, self.localsettings.dbconnection)
			
			self.RefreshList()
			
			panel.GetParent().Close()
コード例 #9
0
def WriteToAnimalTable(connection, animaldata):

    ID = animaldata.ID
    OwnerID = animaldata.ownerid
    Name = animaldata.name
    Sex = animaldata.sex
    Species = animaldata.species
    Breed = animaldata.breed
    Colour = animaldata.colour
    DOB = animaldata.dob
    Comments = miscmethods.ValidateEntryString(animaldata.comments)
    Neutered = animaldata.neutered
    ChipNo = animaldata.chipno
    IsDeceased = animaldata.deceased
    DeceasedDate = animaldata.deceaseddate
    CauseOfDeath = animaldata.causeofdeath
    ASMRef = animaldata.asmref

    fields = (ID, OwnerID, Name, Sex, Species, Breed, Colour, DOB, Comments,
              Neutered, ChipNo)

    if ID != False:

        action = "REPLACE INTO animal (ID, OwnerID, Name, Sex, Species, Breed, Colour, DOB, Comments, Neutered, ChipNo, ChangeLog, IsDeceased, DeceasedDate, CauseOfDeath, ASMRef) VALUES ( " + str(
            fields[0]
        ) + ", " + str(fields[1]) + ", \'" + fields[2] + "\', " + str(
            fields[3]
        ) + ", \'" + fields[4] + "\', \'" + fields[5] + "\', \'" + fields[
            6] + "\', \'" + fields[7] + "\', \'" + fields[8] + "\', " + str(
                fields[9]) + ", \'" + fields[
                    10] + "\', \'" + animaldata.changelog + "\', " + str(
                        IsDeceased
                    ) + ", \'" + str(
                        DeceasedDate
                    ) + "\', \'" + CauseOfDeath + "\', \'" + ASMRef + "\' )"

        #print action

        db.SendSQL(action, connection)

    else:

        action = "INSERT INTO animal (OwnerID, Name, Sex, Species, Breed, Colour, DOB, Comments, Neutered, ChipNo, ChangeLog, IsDeceased, DeceasedDate, CauseOfDeath, ASMRef) VALUES ( " + str(
            fields[1]
        ) + ", \'" + fields[2] + "\', " + str(
            fields[3]
        ) + ", \'" + fields[4] + "\', \'" + fields[5] + "\', \'" + fields[
            6] + "\', \'" + fields[7] + "\', \'" + fields[8] + "\', " + str(
                fields[9]) + ", \'" + fields[
                    10] + "\', \'" + animaldata.changelog + "\', " + str(
                        IsDeceased
                    ) + ", \'" + str(
                        DeceasedDate
                    ) + "\', \'" + CauseOfDeath + "\', \'" + ASMRef + "\' )"

        db.SendSQL(action, connection)
        action = "SELECT ID FROM animal"
        ID = db.SendSQL(action, connection)[-1][0]

    animaldata.ID = ID
コード例 #10
0
def GetBalance(clientdata, localsettings):

    connection = db.GetConnection(localsettings)

    action = "SELECT receipt.Price FROM receipt WHERE receipt.Type = 4 AND receipt.TypeID = " + str(
        clientdata.ID)

    balanceresults1 = db.SendSQL(action, connection)

    action = "SELECT receipt.Price FROM appointment INNER JOIN receipt ON appointment.ID = receipt.AppointmentID WHERE appointment.OwnerID = " + str(
        clientdata.ID)

    balanceresults2 = db.SendSQL(action, connection)

    connection.close()

    balanceresults = balanceresults1 + balanceresults2

    balance = 0

    for a in balanceresults:

        balance = balance + a[0]

    return balance
コード例 #11
0
def WriteToProceduresTable(connection,
                           ID=False,
                           Name=False,
                           Description=False,
                           Price=False):

    fields = (ID, Name, Description, Price)

    if ID != False:

        action = "REPLACE INTO procedures (ID, Name, Description, Price) VALUES ( " + str(
            fields[0]) + ", \'" + str(
                fields[1]
            ) + "\', \'" + fields[2] + "\', \'" + fields[3] + "\' )"
        db.SendSQL(action, connection)
        ID = fields[0]

    else:

        action = "INSERT INTO procedures ( Name, Description, Price) VALUES ( \'" + str(
            fields[1]) + "\', \'" + fields[2] + "\', \'" + fields[3] + "\' )"
        db.SendSQL(action, connection)
        action = "SELECT ID FROM procedures"
        ID = db.SendSQL(action, connection)[-1][0]

    return ID
コード例 #12
0
def WriteToMedicationInTable(connection, medicationindata):

    #fields = (ID, MedicationID, Date, Amount, BatchNo, Expires, WhereFrom)

    ID = medicationindata.ID
    medicationid = medicationindata.medicationid
    date = medicationindata.date
    amount = medicationindata.amount
    batchno = medicationindata.batchno
    expires = medicationindata.expires
    if expires == None:
        expires = "0000-00-00"
    wherefrom = medicationindata.wherefrom
    changelog = medicationindata.changelog

    if ID != False:

        action = "REPLACE INTO medicationin (ID, MedicationID, Date, Amount, BatchNo, Expires, WhereFrom, ChangeLog) VALUES ( " + str(
            ID
        ) + ", " + str(medicationid) + ", \'" + date + "\', " + str(
            amount
        ) + ", \'" + batchno + "\', \'" + expires + "\', \'" + wherefrom + "\', \'" + changelog + "\' )"
        db.SendSQL(action, connection)

    else:

        action = "INSERT INTO medicationin (MedicationID, Date, Amount, BatchNo, Expires, WhereFrom, ChangeLog) VALUES ( " + str(
            medicationid
        ) + ", \'" + date + "\', " + str(
            amount
        ) + ", \'" + batchno + "\', \'" + expires + "\', \'" + wherefrom + "\', \'" + changelog + "\' )"
        db.SendSQL(action, connection)
        action = "SELECT ID FROM medicationin"
        ID = db.SendSQL(action, connection)[-1][0]
        medicationindata.ID = ID
コード例 #13
0
def CreateVersionTable(connection):

    action = "CREATE TABLE version (ID int unsigned not null auto_increment primary key, VersionNo varchar(10))"
    db.SendSQL(action, connection)

    versionno = dbupdates.GetCurrentVersion()

    action = "INSERT INTO version (VersionNo) VALUES (\'" + versionno + "\')"
    db.SendSQL(action, connection)
コード例 #14
0
def WriteToAppointmentTable(connection, appointmentdata):

    fields = (appointmentdata.ID, appointmentdata.animalid,
              appointmentdata.ownerid, appointmentdata.date,
              appointmentdata.time,
              miscmethods.ValidateEntryString(appointmentdata.reason),
              appointmentdata.arrived, appointmentdata.withvet,
              miscmethods.ValidateEntryString(appointmentdata.problem),
              miscmethods.ValidateEntryString(appointmentdata.notes),
              miscmethods.ValidateEntryString(appointmentdata.plan),
              appointmentdata.done, appointmentdata.operation,
              appointmentdata.vet)

    fieldnames = ("ID", "AnimalID", "OwnerID", "Date", "Time",
                  "AppointmentReason", "Arrived", "WithVet", "Problem",
                  "Notes", "Plan", "Done", "Operation", "Vet")

    if appointmentdata.ID != False:

        if appointmentdata.arrivaltime == None:

            arrivaltime = "NULL"

        else:

            arrivaltime = "\"" + str(appointmentdata.arrivaltime) + "\""

        action = "REPLACE INTO appointment (ID, AnimalID, OwnerID, Date, Time, AppointmentReason, Arrived, WithVet, Problem, Notes, Plan, Done, Operation, Vet, ChangeLog, Staying, ArrivalTime) VALUES ( " + str(
            fields[0]
        ) + ", " + str(fields[1]) + ", " + str(fields[2]) + ", \'" + str(
            fields[3]
        ) + "\', \'" + str(fields[4]) + "\', \'" + fields[5] + "\', " + str(
            fields[6]
        ) + ", " + str(fields[7]) + ", \'" + fields[8] + "\', \'" + fields[
            9] + "\', \'" + fields[10] + "\', " + str(fields[11]) + ", " + str(
                fields[12]
            ) + ", \'" + appointmentdata.vet + "\', \'" + appointmentdata.changelog + "\', " + str(
                appointmentdata.staying) + ", " + arrivaltime + " )"
        db.SendSQL(action, connection)

    else:

        action = "INSERT INTO appointment (AnimalID, OwnerID, Date, Time, AppointmentReason, Arrived, WithVet, Problem, Notes, Plan, Done, Operation, Vet, ChangeLog, Staying, ArrivalTime) VALUES ( " + str(
            fields[1]
        ) + ", " + str(fields[2]) + ", \'" + str(fields[3]) + "\', \'" + str(
            fields[4]
        ) + "\', \'" + fields[5] + "\', " + str(fields[6]) + ", " + str(
            fields[7]
        ) + ", \'" + fields[8] + "\', \'" + fields[9] + "\', \'" + fields[
            10] + "\', " + str(fields[11]) + ", " + str(
                fields[12]
            ) + ", \'" + appointmentdata.vet + "\', \'" + appointmentdata.changelog + "\', " + str(
                appointmentdata.staying) + ", NULL )"
        db.SendSQL(action, connection)
        action = "SELECT LAST_INSERT_ID() FROM appointment"
        appointmentdata.ID = db.SendSQL(action, connection)[0][0]
コード例 #15
0
def WriteToStaffTable(connection, date, name, position, timeon, timeoff,
                      operating, ID, localsettings):

    success = False

    if miscmethods.ValidateTime(timeon) == True and miscmethods.ValidateTime(
            timeoff) == True:

        timeonint = int(timeon[:2] + timeon[3:5])
        timeoffint = int(timeoff[:2] + timeoff[3:5])

        if timeonint < timeoffint:

            success = True
        else:

            miscmethods.ShowMessage(
                GetLabel(localsettings, "vetfinishedbeforestartingmessage"))

    if success == True:

        starttimesql = timeon[:2] + ":" + timeon[3:5] + ":00"
        offtimesql = timeoff[:2] + ":" + timeoff[3:5] + ":00"

        action = "SELECT ID FROM staff WHERE DATE = \'" + str(
            date
        ) + "\' AND Name = \'" + name + "\' AND ( \'" + starttimesql + "\' BETWEEN TimeOn AND TimeOff OR \'" + offtimesql + "\' BETWEEN TimeOn AND TimeOff OR TimeOn BETWEEN \'" + starttimesql + "\' AND \'" + offtimesql + "\' OR TimeOff BETWEEN \'" + starttimesql + "\' AND \'" + offtimesql + "\' )"
        results = db.SendSQL(action, connection)

        if len(results) > 0 and ID == False:

            miscmethods.ShowMessage(
                GetLabel(localsettings, "vettwoplacesatoncemessage"))

            success = False
        else:

            if ID == False:
                action = "INSERT INTO staff (Name, Date, Position, TimeOn, TimeOff, Operating) VALUES (\'" + name + "\', \'" + str(
                    date
                ) + "\', \'" + position + "\', \'" + timeon + "\', \'" + timeoff + "\', " + str(
                    operating) + ")"
            else:
                action = "REPLACE INTO staff (ID, Name, Date, Position, TimeOn, TimeOff, Operating) VALUES (" + str(
                    ID
                ) + ", \'" + name + "\', \'" + str(
                    date
                ) + "\', \'" + position + "\', \'" + timeon + "\', \'" + timeoff + "\', " + str(
                    operating) + ")"
            db.SendSQL(action, connection)

    else:

        miscmethods.ShowMessage(GetLabel(localsettings, "invalidtimemessage"))

    return success
コード例 #16
0
def CreateKennelTables(connection):

    action = "CREATE TABLE kennelblock (ID int unsigned not null auto_increment primary key, Name varchar(100), Description varchar(250))"
    db.SendSQL(action, connection)

    action = "CREATE TABLE kennel (ID int unsigned not null auto_increment primary key, KennelBlockID int, Name varchar(100), Description varchar(250))"
    db.SendSQL(action, connection)

    action = "CREATE TABLE kennelstay (ID int unsigned not null auto_increment primary key, AnimalID int, KennelID int, DateIn date, TimeIn varchar(10), DateOut date, TimeOut varchar(10), Comments text)"
    db.SendSQL(action, connection)
コード例 #17
0
def CreateMedicationTables(connection):

    action = "CREATE TABLE medication (ID int unsigned not null auto_increment primary key, Name varchar(50), Description varchar(250), Unit varchar(20), BatchNo varchar(30), CurrentPrice int, ChangeLog text, ReOrderNo int, ExpiryDate date, Type int, CostPrice int)"  ## -- Types(0 = medication, 1 = vaccination, 2 = consumable, 3 = shop, 4 = chip)
    db.SendSQL(action, connection)

    action = "CREATE TABLE medicationin (ID int unsigned not null auto_increment primary key, MedicationID int, Date date, Amount int, BatchNo varchar(30), Expires date, WhereFrom varchar(50), ChangeLog text)"
    db.SendSQL(action, connection)

    action = "CREATE TABLE medicationout (ID int unsigned not null auto_increment primary key, MedicationID int, Date date, Amount int, BatchNo varchar(30), WhereTo varchar(50), AppointmentID int, ChangeLog text, NextDue date)"
    db.SendSQL(action, connection)
コード例 #18
0
def CreateProceduresTable(connection):

    action = "CREATE TABLE procedures (ID int unsigned not null auto_increment primary key, Name varchar(50), Description text, Price int)"
    db.SendSQL(action, connection)

    standardprocedures = (("General Checkover", "Full body check", 500),
                          ("Clip Claws", "Claws clipped", 250))

    for a in standardprocedures:

        action = "INSERT INTO procedures (Name, Description, Price) VALUES (\'" + a[
            0] + "\', \'" + a[1] + "\', " + str(a[2]) + ")"
        db.SendSQL(action, connection)
コード例 #19
0
def WriteToLostAndFoundTable(connection, lostandfounddata):

    if lostandfounddata.ID == False:

        action = "INSERT INTO lostandfound (ChangeLog) VALUES (\"" + lostandfounddata.changelog + "\")"
        db.SendSQL(action, connection)

        action = "SELECT LAST_INSERT_ID() FROM lostandfound"
        lostandfounddata.ID = db.SendSQL(action, connection)[0][0]

    action = "UPDATE lostandfound SET LostOrFound = " + str(
        lostandfounddata.lostorfound) + ", ContactID = " + str(
            lostandfounddata.contactid
        ) + ", Species = \"" + str(
            lostandfounddata.species
        ) + "\", Date = \"" + str(lostandfounddata.date) + "\", Sex = " + str(
            lostandfounddata.sex) + ", Neutered = " + str(
                lostandfounddata.neutered) + ", FurLength = " + str(
                    lostandfounddata.furlength) + ", Colour1 = \"" + str(
                        lostandfounddata.colour1) + "\", Colour2 = \"" + str(
                            lostandfounddata.colour2
                        ) + "\", Colour3 = \"" + str(
                            lostandfounddata.colour3) + "\", Collar = " + str(
                                lostandfounddata.collar
                            ) + ", CollarDescription = \"" + str(
                                lostandfounddata.collardescription
                            ) + "\", Size = " + str(
                                lostandfounddata.size) + ", Age = " + str(
                                    lostandfounddata.age
                                ) + ", IsChipped = " + str(
                                    lostandfounddata.ischipped
                                ) + ", ChipNo = \"" + str(
                                    lostandfounddata.chipno
                                ) + "\", Temperament = " + str(
                                    lostandfounddata.temperament
                                ) + ", Comments = \"" + str(
                                    lostandfounddata.comments
                                ) + "\", DateComplete = \"" + str(
                                    lostandfounddata.datecomplete
                                ) + "\", ChangeLog = \"" + str(
                                    lostandfounddata.changelog
                                ) + "\", Area = \"" + str(
                                    lostandfounddata.area
                                ) + "\", AnimalID = " + str(
                                    lostandfounddata.animalid
                                ) + " WHERE ID = " + str(lostandfounddata.ID)

    db.SendSQL(action, connection)
コード例 #20
0
ファイル: settings.py プロジェクト: tuksik/evette
    def UpdateShelterName(self, ID=False):

        action = "SELECT client.ClientTitle, client.ClientForenames, client.ClientSurname FROM client INNER JOIN settings ON settings.ShelterID = client.ID"
        shelteridresults = db.SendSQL(action, self.localsettings.dbconnection)

        if len(shelteridresults) > 0:

            sheltername = ""

            if shelteridresults[0][0] != "":

                sheltername = sheltername + shelteridresults[0][0] + " "

            if shelteridresults[0][1] != "":

                sheltername = sheltername + shelteridresults[0][1] + " "

            if shelteridresults[0][2] != "":

                sheltername = sheltername + shelteridresults[0][2]

        else:

            sheltername = self.GetLabel("nonelabel")

        self.asmshelterentry.SetValue(sheltername)
コード例 #21
0
ファイル: attachedfilemethods.py プロジェクト: tuksik/evette
    def SaveMedia(self, ID=False):

        busy = wx.BusyCursor()

        listboxid = self.listbox.GetSelection()

        mediaid = self.listbox.htmllist[listboxid][0]
        filename = self.listbox.htmllist[listboxid][3]

        action = "SELECT Content FROM media WHERE ID = " + str(mediaid)
        results = db.SendSQL(action, self.localsettings.dbconnection)

        output = base64.decodestring(str(results[0][0]))

        if filename.__contains__("."):

            fileextension = filename.split(".")[-1]

        else:

            fileextension = ""

        targetfile = wx.SaveFileSelector(fileextension.upper(), fileextension,
                                         filename)

        out = open(targetfile, "wb")
        out.write(output)
        out.close()

        del busy
コード例 #22
0
ファイル: settings.py プロジェクト: tuksik/evette
    def UpdateShelterVaccination(self, ID=False):

        try:
            asmconnection = db.GetASMConnection()
            action = "SELECT ID, VaccinationType FROM vaccinationtype WHERE ID = " + str(
                self.localsettings.asmvaccinationid)
            asmvaccinationresults = db.SendSQL(action, asmconnection)
            asmconnection.close()

            if len(asmvaccinationresults) > 0:

                self.localsettings.asmvaccinationid = asmvaccinationresults[0][
                    0]
                asmvaccinationtype = asmvaccinationresults[0][1]

            else:

                self.localsettings.asmvaccinationid = 0
                asmvaccinationtype = self.GetLabel("nonelabel")

            self.asmvaccinationentry.SetValue(asmvaccinationtype)

        except:

            self.asmvaccinationentry.SetValue(self.GetLabel("errorlabel"))
            self.asmvaccinationbutton.Disable()
コード例 #23
0
    def GetStaffList(self):

        date = miscmethods.GetSQLDateFromDate(self.date)

        action = "SELECT Name, Position FROM staff WHERE Date = \"" + str(
            date) + "\" ORDER BY Name"
        results = db.SendSQL(action, self.localsettings.dbconnection)

        vets = []
        nurses = []
        others = []

        for a in results:

            if a[1] == self.GetLabel("vetpositiontitle"):

                vets.append(a[0])

            elif a[1] == self.GetLabel("vetnursepositiontitle"):

                nurses.append(a[0])

            else:

                others.append(a[0])

        return (vets, nurses, others)
コード例 #24
0
def FormatChangeLog(changelog, name, connection):

    localsettings = settings.settings(False)
    localsettings.GetSettings()

    output = name + "\n\n"

    count = 0

    for a in changelog.split("$$$"):

        date = a.split("%%%")[0]
        userid = a.split("%%%")[1]

        try:
            action = "SELECT Name FROM user WHERE ID = " + str(userid)
            results = db.SendSQL(action, connection)
            username = results[0][0]
        except:
            username = localsettings.dictionary["userdeleted"][
                localsettings.language]

        output = output + date + " - " + username + "\n"

        count = count + 1

        if count == 10:
            break

    return output.strip()
コード例 #25
0
    def SubmitLookup(self, ID):

        panel = ID.GetEventObject().GetParent()

        name = panel.nameentry.GetValue()

        lookup = self.lookup
        columnname = lookup[0].upper() + lookup[1:] + "Name"

        if name == "":

            miscmethods.ShowMessage(self.GetLabel("lookupsnonamemessage"))

        else:

            if panel.lookupid == False:

                action = "INSERT INTO " + lookup + " (" + columnname + ") VALUES (\"" + name + "\")"

            else:

                action = "UPDATE " + lookup + " SET " + columnname + " = \"" + name + "\" WHERE ID = " + str(
                    panel.lookupid)

            db.SendSQL(action, self.localsettings.dbconnection)
            self.RefreshLookups()

            panel.GetParent().Close()
コード例 #26
0
ファイル: formmethods.py プロジェクト: tuksik/evette
	def RefreshList(self, ID=False):
		
		self.Hide()
		
		listboxid = self.GetSelection()
		
		if listboxid != -1:
			templatename = self.htmllist[listboxid]
		else:
			templatename = "None"
		
		action = "SELECT * FROM form WHERE FormType = \"" + self.formtype + "\" ORDER BY Title"
		results = db.SendSQL(action, self.localsettings.dbconnection)
		
		
		self.htmllist = results
		
		self.SetItemCount(len(self.htmllist))
		
		self.SetSelection(-1)
		
		for a in range(0, len(self.htmllist)):
			
			if self.htmllist[a][1] == templatename:
				
				self.SetSelection(a)
		
		self.Refresh()
		
		self.Show()
コード例 #27
0
def WriteToUserTable(connection, ID, name, password, position, permissions):

    if ID == False:
        action = "INSERT INTO user (Name, Password, Position, Permissions) VALUES (\'" + name + "\', \'" + password + "\', \'" + position + "\', \'" + permissions + "\')"
    else:
        action = "REPLACE INTO user (ID, Name, Password, Position, Permissions) VALUES (" + str(
            ID
        ) + ", \'" + name + "\', \'" + password + "\', \'" + position + "\', \'" + permissions + "\')"
    db.SendSQL(action, connection)
コード例 #28
0
	def Delete(self, ID):
		
		if miscmethods.ConfirmMessage("Are you sure that you want to delete this appointment?") == True:
			
			action = "DELETE FROM appointment WHERE ID = " + str(self.appointmentdata.ID)
			db.SendSQL(action, self.appointmentdata.localsettings.dbconnection)
			
			
			self.Close(self)
コード例 #29
0
    def Delete(self, ID):

        listboxid = self.staffsummarylistbox.GetSelection()
        staffid = self.staffsummarylistbox.htmllist[listboxid][0]

        action = "DELETE FROM staff WHERE ID = " + str(staffid)
        db.SendSQL(action, self.localsettings.dbconnection)

        self.RefreshRota()
コード例 #30
0
ファイル: attachedfilemethods.py プロジェクト: tuksik/evette
    def RefreshList(self, ID=False):

        action = "SELECT ID, LinkType, LinkID, FileName, Description, FileSize, UploadedBy FROM media WHERE LinkType = " + str(
            self.linktype) + " AND LinkID = " + str(
                self.linkid) + " ORDER BY UploadedBy desc"

        self.htmllist = db.SendSQL(action, self.localsettings.dbconnection)

        customwidgets.ListCtrlWrapper.RefreshList(self)