reporting Package

reporting Package

Report generation

boleto Module

class stoqlib.reporting.boleto.BoletoPDF(file_descr, format=0)[source]

Bases: object

drawReciboSacadoCanhoto(boletoDados, x, y)[source]
drawReciboSacado(boletoDados, x, y)[source]
drawHorizontalCorteLine(x, y, width)[source]
drawVerticalCorteLine(x, y, height)[source]
drawReciboCaixa(boletoDados, x, y)[source]
drawBoletoCarneDuplo(boletoDados1, boletoDados2)[source]
drawBoletoCarne(boletoDados, y)[source]
drawBoleto(boletoDados)[source]
nextPage()[source]
save()[source]
add_data(data)[source]
render()[source]
FORMAT_BOLETO = 0
FORMAT_CARNE = 1
class stoqlib.reporting.boleto.BillReport(filename, payments)[source]

Bases: object

title = 'Bill'
classmethod check_printable(payments)[source]
classmethod validate_payment_for_printing(payment)[source]
add_payments()[source]
save()[source]
class stoqlib.reporting.boleto.BillTestReport(filename, data)[source]

Bases: object

save()[source]

booklet Module

class stoqlib.reporting.booklet.BookletReport(filename, payments)[source]

Bases: stoqlib.reporting.report.HTMLReport

title = 'Booklets'
template_filename = 'booklet/report.html'
get_namespace()[source]
adjust_for_test()[source]
stoqlib.reporting.booklet.test()[source]

callsreport Module

A calls receipt implementation

class stoqlib.reporting.callsreport.CallsReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

Realized calls to client report

title = 'Calls Report'
main_object_name = ('call', 'calls')

clientcredit Module

Client credit report implementation

class stoqlib.reporting.clientcredit.ClientCreditReport(filename, client)[source]

Bases: stoqlib.reporting.report.HTMLReport

Create letter of credit report

template_filename = 'client_credit/client_credit.html'
title = 'Letter of Credit'
complete_header = True
client = None
get_generated_date()[source]

financial Module

class stoqlib.reporting.financial.FinancialIntervalReport(store, year)[source]

Bases: object

get_data()[source]
run()[source]
write(temporary)[source]
class stoqlib.reporting.financial.XLSFinancialExporter(data)[source]

Bases: object

process()[source]
write(temporary)[source]

inventory Module

Inventory report implementation

class stoqlib.reporting.inventory.InventoryReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

Simple report for Inventory objs

title = 'Inventory Listing'
main_object_name = ('inventory entry', 'inventory entries')
get_cell(obj, column)[source]

labelreport Module

class stoqlib.reporting.labelreport.LabelReport(temp, models, skip=0, store=None)[source]

Bases: object

title = 'Labels to print'
save()[source]

loanreceipt Module

class stoqlib.reporting.loanreceipt.LoanReceipt(filename, loan)[source]

Bases: stoqlib.reporting.report.HTMLReport

title = 'Loan'
template_filename = 'loan/loan.html'
get_namespace()[source]
adjust_for_test()[source]

payment Module

Payment receival report implementation

class stoqlib.reporting.payment.ReceivablePaymentReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.payment._BasePaymentReport

This report shows a list of receivable payments. For each payment it shows: payment number, description, drawee, due date, paid date, status and value.

class stoqlib.reporting.payment.PayablePaymentReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.payment._BasePaymentReport

This report shows a list of payable payments. For each payment it shows: payment number, description, supplier, due date, paid date, status and value.

class stoqlib.reporting.payment.BillCheckPaymentReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.payment._BasePaymentReport

This report shows a list of Gpayments and some information about the bill or check method payment (if available) like: the bank id, the bank branch, the bank account. The field payment_number in the report can be the check number or the bill number.

class stoqlib.reporting.payment.CardPaymentReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.payment._BasePaymentReport

This report shows a list of information about the card method payment. For each payment it show: payment number, description, drawee, credit provider, due date, value, fee and fee calculation.

class stoqlib.reporting.payment.PaymentFlowHistoryReport(filename, payment_histories)[source]

Bases: stoqlib.reporting.report.HTMLReport

title = u'Payment Flow History'
template_filename = 'payment_flow_history/payment_flow_history.html'
complete_header = False
get_subtitle()[source]
class stoqlib.reporting.payment.AccountTransactionReport(filename, objectlist, transactions, account, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

main_object_name = ('transaction', 'transactions')

paymentsreceipt Module

class stoqlib.reporting.paymentsreceipt.BasePaymentReceipt(filename, payment, order, date, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.HTMLReport

Base account receipt

title = 'Payment receipt'
template_filename = 'payment_receipt/payment_receipt.html'
complete_header = True
get_subtitle()[source]
get_namespace()[source]
get_recipient()[source]

This should be implemented in subclasses

get_drawee()[source]

This should be implemented in subclasses

class stoqlib.reporting.paymentsreceipt.InPaymentReceipt(filename, payment, order, date, *args, **kwargs)[source]

Bases: stoqlib.reporting.paymentsreceipt.BasePaymentReceipt

Accounts receivable receipt

get_drawee()[source]
get_recipient()[source]
class stoqlib.reporting.paymentsreceipt.OutPaymentReceipt(filename, payment, order, date, *args, **kwargs)[source]

Bases: stoqlib.reporting.paymentsreceipt.BasePaymentReceipt

Accounts payable receipt

get_drawee()[source]
get_recipient()[source]

product Module

Products report implementation

class stoqlib.reporting.product.ProductReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report show a list of all products returned by a SearchBar, listing both its description and its balance in the stock selected.

title = 'Product Listing'
filter_format_string = 'on branch <u>%s</u>'
class stoqlib.reporting.product.ProductBrandReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report show a list of all products brand returned by a SearchBar, listing both its brand and its product quantity in the stock selected.

title = 'Brand Listing'
filter_format_string = 'on branch <u>%s</u>'
summary = ['quantity']
class stoqlib.reporting.product.ProductBrandByBranchReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectTreeReport

This report show a list of all products brand by branch returned by a SearchBar, listing both its brand and its product quantity in the stock selected.

title = 'Brand by branch Listing'
filter_format_string = 'on branch <u>%s</u>'
summary = ['quantity']
has_parent(obj)[source]
accumulate(obj)[source]
class stoqlib.reporting.product.SimpleProductReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Product Listing'
summary = ['stock']
class stoqlib.reporting.product.ProductPriceReport(filename, products, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.TableReport

This report show a list of all products returned by a SearchBar, listing both its description and price in the selected stock.

title = 'Product Listing'
filter_format_string = 'on branch <u>%s</u>'
get_columns()[source]
get_row(obj)[source]
class stoqlib.reporting.product.ProductQuantityReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report show a list of all products returned by a SearchBar, listing both its description, quantity solded and quantity received.

title = 'Product Listing'
main_object_name = ('product', 'products')
summary = ['quantity_sold', 'quantity_received', 'quantity_transfered', 'quantity_produced', 'quantity_lost', 'quantity_consumed']
class stoqlib.reporting.product.ProductsSoldReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report lists all products sold with the average stock cost for a given period of time.

title = 'Products Sold Listing'
main_object_name = ('product sold', 'products sold')
class stoqlib.reporting.product.ProductCountingReport(filename, data, title=None, blocked_records=0, status_name=None, filter_strings=None, status=None)[source]

Bases: stoqlib.reporting.report.TableReport

This report shows a list of all products returned by a Searchbar and it leaves several fields in blank, like quantity, partial value and total value. These fields must be filled out in the counting process, manually.

title = 'Product Counting'
main_object_name = ('product', 'products')
get_columns()[source]
get_row(obj)[source]
stoqlib.reporting.product.format_data(data)[source]
class stoqlib.reporting.product.ProductStockReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Product Stock Report'
main_object_name = ('product', 'products')
class stoqlib.reporting.product.ProductClosedStockReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Closed Product Stock Report'
main_object_name = ('product', 'products')

production Module

Production report implementation

class stoqlib.reporting.production.ProductionItemReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report show a list of all production items returned by a SearchBar, listing both its description, category and its quantities.

title = 'Production Item Listing'
filter_format_string = 'on branch <u>%s</u>'
summary = ['quantity', 'produced', 'lost']
class stoqlib.reporting.production.ProductionReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = u'Production Order Report'
main_object_name = ('order', 'orders')
filter_format_string = u'with status <u>%s</u>'
class stoqlib.reporting.production.ProductionOrderReport(filename, order)[source]

Bases: stoqlib.reporting.report.HTMLReport

template_filename = 'production/production.html'
title = u'Production Order'
complete_header = False
get_subtitle()[source]

purchase Module

Purchase report implementation

class stoqlib.reporting.purchase.PurchaseReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Purchase Order Report'
main_object_name = ('order', 'orders')
filter_format_string = 'with status <u>%s</u>'
summary = ['total', 'ordered_quantity', 'received_quantity']
class stoqlib.reporting.purchase.PurchasedItemsReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Purchases Items Report'
main_object_name = ('items', 'items')
summary = ['purchased', 'received', 'stocked']
class stoqlib.reporting.purchase.PurchaseOrderReport(filename, order)[source]

Bases: stoqlib.reporting.report.HTMLReport

template_filename = 'purchase/purchase.html'
title = 'Purchase Order'
complete_header = False
get_agreed_freight()[source]
get_received_freight()[source]
get_subtitle()[source]
class stoqlib.reporting.purchase.PurchaseQuoteReport(filename, order)[source]

Bases: stoqlib.reporting.report.HTMLReport

A quote report to be sent to suppliers

title = u'Quote Request'
template_filename = 'quote/quote.html'
complete_header = False
get_subtitle()[source]

purchasereceival Module

Purchase receival report implementation

class stoqlib.reporting.purchasereceival.PurchaseReceivalReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Purchase Receival Report'
main_object_name = ('purchase', 'purchases')
summary = ['invoice_total']

report Module

class stoqlib.reporting.report.HTMLReport(filename)[source]

Bases: object

template_filename = None
title = ''
complete_header = True
get_html()[source]
save_html(filename)[source]
render(stylesheet=None)[source]
save()[source]
get_namespace()[source]

This hook method can be implemented by children and should return parameters that will be passed to report template in form of a dict.

adjust_for_test()[source]

This hook method must be implemented by children that generates reports with data that change with the workstation or point in time. This allows for the test reports to be always generated with the same data.

class stoqlib.reporting.report.TableReport(filename, data, title=None, blocked_records=0, status_name=None, filter_strings=None, status=None)[source]

Bases: stoqlib.reporting.report.HTMLReport

A report that contains a single table.

Subclasses must implement get_columns and get_row, and can optionaly implement accumulate, reset and get_summary_row.

subtitle_template = 'Listing {rows} of a total of {total_rows} {item}'
main_object_name = ('item', 'items')
filter_format_string = ''
complete_header = False
template_filename = 'objectlist.html'
title = None

The title of the report. Will be present in the header.

get_data()[source]
accumulate(row)[source]

This method is called once for each row in the report.

Here you can create summaries (like the sum of all payments) for the report, that will be added in the last row of the table

reset()[source]

This is called when the iteration on all the rows starts.

Use this to setup or reset any necesary data (like the summaries)

get_summary_row()[source]

If the table needs a summary row in the end, this method should return the list of values that will be in this last row.

The values should already be formatted for presentation.

get_columns()[source]

Get the columns for this table report.

This should return a list of dictionaries defining each column in the table. The dictionaries should define the keys ‘title’, with the string that will be in the header of the table and ‘align’, for adjusting the alignment of the column (‘left’, ‘right’ or ‘center’)

get_row(obj)[source]

Returns the data to be displayed in the row.

Subclaases must implement this method and return a list of value for each cell in the row. This values should already be formatted correctly (ie, a date should already be converted to a string in the desired format).

class stoqlib.reporting.report.ObjectListReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.TableReport

Creates an pdf report from an objectlist and its current state

This report will only show the columns that are visible, in the order they are visible. It will also show the filters that were enabled when the report was generated.

summary = []

Defines the columns that should have a summary in the last row of the report. This is a list of strings defining the attribute of the respective column. Currently, only numeric values are supported (Decimal, currenty, etc..).

get_columns()[source]
get_cell(obj, column)[source]
get_row(obj)[source]
accumulate(row)[source]

This method is called once for each row in the report.

Here you can create summaries (like the sum of all payments) for the report, that will be added in the last row of the table

reset()[source]

This is called when the iteration on all the rows starts.

Use this to setup or reset any necesary data (like the summaries)

get_summary_row()[source]
class stoqlib.reporting.report.ObjectTreeReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

Creates an pdf report from an objecttree and its current state

This report will only show the columns that are visible, in the order they are visible. It will also show the filters that were enabled when the report was generated. And finnally display parent row in bold and children row shifted a little bit to the right

template_filename = 'objecttree.html'
get_row(obj)[source]
has_parent(obj)[source]

sale Module

Sales report implementation

class stoqlib.reporting.sale.SaleOrderReport(filename, order)[source]

Bases: stoqlib.reporting.report.HTMLReport

Transfer Order receipt This class builds the namespace used in template

template_filename = 'sale/sale.html'
title = 'Sale Order'
complete_header = True
get_person_document()[source]
get_subtitle()[source]
get_namespace()[source]
class stoqlib.reporting.sale.SalesReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Sales Report'
main_object_name = ('sale', 'sales')
filter_format_string = 'with status <u>%s</u>'
summary = ['total', 'total_quantity']
class stoqlib.reporting.sale.ReturnedSalesReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Returned Sales Report'
class stoqlib.reporting.sale.ReturnedItemReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Returned Items Report'
class stoqlib.reporting.sale.SoldItemsByClientReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Sales By Client Report'
class stoqlib.reporting.sale.SoldItemsByBranchReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report show a list of sold items by branch. For each item it show: product code, product description, branch name, sold quantity and total.

title = 'Sold Items by Branch Report'
summary = ['quantity', 'total']
template_filename = 'sale/sold_items_by_branch.html'
reset()[source]
accumulate(row)[source]
class stoqlib.reporting.sale.SalesPersonReport(filename, payments_list, salesperson, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.TableReport

title = 'Sales'
get_columns()[source]
get_row(obj)[source]
reset()[source]
accumulate(obj)[source]
get_summary_row()[source]
stoqlib.reporting.sale.test()[source]

salereturn Module

Sale return implementation

class stoqlib.reporting.salereturn.SaleReturnReport(filename, store, client, returned_sale, returned_sale_items)[source]

Bases: stoqlib.reporting.report.HTMLReport

Return sales report. Show client information, returned sale and returned items informations

template_filename = 'return_sale/return_sale.html'
title = 'Sale Return'
complete_header = False
client = None
returned_sale = None
returned_items = None
get_subtitle()[source]
class stoqlib.reporting.salereturn.PendingReturnReceipt(filename, pending_return)[source]

Bases: stoqlib.reporting.report.HTMLReport

template_filename = 'return_sale/pending_receipt.html'
title = 'Pending Returned Sale Report'
complete_header = False
get_namespace()[source]
get_subtitle()[source]

service Module

Services report implementation

class stoqlib.reporting.service.ServiceReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report show a list of services returned by a SearchBar, listing both its description, cost and price.

title = 'Service Listing'
filter_format_string = 'on branch <u>%s</u>'
main_object_name = ('service', 'services')
class stoqlib.reporting.service.ServicePriceReport(filename, data, title=None, blocked_records=0, status_name=None, filter_strings=None, status=None)[source]

Bases: stoqlib.reporting.report.TableReport

This report show a list of services and it’s prices.

title = 'Service Listing'
main_object_name = ('service', 'services')
get_columns()[source]
get_row(obj)[source]

stockdecrease Module

A Manual stock decrease receipt implementation

class stoqlib.reporting.stockdecrease.StockDecreaseReceipt(filename, order)[source]

Bases: stoqlib.reporting.report.HTMLReport

template_filename = 'stock_decrease/stock_decrease.html'
title = 'Manual Stock Decrease Receipt'
complete_header = False
get_subtitle()[source]
class stoqlib.reporting.stockdecrease.StockDecreaseReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Stock decrease report'
main_object_name = ('stock decrease', 'stock decreases')

till Module

Till report implementation

class stoqlib.reporting.till.TillHistoryReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

This report show a list of the till history returned by a SearchBar, listing both its description, date and value.

title = 'Till History Listing'
main_object_name = ('till entry', 'till entries')
summary = ['value']
class stoqlib.reporting.till.TillDailyMovementReport(filename, store, branch, daterange, data_object)[source]

Bases: stoqlib.reporting.report.HTMLReport

This report shows all the financial transactions on till

template_filename = 'till/till.html'
title = 'Daily Movement'
complete_header = False
get_subtitle()[source]

Returns a subtitle text

get_namespace()[source]
has_in_payments()[source]
has_out_payments()[source]
has_till_entries()[source]

transfer Module

A transfer receipt implementation

class stoqlib.reporting.transfer.TransferOrderReceipt(filename, order)[source]

Bases: stoqlib.reporting.report.HTMLReport

Transfer Order receipt This class builds the namespace used in template

template_filename = 'transfer/transfer.html'
title = 'Transfer Receipt'
complete_header = False
get_namespace()[source]
adjust_for_test()[source]
class stoqlib.reporting.transfer.TransferOrderReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Transfer report'
main_object_name = ('transfer', 'transfers')
class stoqlib.reporting.transfer.TransferItemReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Transfer item report'
main_object_name = ('transfer item', 'transfer items')

utils Module

Useful functions related to reports building and visualization.

stoqlib.reporting.utils.get_logo_data(store)[source]
stoqlib.reporting.utils.get_header_data()[source]

workorder Module

Work order reports implementation

class stoqlib.reporting.workorder.WorkOrdersReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

title = 'Work orders report'
main_object_name = ('work order', 'work orders')
filter_format_string = 'with status <u>%s</u>'
summary = ['total']
class stoqlib.reporting.workorder.WorkOrderQuoteReport(filename, workorder)[source]

Bases: stoqlib.reporting.workorder._BaseWorkOrderReport

template_filename = 'workorder/quote.html'
class stoqlib.reporting.workorder.WorkOrderReceiptReport(filename, workorder)[source]

Bases: stoqlib.reporting.workorder._BaseWorkOrderReport

template_filename = 'workorder/receipt.html'

person Module

class stoqlib.reporting.person.ClientsWithSaleReport(filename, objectlist, data, *args, **kwargs)[source]

Bases: stoqlib.reporting.report.ObjectListReport

Base report for Payable and Receivable reports

title = 'Clients With Sale'
main_object_name = ('client', 'clients')
summary = ['n_sales', 'total_amount']