Esempio n. 1
0
def checkpbal():
    if empl_id.get() == "" or ad_no.get() == "":
        ee3.delete(0, END)
        ee3.insert(END, "NULL ENTRIES NOT POSSIBLE")
    else:
        xyz = aback.checkid(int(empl_id.get()))
        #print(xyz)
        if type(xyz) == int:
            ee3.delete(0, END)
            ee3.insert(END, "No such employee id exists")
        else:
            ADH = aback.getaadhaar(empl_id.get())[0][0]
            #print(ADH)
            if int(ad_no.get()) == ADH:
                #print("DO SOMETHING HERE")
                top = passvariable1.get()
                if top == "PTO":
                    ptovalue = aback.getpto(int(empl_id.get()))
                    ee3.delete(0, END)
                    ee3.insert(END, ptovalue)
                elif top == "PRIVILEGE PASS":
                    ppvalue = aback.getpp(int(empl_id.get()))
                    #print(type(ppvalue[0][0]))
                    ee3.delete(0, END)
                    ee3.insert(END, ppvalue)
                elif top == "CARRY FWD PTO":
                    ee3.delete(0, END)
                    cfpto = aback.getcfpto(int(empl_id.get()))
                    #print(cfpto)
                    try:
                        type(cfpto[0][0])
                        ee3.delete(0, END)
                        ee3.insert(END, cfpto)
                    except IndexError:
                        ee3.delete(0, END)
                        ee3.insert(END, "NO CARRY FWD PTO")

                elif top == "CARRY FWD PP":
                    ee3.delete(0, END)
                    cfpp = aback.getcfpp(int(empl_id.get()))
                    #print(cfpp)
                    try:
                        type(cfpp[0][0])
                        ee3.delete(0, END)
                        ee3.insert(END, cfpp)
                    except IndexError:
                        ee3.delete(0, END)
                        ee3.insert(END, "NO CARRY FWD PP")

            else:
                ee3.delete(0, END)
                ee3.insert(END, "WRONG AADHAR NUMBER")
Esempio n. 2
0
def dispfam_data():
    if emp_id.get() == "":
        msg = "Employee id cannot be NULL"
        list2.delete(0, END)
        list2.insert(END, msg)
    else:
        xyz = aback.checkid(int(emp_id.get()))
        #print(xyz)
        if type(xyz) == int:
            list2.delete(0, END)
            list2.insert(END, "No such employee id exists")
        else:
            list2.delete(0, END)
            for i in aback.viewfam(emp_id.get()):
                list2.insert(END, i)
Esempio n. 3
0
def search_emp():
    if emp_id.get() == "":
        msg = "PLEASE GIVE EMPLOYEE ID"
        list1.delete(0, END)
        list1.insert(END, msg)
    else:
        xyz = aback.checkid(int(emp_id.get()))
        #print(xyz)
        if type(xyz) == int:
            list1.delete(0, END)
            list1.insert(END, "No such employee id exists")
        else:
            list1.delete(0, END)
            for i in aback.viewemp(emp_id.get()):
                list1.insert(END, i)
        clearpart1()
Esempio n. 4
0
def add_data():
    global flag
    flag = 0
    gpp.set("")
    doy = dobvariable3.get()
    age = current_year - int(doy)
    currage.set("CURRENT AGE : " + str(age))
    dateofbirth = dobvariable1.get() + "-" + dobvariable2.get(
    ) + '-' + dobvariable3.get()
    dateofappointment = variable1.get() + "-" + variable2.get(
    ) + '-' + variable3.get()
    if emp_id.get() == "" or name_val.get() == "" or desig.get(
    ) == "" or basic_val.get() == "" or grade_pay.get() == "" or level_val.get(
    ) == "" or variable4.get() == "" or variable5.get() == "" or aadhar_no.get(
    ) == "":
        msg = "ENTRIES cannot be NULL"
        list1.delete(0, END)
        list1.insert(END, msg)
    else:
        flag = 1
        xyz = aback.checkid(int(emp_id.get()))
        xyz2 = aback.checkad(int(aadhar_no.get()))
        #print(xyz2)
        if (type(xyz) == int and type(xyz2) == int):
            list1.delete(0, END)
            aback.insert_value1(emp_id.get(), name_val.get(), dateofbirth,
                                desig.get(), basic_val.get(), grade_pay.get(),
                                level_val.get(), dateofappointment,
                                variable4.get(), variable5.get(),
                                aadhar_no.get())
            t = (emp_id.get(), name_val.get(), dateofbirth, desig.get(),
                 basic_val.get(), grade_pay.get(), level_val.get(),
                 dateofappointment, variable4.get(), variable5.get(),
                 aadhar_no.get())
            list1.insert(END, t)
            if (float(grade_pay.get()) >= 5400):
                gpp.set("OFFICER")
            else:
                gpp.set("NOT OFFICER")
        else:
            list1.delete(0, END)
            list1.insert(END, "id or aadhar Number duplicate")
        passbal()
Esempio n. 5
0
def addfam_data():

    if emp_id.get() == "" or f1name.get() == "" or f1dob.get(
    ) == "" or fam_ad.get() == "":
        msg = "ENTRIES cannot be NULL"
        list2.delete(0, END)
        list2.insert(END, msg)
    else:
        xyz = aback.checkid(int(emp_id.get()))
        #print(xyz)
        if type(xyz) == int:
            list2.delete(0, END)
            list2.insert(END, "No such employee id exists")
        else:
            list2.delete(0, END)
            aback.insert_value2(emp_id.get(), variable6.get(), f1name.get(),
                                f1dob.get(), fam_ad.get())
            list2.insert(END, "MEMBER ADDED SUCCESSFULLY")
            e7.delete(0, END)
            e8.delete(0, END)
            eA1.delete(0, END)
Esempio n. 6
0
def search_emp():
    if emp_id.get() == "" or aadhar_no.get() == "":
        msg = "PLEASE GIVE BOTH EMPLOYEE ID AND AADHAR"
        msgg.set(msg)
        list1.delete(0, END)
        list2.delete(0, END)
        name_val.set("")
        dob_val.set("")
        desig.set("")
        basic_val.set("")
        grade_pay.set("")
        level_val.set("")
        doa_val.set("")
        variable4.set("")
        variable5.set("")
        pp_b.set("")
        pto_b.set("")
        cfpp_b.set("")
        cfpto_b.set("")
    else:
        xyz = aback.checkid(int(emp_id.get()))
        #print(xyz)
        if type(xyz) == int:
            msgg.set("No such employee id exists")
            list1.delete(0, END)
            list2.delete(0, END)
            name_val.set("")
            dob_val.set("")
            desig.set("")
            basic_val.set("")
            grade_pay.set("")
            level_val.set("")
            doa_val.set("")
            variable4.set("")
            variable5.set("")
            pp_b.set("")
            pto_b.set("")
            cfpp_b.set("")
            cfpto_b.set("")
        else:

            msgg.set("SUCCESSFUL SEARCH")
            ADH = aback.getaadhaar(emp_id.get())[0][0]
            if int(aadhar_no.get()) == ADH:
                for dd in aback.viewemp(emp_id.get()):
                    #print(dd)
                    name_val.set(dd[1])
                    dob_val.set(dd[2])
                    desig.set(dd[3])
                    basic_val.set(dd[4])
                    grade_pay.set(dd[5])
                    level_val.set(dd[6])
                    doa_val.set(dd[7])
                    variable4.set(dd[8])
                    variable5.set(dd[9])
                list1.delete(0, END)
                for fd in aback.viewfam(emp_id.get()):
                    #print(fd)
                    list1.insert(END, fd[2:6])
                ptovalue = aback.getpto(int(emp_id.get()))[0][0]
                pto_b.set("PTO BAL:   " + str(ptovalue))
                ppvalue = aback.getpp(int(emp_id.get()))[0][0]
                pp_b.set("PP BAL :   " + str(ppvalue))

                cfptovalue = aback.getcfpto(int(emp_id.get()))
                try:
                    type(cfptovalue[0][0])
                    cfpto_b.set("CF PTO BAL:   " + str(cfptovalue[0][0]))
                except IndexError:
                    cfpto_b.set(" NO CF PTO BAL")

                cfppvalue = aback.getcfpp(int(emp_id.get()))
                try:
                    type(cfppvalue[0][0])
                    cfpp_b.set("CF PP BAL:   " + str(cfppvalue[0][0]))
                except IndexError:
                    cfpp_b.set(" NO CF PP BAL")

                list2.delete(0, END)
                for td in aback.traveldata(emp_id.get()):
                    #print(td)
                    list2.insert(END, td)

            else:
                list1.delete(0, END)
                name_val.set("")
                dob_val.set("")
                desig.set("")
                basic_val.set("")
                grade_pay.set("")
                level_val.set("")
                doa_val.set("")
                variable4.set("")
                variable5.set("")
                pp_b.set("")
                pto_b.set("")
                list2.delete(0, END)
                top_pp.set("")
                from_city.set("")
                to_city.set("")
                via_city.set("")
                top_j.set("")
                break_j.set("")
                fm.set("")
                doj.set("")
                texx1.delete(1.0, END)
                msgg.set("WRONG AADHAR NO")
Esempio n. 7
0
def passbal():
    flag2 = 0  #here is pbal PART
    if emp_id.get() == "" or aadhar_no.get() == "" or gpp.get() == "":
        pass
    else:
        if flag == 0:
            xyz = aback.checkid(int(emp_id.get()))
            xyz2 = aback.checkad(int(aadhar_no.get()))
        else:
            xyz = 11  #jst giving an integer
            xyz2 = 11  #integer value
        if (type(xyz) == int and type(xyz2) == int):
            flag2 = 1
            if gpp.get() == "NOT OFFICER":
                doa = variable3.get()
                #print(doa)
                yos = current_year - int(doa)
                if (yos == 5):
                    doam = variable2.get()
                    #print(doam)
                    yosm = current_month - int(doam)
                    #print(yosm)
                    if (yosm > 0):

                        #print("comp 5 yrs ,,, 3pp")
                        ppass = 3
                    else:
                        if (yosm == 0):
                            #now same month so check for day
                            doad = variable1.get()
                            yosd = current_day - int(doad)
                            if (yosd > 0):
                                #5yrs completed
                                ppass = 3
                            else:
                                ppass = 1

                        else:
                            #print("not comp 5 yrs,,,,1pp")
                            ppass = 1

                else:
                    if (yos > 5):
                        #print("completed 5 yrs --- 3pp")
                        ppass = 3
                    else:
                        #print("not comopleted-----1pp")
                        ppass = 1
            else:
                #print("officer ,6pp")
                #officer
                ppass = 6
        else:
            list1.delete(0, END)
            list1.insert(END, "aadhar Number already exists")

    #to insert aadhar data
    if flag2 == 1:
        aback.insert_value3(emp_id.get(), aadhar_no.get(), ppass)
    else:
        pass
Esempio n. 8
0
def submitdata():
    if empl_id.get() == "" or ad_no.get() == "" or from_city.get(
    ) == "" or to_city.get() == "" or via_city.get() == "" or route.get(
    ) == "" or fm.get() == "" or doj.get() == "" or dov.get() == "":
        msg = "ENTRIES cannot be NULL"
        msgg.set(msg)
    else:
        #print("xxxxxxxxxvvvvvvvvvvvvv")
        xyz = aback.checkid(int(empl_id.get()))
        #print(xyz)
        if type(xyz) == int:
            msgg.set("no such emp id exists")
        else:
            ADH = aback.getaadhaar(empl_id.get())[0][0]
            if int(ad_no.get()) == ADH:
                #print("DO SOMETHING HERE")
                if passvariable1.get() == "PTO":
                    ptoval = aback.getpto(int(empl_id.get()))[0][0]
                    if journeyvariable.get() == "HALF/ONE WAY JOURNEY":
                        newpto = ptoval - 0.5
                        if newpto >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_pto(newpto, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH PTO BALANCE")
                    else:
                        newpto = ptoval - 1.0
                        if newpto >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_pto(newpto, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH PTO BALANCE")
                elif passvariable1.get() == "PRIVILEGE PASS":
                    ppval = aback.getpp(int(empl_id.get()))[0][0]
                    if journeyvariable.get() == "HALF/ONE WAY JOURNEY":
                        newpp = ppval - 0.5
                        if newpp >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_pp(newpp, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH PP BALANCE")
                    else:
                        newpp = ppval - 1
                        if newpp >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_pp(newpp, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH PP BALANCE")

                elif passvariable1.get() == "CARRY FWD PTO":
                    cfptoval = aback.getcfpto(int(empl_id.get()))[0][0]
                    if journeyvariable.get() == "HALF/ONE WAY JOURNEY":
                        newcfpto = cfptoval - 0.5
                        if newcfpto >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_cfpto(newcfpto, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH CARRY FORWARD PTO BALANCE")

                    else:
                        newcfpto = cfptoval - 1.0
                        if newcfpto >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_cfpto(newcfpto, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH CARRY FORWARD PTO BALANCE")

                elif passvariable1.get() == "CARRY FWD PP":
                    cfppval = aback.getcfpp(int(empl_id.get()))[0][0]
                    if journeyvariable.get() == "HALF/ONE WAY JOURNEY":
                        newcfpp = cfppval - 0.5
                        if newcfpp >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_cfpp(newcfpp, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH CARRY FORWARD PP BALANCE")
                    else:
                        newcfpp = cfppval - 1
                        if newcfpp >= 0:
                            aback.insert_value4(empl_id.get(), ad_no.get(),
                                                passvariable1.get(),
                                                from_city.get(), to_city.get(),
                                                via_city.get(),
                                                journeyvariable.get(),
                                                route.get(), fm.get(),
                                                doj.get(), dov.get(),
                                                texx.get(1.0, END))
                            aback.update_cfpp(newcfpp, empl_id.get())
                            msgg.set("SUCCESSFUL")
                            ee4.delete(0, END)
                            ee5.delete(0, END)
                            ee6.delete(0, END)
                            ee7.delete(0, END)
                            ee77.delete(0, END)
                            edate.delete(0, END)
                            edate2.delete(0, END)
                            texx.delete(1.0, END)
                            checkpbal()
                        else:
                            msgg.set("NOT ENOUGH CARRY FORWARD PP BALANCE")

            else:
                msgg.set("WRONG AADHAR NO.")