示例#1
0
    def get(self):
        Guser = users.get_current_user()
        if Guser:
            vstrIDNumber = self.request.get('vstrIDNumber')

            findRequest = LoanApplicantDetails.query(
                LoanApplicantDetails.strIDNumber == vstrIDNumber)
            thisLoanApplicantList = findRequest.fetch()

            if len(thisLoanApplicantList) > 0:
                thisLoanApplicant = thisLoanApplicantList[0]
            else:
                thisLoanApplicant = LoanApplicantDetails()

            findRequest = AdvancedAmount.query(
                AdvancedAmount.strAccountNumber ==
                thisLoanApplicant.strAccountNumber)
            thisAdvanceList = findRequest.fetch()

            findRequest = UserRights.query(
                UserRights.strReference == Guser.user_id())
            thisUserRightsList = findRequest.fetch()

            if len(thisUserRightsList) > 0:
                thisUserRights = thisUserRightsList[0]
            else:
                thisUserRights = UserRights()

            if thisUserRights.bolIsEmployee:
                if len(thisAdvanceList) > 0:
                    template = template_env.get_template(
                        'templates/dynamic/ratings/History.html')
                    context = {
                        'thisAdvanceList': thisAdvanceList,
                        'thisLoanApplicant': thisLoanApplicant
                    }
                    self.response.write(template.render(context))
                else:
                    template = template_env.get_template(
                        'templates/dynamic/ratings/History.html')
                    context = {'Message': "Client has no history"}
                    self.response.write(template.render(context))
            else:
                template = template_env.get_template('templates/500.html')
                context = {}
                self.response.write(template.render(context))
        else:
            template = template_env.get_template('templates/500.html')
            context = {}
            self.response.write(template.render(context))
示例#2
0
    def get(self):
        Guser = users.get_current_user()
        if Guser:

            findRequest = UserRights.query(UserRights.strReference == Guser.user_id())
            thisUserRightsList = findRequest.fetch()

            if len(thisUserRightsList) > 0:
                thisUserRights = thisUserRightsList[0]
            else:
                thisUserRights = UserRights()

            if thisUserRights.bolIsEmployee and thisUserRights.bolAccessToEmployeesAdminForm:
                template = template_env.get_template('templates/dynamic/employee/admin.html')
                context = {}
                self.response.write(template.render(context))
            else:
                template = template_env.get_template('templates/500.html')
                context = {}
                self.response.write(template.render(context))
示例#3
0
    def post(self):
        try:
            strEmployeeCode = self.request.get('vstrEmployeeCode')
            logging.info("Employees Delete Executed")
            findRequest = EmploymentDetails.query(
                EmploymentDetails.strEmployeeCode == strEmployeeCode)
            TempEmployees = findRequest

            strReference = ""

            for Employee in TempEmployees:
                strReference = Employee.strReference
                Employee.key.delete()

            findRequest = ResidentialAddress.query(
                ResidentialAddress.strEmployeeCode == strEmployeeCode)
            TempPhysical = findRequest

            for physical in TempPhysical:
                physical.key.delete()

            findRequest = PostalAddress.query(
                PostalAddress.strEmployeeCode == strEmployeeCode)
            TempPostal = findRequest

            for postal in TempPostal:
                postal.key.delete()

            findRequest = BankingDetails.query(
                BankingDetails.strEmployeeCode == strEmployeeCode)
            TempBanking = findRequest

            for banking in TempBanking:
                banking.key.delete()

            findRequest = ContactDetails.query(
                ContactDetails.strEmployeeCode == strEmployeeCode)
            TempContact = findRequest

            for contact in TempContact:
                contact.key.delete()

            findRequest = UserRights.query(
                UserRights.strReference == strReference)
            RightsList = findRequest.fetch()

            if len(RightsList) > 0:
                Rights = RightsList[0]
                Rights.key.delete()

            logging.info("Complete")
            self.redirect('/admin')
        except:
            logging.info("Error")
示例#4
0
    def get(self):
        Guser = users.get_current_user()

        if Guser:
            findRequests = Leads.query(Leads.strConverted == False)
            LeadsList = findRequests.fetch()

            findRequest = Leads.query(Leads.strConverted == True)
            CLeadsList = findRequest.fetch()

            findRequest = EmploymentDetails.query(
                EmploymentDetails.strReference == Guser.user_id())
            EmployList = findRequest.fetch()
            if len(EmployList) > 0:
                Employ = EmployList[0]
            else:
                Employ = EmploymentDetails()

            findRequest = UserRights.query(
                UserRights.strEmployeeCode == Employ.strEmployeeCode)
            RightsList = findRequest.fetch()

            if len(RightsList) > 0:
                Rights = RightsList[0]
            else:
                Rights = UserRights()

            if Rights.bolIsEmployee:
                template = template_env.get_template('templates/leads.html')
                context = {
                    'LeadsList': LeadsList,
                    'CLeadsList': CLeadsList,
                    'Rights': Rights
                }
                self.response.write(template.render(context))
            else:
                template = template_env.get_template('templates/500.html')
                context = {}
                self.response.write(template.render(context))
示例#5
0
    def get(self):
        Guser = users.get_current_user()
        if Guser:

            logging.info("Employee Profiles")

            findRequest =  Activity.query(Activity.strReference == Guser.user_id())
            thisActivityList = findRequest.fetch()

            findRequest = EmploymentDetails.query(EmploymentDetails.strReference == Guser.user_id())
            thisEmployeeList = findRequest.fetch()

            if len(thisEmployeeList) > 0:
                thisEmployee = thisEmployeeList[0]
            else:
                thisEmployee = EmploymentDetails()

            findRequest = Tasks.query(Tasks.strToReference == Guser.user_id())
            thisTasksList = findRequest.fetch()

            TotalTasks = len(thisTasksList)

            findRequest = UserRights.query(UserRights.strReference == Guser.user_id())
            thisUserRightsList = findRequest.fetch()

            if len(thisUserRightsList) > 0:
                thisUserRights = thisUserRightsList[0]
            else:
                thisUserRights = UserRights()

            if thisUserRights.bolIsEmployee:
                template = template_env.get_template('templates/dynamic/employee/Profile.html')
                context = {'thisActivityList':thisActivityList,'thisEmployee':thisEmployee,'TotalTasks': TotalTasks}
                self.response.write(template.render(context))
            else:
                template = template_env.get_template('templates/500.html')
                context = {}
                self.response.write(template.render(context))
示例#6
0
    def post(self):
        Guser = users.get_current_user()
        if Guser:
            findRequest = UserRights.query(UserRights.strReference == Guser.user_id())
            thisUserRightsList = findRequest.fetch()

            if len(thisUserRightsList) > 0:
                thisUserRights = thisUserRightsList[0]
            else:
                thisUserRights = UserRights()

            if thisUserRights.bolIsEmployee and thisUserRights.bolAccessToEmployeesAdminForm:
                findRequest = EmploymentDetails.query()
                thisEmployeeList = findRequest.fetch()
                vstrIndexControl = self.request.get('vstrIndexControl')
                if vstrIndexControl.isalpha():
                    vstrIndexControl = int(vstrIndexControl)

                if vstrIndexControl < len(thisEmployeeList):
                    thisEmployee = thisEmployeeList[vstrIndexControl]
                else:
                    thisEmployee = thisEmployeeList[len(thisEmployeeList) - 1]




                findRequest = Activity.query(Activity.strReference == thisEmployee.strReference)
                thisActivityList = findRequest.fetch()

                if len(thisActivityList) > 0:
                    thisActivity = thisActivityList[0]
                else:
                    thisActivity = Activity()
                template = template_env.get_template('templates/dynamic/employee/browseprofiles.html')
                context = {'thisEmployee':thisEmployee,'thisActivity':thisActivity}
                self.response.write(template.render(context))
    def get(self):
        self.response.write("Remove All Funeral Cover Locks<br>")
        vstrEmployeeCode = self.request.get('vstrEmployeeCode')
        vstrEmployeeCode = str(vstrEmployeeCode)
        vstrEmployeeCode = vstrEmployeeCode.strip()

        findRequest = UserRights.query(UserRights.strEmployeeCode == vstrEmployeeCode)
        EmployeeRightsList = findRequest.fetch()

        if len(EmployeeRightsList) > 0:
            EmployeeRights = EmployeeRightsList[0]
            EmployeeRights.bolEmployeesFuneralCoverFormWriteAccess = True
            EmployeeRights.put()
            self.response.write("Funeral Cover Edit Access Restored")
        else:
            self.response.write("Failed to Restore Edit Access to Funeral Cover Form")
    def get(self):
        self.response.write("Placing an Indefinite Lock on the Funeral Form <br>")
        vstrEmployeeCode = self.request.get('vstrEmployeeCode')
        logging.info(vstrEmployeeCode)
        self.response.write("For Employee : " + vstrEmployeeCode + "<br>")

        findRequest = UserRights.query(UserRights.strEmployeeCode == vstrEmployeeCode)
        EmployeeRightsList = findRequest.fetch()

        if len(EmployeeRightsList) > 0:
            EmployeeRights = EmployeeRightsList[0]
            EmployeeRights.bolEmployeesFuneralCoverFormWriteAccess = False
            EmployeeRights.put()
            self.response.write("Funeral Cover Edit Access Revoked Indefinitely")
        else:
            self.response.write("Failed to Revoke Edit Access to Funeral Cover Form")
    def post(self):
        Guser = users.get_current_user()

        if Guser:
            strFirstnames = self.request.get('vstrFirstnames')
            strSurname = self.request.get('vstrSurname')
            strIDNumber = self.request.get('vstrIDNumber')
            strEmployeeCode = self.request.get('vstrEmployeeCode')
            strBranchCode = self.request.get('vstrBranchCode')

            URL = str(self.request.url)

            URLList = URL.split("/")
            strReference = URLList[len(URLList) - 1]

            findRequest = EmploymentDetails.query(EmploymentDetails.strReference == strReference)
            EmployeeList = findRequest.fetch()

            Employee = EmploymentDetails()

            if len(EmployeeList) > 0:
                Employee = EmployeeList[0]
            else:
                pass

            Employee.writeReference(strinput=strReference)
            Employee.writeEmployeeCode(strinput=strEmployeeCode)
            Employee.writeBranchWorking(strinput=strBranchCode)
            Employee.writeIDNumber(strinput=strIDNumber)
            Employee.writeSurname(strinput=strSurname)
            Employee.writeNames(strinput=strFirstnames)

            Employee.put()

            FindRequest = EmployeeRegRequest.query(EmployeeRegRequest.strReference == strReference)
            EmployeeReqList = FindRequest.fetch()

            findRequest = UserRights.query(UserRights.strReference == strReference)
            UserRightsList =findRequest.fetch()
            UserRight = UserRights()

            if len(UserRightsList) > 0:
                UserRight = UserRightsList[0]

            UserRight.writeReference(strinput=strReference)
            UserRight.writeEmployeeCode(strinput=strEmployeeCode)
            UserRight.put()


            if len(EmployeeReqList) > 0:
                EmployeeReq = EmployeeReqList[0]
                try:
                    EmployeeReq.key.delete()
                except:
                    pass
            else:
                pass


            template = template_env.get_template('templates/dynamic/admin/personalsresponse.html')
            context = {'vstrFirstnames': strFirstnames, 'vstrSurname': strSurname,'vstrIDNumber':strIDNumber,
                       'vstrEmployeeCode': strEmployeeCode,'vstrReference': strReference,'vstrBranchCode':strBranchCode}

            self.response.write(template.render(context))
    def post(self):
        logging.info("saving user rights and settings")

        strIsEmployee = self.request.get('vstrIsEmployee')

        strAccessEmployeeAdmin = self.request.get('vstrAccessEmployeeAdmin')
        strSearchCoverPolicy = self.request.get('vstrSearchCoverPolicy')
        strEditCoverPolicy = self.request.get('vstrEditCoverPolicy')
        strSearchFuneralService = self.request.get('vstrSearchFuneralService')
        strEditFuneralServices = self.request.get('vstrEditFuneralServices')
        strSearchLeadsForm = self.request.get('vstrSearchLeadsForm')
        strEditLeadsForm  = self.request.get('vstrEditLeadsForm')

        Rights = UserRights()
        logging.info(msg=strIsEmployee)

        URL = str(self.request.url)
        URLList = URL.split("/")
        strReference = URLList[len(URLList)-1]


        findRequest = UserRights.query(UserRights.strReference == strReference)
        RightsList = findRequest.fetch()

        if len(RightsList) > 0:
            Rights = RightsList[0]

        if strIsEmployee == "YES":
            Rights.setEmployeeUserRights()
            logging.info(msg="Is employee")

        if strAccessEmployeeAdmin == "YES":
            Rights.bolEmployeesAdminFormReadAccess = True
        else:
            Rights.bolEmployeesAdminFormReadAccess = False

        if strSearchCoverPolicy == "YES":
            Rights.bolEmployeesFuneralCoverFormReadAccess =True
        else:
            Rights.bolEmployeesFuneralCoverFormReadAccess = False

        if strEditCoverPolicy == "YES":
            Rights.bolEmployeesFuneralCoverFormWriteAccess = True
        else:
            Rights.bolEmployeesFuneralCoverFormWriteAccess = False

        if strSearchFuneralService == "YES":
            Rights.bolEmployeesFuneralServicesFormReadAccess = True
        else:
            Rights.bolEmployeesFuneralServicesFormReadAccess = False

        if strEditFuneralServices == "YES":
            Rights.bolEmployeesFuneralServicesFormWriteAccess = True
        else:
            Rights.bolEmployeesFuneralServicesFormWriteAccess = False

        if strSearchLeadsForm == "YES":
            Rights.bolEmployeesLeadsFormReadAccess = True
        else:
            Rights.bolEmployeesLeadsFormReadAccess = False

        if strEditLeadsForm == "YES":
            Rights.bolEmployeesLeadsFormWriteAccess = True
        else:
            Rights.bolEmployeesLeadsFormWriteAccess = False

        URL = str(self.request.url)
        URLlist = URL.split("/")

        strReference = URLlist[len(URLlist) - 1]

        Rights.writeReference(strinput=strReference)

        Rights.put()


        template = template_env.get_template('templates/dynamic/admin/rightsresponse.html')
        context = {'vstrIsEmployee': strIsEmployee,'vstrAccessEmployeeAdmin': strAccessEmployeeAdmin, 'vstrSearchCoverPolicy': strSearchCoverPolicy,
                   'vstrEditCoverPolicy': strEditCoverPolicy, 'vstrSearchFuneralService': strSearchFuneralService,
                   'vstrEditFuneralServices': strEditFuneralServices, 'vstrSearchLeadsForm': strSearchLeadsForm,
                   'vstrEditLeadsForm': strEditLeadsForm}
        self.response.write(template.render(context))
    def get(self):
        Guser = users.get_current_user()
        logging.info(msg=" User Rights Called")

        if Guser:
            findRequest = BranchDetails.query()
            branchList = findRequest.fetch()

            URLList = str(self.request.url)

            URLList = URLList.split("/")

            strReference = URLList[len(URLList) - 1]

            findRequest = EmploymentDetails.query(EmploymentDetails.strReference == strReference)
            ThisEmployeeList = findRequest.fetch()

            ThisEmployee = EmploymentDetails()

            if len(ThisEmployeeList) > 0:
                ThisEmployee = ThisEmployeeList[0]
                strUsername = ThisEmployee.readSurname()
                strReference = ThisEmployee.readReference()
                strIDNumber = ThisEmployee.readIDNumber()
                strEmployeeBranch = ThisEmployee.readBranchWorking()
                strFirstname = ThisEmployee.readNames()
                strSurname = ThisEmployee.readSurname()
                strEmployeeCode = ThisEmployee.readEmployeeCode()

                ThisUserRights = UserRights()

                findRequest = UserRights.query(UserRights.strReference == strReference)
                ThisUserRightsList = findRequest.fetch()
                if len(ThisUserRightsList) > 0:
                    ThisUserRights = ThisUserRightsList[0]


                if ThisUserRights.bolIsEmployee:
                    vstrIsEmployee = "YES"
                else:
                    vstrIsEmployee = "NO"

                if ThisUserRights.bolAccessToEmployeesAdminForm:
                    vstrAccessEmployeeAdmin = "YES"
                else:
                    vstrAccessEmployeeAdmin = "NO"

                if ThisUserRights.bolEmployeesFuneralCoverFormReadAccess:
                    vstrSearchCoverPolicy = "YES"
                else:
                    vstrSearchCoverPolicy = "NO"

                if ThisUserRights.bolEmployeesFuneralCoverFormWriteAccess:
                    vstrEditCoverPolicy = "YES"
                else:
                    vstrEditCoverPolicy = "NO"


                if ThisUserRights.bolEmployeesFuneralServicesFormReadAccess:
                    vstrSearchFuneralService = "YES"
                else:
                    vstrSearchFuneralService = "NO"

                if ThisUserRights.bolEmployeesFuneralServicesFormWriteAccess:
                    vstrEditFuneralServices = "YES"
                else:
                    vstrEditFuneralServices = "NO"

                if ThisUserRights.bolEmployeesLeadsFormReadAccess:
                    vstrSearchLeadsForm = "YES"
                else:
                    vstrSearchLeadsForm = "NO"
                if ThisUserRights.bolEmployeesLeadsFormWriteAccess:
                    vstrEditLeadsForm = "YES"
                else:
                    vstrEditLeadsForm = "NO"

                ThisUserRights.writeEmployeeCode(strinput=strEmployeeCode)
                ThisUserRights.writeReference(strinput=strReference)
                ThisUserRights.put()

                template = template_env.get_template('templates/dynamic/admin/thisuserights.html')
                context = {'vstrUsername':strUsername,'vstrReference': strReference, 'vstrIDNumber': strIDNumber,
                           'branches': branchList,'vstrEmployeeBranch': strEmployeeBranch,'vstrEmployeeCode':strEmployeeCode,  'vstrFirstnames': strFirstname,
                           'vstrSurname': strSurname,'vstrIsEmployee': vstrIsEmployee,'vstrAccessEmployeeAdmin':vstrAccessEmployeeAdmin,
                           'vstrSearchCoverPolicy':vstrSearchCoverPolicy,'vstrEditCoverPolicy':vstrEditCoverPolicy,'vstrSearchFuneralService':vstrSearchFuneralService,
                               'vstrEditFuneralServices':vstrEditFuneralServices,'vstrSearchLeadsForm':vstrSearchLeadsForm,
                               'vstrEditLeadsForm':vstrEditLeadsForm}
                self.response.write(template.render(context))

            else:

                findRequest = EmployeeRegRequest.query(EmployeeRegRequest.strReference == strReference)
                EmployeeList = findRequest.fetch()

                EmployeeReq = EmployeeRegRequest()

                if len(EmployeeList) > 0:
                    EmployeeReq = EmployeeList[0]
                    strUsername = EmployeeReq.readEmail()
                    strReference = EmployeeReq.readReference()
                    strIDNumber = EmployeeReq.readIDNumber()
                    strFirstname = ""
                    strSurname = ""
                    strEmployeeBranch = ""


                    findRequest = EmploymentDetails.query()
                    EmployeeListed = findRequest.fetch()

                    NextCode = len(EmployeeListed)
                    NextCode = "E" + str(NextCode)
                    strEmployeeCode = NextCode

                    CodeList = []
                    CodeList.append(NextCode)
                    template = template_env.get_template('templates/dynamic/admin/thisuserights.html')
                    context = {'vstrUsername':strUsername,'vstrReference': strReference, 'vstrIDNumber': strIDNumber,
                               'branches': branchList,'vstrEmployeeBranch': strEmployeeBranch, 'vstrEmployeeCode':strEmployeeCode,
                               'vstrFirstnames': strFirstname,
                               'vstrSurname': strSurname}
                    self.response.write(template.render(context))

                else:
                    pass







        else:
            pass
示例#12
0
    def get(self):
        logging.info("Employees Handler Called")
        URL = str(self.request.url)
        logging.info(URL)

        URL = URL.split("/")
        EmpCode = URL[len(URL) - 1]
        logging.info(EmpCode)



        findRequest = EmploymentDetails.query(EmploymentDetails.strEmployeeCode == EmpCode)
        EMPresults = findRequest.fetch()

        if len(EMPresults) > 0:
            EmployeeDet = EMPresults[0]
        else:
            EmployeeDet = EmploymentDetails()

        findRequest = BankingDetails.query(BankingDetails.strEmployeeCode == EmpCode)
        BANKresults = findRequest.fetch()

        if len(BANKresults) > 0:
            Banking = BANKresults[0]
        else:
            Banking = BankingDetails()

        findRequest = ContactDetails.query(ContactDetails.strEmployeeCode == EmpCode)
        CONTresults = findRequest.fetch()

        if len(CONTresults) > 0:
            Contacts = CONTresults[0]
        else:
            Contacts = ContactDetails()

        findRequest = PostalAddress.query(PostalAddress.strEmployeeCode == EmpCode)
        POSresults = findRequest.fetch()

        if len(POSresults) > 0:
            PostalAddY = POSresults[0]
        else:
            PostalAddY = PostalAddress()

        findRequest = ResidentialAddress.query(ResidentialAddress.strEmployeeCode == EmpCode)
        RESresults = findRequest.fetch()

        if len(RESresults) > 0:
            Physical = RESresults[0]
        else:
            Physical = ResidentialAddress()

        findRequest = BranchDetails.query()

        clsbranches = findRequest.fetch()

        findRequest = UserRights.query(UserRights.strEmployeeCode == EmpCode)
        UserRightList = findRequest.fetch()

        if len(UserRightList) > 0:
            thisUserRights = UserRightList[0]
        else:
            thisUserRights = UserRights()


        findRequest = Tasks.query(Tasks.strToReference == EmployeeDet.strReference)
        thisTasksList = findRequest.fetch()
        try:
            findRequest = EmploymentDetails.query()
            thisEmploymentDetailList = findRequest.fetch()

            EmpCodesList = []
            for thisEmployee in thisEmploymentDetailList:
                EmpCodesList.append(thisEmployee.strEmployeeCode)

            if EmpCode in EmpCodesList:
                try:
                    thisIndex = EmpCodesList.index(EmpCode)
                except:
                    thisIndex = -1
            else:
                thisIndex = -1


            if (thisIndex > 0) and (thisIndex < (len(EmpCodesList) - 1)):
                vstrPreviousEmployee = EmpCodesList[thisIndex - 1]
                vstrNextEmployee = EmpCodesList[thisIndex + 1]
            elif (thisIndex == 0) and (len(EmpCodesList) > 1) :
                vstrPreviousEmployee = EmpCodesList[thisIndex]
                if len(EmpCodesList) > thisIndex:
                    vstrNextEmployee = EmpCodesList[thisIndex + 1]
                else:
                    vstrNextEmployee = EmpCodesList[0]
            elif (len(EmpCodesList) == 1):
                vstrPreviousEmployee = EmpCode
                vstrNextEmployee = EmpCode
            else:
                vstrPreviousEmployee = EmpCode
                vstrNextEmployee = EmpCode
        except:
            vstrPreviousEmployee = EmpCode
            vstrNextEmployee = EmpCode

        context ={'branches': clsbranches ,'vstrBranchCode': EmployeeDet.readBranchWorking(),'vstrEmployeeCode': EmployeeDet.readEmployeeCode(),
                  'vstrContractType': EmployeeDet.readContractType(),'vstrBasicSalary': EmployeeDet.readBasicSalary(),
                  'vstrDateOfEmployment': EmployeeDet.readDateOfEmployment(),'vstrTitle': EmployeeDet.readTitle(),
                  'vstrFullnames': EmployeeDet.readNames(),'vstrSurname': EmployeeDet.readSurname(),
                  'vstrIDNumber':EmployeeDet.readIDNumber(),'vstrDateOfBirth': EmployeeDet.readDateOfBirth(),
                  'vstrNationality':EmployeeDet.readNationality(),'vstrPhysicalAddressL1':Physical.readResAddressL1(),
                  'vstrPhysicalAddressL2': Physical.readResAddressL2(),'vstrCityTown':Physical.readCityTown(),
                  'vstrProvince':Physical.readProvince(),'vstrPhysicalPostalCode': Physical.readPostalCode(),
                  'vstrPostalAddressL1': PostalAddY.readPostalAddressL1(),'vstrPostalCityTown':PostalAddY.readTownCity(),
                  'vstrPostalProvince':PostalAddY.readProvince(),'vstrPostalCode': PostalAddY.readPostalCode(),
                  'vstrCell': Contacts.readCell(),'vstrTel': Contacts.readTell(), 'vstrEmail': Contacts.readEmail(),
                  'vstrAccountHolder': Banking.readAccountHolder(),'vstrBankName': Banking.readBankName(),
                  'vstrAccountType': Banking.readAccountType(), 'vstrAccountNumber': Banking.readAccountNumber(),
                  'vstrBankBranchCode': Banking.readBranchCode(),
                  'vstrSuspendOnPay': str(EmployeeDet.readSuspendOnPay()),
                  'vstrSuspend': str(EmployeeDet.readSuspend()),
                  'vstr24HourLock': str(EmployeeDet.read24HourLock()),
                  'vstrLockIndefinite': str(EmployeeDet.readLockUserIndefinetely()),'thisUserRights': thisUserRights,
                  'thisTasksList':thisTasksList,'vstrPreviousEmployee':vstrPreviousEmployee,'vstrNextEmployee':vstrNextEmployee}

        template = template_env.get_template('templates/dynamic/admin/employeeDetails.html')

        self.response.write(template.render(context))
示例#13
0
    def post(self):
        Guser = users.get_current_user()

        if Guser:
            strBranchCode = self.request.get('vstrBranchCode')
            strEmployeeCode = self.request.get('vstrEmployeeCode')
            strContractType = self.request.get('vstrContractType')
            strBasicSalary = self.request.get('vstrBasicSalary')
            strDateOfEmployment = self.request.get('vstrDateOfEmployment')
            strTitle = self.request.get('vstrTitle')
            strFullnames = self.request.get('vstrFullnames')
            strSurname = self.request.get('vstrSurname')
            strIDNumber = self.request.get('vstrIDNumber')
            strDateOfBirth = self.request.get('vstrDateOfBirth')
            strNationality = self.request.get('vstrNationality')
            strPhysicalAddressL1 = self.request.get('vstrPhysicalAddressL1')
            strPhysicalAddressL2 = self.request.get('vstrPhysicalAddressL2')
            strCityTown = self.request.get('vstrCityTown')
            strProvince = self.request.get('vstrProvince')
            strPhysicalPostalCode = self.request.get('vstrPhysicalPostalCode')
            strPostalAddressL1 = self.request.get('vstrPostalAddressL1')
            strPostalAddressL2 = self.request.get('vstrPostalAddressL2')
            strPostalCityTown = self.request.get('vstrPostalCityTown')
            strPostalProvince = self.request.get('vstrPostalProvince')
            strPostalCode = self.request.get('vstrPostalCode')

            strAccountHolder = self.request.get('vstrAccountHolder')
            strBankName = self.request.get('vstrBankName')
            strAccountType = self.request.get('vstrAccountType')
            strAccountNumber = self.request.get('vstrAccountNumber')
            strBankBranchCode = self.request.get('vstrBankBranchCode')

            strCell = self.request.get('vstrCell')
            strTel = self.request.get('vstrTel')
            strEmail = self.request.get('vstrEmail')

            vstrIsEmployee = self.request.get('vstrIsEmployee')
            vstrAccessEmployeeAdmin = self.request.get(
                'vstrAccessEmployeeAdmin')
            vstrSearchLoans = self.request.get('vstrSearchLoans')
            vstrEditLoans = self.request.get('vstrEditLoans')
            vstrSearchLeadsForm = self.request.get('vstrSearchLeadsForm')
            vstrEditLeadsForm = self.request.get('vstrEditLeadsForm')
            vstrDeleteLoans = self.request.get('vstrDeleteLoans')
            vstrLoanReprint = self.request.get('vstrReprintLoans')
            vstrProcessPayment = self.request.get('vstrProcessPayment')
            vstrSendPayment = self.request.get('vstrSendPayment')

            findRequest = EmploymentDetails.query(
                EmploymentDetails.strEmployeeCode == strEmployeeCode)
            EmpResult = findRequest.fetch()

            if len(EmpResult) > 0:
                Employee = EmpResult[0]
            else:
                Employee = EmploymentDetails()

            try:
                Employee.writeEmployeeCode(strinput=strEmployeeCode)
                Employee.writeBranchWorking(strinput=strBranchCode)
                Employee.writeContractType(strinput=strContractType)
                Employee.writeBasicSalary(strinput=strBasicSalary)
                Employee.writeDateOfEmployment(strinput=strDateOfEmployment)
                Employee.writeTitle(strinput=strTitle)
                Employee.writeNames(strinput=strFullnames)
                Employee.writeSurname(strinput=strSurname)
                Employee.writeIDNumber(strinput=strIDNumber)
                Employee.writeDateOfBirth(strinput=strDateOfBirth)
                Employee.writeNationality(strinput=strNationality)

                Employee.put()
            except:
                pass

            findRequest = ResidentialAddress.query(
                ResidentialAddress.strEmployeeCode == strEmployeeCode)
            PhysicalResult = findRequest.fetch()

            if len(PhysicalResult) > 0:
                PhysicalAddress = PhysicalResult[0]
            else:
                PhysicalAddress = ResidentialAddress()

            try:
                PhysicalAddress.writeEmployeeCode(strinput=strEmployeeCode)
                PhysicalAddress.writeResAddressL1(
                    strinput=strPhysicalAddressL1)
                PhysicalAddress.writeResAddressL2(
                    strinput=strPhysicalAddressL2)
                PhysicalAddress.writeCityTown(strinput=strCityTown)
                PhysicalAddress.writeProvince(strinput=strProvince)
                PhysicalAddress.writePostalCode(strinput=strPhysicalPostalCode)

                PhysicalAddress.put()
            except:
                pass

            findRequest = PostalAddress.query(
                PostalAddress.strEmployeeCode == strEmployeeCode)
            PostalList = findRequest.fetch()

            if len(PostalList) > 0:
                PostalAddy = PostalList[0]
            else:
                PostalAddy = PostalAddress()

            try:
                PostalAddy.writeEmployeeCode(strinput=strEmployeeCode)
                PostalAddy.writePostalAddressL1(strinput=strPostalAddressL1)
                PostalAddy.writePostalAddressL2(strinput=strPostalAddressL2)
                PostalAddy.writeTownCity(strinput=strPostalCityTown)
                PostalAddy.writeProvince(strinput=strPostalProvince)
                PostalAddy.writePostalCode(strinput=strPostalCode)

                PostalAddy.put()
            except:
                pass

            findRequest = ContactDetails.query(
                ContactDetails.strEmployeeCode == strEmployeeCode)
            ContactList = findRequest.fetch()

            if len(ContactList) > 0:
                Contacts = ContactList[0]
            else:
                Contacts = ContactDetails()
            try:
                Contacts.writeEmployeeCode(strinput=strEmployeeCode)
                Contacts.writeCell(strinput=strCell)
                Contacts.writeTel(strinput=strTel)
                Contacts.writeEmail(strinput=strEmail)

                Contacts.put()
            except:
                pass

            findRequester = BankingDetails.query(
                BankingDetails.strEmployeeCode == strEmployeeCode)
            BankingList = findRequester.fetch()

            if len(BankingList) > 0:
                Banking = BankingList[0]
            else:
                Banking = BankingDetails()

            try:
                Banking.writeEmployeeCode(strinput=strEmployeeCode)
                Banking.writeAccountHolder(strinput=strAccountHolder)
                Banking.writeAccountNumber(strinput=strAccountNumber)
                Banking.writeAccountType(strinput=strAccountType)
                Banking.writeBankName(strinput=strBankName)
                Banking.writeBranchCode(strinput=strBankBranchCode)

                Banking.put()
            except:
                pass

            findRequest = WorkingAccount.query(
                WorkingAccount.strReference == Employee.strReference)
            AllOpenPolicies = findRequest.fetch()
            try:
                for OpenPols in AllOpenPolicies:
                    OpenPols.strActivated = True
                    OpenPols.put()
            except:
                pass

            findRequest = UserRights.query(
                UserRights.strReference == Employee.strReference)
            UserRightsList = findRequest.fetch()

            if len(UserRightsList) > 0:
                EmployeeRights = UserRightsList[0]

                EmployeeRights.writeEmployeeCode(strinput=strEmployeeCode)
                if vstrIsEmployee == "YES":
                    EmployeeRights.bolIsEmployee = True
                else:
                    EmployeeRights.bolIsEmployee = False

                if vstrAccessEmployeeAdmin == "YES":
                    EmployeeRights.bolAccessToEmployeesAdminForm = True
                else:
                    EmployeeRights.bolAccessToEmployeesAdminForm = False

                if vstrSearchLoans == "YES":
                    EmployeeRights.bolEmployeesLoanFormReadAccess = True
                else:
                    EmployeeRights.bolEmployeesLoanFormReadAccess = False

                if vstrEditLoans == "YES":
                    EmployeeRights.bolEmployeesLoanFormWriteAccess = True
                else:
                    EmployeeRights.bolEmployeesLoanFormWriteAccess = False

                if vstrSearchLeadsForm == "YES":
                    EmployeeRights.bolEmployeesLeadsFormReadAccess = True
                else:
                    EmployeeRights.bolEmployeesLeadsFormReadAccess = False

                if vstrEditLeadsForm == "YES":
                    EmployeeRights.bolEmployeesLeadsFormWriteAccess = True
                else:
                    EmployeeRights.bolEmployeesLeadsFormWriteAccess = False

                if vstrDeleteLoans == "YES":
                    EmployeeRights.bolEmployeesLoanFormDeleteAccess = True
                else:
                    EmployeeRights.bolEmployeesLoanFormDeleteAccess = False

                if vstrLoanReprint == "YES":
                    EmployeeRights.bolEmployeesLoanFormReprintAccess = True
                else:
                    EmployeeRights.bolEmployeesLoanFormReprintAccess = False

                if vstrProcessPayment == "YES":
                    EmployeeRights.bolEmployeeLoanFormProcessPayment = True
                else:
                    EmployeeRights.bolEmployeeLoanFormProcessPayment = False

                if vstrSendPayment == "YES":
                    EmployeeRights.bolEmployeeLoanFormSendPayment = True
                else:
                    EmployeeRights.bolEmployeeLoanFormSendPayment = False

                EmployeeRights.put()
            selfURL = "/admin/employees/" + strEmployeeCode
            self.redirect(selfURL)

        else:
            self.redirect("/")