예제 #1
0
class Buscar:
    def __init__(self, padre, entrys, cobros=False):
        self.padre = padre
        self.entrys = entrys
        self.cobros = cobros
        arch = leerglade.leer('busqueda_ventas.glade')
        self.ventas = FacturaVentas()
        self.nav = arch.get_object
        self.nav('window1').set_title('Buscar')
        self.nav('window1').set_default_size(960, 500)
        self.nav('window1').set_position(1)
        self.nav('window1').set_transient_for(self.padre.frm('window1'))
        self.nav('window1').set_modal(True)
        self.nav('window1').set_border_width(5)
        self.nav('window1').show_all()
        self.nav('buttonbox1').set_visible(False)
        self.nav('entry1').grab_focus()
        arch.connect_signals(self)
        self.consultar()

    def consultar(self, widget = None):
        self.nav('liststore1').clear()
        color = False
        for row in self.ventas.ventas_list(self.nav('entry1').get_text(), self.cobros):
            if not color:
                t_color = "#FFFFDA"
                color = True
            else:
                t_color = "#A9FFA9"
                color = False
            self.nav('liststore1').append([
                row[0], row[1], str(row[2]), str(row[3]), row[4],
                row[5], row[6], Format.number(row[7]), t_color
            ])
        self.nav('label1').set_text(str(len(self.nav('liststore1'))) + " Registros")


    def tree_key(self, w1, w2, w3):
        sl, it = self.nav('treeview1').get_selection().get_selected()
        if not self.cobros:
            try:
                self.entrys[0].set_text(str(sl.get_value(it, 0)))
                self.entrys[1].set_text(str(sl.get_value(it, 1)))
                self.entrys[2].set_text(str(sl.get_value(it, 2)))
                self.entrys[3].set_text(str(sl.get_value(it, 3)))
                self.entrys[4].set_text(str(sl.get_value(it, 4)))
                self.entrys[5].set_text(str(sl.get_value(it, 5)))
            except Exception, e:
                print e
                return
        else:
예제 #2
0
 def __init__(self, padre, entrys, cobros=False):
     self.padre = padre
     self.entrys = entrys
     self.cobros = cobros
     arch = leerglade.leer('busqueda_ventas.glade')
     self.ventas = FacturaVentas()
     self.nav = arch.get_object
     self.nav('window1').set_title('Buscar')
     self.nav('window1').set_default_size(960, 500)
     self.nav('window1').set_position(1)
     self.nav('window1').set_transient_for(self.padre.frm('window1'))
     self.nav('window1').set_modal(True)
     self.nav('window1').set_border_width(5)
     self.nav('window1').show_all()
     self.nav('buttonbox1').set_visible(False)
     self.nav('entry1').grab_focus()
     arch.connect_signals(self)
     self.consultar()