def finish(self,event): title=None copy=None if self.action_page.return_copies.GetValue()==True: return_to=self.action_page.return_to.GetStringSelection() return_x=int(self.action_page.return_x.GetValue()) return_these_books=[b for b in self.which_title.books if b.status=="STOCK" and b.distributor==return_to][0:return_x] for b in return_these_books: b.change_status("RETURN") if self.action_page.inventory_copies.GetValue()==True: known_title=False new_title_name="" if self.title_page.new_title.GetValue()==True: new_title_name=self.title_page.enter_new_title.GetValue() else: known_title=self.which_title inventory().addToInventory(title=new_title_name,price=float(self.action_page.inventory_price.GetValue()),distributor=self.action_page.inventory_from.GetValue(),quantity=self.action_page.inventory_x.GetValue(),known_title=known_title,kind_name=self.label) if self.action_page.sell_a_copy.GetValue()==True: m_item=inventoried_merchandise(self.label) m_item.set_title_and_copy(self.which_copy) win = InventoriedMerchandisePopup(self.parent,m_item,self.parent) win.CenterOnScreen() win.ShowModal() win.Destroy()
def finish(self, event): title = None copy = None if self.action_page.return_copies.GetValue() == True: return_to = self.action_page.return_to.GetStringSelection() return_x = int(self.action_page.return_x.GetValue()) return_these_books = [ b for b in self.which_title.books if b.status == "STOCK" and b.distributor == return_to and b.notes == self.which_edition.notes ][0:return_x] for b in return_these_books: b.change_status("RETURN") if self.action_page.inventory_copies.GetValue() == True: known_title = False new_title_name = "" if self.title_page.new_title.GetValue() == True: new_title_name = self.title_page.enter_new_title.GetValue() else: known_title = self.which_title edition = "" if self.edition_page.new_edition.GetValue() == True: edition = self.edition_page.enter_new_edition.GetValue() else: edition = self.edition_page.select_existing_edition.GetString( self.edition_page.select_existing_edition.GetSelections() [0]) inventory().addToInventory( title=new_title_name, price=float(self.action_page.inventory_price.GetValue()), distributor=self.action_page.inventory_from.GetValue(), notes=edition, quantity=self.action_page.inventory_x.GetValue(), known_title=known_title, kind_name=self.label) if self.action_page.sell_a_copy.GetValue() == True: m_item = inventoried_merchandise(self.label) m_item.set_title_and_copy(self.which_edition) win = InventoriedMerchandisePopup(self.parent, m_item, self.parent) win.CenterOnScreen() win.ShowModal() win.Destroy()
def __init__(self, parent): self.parent = parent self._init_ctrls(parent) self.orderboxes = {"default": self.orderbox} self.tab_list.Append("default", "default") self.current_orderbox_name = "default" self.cashbox = cashbox() self.membersList = MembersList() self.inventory = inventory() self.Lower() win = CashDrawerPopup(self, self.cashbox) win.Fit() win.CenterOnScreen() # pos = self.ClientToScreen( (0,0) ) # win.Position(pos, (100, 100)) win.ShowModal() win.Destroy()
def __init__(self, parent): self.parent = parent self._init_ctrls(parent) self.orderboxes = { "default": self.orderbox, } self.tab_list.Append("default", "default") self.current_orderbox_name = "default" self.cashbox = cashbox() self.membersList = MembersList() self.inventory = inventory() self.Lower() win = CashDrawerPopup(self, self.cashbox) win.Fit() win.CenterOnScreen() #pos = self.ClientToScreen( (0,0) ) #win.Position(pos, (100, 100)) win.ShowModal() win.Destroy()
# Set up db connection connection = connectionForURI( "mysql://%s:%s@%s:3306/%s?debug=1&logger=MyLogger&loglevel=debug&use_unicode=1&charset=utf8" % (dbuser, dbpass, dbhost, dbname) ) sqlhub.processConnection = connection class ISBNToBeEntered(SQLObject): class sqlmeta: fromDatabase = True table = "ISBN_to_be_entered" inv = inventory() titles = ISBNToBeEntered.select() for t in titles: # print t try: titleinfo = inv.lookup_by_isbn(t.isbn) except: # print "isbn %s seems to be invalid" % t.isbn pass # print titleinfo if isinstance(titleinfo["list_price"], unicode): correctedprice = float(titleinfo["list_price"].replace("$", "")) else: correctedprice = float(titleinfo["list_price"]) # print correctedprice inv.addToInventory(