Example #1
0
    def saveOrderBox(self,orderbox_name):
	
	#if name was default
	if self.current_orderbox_name=="default":	
		self.orderboxes["default"]=orderbox(self.order_list,self,"default",0)
		# current orderbox gets a name
		self.orderboxes[orderbox_name]=self.orderbox	
		self.orderboxes[orderbox_name].list_position=self.tab_list.GetCount()

	else:
		self.orderboxes[orderbox_name]=orderbox(self.order_list,self,orderbox_name,self.tab_list.GetCount())	


	print "Saving tab %s with position %s" % (orderbox_name,self.orderboxes[orderbox_name].list_position);
	self.tab_list.Append(orderbox_name,orderbox_name)
	
	self.current_orderbox_name=orderbox_name	
	self.orderbox=self.orderboxes[orderbox_name]
        self.order_list.Clear()
        self.orderbox.redisplay()
	self.tab_list.SetSelection(self.orderbox.list_position)	


	print "SAVED %s at Position %s" %(orderbox_name,self.orderbox.list_position) 
	for k in self.orderboxes.keys():
		print "%s %s" %(k,self.orderboxes[k].list_position)
Example #2
0
    def saveOrderBox(self, orderbox_name):

        #if name was default
        if self.current_orderbox_name == "default":
            self.orderboxes["default"] = orderbox(self.order_list, self,
                                                  "default", 0)
            # current orderbox gets a name
            self.orderboxes[orderbox_name] = self.orderbox
            self.orderboxes[
                orderbox_name].list_position = self.tab_list.GetCount()

        else:
            self.orderboxes[orderbox_name] = orderbox(self.order_list, self,
                                                      orderbox_name,
                                                      self.tab_list.GetCount())

        print "Saving tab %s with position %s" % (
            orderbox_name, self.orderboxes[orderbox_name].list_position)
        self.tab_list.Append(orderbox_name, orderbox_name)

        self.current_orderbox_name = orderbox_name
        self.orderbox = self.orderboxes[orderbox_name]
        self.order_list.Clear()
        self.orderbox.redisplay()
        self.tab_list.SetSelection(self.orderbox.list_position)

        print "SAVED %s at Position %s" % (orderbox_name,
                                           self.orderbox.list_position)
        for k in self.orderboxes.keys():
            print "%s %s" % (k, self.orderboxes[k].list_position)
Example #3
0
    def make_sale_sizer(self):
        self.saleSizer = wxStaticBoxSizer(wxStaticBox(parent=self, id=-1, label="Current Sale"), wxVERTICAL)
        # this is for the upper buttons, stashed in saleUpperButtonSizer
        self.saleUpperButtonsSizer = wxFlexGridSizer(rows=2, cols=2, vgap=10, hgap=10)
        self.checkout_button = wxButton(id=-1,
              label='check out', name='co_button', parent=self, 
              style=0)
        EVT_BUTTON(self.checkout_button, self.checkout_button.GetId(),
              self.OnCheckoutButton)

        self.checkin_button = wxButton(id=-1,
              label='check in', name='ci_button', parent=self, 
              style=0)
        EVT_BUTTON(self.checkin_button, self.checkin_button.GetId(),
              self.OnCheckinButton)

        self.remove_button = wxButton(id=-1,
              label='remove item', name='remove_button', parent=self, 
              style=0)
        EVT_BUTTON(self.remove_button, self.remove_button.GetId(),
              self.OnRemove_buttonButton)

        self.void_button = wxButton(id=-1,
              label='void entire\n sale', name='void_button', parent=self, 
              style=0)
        EVT_BUTTON(self.void_button, self.void_button.GetId(),
              self.OnVoid_button)
        self.saleUpperButtonsSizer.Add(self.checkout_button)
        self.saleUpperButtonsSizer.Add(self.checkin_button)
        self.saleUpperButtonsSizer.Add(self.remove_button)
        self.saleUpperButtonsSizer.Add(self.void_button)
         
	    # The order list and display list will be added as is in the
		# saleSizer, since they're alone on their lines...
        self.order_list = wxListBox(choices=[], id=-1,
              name='order_list', parent=self, 
              size=wxSize(200, 200), style=wxLIST_FORMAT_RIGHT, 
			  validator=wxDefaultValidator)
        EVT_LISTBOX(self.order_list, self.order_list.GetId(), self.OnOrderItemSelected)
		
        self.display_field = wxTextCtrl(id=-1,
              name='display_field', parent=self, 
              size=wxSize(200, 32), style=wxTE_PROCESS_ENTER, value='0')
        self.display_field.SetToolTipString('hi')
        self.display_field.SetInsertionPoint(0)
        self.display_field.Show(True)
        self.numberbox=numberbox(self.display_field) 
        self.orderbox=orderbox(self.order_list,self,"default",0)
 
        # The sale and discount buttons		
        self.saleLowerButtonsSizer = wxBoxSizer(wxHORIZONTAL) 
        self.total_button = wxButton(id=-1,
              label='subtotal', name='total_button', parent=self,
              size=wxSize(150, 32), style=0)
        EVT_BUTTON(self.total_button, self.total_button.GetId(),
              self.OnTotal_buttonButton)

        self.discount_button = wxButton(id=-1,
              label='discount', name='discount_button', parent=self,
              size=wxSize(55, 32), style=0)
        EVT_BUTTON(self.discount_button, self.discount_button.GetId(),
              self.OnDiscountButton)
        self.saleLowerButtonsSizer.Add(self.total_button)
        self.saleLowerButtonsSizer.Add(self.discount_button)

		# We make a grid for the payment mode, since there could be
		# more than 3 here
        self.salePaymentModeSizer = wxGridSizer(rows=1, cols=3, vgap=10, hgap=10)
        self.credit_button = wxButton(id=-1,
                                      label='credit', name='credit_button', parent=self, 
                                      size=wxSize(66, 32), style=0)
        EVT_BUTTON(self.credit_button, self.credit_button.GetId(),
                   self.OnCredit_button)

        self.cash_button = wxButton(id=-1,
                                      label='cash', name='cash_button', parent=self, 
                                      size=wxSize(66, 32), style=0)
        EVT_BUTTON(self.cash_button, self.cash_button.GetId(),
                   self.OnCash_button)

        self.check_button = wxButton(id=-1,
                                     label='check', name='check_button', parent=self,
                                     size=wxSize(66, 32), style=0)
        EVT_BUTTON(self.check_button, self.check_button.GetId(),
                   self.OnCheck_button)
        self.salePaymentModeSizer.Add(self.credit_button)
        self.salePaymentModeSizer.Add(self.cash_button)
        self.salePaymentModeSizer.Add(self.check_button)

        self.saleSizer.Add(self.saleUpperButtonsSizer)
        self.saleSizer.Add(self.order_list, proportion=1, flag=wxALIGN_CENTER|wxGROW)
        self.saleSizer.Add(self.display_field, flag=wxGROW)
        self.saleSizer.Add(self.saleLowerButtonsSizer)
        self.saleSizer.Add(self.salePaymentModeSizer, flag=wxGROW)
        return self.saleSizer
Example #4
0
    def make_sale_sizer(self):
        self.saleSizer = wxStaticBoxSizer(
            wxStaticBox(parent=self, id=-1, label="Current Sale"), wxVERTICAL)
        # this is for the upper buttons, stashed in saleUpperButtonSizer
        self.saleUpperButtonsSizer = wxFlexGridSizer(rows=2,
                                                     cols=2,
                                                     vgap=10,
                                                     hgap=10)
        self.checkout_button = wxButton(id=-1,
                                        label='check out',
                                        name='co_button',
                                        parent=self,
                                        style=0)
        EVT_BUTTON(self.checkout_button, self.checkout_button.GetId(),
                   self.OnCheckoutButton)

        self.checkin_button = wxButton(id=-1,
                                       label='check in',
                                       name='ci_button',
                                       parent=self,
                                       style=0)
        EVT_BUTTON(self.checkin_button, self.checkin_button.GetId(),
                   self.OnCheckinButton)

        self.remove_button = wxButton(id=-1,
                                      label='remove item',
                                      name='remove_button',
                                      parent=self,
                                      style=0)
        EVT_BUTTON(self.remove_button, self.remove_button.GetId(),
                   self.OnRemove_buttonButton)

        self.void_button = wxButton(id=-1,
                                    label='void entire\n sale',
                                    name='void_button',
                                    parent=self,
                                    style=0)
        EVT_BUTTON(self.void_button, self.void_button.GetId(),
                   self.OnVoid_button)
        self.saleUpperButtonsSizer.Add(self.checkout_button)
        self.saleUpperButtonsSizer.Add(self.checkin_button)
        self.saleUpperButtonsSizer.Add(self.remove_button)
        self.saleUpperButtonsSizer.Add(self.void_button)

        # The order list and display list will be added as is in the
        # saleSizer, since they're alone on their lines...
        self.order_list = wxListBox(choices=[],
                                    id=-1,
                                    name='order_list',
                                    parent=self,
                                    size=wxSize(200, 200),
                                    style=wxLIST_FORMAT_RIGHT,
                                    validator=wxDefaultValidator)
        EVT_LISTBOX(self.order_list, self.order_list.GetId(),
                    self.OnOrderItemSelected)

        self.display_field = wxTextCtrl(id=-1,
                                        name='display_field',
                                        parent=self,
                                        size=wxSize(200, 32),
                                        style=wxTE_PROCESS_ENTER,
                                        value='0')
        self.display_field.SetToolTipString('hi')
        self.display_field.SetInsertionPoint(0)
        self.display_field.Show(True)
        self.numberbox = numberbox(self.display_field)
        self.orderbox = orderbox(self.order_list, self, "default", 0)

        # The sale and discount buttons
        self.saleLowerButtonsSizer = wxBoxSizer(wxHORIZONTAL)
        self.total_button = wxButton(id=-1,
                                     label='subtotal',
                                     name='total_button',
                                     parent=self,
                                     size=wxSize(150, 32),
                                     style=0)
        EVT_BUTTON(self.total_button, self.total_button.GetId(),
                   self.OnTotal_buttonButton)

        self.discount_button = wxButton(id=-1,
                                        label='discount',
                                        name='discount_button',
                                        parent=self,
                                        size=wxSize(55, 32),
                                        style=0)
        EVT_BUTTON(self.discount_button, self.discount_button.GetId(),
                   self.OnDiscountButton)
        self.saleLowerButtonsSizer.Add(self.total_button)
        self.saleLowerButtonsSizer.Add(self.discount_button)

        # We make a grid for the payment mode, since there could be
        # more than 3 here
        self.salePaymentModeSizer = wxGridSizer(rows=1,
                                                cols=3,
                                                vgap=10,
                                                hgap=10)
        self.credit_button = wxButton(id=-1,
                                      label='credit',
                                      name='credit_button',
                                      parent=self,
                                      size=wxSize(66, 32),
                                      style=0)
        EVT_BUTTON(self.credit_button, self.credit_button.GetId(),
                   self.OnCredit_button)

        self.cash_button = wxButton(id=-1,
                                    label='cash',
                                    name='cash_button',
                                    parent=self,
                                    size=wxSize(66, 32),
                                    style=0)
        EVT_BUTTON(self.cash_button, self.cash_button.GetId(),
                   self.OnCash_button)

        self.check_button = wxButton(id=-1,
                                     label='check',
                                     name='check_button',
                                     parent=self,
                                     size=wxSize(66, 32),
                                     style=0)
        EVT_BUTTON(self.check_button, self.check_button.GetId(),
                   self.OnCheck_button)
        self.salePaymentModeSizer.Add(self.credit_button)
        self.salePaymentModeSizer.Add(self.cash_button)
        self.salePaymentModeSizer.Add(self.check_button)

        self.saleSizer.Add(self.saleUpperButtonsSizer)
        self.saleSizer.Add(self.order_list,
                           proportion=1,
                           flag=wxALIGN_CENTER | wxGROW)
        self.saleSizer.Add(self.display_field, flag=wxGROW)
        self.saleSizer.Add(self.saleLowerButtonsSizer)
        self.saleSizer.Add(self.salePaymentModeSizer, flag=wxGROW)
        return self.saleSizer