Created
June 23, 2009 18:01
-
-
Save batok/134719 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DlgRetroactivoTipoCambio(g_sc.SizedDialog): | |
def __init__(self, datos = None ): | |
g_sc.SizedDialog.__init__(self, None, -1, "Retroactivo Tipo de Cambio", size = ( 800, 600 ), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) | |
self.SetExtraStyle( wx.WS_EX_VALIDATE_RECURSIVELY) | |
pane = self.GetContentsPane() | |
pane.SetSizerType("form") | |
self.gdatos = datos | |
wx.StaticText(pane,-1,"Corrida Destino") | |
corrida_destino = wx.TextCtrl(pane, -1, datos.corrida_destino, size = ( 50,20), validator = BanamexTextValidator("corrida_destino", datos)) | |
wx.StaticText(pane,-1,"Tipo de Cambio") | |
tipo_de_cambio = wx.TextCtrl(pane, -1, datos.tipo_de_cambio, size = ( 50,20), validator = BanamexTextValidator("tipo_de_cambio", datos)) | |
wx.StaticText(pane,-1,"Fecha Inicial") | |
fecha_inicial = wx.DatePickerCtrl( pane, -1, wx.DefaultDateTime, wx.DefaultPosition, [140,-1], wx.DP_DROPDOWN|wx.DP_ALLOWNONE, validator = SimDateValidator("fecha_inicial", datos) ) | |
fecha_inicial.SetValue(datos.fecha_inicial) | |
wx.StaticText(pane,-1,"Fecha Final") | |
fecha_final = wx.DatePickerCtrl( pane, -1, wx.DefaultDateTime, wx.DefaultPosition, [140,-1], wx.DP_DROPDOWN|wx.DP_ALLOWNONE, validator = SimDateValidator("fecha_final", datos) ) | |
fecha_final.SetValue(datos.fecha_final) | |
wx.StaticText(pane,-1,"Corridas") | |
corridas = wx.ListCtrl(pane,-1,size = (400,400) ,style = wx.LC_REPORT ) | |
bg1 = wx.Colour( 239, 235, 239 ) | |
bg2 = wx.Colour( 255, 207, 99 ) | |
title = "#, Corrida, F.Inicial,F.Final" | |
for i, colTitle in enumerate(title.split(",")): | |
corridas.InsertColumn(i, colTitle) | |
sql = """ | |
select idcorrida, fechainicial, fechafinal from simcorridas where idempresa = %s order by idcorrida | |
""" % ( datos.empresa) | |
cu = datos.conn.cursor() | |
cu.execute(sql) | |
x = 0 | |
for row in cu.fetchall(): | |
x += 1 | |
i = corridas.InsertStringItem(sys.maxint, "%05d" % x) | |
bgcolor = bg1 | |
if i % 2 == 0: | |
bgcolor = bg2 | |
corridas.SetItemBackgroundColour( i, bgcolor) | |
corridas.SetStringItem(i,1,str(row[0])) | |
a, m ,d = row[1].year, row[1].month, row[1].day | |
corridas.SetStringItem(i,2,"%04d/%02d/%02d" % (a,m,d) ) | |
a, m ,d = row[2].year, row[2].month, row[2].day | |
corridas.SetStringItem(i,3,"%04d/%02d/%02d" % (a,m,d) ) | |
cu.close() | |
fila = 0 | |
for i, colTitle in enumerate(title.split(",")): | |
if i == 0: | |
fila = corridas.InsertStringItem(sys.maxint, "#%s#" % colTitle) | |
else: | |
corridas.SetStringItem(fila, i, "#%s#" % colTitle) | |
corridas.SetColumnWidth(0,50) | |
for i in range(1,4): | |
corridas.SetColumnWidth(i, wx.LIST_AUTOSIZE) | |
corridas.DeleteItem(fila) | |
#self.Refresh() | |
#self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnActivate, empleados ) | |
self.SetButtonSizer( self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL )) | |
self.Fit() | |
#self.SetMinSize(self.GetSize()) | |
fecha_inicial.SetFocus() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment