本文整理汇总了Python中DBManager.DBManager.getCuentaHorarioID方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.getCuentaHorarioID方法的具体用法?Python DBManager.getCuentaHorarioID怎么用?Python DBManager.getCuentaHorarioID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.getCuentaHorarioID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CuentaCancha
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import getCuentaHorarioID [as 别名]
class CuentaCancha( wx.Dialog ):
def __init__( self, parent, id, title, data ):
wx.Dialog.__init__( self, parent, id, title )
self.data = data
self.SetSize( ( 800, 600 ) )
self.SetMinSize( ( 800, 600 ) )
self.list_ctrl = wx.ListCtrl(self, style=wx.LC_REPORT)
image2 = wx.Image('images/add.png',
wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.btn_add = wx.BitmapButton(self, id=-1, bitmap=image2,
size=(24,24))
image5 = wx.Image('images/delete.png',
wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.btn_del = wx.BitmapButton(self, id=-1, bitmap=image5,
size=(24,24))
self.__generateContent( )
self.Bind(wx.EVT_CLOSE, self.__OnClose)
Publisher().subscribe(self.__redefine, ("producto_seleccionado"))
def __OnClose( self, evt ):
Publisher().sendMessage(("cuentacancha_cerrada"), True)
self.Destroy()
def __generateContent( self ):
self.DBM = DBManager()
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 )
rows = list()
try:
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"],
#.........这里部分代码省略.........