Esempio n. 1
0
 def addPermTime(self, time):
     if time == '':
         kivytoast.toast('Invalid Hours !!', (1, 0, 0, 0.5), length_long=True)
     else:
         db = pymysql.connect(credentials['address'], credentials['username'], credentials['password'], credentials['db'], autocommit=True, connect_timeout=1)
         cur = db.cursor()
         cur.execute("INSERT INTO essl.`leave_details` (ID, from_date, to_date, Reason, Status, app_date) VALUES('%d', '%s', '%s', '%s', 'PE', '%s')" %(int(self.data[0]), self.data[1], self.data[1], time, self.data[1]))
         cur.close()
         db.close()
         kivytoast.toast('Success', (1, 0, 1, 0.5), length_long=True)
Esempio n. 2
0
 def Time(self, time):
     db = pymysql.connect(credentials['address'], credentials['username'], credentials['password'], credentials['db'], autocommit=True, connect_timeout=1)
     cur = db.cursor()
     try:
         cur.execute("INSERT INTO essl.%d (IO, MTIME, MDATE, DOOR, AccType) VALUES('%s', '%s', '%s', '%s', 'REGULARIZATION')" %(int(self.id), self.io, time, self.date, self.door))
         kivytoast.toast('Data Added Successfully', (1, 0, 1, 0.5), length_long=True)
     except Exception as e:
         print(e)
         kivytoast.toast('Invalid Information !!', (1, 0, 0, 0.5), length_long=True)
     cur.close()
     db.close()
Esempio n. 3
0
 def remTime(self):
     db = pymysql.connect(credentials['address'], credentials['username'], credentials['password'], credentials['db'], autocommit=True, connect_timeout=1)
     cur = db.cursor()
     try:
         cur.execute("DELETE FROM essl.%d WHERE IO = '%s' AND MTIME = '%s' AND MDATE = '%s' AND DOOR = '%s' AND AccType = '%s'"%(int(self.id), self.data[0], self.data[1], self.date, self.data[2], self.data[3]))
         kivytoast.toast('Deleted Successfully !', (1, 0, 1, 0.5), length_long=True)
     except Exception as e:
         print(e)
         kivytoast.toast('Error, Please Restart', (1, 0, 0, 0.5), length_long=True)
     cur.close()
     db.close()
Esempio n. 4
0
    def checkLogin(self):
        login = checkCredentials(self.ids.username.text,
                                 self.ids.password.text)

        if login == 1:
            ScreenManagement.sm.add_widget(adminPage.AdminPage(name='admin'))
            ScreenManagement.sm.current = 'admin'
        elif login == 2:
            from pages import userPage
            ScreenManagement.sm.add_widget(userPage.UserPage(name='user'))
            ScreenManagement.sm.current = 'user'
        else:
            kivytoast.toast('Wrong Login Credentials!', (1, 0, 0, 0.5))
Esempio n. 5
0
 def getMonthInfo(self, artistID):
     global date
     try:
         monthlyWrkHours.id.append(int(artistID.split(":")[0]))
         monthlyPopup.month = (formatDateTitle(date))
         monthlyPopup.workTime()
         monthlyPopup.pop()
     except Exception as e:
         if date == 'SELECT DATE':
             kivytoast.toast('Select Date !', (1, 0, 0, 0.5),
                             length_long=True)
         else:
             kivytoast.toast('Error Retrieving Data', (0, 1, 1, 0.5),
                             length_long=True)
Esempio n. 6
0
 def getDayInfo(self, artistID):
     global date
     from pages import infoPopup
     try:
         infoPopup.InfoTabAdmin(int(artistID.split(":")[0]),
                                formatDate(date))
     except Exception as e:
         print(e)
         if date == 'SELECT DATE':
             kivytoast.toast('Select Date !', (1, 0, 0, 0.5),
                             length_long=True)
         else:
             kivytoast.toast('No Data Available for this date',
                             (0, 1, 1, 0.5),
                             length_long=True)
Esempio n. 7
0
 def callexcel(self, text, date):
     if text == 'DAY':
         excelIO.excelExport(date)
         #try:
         #    excelIO.excelExport(date)
         #except Exception as e:
         #    from pages import kivytoast
         #    kivytoast.toast(str(e), (1, 0, 0, 0.5), length_long=True)
     if text == 'MONTH':
         try:
             excelIO.exportMonth(
                 date.split(".")[1].zfill(2),
                 date.split(".")[2].zfill(2))
         except:
             from pages import kivytoast
             kivytoast.toast('Please Select Date / Error', (1, 0, 0, 0.5),
                             length_long=True)
Esempio n. 8
0
    def request_for_leave(self):
        id = self.ids.eid.text
        from_date = self.format_date(self.ids.fromDate.text)
        to_date = self.format_date(self.ids.toDate.text)
        if self.ids.el.active and self.ids.cl.active:
            type = '{}-{}:{}-{}'.format('EL', self.ids.el_days.text, 'CL', self.ids.cl_days.text)
        elif self.ids.el.active and not self.ids.cl.active:
            type = '{}-{}'.format('EL', self.ids.el_days.text)
        elif self.ids.cl.active and not self.ids.el.active:
            type = '{}-{}'.format('CL', self.ids.cl_days.text)
        elif self.ids.lop.active:
            type = 'LOP'
        reason = self.ids.reason.text

        eup = ExchangeMail.send_mail([id, from_date, to_date, type, reason])
        up = leaveData.upload_to_db(id, from_date, to_date, type, reason)
        if up == 1:
            from pages import kivytoast
            kivytoast.toast('Leave request submitted', (0, 1, 0, 0.5), length_long=True)
Esempio n. 9
0
    def deleteAllData(self, delDate):
        db = pymysql.connect(credentials['address'],
                             credentials['username'],
                             credentials['password'],
                             credentials['db'],
                             autocommit=True,
                             connect_timeout=1)
        cur = db.cursor()
        cur1 = db.cursor()

        cur.execute(
            "SELECT ID FROM essl.user_master WHERE Status = 'OPEN' AND Name != 'ADMIN'"
        )
        for id in cur.fetchall():
            if id[0] == 1000:
                continue
            cur1.execute("DELETE FROM essl.%d WHERE MDATE = '%s'" %
                         (id[0], delDate))

        kivytoast.toast('Delete Successfull', (1, 1, 0, 0.5), length_long=True)
Esempio n. 10
0
    def callback(instance):
        def call(instance):
            if instance.text == 'OK':
                pop.dismiss()
        global selectedDates
        if instance.text == 'SAVE':
            db = pymysql.connect(credentials['address'], credentials['username'], credentials['password'], credentials['db'], autocommit=True, connect_timeout=1)
            cur = db.cursor()
            closePopBtn = Button(text="OK", size_hint=(1, 0.25))
            closePopBtn.bind(on_release=call)
            if holidayBtn.state == 'down':
                for date in selectedDates:
                    cur.execute("INSERT INTO essl.month_details (DAY, MONTH, YEAR, DETAIL) VALUES(%d, %d, %d, 'HOLIDAY')" %(date[0], date[1], date[2]))
                kivytoast.toast('Holidays Applied', (0, 1, 0, 0.5), length_long=True)
            elif halfdayBtn.state == 'down':
                for date in selectedDates:
                    cur.execute("INSERT INTO essl.month_details (DAY, MONTH, YEAR, DETAIL) VALUES(%d, %d, %d, 'HALFDAY')" %(date[0], date[1], date[2]))
                kivytoast.toast('Halfdays Applied', (0, 1, 0, 0.5), length_long=True)

            cur.close()
            db.close()
Esempio n. 11
0
    def addPermTimeBulk(self, hours):
        def callback(instance):
            if instance.text == 'OK':
                pop.dismiss()
                return 0

        closePopBtn = Button(text="OK", size_hint=(1, 0.25))
        closePopBtn.bind(on_release=callback)
        if hours == '' or self.department == 'DEPARTMENT' or self.department == '':
            kivytoast.toast('Please Enter Valid Details !', (1, 0, 0, 0.5))
        elif self.department == 'ALL':
            db = pymysql.connect(credentials['address'],
                                 credentials['username'],
                                 credentials['password'],
                                 credentials['db'],
                                 autocommit=True,
                                 connect_timeout=1)
            cur = db.cursor()
            cur1 = db.cursor()
            cur.execute(
                "SELECT ID FROM essl.user_master WHERE Status = 'OPEN' AND Name != 'ADMIN'"
            )
            for id in cur.fetchall():
                if id[0] == 1000:
                    continue
                cur1.execute(
                    "INSERT INTO essl.%d (IO, MTIME, MDATE, DOOR) VALUES('P', '%s', '%s', 'PERMISSION')"
                    % (int(id[0]), hours, formatDate(self.date.text)))
            cur.close()
            cur1.close()
            db.close()
            kivytoast.toast('Added Permission Time', (0, 1, 0, 0.5),
                            length_long=True)
        else:
            db = pymysql.connect(credentials['address'],
                                 credentials['username'],
                                 credentials['password'],
                                 credentials['db'],
                                 autocommit=True,
                                 connect_timeout=1)
            cur = db.cursor()
            cur1 = db.cursor()
            cur.execute(
                "SELECT ID FROM essl.user_master WHERE Status = 'OPEN' AND Department = '%s'"
                % (self.department))
            for id in cur.fetchall():
                if id[0] == 1000:
                    continue
                cur1.execute(
                    "INSERT INTO essl.%d (IO, MTIME, MDATE, DOOR) VALUES('P', '%s', '%s', 'PERMISSION')"
                    % (int(id[0]), hours, formatDate(self.date.text)))
            cur.close()
            cur1.close()
            db.close()
            kivytoast.toast('Added Permission Time', (0, 1, 0, 0.5),
                            length_long=True)