当前位置: 首页>>代码示例>>Python>>正文


Python DBManager.getEgresos方法代码示例

本文整理汇总了Python中DBManager.DBManager.getEgresos方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.getEgresos方法的具体用法?Python DBManager.getEgresos怎么用?Python DBManager.getEgresos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBManager.DBManager的用法示例。


在下文中一共展示了DBManager.getEgresos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CanchasTabFinanzas

# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import getEgresos [as 别名]
class CanchasTabFinanzas(wx.Panel):

   def __init__(self, parent):

       wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

       self.DBM   = DBManager()
       self.vbox  = wx.BoxSizer( wx.VERTICAL )
       hbox1      = wx.BoxSizer( wx.HORIZONTAL )
       image1     = wx.Image('calendar.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
       btn_cal    = wx.BitmapButton(self, id=-1, bitmap=image1, size=(40,30))
       image2     = wx.Image('print.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
       btn_prt    = wx.BitmapButton(self, id=-1, bitmap=image2, size=(40,30))
       image3     = wx.Image('money.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
       btn_inicio = wx.BitmapButton(self, id=-1, bitmap=image3, size=(40,30))
       image4     = wx.Image('cashRegister.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
       btn_gasto  = wx.BitmapButton(self, id=-1, bitmap=image4, size=(40,30))
       #image3       = wx.Image('venta.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
       #btn_vta      = wx.BitmapButton(self, id=-1, bitmap=image3, size=(40,30))
       self.desde   = None
       self.hasta   = None

       self.Bind(wx.EVT_BUTTON, self.OnCalendar, btn_cal)
       #self.Bind(wx.EVT_BUTTON, self.OnVenta, btn_vta)
       self.Bind(wx.EVT_BUTTON, self.OnPrint, btn_prt)
       self.Bind(wx.EVT_BUTTON, self.OnInicio, btn_inicio)
       self.Bind(wx.EVT_BUTTON, self.OnGasto, btn_gasto)

       hbox1.Add(btn_cal)
       hbox1.Add(btn_prt)
       hbox1.Add(btn_inicio)
       hbox1.Add(btn_gasto)
       #hbox1.Add(btn_vta)
       self.vbox.Add(hbox1)

       self.hbox2     = wx.BoxSizer( wx.HORIZONTAL )
       self.list_ctrl = wx.ListCtrl(self, style=wx.LC_REPORT)

       self.hbox2.Add(self.list_ctrl, 2, flag=wx.EXPAND)
       self.vbox.Add(self.hbox2, 2, wx.EXPAND)
       self.TOTAL     = 0

       self.SetSizer(self.vbox)
       self.__generateContent()
       Publisher().subscribe(self.OnExternalCalSelected, ("dates"))
       Publisher().subscribe(self.OnTabSelected , ("tab_cuentas_update"))

   def __generateContent( self, desde=None, hasta=None): 
       cuentas = self.DBM.getCuentas(desde, hasta)
       egresos = self.DBM.getEgresos(desde, hasta)

       index = 0

       self.list_ctrl.InsertColumn(0, "Hora")
       self.list_ctrl.InsertColumn(1, "Producto")
       self.list_ctrl.InsertColumn(2, "Cantidad")
       self.list_ctrl.InsertColumn(3, "Precio")
       self.list_ctrl.InsertColumn(4, "Total")

       for cuenta in cuentas+egresos:
          self.list_ctrl.InsertStringItem(index, cuenta[0])
          self.list_ctrl.SetStringItem(index, 1, cuenta[1])
          if cuenta[1] == "Inicio de caja":
              self.list_ctrl.SetStringItem(index, 2, '-')
              self.list_ctrl.SetStringItem(index, 3, '-')
          else:
              self.list_ctrl.SetStringItem(index, 3, "$ %s" % str(cuenta[3]))
              self.list_ctrl.SetStringItem(index, 2, str(cuenta[2]))

          self.list_ctrl.SetStringItem(index, 4, "$ %s" % str(cuenta[4]))

          self.TOTAL += cuenta[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' % str(self.TOTAL))
       self.list_ctrl.SetItemBackgroundColour(index, "red")
       self.list_ctrl.SetItemTextColour(index, "yellow")

   def OnExternalCalSelected( self, evt ):
       desde      = evt.data[0].__str__().split(' ')[0]
       hasta      = evt.data[1].__str__().split(' ')[0]
       self.desde = desde
       self.hasta = hasta
       self.TOTAL = 0
       self.list_ctrl.ClearAll()
       self.__generateContent( desde, hasta )

   def OnGasto( self, evt ):
       Gasto(self, -1, "Egreso de caja")
       self.list_ctrl.ClearAll()
       self.__generateContent()
#.........这里部分代码省略.........
开发者ID:gaccardo,项目名称:canchas,代码行数:103,代码来源:CanchasTabFinanzas.py


注:本文中的DBManager.DBManager.getEgresos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。