コード例 #1
0
ファイル: savings.py プロジェクト: malpinder/webpy
 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()
コード例 #2
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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()
コード例 #3
0
ファイル: blog.py プロジェクト: malpinder/webpy
    def GET(self):

        if withprivilege():
            form = self.form()
            return render.blognew(form)
        else:
            raise web.seeother('/blog')
コード例 #4
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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()
コード例 #5
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         return render.savingsnewcustomer({
             'error' : '',
             'state':"New",
             }, None)
     else:
         raise web.notfound()
コード例 #6
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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()
コード例 #7
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         return render.savingsnewcustomer({
             'error': '',
             'state': "New",
         }, None)
     else:
         raise web.notfound()
コード例 #8
0
ファイル: blog.py プロジェクト: malpinder/webpy
    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
コード例 #9
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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()
コード例 #10
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #11
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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
コード例 #12
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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
コード例 #13
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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()
コード例 #14
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #15
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #16
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #17
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #18
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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()
コード例 #19
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #20
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #21
0
ファイル: savings.py プロジェクト: marzim/savingxfun
    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()
コード例 #22
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         notes = AllNotes().retrieve()
         return render.savingsnotes(notes, formatNumber)
コード例 #23
0
ファイル: savings.py プロジェクト: malpinder/webpy
 def GET(self):
     if withprivilege():
         savings = model.get_allsavings()
         return render.savingssummary(savings)
     else:
         raise web.notfound()
コード例 #24
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingscustomers(customers)
     else:
         raise web.notfound()
コード例 #25
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         guides = model.get_guidelines()
         return render.savingsguide(guides)
     else:
         raise web.notfound()
コード例 #26
0
ファイル: savings.py プロジェクト: malpinder/webpy
 def GET(self,id):
     if withprivilege():
         return render.savingscontribcustomer('','Marvin')
     else:
         raise web.notfound()
コード例 #27
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingsnewloan(customers, None, "", "New", "")
     else:
         raise web.notfound()
コード例 #28
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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')
コード例 #29
0
ファイル: savings.py プロジェクト: malpinder/webpy
 def GET(self):
     if withprivilege():
         loans = model.get_loans()
         return render.savingsloan(loans)
     else:
         raise web.notfound()
コード例 #30
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 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')
コード例 #31
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         notes = AllNotes().retrieve()
         return render.savingsnotes(notes,formatNumber)
コード例 #32
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         guides = model.get_guidelines()
         return render.savingsguide(guides)
     else:
         raise web.notfound()
コード例 #33
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingsnewloan(customers, None, "", "New", "")
     else:
         raise web.notfound()
コード例 #34
0
 def GET(self, id):
     if withprivilege() and superuser():
         user = model.get_userbyid(int(id))
         return render.usersedit(user)
     else:
         raise web.seeother('/')
コード例 #35
0
 def GET(self):
     if withprivilege():
         users = model.get_users()
         return render.users(users)
     else:
         raise web.seeother('/')
コード例 #36
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def GET(self):
     if withprivilege():
         customers = custmodel.get_customers()
         return render.savingscustomers(customers)
     else:
         raise web.notfound()
コード例 #37
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def POST(self):
     if withprivilege():
         data = web.input()
         contribmodel.update_contributions_withdraw(data.customerId, 1)
         raise web.seeother('/savings/contributions/')
コード例 #38
0
ファイル: savings.py プロジェクト: marzim/savingxfun
 def POST(self):
     if withprivilege():
         data = web.input()
         contribmodel.update_contributions_withdraw(data.customerId, 1)
         raise web.seeother('/savings/contributions/')