def showrecord(self,code): return sq.wxsqltxt('employee.db',"""select distinct attend.date,attend.enterit,attend.exitit,empfile.tsktimeout from attend,empfile where attend.employid = empfile.employid and attend.employid = %s """ %code)
def showrecord(self, code): return sq.wxsqltxt( 'employee.db', """select empfile.employid,employ.name,employ.family,empfile.groupid, empfile.workid,empfile.picpath,empfile.empdate,empfile.tsktimein,empfile.tsktimeout from empfile,employ where employ.employid = %s and empfile.employid = employ.employid """ % code)
def showitem(self): now = NOW mylist = sq.wxsqltxt('employee.db',"""select attend.date , employ.name , employ.family , attend.enterit , attend.exitit , Groups.groupname , Shifts.Shiftname from attend natural join employ,Shifts,Groups on Shifts.Shiftid = attend.shiftid and Groups.Groupid = attend.groupid and attend.date = '%s' """ %now) for item in mylist: self.m_dataViewCtrl1.AppendItem(item[::-1])
def showrecord(self, code): return sq.wxsqltxt( 'employee.db', """select empfile.employid,employ.name,employ.family,Groups.groupname,Shifts.Shiftname,empfile.picpath from empfile,employ,Groups,Shifts where empfile.employid = %s and empfile.employid = employ.employid and empfile.groupid = Groups.Groupid and empfile.workid = Shifts.Shiftid """ % code)
def showrecord(self, myday): #print myday return sq.wxsqltxt( 'employee.db', """select employ.name , employ.family , attend.enterit , attend.exitit , Groups.groupname , Shifts.Shiftname from attend natural join employ,Shifts,Groups on Shifts.Shiftid = attend.shiftid and Groups.Groupid = attend.groupid and attend.date = '%s' """ % myday)
def Litem( self , bar ): data = sq.wxsqltxt('Menu.db',"""select distinct mitem.itemname from mitem where mitem.mbarid=%s """%bar) result = [] for i in range(len(data)): if data[i][0] != None: result.append(data[i][0]) return result
def entry(self, event): f0 = self.m_searchCtrl1.GetValue() f1 = self.fild1.GetValue() f2 = self.fild2.GetValue() f3 = self.fild3.GetValue() f4 = self.fild4.GetValue() f5 = self.m_datePicker1.GetValue() f6 = self.fild6.GetValue() f7 = self.fild7.GetValue() fs = sq.wxsqltxt( 'employee.db', """select empfile.employid , empfile.groupid , empfile.workid from empfile where empfile.employid = %s """ % f0) #print f5,type(f5) #print fs[0][0],fs[0][1],fs[0][2] #today = unicode(JalaliDatetime(f5).strftime('%x')) tst = sq.wxsqltxt( 'employee.db', """select attend.employid ,attend.date, attend.enterit , attend.exitit from attend where attend.employid = %s """ % f0) #print tst #print f6,f7 sq.wxsqlup( 'employee.db', ' attend ', ' enterit = ? where attend.employid = %s and attend.date = ' % f0 + '"' + self.myday + '"', [f6]) sq.wxsqlup( 'employee.db', ' attend ', ' exitit = ? where attend.employid = %s and attend.date = ' % f0 + '"' + self.myday + '"', [f7]) self.Refresh() self.Layout() q = self.GetParent() q.Close()
def Ondate(self, event): f5 = self.m_datePicker1.GetValue() #.strftime('%Y-%M-%D') self.myday = JalaliDatetime( date(int(f5.FormatISODate()[:4]), int(f5.FormatISODate()[5:7]), int(f5.FormatISODate()[8:10]))).strftime('%N/%P/%K') #print self.myday inout = sq.wxsqltxt( 'employee.db', """select attend.employid ,attend.date, attend.enterit , attend.exitit from attend where attend.employid = %s and attend.date = """ % self.m_searchCtrl1.GetValue() + '"' + self.myday + '"') #print inout self.fild6.SetValue(inout[0][2]) self.fild7.SetValue(inout[0][3])
def __init__( self, parent,lbl ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 768,293 ), style = wx.TAB_TRAVERSAL ) bSizer4 = wx.BoxSizer( wx.VERTICAL ) self.m_dataViewCtrl1 = wx.dataview.DataViewListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.dataview.DV_HORIZ_RULES|wx.dataview.DV_MULTIPLE|wx.dataview.DV_ROW_LINES|wx.dataview.DV_VARIABLE_LINE_HEIGHT|wx.dataview.DV_VERT_RULES ) self.DVCol = [] for cloum in lbl: self.DVCol.append(self.m_dataViewCtrl1.AppendTextColumn(cloum,0)) ''' self.m_dataViewColumn1 = self.m_dataViewCtrl1.AppendTextColumn( u"توضیحات", 0 ) self.m_dataViewColumn2 = self.m_dataViewCtrl1.AppendTextColumn( u"خروج عصر", 0 ) self.m_dataViewColumn3 = self.m_dataViewCtrl1.AppendTextColumn( u"ورود عصر", 0 ) self.m_dataViewColumn4 = self.m_dataViewCtrl1.AppendTextColumn( u"خروج صبح", 0 ) self.m_dataViewColumn5 = self.m_dataViewCtrl1.AppendTextColumn( u"ورود صبح", 0 ) self.m_dataViewColumn6 = self.m_dataViewCtrl1.AppendDateColumn( u"تاریخ", 0 ) self.m_dataViewColumn7 = self.m_dataViewCtrl1.AppendTextColumn( u"نام خانوادگی", 0 ) self.m_dataViewColumn8 = self.m_dataViewCtrl1.AppendTextColumn( u"نام", 0 ) self.m_dataViewColumn9 = self.m_dataViewCtrl1.AppendTextColumn( u"شماره عضویت", 0 ) ''' bSizer4.Add( self.m_dataViewCtrl1, 4, wx.ALL|wx.EXPAND, 5 ) #mylist = sq.wxsqsel('employee.db','attend ,employ ','*','') mylist = sq.wxsqltxt('employee.db',"""select attend.date , employ.name , employ.family , attend.enterit , attend.exitit , Groups.groupname , Shifts.Shiftname from attend natural join employ,Shifts,Groups on Shifts.Shiftid = attend.shiftid and Groups.Groupid = attend.groupid """) #print mylist for item in mylist: self.m_dataViewCtrl1.AppendItem(item[::-1]) self.SetSizer( bSizer4 ) self.Layout()
def __init__(self, parent, lbl): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(520, 470), style=wx.TAB_TRAVERSAL) #self.SetLayoutDirection(2) bSizer4 = wx.BoxSizer(wx.VERTICAL) bSizer2 = wx.BoxSizer(wx.HORIZONTAL) bSizer2.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.m_bpButton1 = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_GO_BACK, ), wx.DefaultPosition, wx.DefaultSize, wx.BU_LEFT) bSizer2.Add(self.m_bpButton1, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.m_datePicker1 = wx.DatePickerCtrl(self, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.DP_DEFAULT | wx.DP_DROPDOWN) bSizer2.Add(self.m_datePicker1, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.m_bpButton2 = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_GO_FORWARD, ), wx.DefaultPosition, wx.DefaultSize, wx.BU_RIGHT) bSizer2.Add(self.m_bpButton2, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, u"تاریخ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) bSizer2.Add(self.m_staticText1, 0, wx.ALIGN_CENTER | wx.ALL, 5) bSizer4.Add(bSizer2, 1, wx.EXPAND, 5) self.m_dataViewCtrl1 = wx.dataview.DataViewListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.dataview.DV_HORIZ_RULES | wx.dataview.DV_MULTIPLE | wx.dataview.DV_ROW_LINES | wx.dataview.DV_VARIABLE_LINE_HEIGHT | wx.dataview.DV_VERT_RULES) self.DVCol = [] for cloum in lbl: self.DVCol.append(self.m_dataViewCtrl1.AppendTextColumn(cloum, 0)) ''' self.m_dataViewColumn1 = self.m_dataViewCtrl1.AppendTextColumn( u"توضیحات", 0 ) self.m_dataViewColumn2 = self.m_dataViewCtrl1.AppendTextColumn( u"خروج صبح", 0 ) self.m_dataViewColumn3 = self.m_dataViewCtrl1.AppendTextColumn( u"ورود صبح", 0 ) self.m_dataViewColumn4 = self.m_dataViewCtrl1.AppendTextColumn( u"نام خانوادگی", 0 ) self.m_dataViewColumn5 = self.m_dataViewCtrl1.AppendTextColumn( u"نام", 0 ) self.m_dataViewColumn6 = self.m_dataViewCtrl1.AppendTextColumn( u"شماره عضویت", 0 ) ''' bSizer4.Add(self.m_dataViewCtrl1, 4, wx.ALL | wx.EXPAND, 5) self.day = JalaliDatetime.now().strftime('%N/%P/%K') #print self.day mylist = sq.wxsqltxt( 'employee.db', """select employ.name , employ.family , attend.enterit , attend.exitit , Groups.groupname , Shifts.Shiftname from attend natural join employ,Shifts,Groups on Shifts.Shiftid = attend.shiftid and Groups.Groupid = attend.groupid and attend.date = '%s' """ % self.day) for item in mylist: self.m_dataViewCtrl1.AppendItem(item[::-1]) bSizer3 = wx.BoxSizer(wx.HORIZONTAL) self.m_button2 = wx.Button(self, wx.ID_ANY, u"تائید", wx.DefaultPosition, wx.DefaultSize, 0) bSizer3.Add(self.m_button2, 0, wx.ALIGN_CENTER | wx.ALL, 5) self.m_button1 = wx.Button(self, wx.ID_ANY, u"انصراف", wx.DefaultPosition, wx.DefaultSize, 0) bSizer3.Add(self.m_button1, 0, wx.ALIGN_CENTER | wx.ALL, 5) bSizer3.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.m_checkBox1 = wx.CheckBox(self, wx.ID_ANY, u"ارسال به فایل اکسل", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT) self.m_checkBox1.Enable(False) bSizer3.Add(self.m_checkBox1, 0, wx.ALIGN_CENTER | wx.ALL, 5) bSizer4.Add(bSizer3, 1, wx.EXPAND, 5) self.SetSizer(bSizer4) self.Layout() # Connect Events self.m_bpButton1.Bind(wx.EVT_BUTTON, self.OnFor) self.m_bpButton2.Bind(wx.EVT_BUTTON, self.OnBck) self.m_button1.Bind(wx.EVT_BUTTON, self.OnCanel) self.m_button2.Bind(wx.EVT_BUTTON, self.OnOkey) self.m_datePicker1.Bind(wx.EVT_DATE_CHANGED, self.Ondate)