示例#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)
示例#2
0
	def OpenAnimalRecord(self, ID):
		
		notebook = ID.GetEventObject().GetGrandParent()
		
		animaldata = self.appointmentdata.animaldata
		
		animalpanel = animalmethods.AnimalPanel(notebook, animaldata)
		
		notebook.AddPage(animalpanel)
示例#3
0
    def EditAnimal(self, ID=False):

        listboxid = self.listbox.GetSelection()
        animalid = self.listbox.htmllist[listboxid][5]
        animaldata = animalmethods.AnimalSettings(self.localsettings, False,
                                                  animalid)

        notebook = self.GetGrandParent().GetGrandParent()

        animalpanel = animalmethods.AnimalPanel(notebook, animaldata)
        notebook.AddPage(animalpanel)
示例#4
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)
示例#5
0
    def EditAnimalFromMenu(self, ID):

        animalpanel = animalmethods.AnimalPanel(
            self.notebook, self.selectedappointmentdata.animaldata)
        wx.CallAfter(self.notebook.AddPage, animalpanel)
示例#6
0
文件: evette.py 项目: tuksik/evette
	def SubmitASMImport(self, ID):
		
		panel = ID.GetEventObject().GetGrandParent()
		
		listboxid = panel.listbox.GetSelection()
		
		if listboxid != -1:
			
			animaldata = panel.animaldata[listboxid]
			
			action = "SELECT ID FROM animal WHERE ASMRef = \"" + animaldata[0] + "\""
			results = db.SendSQL(action, self.localsettings.dbconnection)
			
			if len(results) > 0:
				
				if miscmethods.ConfirmMessage(self.GetMenu("alreadyimportedmessage"), self.notebook):
					
					animalsettings = animalmethods.AnimalSettings(self.localsettings, False, results[0][0])
					
					animalpanel = animalmethods.AnimalPanel(self.notebook, animalsettings)
					
					self.notebook.AddPage(animalpanel)
					
					panel.GetParent().Close()
				
			else:
				
				archived = animaldata[10]
				activemovementtype = animaldata[11]
				
				if archived == 0 or activemovementtype == 2:
					
					action = "SELECT ShelterID FROM settings"
					clientid = db.SendSQL(action, self.localsettings.dbconnection)[0][0]
					
					#miscmethods.ShowMessage("Animal is on shelter", panel)
					
				else:
					
					action = "SELECT owner.OwnerSurname, owner.OwnerAddress, owner.OwnerPostcode, owner.HomeTelephone, owner.MobileTelephone, owner.WorkTelephone, owner.EmailAddress, animal.ActiveMovementType, owner.OwnerTitle, owner.OwnerForenames FROM owner INNER JOIN adoption ON adoption.OwnerID = owner.ID INNER JOIN animal ON adoption.ID = animal.ActiveMovementID WHERE animal.ShelterCode = \"" + animaldata[0] + "\" AND ( animal.ActiveMovementType = 1 OR animal.ActiveMovementType = 2 ) AND animal.Archived = 1"
					results = db.SendSQL(action, panel.asmconnection)
					
					if len(results) == 1:
						
						ownersurname = results[0][0]
						
						if ownersurname == None:
							
							ownersurname = ""
						
						owneraddress = results[0][1]
						
						if owneraddress == None:
							
							owneraddress = ""
						
						owneraddress = owneraddress.replace("\r", "")
						
						ownerpostcode = results[0][2]
						
						if ownerpostcode == None:
							
							ownerpostcode = ""
						
						ownerhometelephone = results[0][3]
						
						if ownerhometelephone == None:
							
							ownerhometelephone = ""
						
						ownermobiletelephone = results[0][4]
						
						if ownermobiletelephone == None:
							
							ownermobiletelephone = ""
						
						ownerworktelephone = results[0][5]
						
						if ownerworktelephone == None:
							
							ownerworktelephone = ""
						
						owneremailaddress = results[0][6]
						
						if owneremailaddress == None:
							
							owneremailaddress = ""
						
						movementtype = results[0][7]
						
						ownertitle = results[0][8]
						
						if ownertitle == None:
							
							ownertitle = ""
						
						ownerforenames = results[0][9]
						
						if ownerforenames == None:
							
							ownerforenames = ""
						
						action = "SELECT ID, ClientTitle, ClientForenames, ClientSurname, ClientAddress FROM client WHERE ClientPostCode = \"" + ownerpostcode + "\" OR ClientSurname = \"" + ownersurname + "\""
						evetteowners = db.SendSQL(action, self.localsettings.dbconnection)
						
						possiblematches = []
						
						asmhousenumber = owneraddress.split(" ")[0]
						
						for a in evetteowners:
							
							evettehousenumber = a[4].split(" ")[0]
							
							if asmhousenumber == evettehousenumber:
								
								possiblematches.append(a)
								
							else:
								
								if ownerforenames == "" or a[2] == "" or ownerforenames == a[2]:
									
									possiblematches.append(a)
						
						selectedownerid = 0
						
						panel.chosenownerid = 0
						
						if len(possiblematches) > 0:
							
							panel.possiblematches = possiblematches
							
							dialog = wx.Dialog(panel, -1, "Possible Owners")
							
							dialog.panel = panel
							
							topsizer = wx.BoxSizer(wx.VERTICAL)
							
							sheltermanagerownerinfo = wx.StaticText(dialog, -1, ownertitle + " " + ownerforenames + " " + ownersurname + ". " + owneraddress.replace("\n", ", ") + ". " + ownerpostcode)
							
							topsizer.Add(sheltermanagerownerinfo, 0, wx.EXPAND)
							
							topsizer.Add(wx.StaticText(dialog, -1, "", size=(-1,10)))
							
							chooseownerlabel = wx.StaticText(dialog, -1, "Choose an owner")
							topsizer.Add(chooseownerlabel, 0, wx.ALIGN_LEFT)
							
							dialog.listbox = wx.ListBox(dialog)
							dialog.listbox.Bind(wx.EVT_LISTBOX_DCLICK, self.SelectOwner)
							
							for v in possiblematches:
								
								listboxoutput = v[1] + " " + v[2] + " " + v[3] + ". " + v[4].replace("\n", ", ").replace("\r", "")
								
								dialog.listbox.Append(listboxoutput)
							
							topsizer.Add(dialog.listbox, 1, wx.EXPAND)
							
							dialog.SetSizer(topsizer)
							
							
							
							dialog.ShowModal()
							
							clientid = panel.chosenownerid
							
						if panel.chosenownerid == 0:
							
							clientsettings = clientmethods.ClientSettings(self.localsettings)
							
							clientsettings.title = ownertitle
							clientsettings.forenames = ownerforenames
							clientsettings.surname = ownersurname
							clientsettings.address = owneraddress
							clientsettings.postcode = ownerpostcode
							clientsettings.hometelephone = ownerhometelephone
							clientsettings.mobiletelephone = ownermobiletelephone
							clientsettings.worktelephone = ownerworktelephone
							clientsettings.emailaddress = owneremailaddress
							clientsettings.comments = "Imported from ASM"
							
							clientsettings.Submit()
							
							clientid = clientsettings.ID
						
					else:
						
						clientid = 0
				
				if clientid > 0:
					
					animalsettings = animalmethods.AnimalSettings(self.localsettings, clientid)
					
					animalsettings.name = animaldata[1]
##					print "animaldata[2] = " + str(animaldata[2])
##					if animaldata[2] == 0:
##                                                animalsettings.sex = 2
##                                        elif animaldata[2] == 1:
##                                                animalsettings.sex = 1
##                                        else:
##                                                animalsettings.sex = 0
##                                        
##                                        print "sex = " + str(animalsettings.sex)
                                        
                                        if animaldata[2] == self.GetMenu("malelabel"):
                                                
                                                animalsettings.sex = 1
                                                
                                        elif animaldata[2] == self.GetMenu("femalelabel"):
                                                
                                                animalsettings.sex = 2
                                        else:
                                                
                                                animalsettings.sex = 0
					
					animalsettings.species = animaldata[4]
					animalsettings.breed = animaldata[5]
					animalsettings.colour = animaldata[6]
					
					dob = animaldata[7]
					
					animalsettings.dob = miscmethods.FormatDate(dob, self.localsettings)
					
					animalsettings.comments = ""
					
					animalsettings.neutered = animaldata[3]
					animalsettings.chipno = animaldata[8]
					
					if animalsettings.chipno == None:
						
						animalsettings.chipno = ""
					
					if animalsettings.comments == None:
						
						animalsettings.comments = ""
					
					animalsettings.asmref = animaldata[0]
					
					animalsettings.Submit()
					
					animalpanel = animalmethods.AnimalPanel(self.notebook, animalsettings)
					
					self.notebook.AddPage(animalpanel)
					
					panel.GetParent().Close()
					
				else:
					
					miscmethods.ShowMessage(self.GetMenu("errorobtainingownermessage"), panel)