Ejemplo n.º 1
0
	def cargar_ventas(self, ventas = None):
		if ventas is None:
			ventas = controller2.obtener_ventas()
		
		self.model = QtGui.QStandardItemModel(len(ventas),6)
		self.model.setHorizontalHeaderItem(0, QtGui.QStandardItem(u"Fecha"))
		self.model.setHorizontalHeaderItem(1, QtGui.QStandardItem(u"Tipo Documento"))
		self.model.setHorizontalHeaderItem(2, QtGui.QStandardItem(u"Detalle Compra"))
		self.model.setHorizontalHeaderItem(3, QtGui.QStandardItem(u"Neto"))
		self.model.setHorizontalHeaderItem(4, QtGui.QStandardItem(u"IVA"))
		self.model.setHorizontalHeaderItem(5, QtGui.QStandardItem(u"Total"))
		r = 0
		for row in ventas:
			index = self.model.index(r, 0, QtCore.QModelIndex());
			self.model.setData(index, row['Fecha'])
			index = self.model.index(r, 1, QtCore.QModelIndex());
			self.model.setData(index, row['Documento'])
			index = self.model.index(r, 2, QtCore.QModelIndex());
			self.model.setData(index, row['Detalle'])
			index = self.model.index(r, 3, QtCore.QModelIndex());
			self.model.setData(index, row['Neto'])
			index = self.model.index(r, 4, QtCore.QModelIndex());
			self.model.setData(index, row['IVA'])
			index = self.model.index(r, 5, QtCore.QModelIndex());
			self.model.setData(index, row['Total'])
			r = r+1
		
		self.ui.TablaVentas.setModel(self.model)
		self.ui.TablaVentas.setColumnWidth(0,100)
		self.ui.TablaVentas.setColumnWidth(1,100)
		self.ui.TablaVentas.setColumnWidth(2,150)
		self.ui.TablaVentas.setColumnWidth(3,150)
		self.ui.TablaVentas.setColumnWidth(4,100)
		self.ui.TablaVentas.setColumnWidth(5,100)
Ejemplo n.º 2
0
	def cargar_sucursales(self, index):
		id_sucursal = self.ui.FiltroSucursales.itemData(self.ui.FiltroSucursales.currentIndex())
		if id_sucursal == -1:
			ventas = controller2.obtener_ventas()
		else:
			ventas = controller2.obtener_venta(id_sucursal)
		self.cargar_ventas(ventas)