예제 #1
0
def staff_payments_get_content(var=None):
    """

    :param var:
    :return:
    """
    from openstudio.os_customer import Customer

    customer = Customer(auth.user.id)
    rows = customer.get_invoices_rows(
        public_group=False,
        payments_only=True
    )

    header = THEAD(TR(
        TH(T('Invoice #')),
        TH(T('Date')),
        TH(T('Due')),
        TH(T('Amount')),
        TH(T('Status')),
        TH(),
    ))

    table = TABLE(header, _class='table table-striped table-hover')

    for i, row in enumerate(rows):
        repr_row = list(rows[i:i + 1].render())[0]

        pdf = os_gui.get_button(
            'print',
            URL('invoices', 'pdf',
                vars={'iID':row.invoices.id}),
            btn_size='',
            _class='pull-right'
        )

        table.append(TR(
            TD(row.invoices.InvoiceID),
            TD(repr_row.invoices.DateCreated),
            TD(repr_row.invoices.DateDue),
            TD(repr_row.invoices_amounts.TotalPriceVAT),
            TD(repr_row.invoices.Status),
            TD(pdf)
        ))

    return table
예제 #2
0
def invoices():
    """
        Shows all invoices for a customer
    """
    from openstudio.os_customer import Customer

    response.title = T('Invoices')
    response.subtitle = ''
    #response.view = 'shop/index.html'

    features = db.customers_profile_features(1)
    if not features.Invoices:
        redirect(URL('profile', 'index'))

    customer = Customer(auth.user.id)
    rows = customer.get_invoices_rows()
    back = os_gui.get_button('back', URL('profile', 'orders'), _class='btn-link')

    return dict(rows = rows, back=back)