def __init__(self, parent, iid):
        self.iid = iid
        wx.Dialog.__init__(self,
                           parent,
                           wx.ID_ANY,
                           "Quotation " + self.iid,
                           size=(650, 320))
        self.panel = wx.Panel(self, wx.ID_ANY)

        self.m_cartDV = wx.dataview.DataViewListCtrl(self.panel,
                                                     wx.ID_ANY, (20, 20),
                                                     wx.Size(600, 180), 0)
        self.m_cartDV.SetMinSize(wx.Size(-1, 400))

        self.m_cartDV.AppendTextColumn('Name')
        self.m_cartDV.AppendTextColumn('Quantity')
        self.m_cartDV.AppendTextColumn('Price')
        self.m_cartDV.AppendTextColumn('Total Price')

        qry = 'select p.name, pq.quantity, pq.price from products p, productquotes pq, quotations q where p.id = pq.product and  q.id = pq.quoteId and pq.quoteId = %s' % (
            iid)
        curs = conn.cursor()
        curs.execute(qry)
        r = curs.fetchone()
        while (1):
            if r is not None:
                self.m_cartDV.AppendItem([
                    r['name'],
                    str(r['quantity']),
                    str(r['price']),
                    str(int(r['quantity']) * int(r['price']))
                ])
                r = curs.fetchone()
            else:
                break

        self.lblRecMoney = wx.StaticText(self.panel,
                                         label="Recieved Money",
                                         pos=(20, 220))
        self.recMoney = wx.TextCtrl(self.panel,
                                    value="",
                                    pos=(130, 220),
                                    size=(90, -1),
                                    validator=numOnlyValidator())

        self.convertButton = wx.Button(self.panel,
                                       label="Convert to Invoice",
                                       pos=(110, 260))
        self.closeButton = wx.Button(self.panel,
                                     label="Cancel",
                                     pos=(250, 260))

        self.convertButton.Bind(wx.EVT_BUTTON, self.convertToInvoice)
        #self.convertButton.Bind(wx.EVT_BUTTON, self.asd)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)

        self.Bind(wx.EVT_CLOSE, self.OnQuit)

        self.Show()
    def __init__(self, parent, terminalObj):
        self.t = terminalObj

        wx.Dialog.__init__(self,
                           parent,
                           wx.ID_ANY,
                           "Name Input",
                           size=(650, 300))
        self.panel = wx.Panel(self, wx.ID_ANY)

        self.lblName = wx.StaticText(self.panel, label="Name", pos=(20, 20))
        self.name = wx.TextCtrl(self.panel,
                                value="",
                                pos=(110, 20),
                                size=(500, -1))

        self.lblPhone = wx.StaticText(self.panel, label="Phone", pos=(20, 60))
        self.phone = wx.TextCtrl(self.panel,
                                 value="",
                                 pos=(110, 60),
                                 size=(500, -1),
                                 validator=numOnlyValidator())

        self.lblAdd = wx.StaticText(self.panel, label="Address", pos=(20, 100))
        self.address = wx.TextCtrl(self.panel,
                                   value="",
                                   pos=(110, 100),
                                   size=(500, -1))
        '''
        self.lblPrevB = wx.StaticText(self.panel, label="Previous Balance\n(if any)", pos=(20,140))
        self.previousBal = wx.TextCtrl(self.panel, value="", pos=(110,140), size=(500,-1), validator=numOnlyValidator())
        '''

        self.saveButton = wx.Button(self.panel, label="Save", pos=(110, 200))
        self.closeButton = wx.Button(self.panel, label="Close", pos=(250, 200))

        self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)

        self.Bind(wx.EVT_CLOSE, self.OnQuit)
        self.phone.Bind(wx.EVT_TEXT, self.findInfo)

        self.phone.SetFocus()

        self.Show()
Beispiel #3
0
	def __init__(self, parent):
		
		wx.Dialog.__init__(self, parent, wx.ID_ANY, "Manual Entry", size= (650,400))
		self.panel = wx.Panel(self,wx.ID_ANY)
		
		self.mainSizer = wx.BoxSizer( wx.VERTICAL )
		
		self.folios = self.fetchFolios()
		
		self.lblFolioD = wx.StaticText(self.panel, label="Folio (Debit)")
		self.folioComboD = wx.ComboBox(self, size=wx.DefaultSize, choices= list(self.folios.keys()))
		
		self.debitSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.debitSizer.Add( self.lblFolioD )
		self.debitSizer.Add( self.folioComboD )
		self.mainSizer.Add( self.debitSizer )
		#self.folioC = wx.TextCtrl(self.panel, value="", pos=(130,70), size=(90,-1))
		
		self.lblFolioC = wx.StaticText(self.panel, label="Folio (Credit)")
		self.folioComboC = wx.ComboBox(self, size=wx.DefaultSize, choices= list(self.folios.keys()))
		
		self.creditSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.creditSizer.Add( self.lblFolioC )
		self.creditSizer.Add( self.folioComboC )
		self.mainSizer.Add( self.creditSizer )
		
		self.lblTransaction = wx.StaticText(self.panel, label="Transaction Type", pos=(20,170))
		self.transaction = wx.TextCtrl(self.panel, value="", size=(90,-1))
		
		self.transSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.transSizer.Add( self.lblTransaction )
		self.transSizer.Add( self.transaction )
		self.mainSizer.Add( self.transSizer )
		
		self.lblChequeNo = wx.StaticText(self.panel, label="Cheque Number")
		self.chequeNo = wx.TextCtrl(self.panel, value="", size=(90,-1))
		
		self.chequeSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.chequeSizer.Add( self.lblChequeNo )
		self.chequeSizer.Add( self.chequeNo )
		self.mainSizer.Add( self.chequeSizer )
		
		self.lblAmount = wx.StaticText(self.panel, label="Amount")
		self.amount = wx.TextCtrl(self.panel, value="", size=(90,-1), validator=numOnlyValidator())

		self.amountSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.amountSizer.Add( self.lblAmount )
		self.amountSizer.Add( self.amount )
		self.mainSizer.Add( self.amountSizer )
		
		self.saveButton = wx.Button(self.panel, label="Save")
		self.closeButton = wx.Button(self.panel, label="Cancel")
		
		self.buttonSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.buttonSizer.Add( self.saveButton )
		self.buttonSizer.Add( self.closeButton )
		self.mainSizer.Add( self.buttonSizer )
		
		self.SetSizer( self.mainSizer )
		self.Layout()
		self.mainSizer.Fit(self.panel)
		self.Centre( wx.BOTH )
		
		self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
		self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
		
		self.Bind(wx.EVT_CLOSE, self.OnQuit)
		
		self.Show()	
Beispiel #4
0
	def __init__( self, parent, transactionButtonName, uid ):
		# input stream
		self.inputStream = ''
		self.t = terminal()
		self.t.operatorId = uid
		
		wx.Panel.__init__ ( self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		
		self.SetSizeHints( wx.Size( -1,-1 ), wx.DefaultSize )
		self.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_CAPTIONTEXT ) )
		
		bSizerMyFrame1 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.papa = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL)
		self.papa.SetFont( wx.Font( 14, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Arial" ) )
		
		bSizerMain = wx.BoxSizer( wx.VERTICAL )

		########### Cart Grid Start
		self.productsGrid = wx.grid.Grid( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), 0 )
		self.productsGrid.CreateGrid( 99, 6 )
		self.productsGrid.EnableEditing( True )
		self.productsGrid.EnableGridLines( True )
		self.productsGrid.EnableDragGridSize( False )
		self.productsGrid.SetMargins( 0, 0 )
		self.productsGrid.SetRowLabelSize( 20 )
		
		self.productsGrid.SetColSize( 0, 60 )
		self.productsGrid.SetColSize( 1, 120 )
		self.productsGrid.SetColSize( 2, 180 )
		self.productsGrid.SetColSize( 3, 240 )
		self.productsGrid.SetColSize( 4, 300 )
		self.productsGrid.SetColSize( 5, 360 )
		
		self.productsGrid.SetColLabelValue( 0, u"ID" )
		self.productsGrid.SetColLabelValue( 1, u"Name" )
		self.productsGrid.SetColLabelValue( 2, u"Quantity" )
		self.productsGrid.SetColLabelValue( 3, u"Unit Price" )
		self.productsGrid.SetColLabelValue( 4, u"Total Discount" )
		self.productsGrid.SetColLabelValue( 5, u"Total Price" )
		
		self.productsGrid.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
		self.productsGrid.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
		########### Cart Grid End
		
		self.bSizerPG = wx.BoxSizer( wx.HORIZONTAL )
		self.bSizerPG.Add( self.productsGrid, 1, wx.EXPAND|wx.ALL, 5 )
		
		self.inputTC = wx.SearchCtrl( self.papa, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
		#self.inputTC.SetEditable( False )
		self.inputTC.SetDescriptiveText( "Search for Customer or Product" )

		'''
		searchSize = self.inputTC.GetSize()
		x, y = self.inputTC.GetScreenPosition()
		y = searchSize[1] + y
		'''
		self.suggestionList = wx.ListBox ( self.papa, choices=self.suggestionCandidatesAsList( self.inputTC.GetValue() ), pos=(30, 60),  size=(-1, -1) )
		self.suggestionList.SetTransparent(wx.IMAGE_ALPHA_OPAQUE)
		self.suggestionList.Hide()
		
		self.customerHeading = wx.StaticText( self.papa, wx.ID_ANY, u"Customer Information", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.customerName = wx.StaticText( self.papa, wx.ID_ANY, u"Name:   ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.customerContact = wx.StaticText( self.papa, wx.ID_ANY, u"Contact:   ", wx.DefaultPosition, wx.DefaultSize, 0 )
		#self.customerBalance = wx.StaticText( self.papa, wx.ID_ANY, u"Balance:   ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.newCustomerButton = wx.Button( self.papa, wx.ID_ANY, u"Select Customer", wx.DefaultPosition, wx.DefaultSize, 0 )
		
		self.bSizerTopSecondRowCustInfo = wx.BoxSizer( wx.VERTICAL )
		self.bSizerTopSecondRowCustInfo.Add( self.customerHeading, 1, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRowCustInfo.Add( self.customerName, 1, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRowCustInfo.Add( self.customerContact, 1, wx.EXPAND|wx.ALL, 5 )
		#self.bSizerTopSecondRowCustInfo.Add( self.customerBalance, 1, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRowCustInfo.Add( self.newCustomerButton, 1, wx.EXPAND|wx.ALL, 5 )
		
		self.totalBill = wx.StaticText( self.papa, wx.ID_ANY, u"Total:   0000000", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.discountTC = wx.TextCtrl( self.papa, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, 0, validator=numOnlyValidator() )
		#self.discountTC.SetEditable(False)
		self.billAfterDiscount = wx.StaticText( self.papa, wx.ID_ANY, u"After Discount:   0000000", wx.DefaultPosition, wx.DefaultSize, 0 )
		
		self.totalBill.SetFont( wx.Font( 18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
		self.discountTC.SetFont( wx.Font( 18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
		self.billAfterDiscount.SetFont( wx.Font( 18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
		
		self.bSizerTopSecondRowCartInfo = wx.BoxSizer( wx.VERTICAL )
		self.bSizerTopSecondRowCartInfo.Add( self.totalBill, 1, wx.EXPAND|wx.ALL|wx.ALIGN_CENTRE_VERTICAL, 5 )
		self.bSizerTopSecondRowCartInfo.Add( self.discountTC, 1, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRowCartInfo.Add( self.billAfterDiscount, 2, wx.ALIGN_CENTRE_VERTICAL, 5 )
		
		self.transactionButton = wx.Button( self.papa, wx.ID_ANY, transactionButtonName, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.returnButton = wx.Button( self.papa, wx.ID_ANY, u"Return", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.cleanCartButton = wx.Button( self.papa, wx.ID_ANY, u"Clear", wx.DefaultPosition, wx.DefaultSize, 0 )
		
		self.transactionButton.SetFont( wx.Font( 18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "Arial" ) )
		
		self.bSizerTopSecondRowControls = wx.BoxSizer( wx.VERTICAL )
		self.bSizerTopSecondRowControls.Add( self.transactionButton, 3, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRowControls.Add( self.returnButton, 2, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRowControls.Add( self.cleanCartButton, 2, wx.EXPAND|wx.ALL, 5 )
		
		self.bSizerTopSecondRow = wx.BoxSizer( wx.HORIZONTAL )
		self.bSizerTopSecondRow.Add ( self.bSizerTopSecondRowCustInfo, 3, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRow.Add ( self.bSizerTopSecondRowCartInfo, 3, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTopSecondRow.Add ( self.bSizerTopSecondRowControls, 4, wx.EXPAND|wx.ALL, 5 )
		
		self.bSizerTop = wx.BoxSizer( wx.VERTICAL )
		self.bSizerTop.Add ( self.inputTC, 1, wx.EXPAND|wx.ALL, 5 )
		#self.bSizerTop.Add ( self.suggestionList, 0, wx.EXPAND|wx.ALL, 5 )
		self.bSizerTop.Add ( self.bSizerTopSecondRow, 4, wx.EXPAND|wx.ALL, 5 )
		
		bSizerMain.Add( self.bSizerTop, 4, wx.EXPAND|wx.ALL, 5 )
		bSizerMain.Add( self.bSizerPG, 6, wx.EXPAND|wx.ALL, 5 )
		
		self.papa.SetSizer( bSizerMain )
		self.papa.Layout()
		bSizerMain.Fit( self.papa )
		bSizerMyFrame1.Add( self.papa, 1, wx.EXPAND |wx.ALL, 5 )
		
		self.SetSizer( bSizerMyFrame1 )
		self.Layout()
		
		self.Centre( wx.BOTH )
		
		# Connect Events
		self.inputTC.Bind( wx.EVT_TEXT, self.search )
		self.inputTC.Bind( wx.EVT_SET_FOCUS, self.showSearchSuggestion )
		self.inputTC.Bind( wx.EVT_KILL_FOCUS, self.hideSearchSuggestion )
		
		self.suggestionList.Bind (wx.EVT_SET_FOCUS, self.search )
		
		self.transactionButton.Bind( wx.EVT_BUTTON, self.CheckOutFunc )
		self.returnButton.Bind( wx.EVT_BUTTON, self.refundFunc )
		self.cleanCartButton.Bind( wx.EVT_BUTTON, self.clearEverything )
		
		self.productsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGED, self.cartChange)
		
		self.newCustomerButton.Bind ( wx.EVT_BUTTON, self.determineParty )
		
		self.discountTC.Bind (wx.EVT_TEXT, self.imposeDiscount)

		# Collect barcode input
		#self.papa.Bind( wx.EVT_TEXT, self.barcodeInput )
		self.inputTC.Bind(wx.EVT_CHAR_HOOK, self.barcodeInput)
    def __init__(self, parent, iid, cid):
        self.iid = iid
        self.cid = cid

        wx.Dialog.__init__(self,
                           parent,
                           wx.ID_ANY,
                           "Invoice " + iid,
                           size=(650, 500))
        self.panel = wx.Panel(self, wx.ID_ANY)

        self.m_cartDV = wx.dataview.DataViewListCtrl(self.panel,
                                                     wx.ID_ANY, (20, 20),
                                                     wx.Size(600, 180), 0)
        self.m_cartDV.SetMinSize(wx.Size(-1, 400))

        self.m_cartDV.AppendTextColumn('Name')
        self.m_cartDV.AppendTextColumn('Quantity')
        self.m_cartDV.AppendTextColumn('Price')
        self.m_cartDV.AppendTextColumn('Total Price')

        qry = 'select p.name, pi.quantity, pi.price from productinvoice pi, products p where pi.product = p.id and invoiceId = %s' % (
            iid)
        curs = conn.cursor()
        curs.execute(qry)
        r = curs.fetchone()
        while (1):
            if r is not None:
                self.m_cartDV.AppendItem([
                    r['name'],
                    str(r['quantity']),
                    str(r['price']),
                    str(int(r['quantity']) * int(r['price']))
                ])
                r = curs.fetchone()
            else:
                break

        self.lblRecMoney = wx.StaticText(self.panel,
                                         label="Recieved Money",
                                         pos=(20, 220))
        self.recMoney = wx.TextCtrl(self.panel,
                                    value="",
                                    pos=(130, 220),
                                    size=(90, -1),
                                    validator=numOnlyValidator())

        self.lblcheque = wx.StaticText(self.panel,
                                       label="Cheque Number",
                                       pos=(20, 270))
        self.chequeNum = wx.TextCtrl(self.panel,
                                     value="",
                                     pos=(130, 270),
                                     size=(90, -1))

        self.lbltranspKey = wx.StaticText(self.panel,
                                          label="Bilty",
                                          pos=(20, 320))
        self.transpKey = wx.TextCtrl(self.panel,
                                     value="",
                                     pos=(130, 320),
                                     size=(90, -1))

        self.lbltranspAgency = wx.StaticText(self.panel,
                                             label="Agency",
                                             pos=(20, 370))
        self.transpAgency = wx.TextCtrl(self.panel,
                                        value="",
                                        pos=(130, 370),
                                        size=(90, -1))

        self.saveButton = wx.Button(self.panel, label="Save", pos=(110, 420))
        self.closeButton = wx.Button(self.panel,
                                     label="Cancel",
                                     pos=(250, 420))
        self.returnButton = wx.Button(self.panel,
                                      label="Return",
                                      pos=(390, 420))

        self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
        self.returnButton.Bind(wx.EVT_BUTTON, self.OnReturn)

        self.Bind(wx.EVT_CLOSE, self.OnQuit)

        self.Show()
Beispiel #6
0
    def __init__(self, parent, bc):
        wx.Dialog.__init__(self,
                           parent,
                           wx.ID_ANY,
                           "New Product",
                           size=(650, 360))
        self.panel = wx.Panel(self, wx.ID_ANY)

        self.lblName = wx.StaticText(self.panel, label="Name", pos=(20, 20))
        self.name = wx.TextCtrl(self.panel,
                                value="",
                                pos=(110, 20),
                                size=(500, -1))

        self.lblBarcode = wx.StaticText(self.panel,
                                        label="Barcode",
                                        pos=(20, 60))
        self.barcode = wx.TextCtrl(self.panel,
                                   value="",
                                   pos=(110, 60),
                                   size=(500, -1))
        self.barcode.SetValue(str(bc))

        self.lblCP = wx.StaticText(self.panel,
                                   label="Cost Price",
                                   pos=(20, 100))
        self.costPrice = wx.TextCtrl(self.panel,
                                     value="",
                                     pos=(110, 100),
                                     size=(500, -1),
                                     validator=numOnlyValidator())

        self.lblSP = wx.StaticText(self.panel,
                                   label="Selling Price",
                                   pos=(20, 140))
        self.sellingPrice = wx.TextCtrl(self.panel,
                                        value="",
                                        pos=(110, 140),
                                        size=(500, -1),
                                        validator=numOnlyValidator())

        self.lblQty = wx.StaticText(self.panel,
                                    label="Quantity",
                                    pos=(20, 180))
        self.qty = wx.TextCtrl(self.panel,
                               value="",
                               pos=(110, 180),
                               size=(500, -1),
                               validator=numOnlyValidator())

        self.lblmlvl = wx.StaticText(self.panel,
                                     label="Minimum Level",
                                     pos=(20, 220))
        self.minLvl = wx.TextCtrl(self.panel,
                                  value="",
                                  pos=(110, 220),
                                  size=(500, -1),
                                  validator=numOnlyValidator())

        self.lblcdn = wx.StaticText(self.panel,
                                    label="Codename",
                                    pos=(20, 260))
        self.cdn = wx.TextCtrl(self.panel,
                               value="",
                               pos=(110, 260),
                               size=(500, -1))

        self.saveButton = wx.Button(self.panel, label="Save", pos=(110, 300))
        self.closeButton = wx.Button(self.panel,
                                     label="Cancel",
                                     pos=(250, 300))

        self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)

        self.Bind(wx.EVT_CLOSE, self.OnQuit)

        self.Show()