Пример #1
0
    def get(self):
        logging.info(msg="Edit Employees Handler was called")
        Guser = users.get_current_user()

        if Guser:
            findQuery = EmploymentDetails.query()
            results = findQuery.fetch()

            if len(results) > 0:
                employeesdet = results
            else:
                employeesdet = []

            findQuery = BranchDetails.query()
            results = findQuery.fetch()

            if len(results) > 0:
                branchdet = results
            else:
                branchdet = []

            template = template_env.get_template(
                'templates/dynamic/admin/editemployees.html')
            context = {'employees': employeesdet, 'branches': branchdet}
            self.response.write(template.render(context))
        else:
            pass
Пример #2
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")
Пример #3
0
    def post(self):
        from Employee import EmploymentDetails
        Guser = users.get_current_user()
        if Guser:
            vstrTaskEmployeeCode = self.request.get('vstrTaskEmployeeCode')
            vstrTaskTarget = self.request.get('vstrTaskTarget')
            vstrTaskSubject = self.request.get('vstrTaskSubject')
            vstrTaskDescriptionBody = self.request.get(
                'vstrTaskDescriptionBody')

            findQuery = EmploymentDetails.query(
                EmploymentDetails.strEmployeeCode == vstrTaskEmployeeCode)
            TargetEmployeeList = findQuery.fetch()

            if len(TargetEmployeeList) > 0:
                TargetEmployee = TargetEmployeeList[0]
            else:
                TargetEmployee = EmploymentDetails()

            try:
                thisTask = Tasks()

                thisTask.writeReference(strinput=Guser.user_id())
                thisTask.writeToReference(strinput=TargetEmployee.strReference)
                thisTask.writeTaskType(strinput="Employee")
                thisTask.writeTaskTarget(strinput=vstrTaskTarget)
                thisTask.writeTaskSubject(strinput=vstrTaskSubject)
                thisTask.writeTaskNote(strinput=vstrTaskDescriptionBody)
                if vstrTaskTarget.lower() == "loan":
                    thisTask.writeTaskURL(strinput="/employees/loans")
                elif vstrTaskTarget.lower() == "leads":
                    thisTask.writeTaskURL(strinput="/employees/leads")
                elif vstrTaskTarget.lower() == "payments":
                    thisTask.writeTaskURL(strinput="/employees/payments")
                elif vstrTaskTarget.lower() == "admin":
                    thisTask.writeTaskURL(strinput="/employees/admin")

                thisTask.setTaskID()
                thisTask.put()

                self.response.write("Succesfully Created Task, TaskID : " +
                                    thisTask.strTaskID)
            except:
                self.response.write("Failed to create Task Subject : " +
                                    vstrTaskSubject)
        else:
            pass
Пример #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 createNewAccountNumber(self, strinput):
        from Employee import EmploymentDetails
        try:
            Guser = users.get_current_user()
            logging.info("Create Account Number Called")
            if Guser:
                logging.info("Maybe Problem is here" + str(strinput))
                strinput = str(strinput)
                logging.info(strinput)
                if strinput.isdigit():
                    self.strTotalCreated = int(strinput) + 1
                    logging.info(msg="Tested True if its Digit")
                else:
                    self.strTotalCreated = 1
                    logging.info(msg="Tested False if its digit")

                self.strActivated = False
                self.strReference = Guser.user_id()
                logging.info(msg="Create Account Number Called")

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

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

                self.strAccountNumber = str(Employee.strBranchCode) + str(
                    Employee.strEmployeeCode) + str(self.strTotalCreated)

                self.put()
                return self.strAccountNumber
            else:
                logging.info("Tested False if its GUser")
                return None
        except:
            return None
Пример #6
0
    def get(self):
        """
            Design The Lock Mechanism
        :return:
        """
        Guser = users.get_current_user()
        if Guser:
            vstrEmployeeCode = self.request.get('vstrEmployeeCode')

            findRequest = EmploymentDetails.query(
                EmploymentDetails.strEmployeeCode == vstrEmployeeCode)
            thisEmployeeList = findRequest.fetch()

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

            template = template_env.get_template(
                'templates/dynamic/employee/LockStatus.html')
            context = {'thisEmployee': thisEmployee}
            self.response.write(template.render(context))
Пример #7
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))
Пример #8
0
    def get(self):

        URL = self.request.url
        URL = str(URL)
        vstrRefreshButtonURL = URL
        URLlist = URL.split("/")
        strIDNumber = URLlist[len(URLlist) - 1]

        findRequest = Leads.query(Leads.strIDNumber == strIDNumber)
        LeadList = findRequest.fetch()
        thisLead = Leads()
        if len(LeadList) > 0:
            thisLead = LeadList[0]

        findRequest = Leads.query()
        LeadList = findRequest.fetch()

        findRequest = LeadResponses.query(
            LeadResponses.strIDNumber == strIDNumber)
        LeadResponseList = findRequest.fetch()

        findRequest = EmploymentDetails.query(
            EmploymentDetails.strEmployeeCode == thisLead.strEmployeeCode)
        EmployeeList = findRequest.fetch()
        Employee = EmploymentDetails()
        if len(EmployeeList) > 0:
            Employee = EmployeeList[0]

        template = template_env.get_template(
            'templates/dynamic/leads/sublead.html')
        context = {
            'thisLead': thisLead,
            'LeadList': LeadList,
            'vstrRefreshButtonURL': vstrRefreshButtonURL,
            'Employee': Employee,
            'LeadResponses': LeadResponseList
        }
        self.response.write(template.render(context))
Пример #9
0
    def get(self):
        from Employee import EmploymentDetails
        Guser = users.get_current_user()
        if Guser:
            vstrEmployeeCode = self.request.get('vstrEmployeeCode')

            findRequest = EmploymentDetails.query(
                EmploymentDetails.strEmployeeCode == vstrEmployeeCode)
            thisEmployeeList = findRequest.fetch()

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

            findRequest = Tasks.query(
                Tasks.strToReference == thisEmployee.strReference)
            thisTasksList = findRequest.fetch()

            template = template_env.get_template(
                'templates/dynamic/employee/adminTasks.html')
            context = {'thisTasksList': thisTasksList}
            self.response.write(template.render(context))
Пример #10
0
    def get(self):
        Guser = users.get_current_user()

        if Guser:
            URL = str(self.request.url)

            URLList = URL.split("/")

            strBranchCode = URLList[len(URLList) - 1]

            if "#" in strBranchCode:
                strBranchCode = strBranchCode.strip('#')

            findRequest = EmploymentDetails.query(
                EmploymentDetails.strBranchCode == strBranchCode)
            TempEmploymentList = findRequest.fetch()
            findRequest = BranchDetails.query(
                BranchDetails.strCompanyBranchCode == strBranchCode)
            BranchList = findRequest.fetch()
            if len(BranchList) > 0:
                thisBranch = BranchList[0]
            else:
                thisBranch = BranchDetails()
            context = {'strCallingURL': URL}
            if len(TempEmploymentList) > 0:
                context = {
                    'employees': TempEmploymentList,
                    'thisBranch': thisBranch,
                    'strCallingURL': URL
                }

            template = template_env.get_template(
                'templates/dynamic/admin/branchemployeelist.html')
            self.response.write(template.render(context))
        else:
            pass
Пример #11
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))
Пример #12
0
    def get(self):
        try:
            Guser = users.get_current_user()
            if Guser:
                vstrLeadResponse = self.request.get('vstrLeadResponse')
                vstrFollowUpStatus = self.request.get('vstrFollowUpStatus')
                vstrNextScheduleCall = self.request.get('vstrNextScheduleCall')
                vstrLeadIDNumber = self.request.get('vstrLeadIDNumber')

                thisLeadResponse = LeadResponses()

                thisLeadResponse.writeReference(strinput=Guser.user_id())

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

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

                thisLeadResponse.strEmployeeName = Employee.strFullNames
                thisLeadResponse.strEmployeeSurname = Employee.strSurname
                thisLeadResponse.strEmployeeCode = Employee.strEmployeeCode
                thisLeadResponse.writeIDNumber(strinput=vstrLeadIDNumber)
                thisLeadResponse.writeResponses(strinput=vstrLeadResponse)
                thisLeadResponse.writeStatus(strinput=vstrFollowUpStatus)
                thisLeadResponse.writeNextSchedule(
                    strinput=vstrNextScheduleCall)
                thisLeadResponse.put()

                self.response.write("Succesfully saved a lead Response")
            else:
                self.response.write("Failure Saving Lead Response")
        except:
            self.response.write("Fatal Error Saving Lead Response")
Пример #13
0
    def get(self):
        Guser = users.get_current_user()
        if Guser:
            vstrTitle = self.request.get('vstrTitle')
            logging.info(vstrTitle)
            vstrSurname = self.request.get('vstrSurname')
            vstrFullnames = self.request.get('vstrFullnames')
            vstrIDNumber = self.request.get('vstrIDNumber')
            vstrDateofBirth = self.request.get('vstrDateofBirth')
            vstrResidential = self.request.get('vstrResidential')
            vstrTownCity = self.request.get('vstrTownCity')
            logging.info(vstrTownCity)
            vstrCountry = self.request.get('vstrCountry')
            vstrProvince = self.request.get('vstrProvince')
            vstrPostalCode = self.request.get('vstrPostalCode')
            vstrTel = self.request.get('vstrTel')
            vstrCell = self.request.get('vstrCell')
            logging.info(vstrCell)
            vstrEmail = self.request.get('vstrEmail')
            vstrLeadNotes = self.request.get('vstrLeadNotes')
            vstrInterest = self.request.get('vstrInterest')

            findRequests = Leads.query(Leads.strIDNumber == vstrIDNumber)
            DuplicateLists = findRequests.fetch()

            if len(DuplicateLists) > 0:
                self.response.write("Lead has already been Captured")
            else:
                try:

                    thisLead = Leads()
                    logging.info(
                        "We have SUCCESFULLY CREATED LEAD CAPTURE CLASS")
                    thisLead.writeTitle(strinput=vstrTitle)
                    logging.info("Title Written")
                    thisLead.writeSurname(strinput=vstrSurname)
                    thisLead.writeNames(strinput=vstrFullnames)
                    thisLead.writeIDNumber(strinput=vstrIDNumber)
                    thisLead.writeDateOfBirth(strinput=vstrDateofBirth)
                    thisLead.writeResAddress(strinput=vstrResidential)
                    thisLead.writeCityTown(strinput=vstrTownCity)
                    thisLead.writeCountry(strinput=vstrCountry)
                    logging.info("Till Country")
                    thisLead.writeProvince(strinput=vstrProvince)
                    thisLead.writePostalCode(strinput=vstrPostalCode)
                    thisLead.writeTel(strinput=vstrTel)
                    thisLead.writeCell(strinput=vstrCell)
                    thisLead.writeEmail(strinput=vstrEmail)
                    logging.info("Till Email")

                    thisLead.writeLeadNotes(strinput=vstrLeadNotes)
                    thisLead.writeLeadInterests(strinput=vstrInterest)

                    findRequests = EmploymentDetails.query(
                        EmploymentDetails.strReference == Guser.user_id())
                    EmployeeList = findRequests.fetch()

                    if len(EmployeeList) > 0:
                        Employee = EmployeeList[0]
                        thisLead.writeEmployeeCode(
                            strinput=Employee.strEmployeeCode)
                        thisLead.put()
                        self.response.write("Lead Capture Succesfully")
                    else:
                        self.response.write("Not Authorised to Capture Lead")
                except:
                    self.response.write("An Error Occured Capturing Lead")

        else:
            self.response.write("You are presently not logged in")
Пример #14
0
    def get(self):
        Guser = users.get_current_user()
        if Guser:
            vstrLeadIDNumber = self.request.get('vstrLeadIDNumber')

            findRequest = Leads.query(Leads.strIDNumber == vstrLeadIDNumber)
            LeadList = findRequest.fetch()
            if len(LeadList) > 0:
                thisLead = LeadList[0]
            else:
                thisLead = Leads()

            findRequest = WorkingAccount.query(
                WorkingAccount.strReference == Guser.user_id(),
                WorkingAccount.strActivated == False)
            WorkingAccountList = findRequest.fetch()

            Working = WorkingAccount()
            if len(WorkingAccountList) > 0:
                Working = WorkingAccountList[0]

                strAccountNumber = Working.strAccountNumber
            else:
                findRequest = WorkingAccount.query(
                    WorkingAccount.strReference == Guser.user_id())
                WorkingAccountList = findRequest.fetch()
                strAccountNumber = Working.createNewAccountNumber(
                    strinput=(len(WorkingAccountList) + 1))
                Working.writeReference(strinput=Guser.user_id())
                Working.writeAccountNumber(strinput=strAccountNumber)
                Working.writeActivated(strinput=False)
                Working.put()

            findRequest = LoanApplicantDetails.query(
                LoanApplicantDetails.strAccountNumber == strAccountNumber)
            LoanApplicantList = findRequest.fetch()

            if len(LoanApplicantList) > 0:
                LoanApplicant = LoanApplicantList[0]
            else:
                LoanApplicant = LoanApplicantDetails()

            LoanApplicant.strTitle = thisLead.strTitle
            LoanApplicant.strFullNames = thisLead.strFullNames
            LoanApplicant.strSurname = thisLead.strSurname
            LoanApplicant.strIDNumber = thisLead.strIDNumber
            LoanApplicant.strDateOfBirth = thisLead.strDateOfBirth
            LoanApplicant.strNationality = thisLead.strCountry
            LoanApplicant.strHouseNumber = thisLead.strResidential
            LoanApplicant.strCityTown = thisLead.strTownCity
            LoanApplicant.strProvince = thisLead.strProvince
            LoanApplicant.strCountry = thisLead.strCountry
            LoanApplicant.strPostalCode = thisLead.strPostalCode
            LoanApplicant.strTel = thisLead.strTel
            LoanApplicant.strCell = thisLead.strCell
            LoanApplicant.strEmail = thisLead.strEmail

            LoanApplicant.put()

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

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

            thisLead.strConvertedBy = thisEmployee.strEmployeeCode

            today = datetime.datetime.now()
            today = today.date()

            thisLead.strConversionDate = today
            thisLead.strConverted = True
            thisLead.put()
            self.response.write("""
                <strong>This Lead has been successfully converted <br>
                Please visit the Loan Editing Screen to Continue creating the Loan</strong><br>
                <a href="/employees/loans" type="button" class="btn btn-warning btn-block">Convert Lead</a>
            """)
Пример #15
0
    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.bolEmployeesLoanFormReadAccess:
                    vstrSearchLoans = "YES"
                else:
                    vstrSearchLoans = "NO"

                if ThisUserRights.bolEmployeesLoanFormWriteAccess:
                    vstrEditLoanForm = "YES"
                else:
                    vstrEditLoanForm = "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,
                    'vstrSearchLoans': vstrSearchLoans,
                    'vstrEditLoans': vstrEditLoanForm,
                    '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 = ""

                    i = 0
                    done = False
                    while not (done):
                        findRequest = EmploymentDetails.query()
                        EmployeeListed = findRequest.fetch()

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

                        findRequest = EmploymentDetails.query(
                            EmploymentDetails.strEmployeeCode == NextCode)
                        EmployeeList = findRequest.fetch()

                        if len(EmployeeList) > 0:
                            done = False
                            i = i + 1
                        else:
                            done = True

                    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
Пример #16
0
    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))
Пример #17
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("/")