Exemple #1
0
    def get(self):
        Guser = users.get_current_user()
        if Guser:
            vstrBranchCode = self.request.get('vstrBranchCode')

            findRequest = BranchDetails.query(
                BranchDetails.strCompanyBranchCode == vstrBranchCode)
            thisBranchList = findRequest.fetch()

            if len(thisBranchList) > 0:
                thisBranch = thisBranchList[0]
            else:
                thisBranch = BranchDetails()

            findRequest = CompanyCoffers.query(
                CompanyCoffers.strBranchCode == vstrBranchCode)
            thisCompanyCoffersList = findRequest.fetch()

            if len(thisCompanyCoffersList) > 0:
                thisCompanyCoffers = thisCompanyCoffersList[0]
            else:
                thisCompanyCoffers = CompanyCoffers()

            template = template_env.get_template(
                'templates/dynamic/admin/branchincome.html')
            context = {
                'thisBranch': thisBranch,
                'thisCompanyCoffers': thisCompanyCoffers
            }
            self.response.write(template.render(context))
Exemple #2
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
Exemple #3
0
 def get(self):
     vstrBranchCode = self.request.get('vstrBranchCode')
     findRequest = BranchDetails.query(BranchDetails.strCompanyBranchCode == vstrBranchCode)
     BranchDetailsList = findRequest.fetch()
     if len(BranchDetailsList) > 0:
         BranchDet = BranchDetailsList[0]
         BranchDet.key.delete()
         self.response.write("Branch Succesfully Delete : " + vstrBranchCode)
     else:
         self.response.write("Failed to Delete Branch with the Following Branch Code : " + vstrBranchCode)
Exemple #4
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
Exemple #5
0
    def get(self):
        logging.info("Branches Handler Calleds")
        URL = str(self.request.url)

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

        if not(BranchCode == None):
            findRequest = BranchDetails.query(BranchDetails.strCompanyBranchCode == BranchCode)
            results = findRequest.fetch()
            branchdet = BranchDetails()
            if len(results) > 0:
                branchdet = results[0]
                logging.info("FOUND Branch")
            context = {'vstrBranchName': branchdet.readCompanyBranchName(),
                       'vstrBranchCode': branchdet.readCompanyBranchCode(),
                       'vstrBranchAddress': branchdet.readCompanyBranchAddress(),
                       'vstrBranchContact': branchdet.readCompanyBranchTel(),
                       'vstrBranchManager': branchdet.readBranchManagerName(),
                       'vstrBranchManagerContact': branchdet.readBrachManagerTel(),
                       'vstrBranchManagerEmail': branchdet.readBranchManagerEmail(),
                       'vstrBranchEmail': branchdet.readCompanyBranchEmail()}
            template = template_env.get_template('templates/dynamic/admin/BranchDetails.html')
            self.response.write(template.render(context))
        else:
            logging.info(msg="Not Found from URL")
Exemple #6
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
Exemple #7
0
    def post(self):
        logging.info(msg="Branch Saving Data")
        Guser = users.get_current_user()
        if Guser:
            strBranchName = self.request.get('vstrBranchName')
            strBranchCode = self.request.get('vstrBranchCode')
            strBranchAddress = self.request.get('vstrBranchAddress')
            strBranchContact = self.request.get('vstrBranchContact')
            strBranchEmail = self.request.get('vstrBranchEmail')
            strBranchManager = self.request.get('vstrBranchManager')
            strBranchManagerContact = self.request.get(
                'vstrBranchManagerContact')
            strBranchManagerEmail = self.request.get('vstrBranchManagerEmail')

            newBranch = BranchDetails()

            findRequest = BranchDetails.query(
                BranchDetails.strCompanyBranchCode == strBranchCode)
            TempBranchList = findRequest.fetch()

            if len(TempBranchList) > 0:
                newBranch = TempBranchList[0]

            if newBranch.writeCompanyBranchName(
                    strBranchName) and newBranch.writeCompanyBranchCode(
                        strBranchCode):
                newBranch.writeReference(strinput=Guser.user_id())
                newBranch.writeCompanyBranchTel(strinput=strBranchContact)
                newBranch.writeCompanyBranchAddress(strinput=strBranchAddress)
                newBranch.writeCompanyBranchEmail(strinput=strBranchEmail)
                newBranch.writeBranchManagerName(strinput=strBranchManager)
                newBranch.writeBranchManagerTel(
                    strinput=strBranchManagerContact)
                newBranch.writeBranchManagerEmail(
                    strinput=strBranchManagerEmail)
                newBranch.put()
                self.redirect("/admin")
            else:
                self.redirect("/admin")
        else:
            self.redirect("/admin")