Ejemplo n.º 1
0
 def onDoClocking(self):
     """
     Callback to actually clock-in the user.
     Called when the clock-in button is pressed or return is pressed.
     """
     username = self.clockingPanel.getUserName()
     password = self.clockingPanel.getPassword()
     
     u = user.check(username, password)
     
     if not u:
         message = '<html><head/><body><p><span style=" font-size:14pt; font-weight:600; font-style:italic; color:#ff0856;">%s</span></p></body></html>'%cbpos.tr.auth_('Invalid username or password.')
         self.showAuthErrorMessage(message)
         return
     
     is_in = self.clockingPanel.isIn()
     date_time = datetime.datetime.now()
     
     if is_in:
         if user.clockin(u):
             message = cbpos.tr.auth_('Clock in sucessful.\nYour in time is %s'%date_time)
             self.showDoneMessage(message)
         else:
             message = cbpos.tr.auth_('Clock in UNSUCCESSFUL')
             self.showErrorMessage(message)
     else:
         if user.clockout(u):
             message = cbpos.tr.auth_('Clock out sucessful.\nYour out time is %s'%date_time)
             self.showDoneMessage(message)
         else:
             message = cbpos.tr.auth_('Clock out UNSUCESSFUL')
             self.showErrorMessage(message)
Ejemplo n.º 2
0
    def onDoClocking(self):
        """
        Callback to actually clock-in the user.
        Called when the clock-in button is pressed or return is pressed.
        """
        username = self.clockingPanel.getUserName()
        password = self.clockingPanel.getPassword()

        u = user.check(username, password)

        if not u:
            message = '<html><head/><body><p><span style=" font-size:14pt; font-weight:600; font-style:italic; color:#ff0856;">%s</span></p></body></html>' % cbpos.tr.auth_(
                'Invalid username or password.')
            self.showAuthErrorMessage(message)
            return

        is_in = self.clockingPanel.isIn()
        date_time = datetime.datetime.now()

        if is_in:
            if user.clockin(u):
                message = cbpos.tr.auth_(
                    'Clock in sucessful.\nYour in time is %s' % date_time)
                self.showDoneMessage(message)
            else:
                message = cbpos.tr.auth_('Clock in UNSUCCESSFUL')
                self.showErrorMessage(message)
        else:
            if user.clockout(u):
                message = cbpos.tr.auth_(
                    'Clock out sucessful.\nYour out time is %s' % date_time)
                self.showDoneMessage(message)
            else:
                message = cbpos.tr.auth_('Clock out UNSUCESSFUL')
                self.showErrorMessage(message)
Ejemplo n.º 3
0
 def onClocking(self):
     username = self.loginPanel.getUserName()
     password = self.loginPanel.getPassword()
     
     u = user.check(username, password)
     if u:
         if user.clockin(u):
             date_time = datetime.datetime.now()
             ok_msg = cbpos.tr.auth_('Clock in sucessful.\nYour in time is %s'%date_time)
             self.loginPanel.setMessage(ok_msg)
         else:
             ok_msg = cbpos.tr.auth_('Clock in UNSUCCESSFUL')
             self.loginPanel.setError(ok_msg)
     else:
         self.loginPanel.setError('<html><head/><body><p><span style=" font-size:14pt; font-weight:600; font-style:italic; color:#ff0856;">%s</span></p></body></html>'%cbpos.tr.auth_('Invalid username or password.') )
         self.loginPanel.editPassword.setFocus()
         self.loginPanel.editPassword.selectAll()
Ejemplo n.º 4
0
    def onClocking(self):
        username = self.loginPanel.getUserName()
        password = self.loginPanel.getPassword()

        u = user.check(username, password)
        if u:
            if user.clockin(u):
                date_time = datetime.datetime.now()
                ok_msg = cbpos.tr.auth_(
                    'Clock in sucessful.\nYour in time is %s' % date_time)
                self.loginPanel.setMessage(ok_msg)
            else:
                ok_msg = cbpos.tr.auth_('Clock in UNSUCCESSFUL')
                self.loginPanel.setError(ok_msg)
        else:
            self.loginPanel.setError(
                '<html><head/><body><p><span style=" font-size:14pt; font-weight:600; font-style:italic; color:#ff0856;">%s</span></p></body></html>'
                % cbpos.tr.auth_('Invalid username or password.'))
            self.loginPanel.editPassword.setFocus()
            self.loginPanel.editPassword.selectAll()