Example #1
0
 def GET(self,id):
     if withprivilege():
         loan = model.get_loan(int(id))
         name = custmodel.get_customerbyid(loan.customerid)['name']
         return render.savingsnewloan(None, loan, name, "Edit")
     else:
         raise web.notfound()
Example #2
0
 def GET(self, month_id, customer_id):
     if withprivilege():
         customer = custmodel.get_customerbyid(int(customer_id))
         contributions = contribmodel.get_specificContrib(
             int(customer_id), int(month_id))
         contribution = ''
         for contrib in contributions:
             if contrib.date_paid.year == date.today().year:
                 contribution = contrib
         values = {
             'customer':
             customer,
             'month':
             contribmonth_model.get_month(month_id)['month'],
             'shared_value':
             '{:20,.2f}'.format(customer.number_shares *
                                model.get_guidelines()['share_value']),
             'contrib':
             contribution,
             'penalty':
             model.get_guidelines()['penalty'],
         }
         return render.savingsnewcontrib(**values)
     else:
         raise web.notfound()
Example #3
0
    def GET(self):

        if withprivilege():
            form = self.form()
            return render.blognew(form)
        else:
            raise web.seeother('/blog')
Example #4
0
 def GET(self,id):
     if withprivilege():
         loan = model.get_loan(int(id))
         daterel = datetime.strftime(loan.date_rel, '%m-%d-%Y')
         name = custmodel.get_customerbyid(loan.customerid)['name']
         return render.savingsnewloan(None, loan, name, "Edit", daterel)
     else:
         raise web.notfound()
Example #5
0
 def GET(self):
     if withprivilege():
         return render.savingsnewcustomer({
             'error' : '',
             'state':"New",
             }, None)
     else:
         raise web.notfound()
Example #6
0
 def GET(self, id):
     if withprivilege():
         loan = model.get_loan(int(id))
         daterel = datetime.strftime(loan.date_rel, '%m-%d-%Y')
         name = custmodel.get_customerbyid(loan.customerid)['name']
         return render.savingsnewloan(None, loan, name, "Edit", daterel)
     else:
         raise web.notfound()
Example #7
0
 def GET(self):
     if withprivilege():
         return render.savingsnewcustomer({
             'error': '',
             'state': "New",
         }, None)
     else:
         raise web.notfound()
Example #8
0
    def GET(self, id):
        if not withprivilege():
            raise web.seeother('/blog')

        try:
            post = blogmodel.get_anonymouspost(int(id))
            form = New.form()
            form.fill(post)
            return render.blogedit(post, form)
        except:
            None
Example #9
0
 def GET(self):
     if withprivilege():
         loans = model.get_loans()
         loansList = []
         for loan in loans:
             loansList.append(SavingsLoan(loan.id,loan.name,loan.date_rel,loan.date_due,
                             loan.amount,loan.interest,loan.total_payable,loan.total_payment,
                             loan.outstanding_bal,loan.fully_paidon))
         return render.savingsloan(loansList,datetime,formatNumber)
     else:
         raise web.notfound()
Example #10
0
    def GET(self,customer_id):
        if withprivilege():
            months = contribmonth_model.get_months()
            dict = []
            for month in months:
                dict.append(self.get_contribPerCustomer(month.id, month.month, contribmodel.get_contribbycustid(customer_id)))

            customer = custmodel.get_customerbyid(int(customer_id))
            share_value = formatNumber(customer.number_shares * model.get_guidelines()['share_value'])
            return render.savingscontribcustomer(dict,customer,share_value)
        else:
            raise web.notfound()
Example #11
0
    def GET(self, id):
        if not withprivilege():
            raise web.seeother('/savings/customers')

        try:
            customer = custmodel.get_customerbyid(int(id))
            return render.savingsnewcustomer({
                'error': '',
                'state': 'Edit',
            }, customer)
        except Exception as ex:
            print ex
Example #12
0
    def GET(self, id):
        if not withprivilege():
            raise web.seeother('/savings/customers')

        try:
            customer = custmodel.get_customerbyid(int(id))
            return render.savingsnewcustomer({
                'error':'',
                'state':'Edit',
            }, customer)
        except Exception as ex:
            print ex
Example #13
0
 def GET(self):
     if withprivilege():
         loans = model.get_loans()
         loansList = []
         for loan in loans:
             loansList.append(
                 SavingsLoan(loan.id, loan.name, loan.date_rel,
                             loan.date_due, loan.amount, loan.interest,
                             loan.total_payable, loan.total_payment,
                             loan.outstanding_bal, loan.fully_paidon))
         return render.savingsloan(loansList, datetime, formatNumber)
     else:
         raise web.notfound()
Example #14
0
    def GET(self):
        if withprivilege():
            share_value = model.get_guidelines()['share_value']
            contributions = []
            savingsInterest = SavingsInterestShare().calculate()

            for customer in custmodel.get_customers():
                total = customer.number_shares * share_value
                contributions.append(self.get_contribAllCustomer(customer.id, customer.patronage, customer.name,
                            customer.number_shares, total, contribmodel.get_contribbycustid(customer.id),
                            savingsInterest))
            return render.savingscontribs(contributions,formatNumber)
        else:
            raise web.notfound()
Example #15
0
    def GET(self):
        if withprivilege():
            custearned = []
            savingsInterest = SavingsInterestShare().calculate()
            for customer in custmodel.get_customers():
                patronage=0
                interest_perCustomer = savingsInterest.interestpershare * customer.number_shares + (Decimal(savingsInterest.penaltyshare))
                if customer.patronage != 0:
                    patronage = Decimal(savingsInterest.patronagepercentage) / Decimal(savingsInterest.numberofpatronage)

                custearned.append(CustomersInterestEarned(customer.name,interest_perCustomer,patronage))
            return render.savingscustomersearned(custearned, savingsInterest, formatNumber)
        else:
            raise web.notfound()
Example #16
0
    def GET(self, customer_id):
        if withprivilege():
            months = contribmonth_model.get_months()
            dict = []
            for month in months:
                dict.append(
                    self.get_contribPerCustomer(
                        month.id, month.month,
                        contribmodel.get_contribbycustid(customer_id)))

            customer = custmodel.get_customerbyid(int(customer_id))
            share_value = formatNumber(customer.number_shares *
                                       model.get_guidelines()['share_value'])
            return render.savingscontribcustomer(dict, customer, share_value)
        else:
            raise web.notfound()
Example #17
0
    def GET(self):
        if withprivilege():
            share_value = model.get_guidelines()['share_value']
            contributions = []
            savingsInterest = SavingsInterestShare().calculate()

            for customer in custmodel.get_customers():
                total = customer.number_shares * share_value
                contributions.append(
                    self.get_contribAllCustomer(
                        customer.id, customer.patronage, customer.name,
                        customer.number_shares, total,
                        contribmodel.get_contribbycustid(customer.id),
                        savingsInterest))
            return render.savingscontribs(contributions, formatNumber)
        else:
            raise web.notfound()
Example #18
0
 def GET(self, month_id, customer_id):
     if withprivilege():
         customer = custmodel.get_customerbyid(int(customer_id))
         contributions = contribmodel.get_specificContrib(int(customer_id), int(month_id))
         contribution = ''
         for contrib in contributions:
             if contrib.date_paid.year == date.today().year:
                 contribution = contrib
         values = {'customer': customer,
                 'month': contribmonth_model.get_month(month_id)['month'],
                 'shared_value': '{:20,.2f}'.format(customer.number_shares * model.get_guidelines()['share_value']),
                 'contrib': contribution,
                 'penalty':model.get_guidelines()['penalty'],
                 }
         return render.savingsnewcontrib(**values)
     else:
         raise web.notfound()
Example #19
0
    def GET(self):
        if withprivilege():
            custearned = []
            savingsInterest = SavingsInterestShare().calculate()
            for customer in custmodel.get_customers():
                patronage = 0
                interest_perCustomer = savingsInterest.interestpershare * customer.number_shares + (
                    Decimal(savingsInterest.penaltyshare))
                if customer.patronage != 0:
                    patronage = Decimal(
                        savingsInterest.patronagepercentage) / Decimal(
                            savingsInterest.numberofpatronage)

                custearned.append(
                    CustomersInterestEarned(customer.name,
                                            interest_perCustomer, patronage))
            return render.savingscustomersearned(custearned, savingsInterest,
                                                 formatNumber)
        else:
            raise web.notfound()
Example #20
0
    def GET(self):
        if withprivilege():
            savings = []
            wamount = contribmodel.get_withdrawnamount() if contribmodel.get_withdrawnamount() else 0
            outstanding_bal = model.get_outstandingbal() if model.get_outstandingbal() else 0
            cashinbank = model.get_cashinbank() if model.get_cashinbank() else 0
            for month in range(1, 12):
                contribamount = 0
                totalpenalty = 0
                totalloan_amounts = 0
                totalloan_payments = 0
                contribamount = self.get_value(model.get_savingsContributions(month)[0].contributions_amount)
                totalpenalty = self.get_value(model.get_savingsContributions(month)[0].totalpenalty)
                totalloan_amounts =  self.get_value(model.get_savingsLoans(month)[0].totalloan_amounts) / 2
                totalloan_payments = self.get_value(model.get_savingsLoans(month)[0].totalloan_payments) / 2
                total = Decimal(contribamount) + Decimal(totalpenalty) + Decimal(totalloan_payments) - Decimal(totalloan_amounts)
                savings.append(self.get_savingsSummary(month, calendar.month_name[month], contribamount, totalpenalty,
                        totalloan_amounts, totalloan_payments, total))

            return render.savingssummary(savings,formatNumber, Decimal(wamount), formatNumber(outstanding_bal), cashinbank, Decimal)
        else:
            raise web.notfound()
Example #21
0
    def GET(self):
        if withprivilege():
            savings = []
            wamount = contribmodel.get_withdrawnamount(
            ) if contribmodel.get_withdrawnamount() else 0
            outstanding_bal = model.get_outstandingbal(
            ) if model.get_outstandingbal() else 0
            cashinbank = model.get_cashinbank() if model.get_cashinbank(
            ) else 0
            for month in range(1, 12):
                contribamount = 0
                totalpenalty = 0
                totalloan_amounts = 0
                totalloan_payments = 0
                contribamount = self.get_value(
                    model.get_savingsContributions(month)
                    [0].contributions_amount)
                totalpenalty = self.get_value(
                    model.get_savingsContributions(month)[0].totalpenalty)
                totalloan_amounts = self.get_value(
                    model.get_savingsLoans(month)[0].totalloan_amounts) / 2
                totalloan_payments = self.get_value(
                    model.get_savingsLoans(month)[0].totalloan_payments) / 2
                total = Decimal(contribamount) + Decimal(
                    totalpenalty) + Decimal(totalloan_payments) - Decimal(
                        totalloan_amounts)
                savings.append(
                    self.get_savingsSummary(month, calendar.month_name[month],
                                            contribamount, totalpenalty,
                                            totalloan_amounts,
                                            totalloan_payments, total))

            return render.savingssummary(savings, formatNumber,
                                         Decimal(wamount),
                                         formatNumber(outstanding_bal),
                                         cashinbank, Decimal)
        else:
            raise web.notfound()
Example #22
0
 def GET(self):
     if withprivilege():
         notes = AllNotes().retrieve()
         return render.savingsnotes(notes, formatNumber)
Example #23
0
 def GET(self):
     if withprivilege():
         savings = model.get_allsavings()
         return render.savingssummary(savings)
     else:
         raise web.notfound()
Example #24
0
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingscustomers(customers)
     else:
         raise web.notfound()
Example #25
0
 def GET(self):
     if withprivilege():
         guides = model.get_guidelines()
         return render.savingsguide(guides)
     else:
         raise web.notfound()
Example #26
0
 def GET(self,id):
     if withprivilege():
         return render.savingscontribcustomer('','Marvin')
     else:
         raise web.notfound()
Example #27
0
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingsnewloan(customers, None, "", "New", "")
     else:
         raise web.notfound()
Example #28
0
 def POST(self):
     if withprivilege():
         data = web.input()
         dateadd = datetime.strptime(data.date_add, '%m-%d-%Y')
         model.new_notes(dateadd, Decimal(data.amount), data.comments)
         return web.seeother('/savings/notes')
Example #29
0
 def GET(self):
     if withprivilege():
         loans = model.get_loans()
         return render.savingsloan(loans)
     else:
         raise web.notfound()
Example #30
0
 def POST(self):
     if withprivilege():
         data = web.input()
         dateadd = datetime.strptime(data.date_add, '%m-%d-%Y')
         model.new_notes(dateadd, Decimal(data.amount), data.comments)
         return web.seeother('/savings/notes')
Example #31
0
 def GET(self):
     if withprivilege():
         notes = AllNotes().retrieve()
         return render.savingsnotes(notes,formatNumber)
Example #32
0
 def GET(self):
     if withprivilege():
         guides = model.get_guidelines()
         return render.savingsguide(guides)
     else:
         raise web.notfound()
Example #33
0
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingsnewloan(customers, None, "", "New", "")
     else:
         raise web.notfound()
Example #34
0
 def GET(self, id):
     if withprivilege() and superuser():
         user = model.get_userbyid(int(id))
         return render.usersedit(user)
     else:
         raise web.seeother('/')
Example #35
0
 def GET(self):
     if withprivilege():
         users = model.get_users()
         return render.users(users)
     else:
         raise web.seeother('/')
Example #36
0
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingscustomers(customers)
     else:
         raise web.notfound()
Example #37
0
 def POST(self):
     if withprivilege():
         data = web.input()
         contribmodel.update_contributions_withdraw(data.customerId, 1)
         raise web.seeother('/savings/contributions/')
Example #38
0
 def POST(self):
     if withprivilege():
         data = web.input()
         contribmodel.update_contributions_withdraw(data.customerId, 1)
         raise web.seeother('/savings/contributions/')