group_by = [ # list of fields and lookups for group-by options 'department', 'department__leader', 'occupation', ] list_filter = [ # This are report filter options (similar to django-admin) 'occupation', 'country', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'name', 'salary', 'expenses', ] date_hierarchy = 'birth_date' # the same as django-admin reporting.register('people', PersonReport) # Do not forget to 'register' your class in reports class PersonWithExpensesReport(PersonReport): def get_queryset(self): qs = super(PersonWithExpensesReport, self).get_queryset() qs = qs.filter(expenses__gt=0) return qs verbose_name = 'People with expenses Report' reporting.register('expenses', PersonWithExpensesReport) # Do not forget to 'register' your class in reports
('id', Count, 'Total'), # example of custom title for column ('salary', Sum), # no title - column will be "Salary Sum" ('expenses', Sum), ) aggregate = ( # columns that will be aggregated (syntax the same as for annotate) ('id', Count, 'Total'), ('salary', Sum, 'Salary'), ('expenses', Sum, 'Expenses'), ) group_by = [ # list of fields and lookups for group-by options 'department', 'department__leader', 'occupation', ] list_filter = [ # This are report filter options (similar to django-admin) 'occupation', 'country', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'name', 'salary', 'expenses', ] date_hierarchy = 'birth_date' # the same as django-admin reporting.register( 'people', PersonReport) # Do not forget to 'register' your class in reports
class TimesheetReport(reporting.Report): model = Timesheet verbose_name = 'Timesheet Report' annotate = ( # Annotation fields (tuples of field, func, title) ('id', Count, 'Total'), # example of custom title for column ('horastrab', Sum), # no title - column will be "Salary Sum" ) aggregate = ( # columns that will be aggregated (syntax is the same as for annotate) ('id', Count, 'Total'), ('horastrab', Sum, 'horastrab'), ) group_by = [ # list of fields and lookups for group-by options 'usuario', 'data', ] list_filter = [ # This are report filter options (similar to django-admin) 'occupation', 'country', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'usuario', 'data', ] date_hierarchy = 'data' # the same as django-admin reporting.register('timesheet', TimesheetReport) # Do not forget to 'register' your class in reports
('effective_duration', Sum), ('effective_duration', Avg), ('billsec', Sum), ('total_cost', Sum), ('total_sell', Sum), ) aggregate = ( ('id', Count, 'Nb Calls'), ('effective_duration', Sum), ('effective_duration', Avg), ('billsec', Sum), ('total_cost', Sum), ('total_sell', Sum), ) group_by = [ 'customer__name', ('customer__name', 'sell_destination'), 'sell_destination', 'lcr_carrier_id__name', ('lcr_carrier_id__name', 'cost_destination'), 'cost_destination', ] list_filter = [ 'sell_destination', 'lcr_carrier_id__name', ] date_hierarchy = 'start_stamp' reporting.register('CDR', CDRReport)
# list of fields and lookups for group-by options group_by = [ ('department', ('department__title',)), ('leader', ('department__leader__name',), 'Department leader'), ('occupation', ('occupation__title',)), ('dep_occup', ('department__title', 'occupation__title',), 'Department and occupation'), ] # This are report filter options (similar to django-admin) list_filter = [ 'occupation', 'country', ] ordering = ('-id_count',) # the same as django-admin date_hierarchy = 'birth_date' search_fields = ('department__title',) def salary_sum(self, dct): return unicode(dct['salary_sum']) + ' $' def expenses_sum(self, dct): return unicode(dct['expenses_sum']) + ' $' # Do not forget to 'register' your class in reports reporting.register('people', PersonReport)
## ## reports.py ## Author : <*****@*****.**> ## Started on Wed Mar 24 14:08:07 2010 Shashishekhar S ## $Id$ ## ## Copyright (C) 2010 INFORMEDIA ## import reporting from models import Subscriber class SubscriberReport(reporting.Report): model = Subscriber verbose_name = 'Subscriber Report' detail_list_display = [ 'name', ] # date_hierarchy = 'requested' reporting.register('subscriber', SubscriberReport)
aggregate = ( # columns that will be aggregated (syntax the same as for annotate) ('value', Sum, 'Total'), ) group_by = [ # list of fields and lookups for group-by options 'facility', ] list_filter = [ # This are report filter options (similar to django-admin) 'facility', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'indicator_type', ] date_hierarchy = 'date_created' # the same as django-admin reporting.register('Indicator', IndicatorReport) # Do not forget to 'register' your class in reports class HealthFacilityReport(reporting.Report): model = models.HealthFacility verbose_name = 'HealthFacility Indicator Report' #use annotations (or something else) to calculate indicators? annotate = ( # Annotation fields (tupples of field, func, title) ('indicators', Sum, 'Total'), # example of custom title for column ) aggregate = ( # columns that will be aggregated (syntax the same as for annotate) ('type', Sum, 'Total'), ) group_by = [ # list of fields and lookups for group-by options 'type', ]
class ParticipantReport(reporting.Report): model = Participant verbose_name = 'Participant Report' annotate = ( # Annotation fields (tupples of field, func, title) ('id', Count, 'Total'), # example of custom title for column ) aggregate = ( # columns that will be aggregated (syntax the same as for annotate) ('id', Count, 'Total'), ) group_by = [ # list of fields and lookups for group-by options 'groupby_hack', 'college', #'user', ] list_filter = [ # This are report filter options (similar to django-admin) 'email_verified', 'events', 'college', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'name', 'college', 'roll_no', 'phone_no', 'email_id', ] reporting.register('participant', ParticipantReport) # Do not forget to 'register' your class in reports
("salary", Sum, "Salary"), ("expenses", Sum, "Expenses"), ) group_by = ["department", "department__leader", "occupation"] # list of fields and lookups for group-by options list_filter = ["occupation", "country"] # This are report filter options (similar to django-admin) detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped "name", "salary", "expenses", ] date_hierarchy = "birth_date" # the same as django-admin reporting.register("people", PersonReport) # Do not forget to 'register' your class in reports class OtroReport(reporting.Report): model = Person verbose_name = "Person Report" annotate = ( # Annotation fields (tupples of field, func, title) ("id", Count, "Total"), # example of custom title for column ("salary", Sum), # no title - column will be "Salary Sum" ("expenses", Sum), ) aggregate = ( # columns that will be aggregated (syntax the same as for annotate) ("salary", Sum, "Salary"), ("expenses", Sum, "Expenses"), ) group_by = ["department"] # list of fields and lookups for group-by options
group_by = [ ('department', ('department__title', )), ('leader', ('department__leader__name', ), 'Department leader'), ('occupation', ('occupation__title', )), ('dep_occup', ( 'department__title', 'occupation__title', ), 'Department and occupation'), ] # This are report filter options (similar to django-admin) list_filter = [ 'occupation', 'country', ] ordering = ('-id_count', ) # the same as django-admin date_hierarchy = 'birth_date' search_fields = ('department__title', ) def salary_sum(self, dct): return unicode(dct['salary_sum']) + ' $' def expenses_sum(self, dct): return unicode(dct['expenses_sum']) + ' $' # Do not forget to 'register' your class in reports reporting.register('people', PersonReport)
'queryset': queryset, 'subsets': subsets, }, }) # say we are generating report for all objects into context totals_for_project = True return { 'date_start': date_start, 'date_end': date_end, 'report': report_list, 'total_project_minutes': total_project_minutes, 'total_project_chargable_minutes': total_project_chargable_minutes, 'totals_for_project': totals_for_project, } reporting.register('project_details', ProjectDetailsReport) # Do not forget to 'register' your class in reports class DaysConsultantReport(reporting.Report): # Related model class model = Timesheet # Form class form_class = DaysConsultantForm # Relative path to report template template_name = 'tms/reports/days_consultant.html' # Verbose name, used as report title verbose_name = _('Days by Consultant') # Short description of report description = _('put description here...') def generate(self, *args, **kwargs):
('effective_duration', Avg), ('billsec', Sum), ('total_cost', Sum), ('total_sell', Sum), ) aggregate = ( ('id', Count, 'Nb Calls'), ('effective_duration', Sum), ('effective_duration', Avg), ('billsec', Sum), ('total_cost', Sum), ('total_sell', Sum), ) group_by = [ 'customer__name', ('customer__name', 'sell_destination'), 'sell_destination', 'lcr_carrier_id__name', ('lcr_carrier_id__name', 'cost_destination'), 'cost_destination', ] list_filter = [ 'sell_destination', 'lcr_carrier_id__name', ] date_hierarchy = 'start_stamp' reporting.register('CDR', CDRReport)
list_filter = [ # This are report filter options (similar to django-admin) 'occupation', 'country', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'name', 'salary', 'expenses', ] date_hierarchy = 'birth_date' # the same as django-admin reporting.register( 'people', PersonReport) # Do not forget to 'register' your class in reports class PersonWithExpensesReport(PersonReport): def get_queryset(self): qs = super(PersonWithExpensesReport, self).get_queryset() qs = qs.filter(expenses__gt=0) return qs verbose_name = 'People with expenses Report' reporting.register('expenses', PersonWithExpensesReport ) # Do not forget to 'register' your class in reports
annotate = ( # Annotation fields (tupples of field, func, title) ('id', Count, 'Total'), # example of custom title for column ('salary', Sum), # no title - column will be "Salary Sum" ('expenses', Sum), ) aggregate = ( # columns that will be aggregated (syntax the same as for annotate) ('id', Count, 'Total'), ('salary', Sum, 'Salary'), ('expenses', Sum, 'Expenses'), ) group_by = [ # list of fields and lookups for group-by options 'department', 'department__leader', 'occupation', ] list_filter = [ # This are report filter options (similar to django-admin) 'occupation', 'country', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'name', 'salary', 'expenses', ] date_hierarchy = 'birth_date' # the same as django-admin reporting.register('people', PersonReport) # Do not forget to 'register' your class in reports
# Group mode group_by = [ 'None', 'city', 'type', 'subscription', ] annotate = ( ('id', Count, 'Count'), ) # Detail mode detail_list_display = list_display # Aggregate and filter aggregate = ( ('id', Count, 'Count'), ) list_filter = [ # 'city', 'type', 'subscription', 'hide', ] date_filter = [] reporting.register(WorkReport.link, WorkReport) # Do not forget to 'register' your class in reports reporting.register(WorkTimesReport.link, WorkTimesReport) # Do not forget to 'register' your class in reports reporting.register(TasksReport.link, TasksReport) # Do not forget to 'register' your class in reports reporting.register(TicketsReport.link, TicketsReport) reporting.register(ClientsReport.link, ClientsReport)
] class FacultyReport(reporting.Report): model = Faculty verbose_name = 'Faculty Report' annotate = ( # Annotation fields (tupples of field, func, title) ('id', Count, 'Total'), # example of custom title for column ) aggregate = ( # columns that will be aggregated (syntax the same as for annotate) ('id', Count, 'Total'), ) group_by = [ # list of fields and lookups for group-by options 'department', 'designation', ] list_filter = [ # This are report filter options (similar to django-admin) 'department', 'designation', ] detail_list_display = [ # if detail_list_display is defined user will be able to see how rows was grouped 'name', 'phone_no', 'email_id', 'department', 'designation', ] reporting.register('student', StudentReport) # Do not forget to 'register' your class in reports reporting.register('faculty', FacultyReport) # Do not forget to 'register' your class in reports
import reporting from django.db.models import Sum, Avg, Count from GED.ePapier.models import Documento class DocumentoReport(reporting.Report): model = Documento verbose_name = u'Documento' annotate = ( ('id', Count, 'Quantidade'), ) aggregate = ( ('id', Count, 'Total'), ) group_by = [ 'Categoria', 'Setor', ] list_filter = [ # This are report filter options (similar to django-admin) 'Categoria', 'Setor', ] reporting.register('Documento', DocumentoReport) # Do not forget to 'register' your class in reports