Пример #1
0
def get_results(month, year, period, payment, status, mini_search, countries, exp, aggregate, sort, column):
    # assumes all invoices are chosen
    if not period and (mini_search or payment or status):
        today = datetime.datetime.now()
        lday = {'year':2005, 'month':01, 'day':01}
        period = ['%s/%s/%s' % (lday['day'], lday['month'], lday['year']), 
                  '%s/%s/%s' % (today.day, today.month, today.year)]
    
    # don't print anything if nothting is selected    
    if not (mini_search or period or payment or status):
        period, month, year = None, 01, 2003
    
    # if we are exporting in csv
    csv, html = False, True
    if exp:
        csv, html = True, False
    
    # some fixes
    payment = payment != '' and [payment] or []
    status = status != '' and [status] or []
    
    # we always show the amounts and make sure the column are in order
    if column:
        col = []
        fields = ['customer', 'invoice_id', 'place', 'country', 'reseller', 'did', 
                  'plan_name', 'date', 'date_monthly',
                  'total_amount', 'total_amount_monthly', 'equip', 'shipping_charges', 'activation_charges', 
                  'plan', 'callcost', 'callcost_monthly',
                  'status', 'invoice_status', 'transaction_type']
        for f in fields:
            if f in column:
                col.append(f)
            elif f in ['total_amount', 'total_amount_monthly', 
                     'equip', 'shipping_charges', 'activation_charges', 
                     'plan', 'callcost', 'callcost_monthly']:
                col.append(f)
        column = col
        
    # print the report
    report.list_invoices(month, year, period=period, total=True, header=True, 
                         csv=csv, html=html, payment=payment, status=status, 
                         emails=None, mini_search=mini_search, countries=countries, 
                         aggregate=aggregate, sort=sort, column=column)
Пример #2
0
def get_results(month, year, period, payment, status, mini_search, countries, exp):
    # assumes all invoices are chosen
    if not period and (mini_search or payment or status):
        today = datetime.datetime.now()
        lday = {'year':2005, 'month':01, 'day':01}
        period = ['%s/%s/%s' % (lday['day'], lday['month'], lday['year']), 
                  '%s/%s/%s' % (today.day, today.month, today.year)]
    
    # don't print anything if nothting is selected    
    if not (mini_search or period or payment or status):
        period, month, year = None, 01, 2003
    
    # if we are exporting in csv
    csv, html = False, True
    if exp:
        csv, html = True, False
    
    # print the report
    report.list_invoices(month, year, period=period, total=True, header=True, 
                         csv=csv, html=html, payment=payment, status=status, 
                         emails=None, mini_search=mini_search, countries=countries)