本文整理匯總了Python中DBManager.DBManager.deleteProductFromCuenta方法的典型用法代碼示例。如果您正苦於以下問題:Python DBManager.deleteProductFromCuenta方法的具體用法?Python DBManager.deleteProductFromCuenta怎麽用?Python DBManager.deleteProductFromCuenta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.deleteProductFromCuenta方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: CuentaCancha
# 需要導入模塊: from DBManager import DBManager [as 別名]
# 或者: from DBManager.DBManager import deleteProductFromCuenta [as 別名]
#.........這裏部分代碼省略.........
for row in productos:
rows.append( (row[3], row[4], row[5], row[1], row[2]) )
except:
rows.append( ('Vacio', '', '', '', '') )
self.list_ctrl.InsertColumn(0, "Codigo")
self.list_ctrl.InsertColumn(1, "Marca")
self.list_ctrl.InsertColumn(2, "Descripcion")
self.list_ctrl.InsertColumn(3, "Precio")
self.list_ctrl.InsertColumn(4, "Cantidad")
index = 0
total = 0
for row in rows:
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, "$ %s" % str( row[3] ))
self.list_ctrl.SetStringItem(index, 4, str( row[4] ))
total += row[3] * row[4]
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, "$ %s" % total)
self.list_ctrl.SetItemBackgroundColour(index, "red")
self.Bind(wx.EVT_BUTTON, self.onAdd, self.btn_add)
self.Bind(wx.EVT_BUTTON, self.onDel, self.btn_del)
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)
sizer.Add(sizer2, 0, wx.ALL, 1)
sizer.Add(self.list_ctrl, 1, wx.EXPAND)
self.SetSizer(sizer)
self.Show(True)
def __redefine( self, evt ):
self.list_ctrl.ClearAll()
id_reserva = self.DBM.getIDReservado( self.data['fecha'],
self.data['id_cancha'],
self.data['horario'] )
id_cuenta_horario = self.DBM.getCuentaHorarioID( id_reserva )[0]
self.DBM.addProductToCuentaCancha( id_cuenta_horario,
evt.data['producto'][0],
evt.data['producto'][4],
evt.data['cantidad'] )
nueva_cantidad = evt.data['producto'][6] - int( evt.data['cantidad'] )
self.DBM.reduceStockById( evt.data['producto'][0], nueva_cantidad )
self.DBM.addProductTrans( self.data["fecha"],
evt.data['cantidad'],
1,
evt.data['producto'][4],
evt.data['producto'][0],
1,
1,
self.data['id_cancha'],
id_cuenta_horario)
self.__generateContent()
def onAdd( self, evt ):
sp = SeleccionarProducto( self, id=wx.ID_ANY,
title="Agregar Producto a la Compra")
def onDel( self, evt ):
item = self.list_ctrl.GetItem( self.list_ctrl.GetFirstSelected() )
product = self.DBM.getProductoByCode( item.GetText() )
id_reserva = self.DBM.getIDReservado( self.data['fecha'],
self.data['id_cancha'],
self.data['horario'] )
id_cuenta_horario = self.DBM.getCuentaHorarioID( id_reserva )[0]
productos = self.DBM.getProductosByCuenta( id_cuenta_horario )
cantidad = 0
for prod in productos:
if prod[0] == product[0][0]:
cantidad = prod[2]
n_cantidad = cantidad + product[0][6]
self.DBM.reduceStockById( product[0][0], n_cantidad )
self.DBM.deleteProductFromCuenta( product[0][0], id_cuenta_horario )
self.DBM.deleteProductFromProductTrans( product[0][0], id_cuenta_horario )
self.list_ctrl.ClearAll()
self.__generateContent()