• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python model.Invoice类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zkpylons.model.Invoice的典型用法代码示例。如果您正苦于以下问题:Python Invoice类的具体用法?Python Invoice怎么用?Python Invoice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Invoice类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: refund

    def refund(self, id):
        invoice = Invoice.find_by_id(id)
        try:
            c.invoice_person = invoice.person.id
        except:
            c.invoice_person = ''

        c.due_date = datetime.date.today().strftime("%d/%m/%Y")

        c.product_categories = ProductCategory.find_all()
        # The form adds one to the count by default, so we need to decrement it
        c.item_count = len(invoice.items) - 1

        defaults = dict()
        defaults['invoice.person' ] = c.invoice_person
        defaults['invoice.due_date'] = c.due_date
        for i in range(len(invoice.items)):
            item = invoice.items[i]
            if item.product:
                defaults['invoice.items-' + str(i) + '.product'] = item.product.id
            else:
                defaults['invoice.items-' + str(i) + '.description'] = item.description
            defaults['invoice.items-' + str(i) + '.qty'] = -item.qty
            defaults['invoice.items-' + str(i) + '.cost'] = item.cost
        form = render("/invoice/new.mako")
        return htmlfill.render(form, defaults, use_all_keys=True)
开发者ID:n6151h,项目名称:pyconau2016,代码行数:26,代码来源:invoice.py


示例2: pay

    def pay(self, id):
        """Request confirmation from user
        """
        invoice = Invoice.find_by_id(id, True)
        person = invoice.person

        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_user(person.id), h.auth.has_organiser_role, h.auth.has_unique_key())):
            # Raise a no_auth error
            h.auth.no_role()

        #return render('/registration/really_closed.mako')

        error = self._check_invoice(person, invoice)
        if error is not None:
            return error

        c.payment = Payment()
        c.payment.amount = invoice.total
        c.payment.invoice = invoice

        meta.Session.commit()
        if c.payment.gateway == 'securepay':
            return render("/invoice/securepay.mako")
        else:
            return render("/invoice/payment.mako")
开发者ID:noisymime,项目名称:zookeepr,代码行数:25,代码来源:invoice.py


示例3: unvoid

 def unvoid(self, id):
     c.invoice = Invoice.find_by_id(id, True)
     c.invoice.void = None
     c.invoice.manual = True
     meta.Session.commit()
     h.flash("Invoice was un-voided.")
     return redirect_to(action='view', id=c.invoice.id)
开发者ID:n6151h,项目名称:pyconau2016,代码行数:7,代码来源:invoice.py


示例4: check

    def check(self, app, environ, start_response):

        if not environ.get('REMOTE_USER'):
            set_redirect()
            raise NotAuthenticatedError('Not Authenticated')

        person = Person.find_by_email(environ['REMOTE_USER'])
        if person is None:
            environ['auth_failure'] = 'NO_USER'
            raise NotAuthorizedError(
                'You are not one of the users allowed to access this resource.'
            )

        invoice = Invoice.find_by_id(self.invoice_id)
        if invoice is None:
            raise NotAuthorizedError(
                "Invoice doesn't exist"
            )

        if person.id <> invoice.person_id:
            set_role("Invoice is not for this user")
            raise NotAuthorizedError(
                "Invoice is not for this user"
            )

        return app(environ, start_response)
开发者ID:Ivoz,项目名称:zookeepr,代码行数:26,代码来源:auth.py


示例5: void

    def void(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.invoice = Invoice.find_by_id(id, True)
        if c.invoice.is_void():
            h.flash("Invoice was already voided.")
            return redirect_to(action='view', id=c.invoice.id)

        if h.auth.authorized(h.auth.has_organiser_role):
            c.invoice.void = "Administration Change"
            meta.Session.commit()
            h.flash("Invoice was voided.")
            return redirect_to(action='view', id=c.invoice.id)
        else:
            if c.invoice.paid():
                h.flash("Cannot void a paid invoice.")
                return redirect_to(action='view', id=c.invoice.id)
            c.invoice.void = "User cancellation"
            c.person = c.invoice.person
            meta.Session.commit()
            email(lca_info['contact_email'], render('/invoice/user_voided.mako'))
            h.flash("Previous invoice was voided.")
            return redirect_to(controller='registration', action='pay', id=c.person.registration.id)
开发者ID:PaulWay,项目名称:zookeepr,代码行数:25,代码来源:invoice.py


示例6: remind

 def remind(self):
     c.invoice_collection = Invoice.find_all()
     #c.invoice = c.invoice_collection[0]
     #c.recipient = c.invoice.person
     # create dummy person for example:
     c.recipient = FakePerson()
     return render('/invoice/remind.mako')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:7,代码来源:invoice.py


示例7: void

    def void(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.invoice = Invoice.find_by_id(id, True)
        if c.invoice.is_void:
            h.flash("Invoice was already voided.")
            return redirect_to(action='view', id=c.invoice.id)
        elif len(c.invoice.payment_received) and h.auth.authorized(h.auth.has_organiser_role):
            h.flash("Invoice has a payment applied to it, do you want to " + h.link_to('Refund', h.url_for(action='refund')) + " instead?")
            return redirect_to(action='view', id=c.invoice.id)
        elif len(c.invoice.payment_received):
            h.flash("Cannot void a paid invoice.")
            return redirect_to(action='view', id=c.invoice.id)
        elif h.auth.authorized(h.auth.has_organiser_role):
            c.invoice.void = "Administration Change"
            meta.Session.commit()
            h.flash("Invoice was voided.")
            return redirect_to(action='view', id=c.invoice.id)
        else:
            c.invoice.void = "User cancellation"
            c.person = c.invoice.person
            meta.Session.commit()
            email(Config.get('contact_email'), render('/invoice/user_voided.mako'))
            h.flash("Previous invoice was voided.")
            return redirect_to(controller='registration', action='pay', id=c.person.registration.id)
开发者ID:n6151h,项目名称:pyconau2016,代码行数:27,代码来源:invoice.py


示例8: extend

 def extend(self, id):
     c.invoice = Invoice.find_by_id(id, True)
     if c.invoice.is_overdue:
         c.invoice.due_date = datetime.datetime.now() + datetime.timedelta(days=1)
     else:
         c.invoice.due_date = c.invoice.due_date + ((c.invoice.due_date - datetime.datetime.now()) * 2)
     meta.Session.commit()
     return redirect_to(action='view')
开发者ID:n6151h,项目名称:pyconau2016,代码行数:8,代码来源:invoice.py


示例9: pdf

    def pdf(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role, h.auth.has_unique_key())):
            # Raise a no_auth error
            h.auth.no_role()

        c.invoice = Invoice.find_by_id(id, True)
        xml_s = render('/invoice/pdf.mako')

        xsl_f = get_path('zk_root') + '/zkpylons/templates/invoice/pdf.xsl'
        pdf_data = pdfgen.generate_pdf(xml_s, xsl_f)

        filename = Config.get('event_shortname') + '_' + str(c.invoice.id) + '.pdf'
        return pdfgen.wrap_pdf_response(pdf_data, filename)
开发者ID:n6151h,项目名称:pyconau2016,代码行数:13,代码来源:invoice.py


示例10: printable

    def printable(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role, h.auth.has_unique_key())):
            # Raise a no_auth error
            h.auth.no_role()

        c.printable = True
        c.invoice = Invoice.find_by_id(id, True)
        c.payment_received = None
        c.payment = None
        if c.invoice.is_paid and c.invoice.total > 0:
            c.payment_received = c.invoice.good_payments[0]
            c.payment = c.payment_received.payment
        return render('/invoice/view_printable.mako')
开发者ID:n6151h,项目名称:pyconau2016,代码行数:13,代码来源:invoice.py


示例11: pdf

    def pdf(self, id):
        if not h.auth.authorized(
            h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role, h.auth.has_unique_key())
        ):
            # Raise a no_auth error
            h.auth.no_role()

        c.invoice = Invoice.find_by_id(id, True)
        xml_s = render("/invoice/pdf.mako")

        xsl_f = file_paths["zk_root"] + "/zkpylons/templates/invoice/pdf.xsl"
        pdf_data = pdfgen.generate_pdf(xml_s, xsl_f)

        filename = lca_info["event_shortname"] + "_" + str(c.invoice.id) + ".pdf"
        return pdfgen.wrap_pdf_response(pdf_data, filename)
开发者ID:gracz120,项目名称:zookeepr,代码行数:15,代码来源:invoice.py


示例12: pay_manual

    def pay_manual(self, id):
        """Request confirmation from user
        """
        invoice = Invoice.find_by_id(id, True)
        person = invoice.person

        error = self._check_invoice(person, invoice, ignore_overdue=True)
        if error is not None:
            return error

        c.payment = Payment()
        c.payment.amount = invoice.total
        c.payment.invoice = invoice

        meta.Session.commit()
        return redirect_to(controller='payment', id=c.payment.id, action='new_manual')
开发者ID:n6151h,项目名称:pyconau2016,代码行数:16,代码来源:invoice.py


示例13: pdf

    def pdf(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role, h.auth.has_unique_key())):
            # Raise a no_auth error
            h.auth.no_role()

        c.invoice = Invoice.find_by_id(id, True)
        xml_s = render('/invoice/pdf.mako')

        template_path = file_paths['theme_templates'] + '/invoice/pdf.xsl'
        if(os.path.isfile(template_path)):
            xsl_f = template_path
        else:
            xsl_f = file_paths['zk_root'] + '/zkpylons/templates/invoice/pdf.xsl'
        pdf_data = pdfgen.generate_pdf(xml_s, xsl_f)

        filename = lca_info['event_shortname'] + '_' + str(c.invoice.id) + '.pdf'
        return pdfgen.wrap_pdf_response(pdf_data, filename)
开发者ID:noisymime,项目名称:zookeepr,代码行数:17,代码来源:invoice.py


示例14: get_invoice

 def get_invoice(self, id):
     """
     Returns a JSON representation of an existing invoice
     """
     invoice = Invoice.find_by_id(id, True)
     obj = {
         "id": invoice.id,
         "person_id": invoice.person_id,
         "manual": invoice.manual,
         "void": invoice.void,
         "issue_date": invoice.issue_date.strftime("%d/%m/%Y"),
         "due_date": invoice.due_date.strftime("%d/%m/%Y"),
         "items": [
             {"product_id": item.product_id, "description": item.description, "qty": item.qty, "cost": item.cost}
             for item in invoice.items
         ],
     }
     return dict(r=dict(invoice=obj))
开发者ID:gracz120,项目名称:zookeepr,代码行数:18,代码来源:invoice.py


示例15: get_invoice

 def get_invoice(self, id):
     """
     Returns a JSON representation of an existing invoice
     """
     invoice = Invoice.find_by_id(id, True)
     obj = {
         'id': invoice.id,
         'person_id': invoice.person_id,
         'manual': invoice.manual,
         'void': invoice.void,
         'issue_date': invoice.issue_date.strftime('%d/%m/%Y'),
         'due_date': invoice.due_date.strftime('%d/%m/%Y'),
         'items': [
             {
             'product_id': item.product_id,
             'description': item.description,
             'qty': item.qty,
             'cost': item.cost,
             } for item in invoice.items],
     }
     return dict(r=dict(invoice=obj))
开发者ID:n6151h,项目名称:pyconau2016,代码行数:21,代码来源:invoice.py


示例16: pay_invoice

    def pay_invoice(self):
        """
        Pay an invoice via the new angular.js interface

        Expects: and invoice_id. Assumes total amount is to be paid.

        TODO: Validation??
        """
        invoice_id = int(request.params['invoice'],10)
        invoice = Invoice.find_by_id(invoice_id, True)
        person = invoice.person

        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_user(person.id), h.auth.has_organiser_role, h.auth.has_unique_key())):
            # Raise a no_auth error
            h.auth.no_role()

        payment = Payment()
        payment.amount = invoice.total
        payment.invoice = invoice

        payment_received = PaymentReceived(
                                    approved=True,
                                    payment=payment,
                                    invoice_id=invoice.id,
                                    success_code='0',
                                    amount_paid=payment.amount,
                                    currency_used='AUD',
                                    response_text='Approved',
                                    client_ip_zookeepr='127.1.0.1',
                                    client_ip_gateway='127.0.0.1',
                                    email_address=person.email_address,
                                    gateway_ref='Rego Desk Cash'
                    )

        meta.Session.add(payment)
        meta.Session.add(payment_received)
        meta.Session.commit()

        return "Payment recorded"
开发者ID:Ivoz,项目名称:zookeepr,代码行数:39,代码来源:invoice.py


示例17: pay_invoice

    def pay_invoice(self, id):
        """
        Pay an invoice via the new angular.js interface

        Expects: invoice_id. Assumes total amount is to be paid.

        TODO: Validation??
        """
        invoice = Invoice.find_by_id(id, True)
        person = invoice.person
        if not invoice.is_paid:
            payment = Payment()
            payment.amount = invoice.total
            payment.invoice = invoice

            payment_received = PaymentReceived(
                                        approved=True,
                                        payment=payment,
                                        invoice_id=invoice.id,
                                        success_code='0',
                                        amount_paid=payment.amount,
                                        currency_used='AUD',
                                        response_text='Approved',
                                        client_ip_zookeepr='127.1.0.1',
                                        client_ip_gateway='127.0.0.1',
                                        email_address=person.email_address,
                                        gateway_ref='Rego Desk Cash'
                        )

            meta.Session.add(payment)
            meta.Session.add(payment_received)
            meta.Session.commit()

            return dict(r=dict(message="Payment recorded"))
        else:
            return dict(r=dict(message="A payment has already been recorded for this invoice"))
开发者ID:n6151h,项目名称:pyconau2016,代码行数:36,代码来源:invoice.py


示例18: _to_python

 def _to_python(self, value, state):
     invoice = Invoice.find_by_id(int(value), False)
     if invoice is None:
         raise Invalid("Unknown invoice ID.", value, state)
     else:
         return invoice
开发者ID:flosokaks,项目名称:zookeepr,代码行数:6,代码来源:validators.py


示例19: index

    def index(self):
        c.can_edit = True
        c.invoice_collection = Invoice.find_all()

        return render('/invoice/list.mako')
开发者ID:n6151h,项目名称:pyconau2016,代码行数:5,代码来源:invoice.py



注:本文中的zkpylons.model.Invoice类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python model.Person类代码示例发布时间:2022-05-26
下一篇:
Python model.Funding类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap