本文整理汇总了Python中DBManager.DBManager.getCantidadByCodigo方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.getCantidadByCodigo方法的具体用法?Python DBManager.getCantidadByCodigo怎么用?Python DBManager.getCantidadByCodigo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.getCantidadByCodigo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VentaAdmin
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import getCantidadByCodigo [as 别名]
#.........这里部分代码省略.........
self.list_ctrl.InsertColumn(2, "Descripcion")
self.list_ctrl.InsertColumn(3, "Cantidad")
self.list_ctrl.InsertColumn(4, "Precio")
total = 0
index = 0
for row in rows:
if row[0] != '1000':
self.list_ctrl.InsertStringItem(index, row[0])
self.list_ctrl.SetStringItem(index, 1, row[1])
self.list_ctrl.SetStringItem(index, 2, row[2])
self.list_ctrl.SetStringItem(index, 3, row[4])
self.list_ctrl.SetStringItem(index, 4, "$ %.2f" % float(row[3]))
total += float( row[3] )
if index % 2:
self.list_ctrl.SetItemBackgroundColour(index, "white")
else:
self.list_ctrl.SetItemBackgroundColour(index, "gray")
index += 1
self.list_ctrl.InsertStringItem(index, 'TOTAL')
self.list_ctrl.SetStringItem(index, 1, '')
self.list_ctrl.SetStringItem(index, 2, '')
self.list_ctrl.SetStringItem(index, 3, '')
self.list_ctrl.SetStringItem(index, 4, '$ %.2f' % float(total))
self.list_ctrl.SetItemBackgroundColour(index, "red")
self.list_ctrl.SetItemTextColour(index, "yellow")
self.Bind(wx.EVT_BUTTON, self.onAdd, self.btn_add)
self.Bind(wx.EVT_BUTTON, self.onClose, self.btn_prt)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer2 = wx.BoxSizer(wx.HORIZONTAL)
sizer2.Add(self.btn_add, 0, wx.ALL, 1)
sizer2.Add(self.btn_del, 0, wx.ALL, 1)
sizer2.Add(self.btn_prt, 0, wx.ALL, 1)
sizer.Add(sizer2, 0, wx.ALL, 1)
sizer.Add(self.list_ctrl, 1, wx.EXPAND)
self.SetSizer(sizer)
self.Show(True)
Publisher().subscribe(self.onSearch, ("producto_buscado"))
Publisher().subscribe(self.refreshAfterAdd, ("producto_agregado"))
def __redefine( self, evt ):
self.list_ctrl.ClearAll()
producto = evt.data['producto']
cantidad = evt.data['cantidad']
self.rows.append( (producto[1],
producto[3],
producto[2],
str(producto[4]),
cantidad,
producto[0] ) )
self.__generateContent()
def onSearch( self, evt ):
self.list_ctrl.ClearAll()
search_stock = SearchStock(self, -1, "Buscar")
self.__generateContent(evt.data)
def onAdd( self, evt ):
seleccionar = SeleccionarProducto(self,
-1,
"Agregar un producto a la compra")
def onClose( self, evt ):
dlg = wx.MessageDialog(self,
'Seguro que desea cerrar la venta?',
'Cerrar Venta?', wx.YES_NO | wx.ICON_QUESTION)
result = dlg.ShowModal() == wx.ID_YES
if result:
dlg.Destroy()
self.Destroy()
for producto in self.rows:
stock = int( self.DBM.getCantidadByCodigo( str( producto[0] ) )[0] )
nueva_cantidad = stock - int(producto[4])
self.DBM.reduceStockById( producto[5], nueva_cantidad )
self.DBM.addProductTrans( datetime.datetime.now().strftime("%m/%d/%y %H:%M:%S").__str__(),
producto[4],
1,
producto[3],
producto[5],
1,
1,
0,
0 )
def refreshAfterAdd( self, evt ):
self.list_ctrl.ClearAll()
self.__generateContent()
示例2: DBManager
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import getCantidadByCodigo [as 别名]
from DBManager import DBManager
db = DBManager()
#print db.userLogin("gaccardo", "pepe1234")
#print db.countCanchas()
#print db.getCanchaStatus('01/07/2013 00:00:00', 1, '14')
#print db.getProductos()
#print db.getCanchasNames()
#print db.getCanchaPrecio(1)
#print db.getCuentas()
#print db.productosPedido()
#print db.addProduct( '1102', 'Calculo', 'Esta', '459.94', '10', '45')
#print db.changeUserStatus('gaccardo', 1)
#print db.getClienteReservado('01/26/2013 00:00:00', 2, '14')
#print db.getCanchaStatus('01/26/2013 00:00:00', 2, '14')
print db.getCantidadByCodigo('1002')