Example #1
0
 def data_providers(self):
     config = self.report_config
     if self.location:
         if self.location.location_type.name.upper() == 'FACILITY':
             self.use_datatables = True
             return [
                 InventoryHistoryData(config=config),
                 RandRHistory(config=config),
                 Notes(config=config),
                 RecentMessages(config=config),
                 RegistrationData(config=dict(loc_type='FACILITY',
                                              **config),
                                  css_class='row_chart_all'),
                 RegistrationData(config=dict(loc_type='DISTRICT',
                                              **config),
                                  css_class='row_chart_all'),
                 RegistrationData(config=dict(loc_type='REGION', **config),
                                  css_class='row_chart_all')
             ]
         else:
             self.use_datatables = False
             return [
                 RandRSubmissionData(config=config),
                 DistrictSummaryData(config=config),
                 SohSubmissionData(config=config),
                 DeliverySubmissionData(config=config),
                 ProductAvailabilitySummary(config=config,
                                            css_class='row_chart_all')
             ]
     else:
         return []
Example #2
0
    def data_providers(self):
        from custom.ilsgateway.tanzania.reports.facility_details import (InventoryHistoryData,
            RegistrationData, RandRHistory, Notes, RecentMessages)

        config = self.report_config
        data_providers = []
        if config['org_summary']:
            location = SQLLocation.objects.get(location_id=config['org_summary'][0].location_id)

            data_providers = [
                SohSubmissionData(config=config, css_class='row_chart'),
                ProductSelectionPane(config=config, css_class='row_chart'),
                ProductAvailabilitySummary(config=config, css_class='row_chart_all', chart_stacked=False),
            ]

            if location.location_type.name.upper() == 'DISTRICT':
                data_providers.append(DistrictSohPercentageTableData(config=config, css_class='row_chart_all'))
            elif location.location_type.name.upper() == 'FACILITY':
                return [
                    InventoryHistoryData(config=config),
                    RandRHistory(config=config),
                    Notes(config=config),
                    RecentMessages(config=config),
                    RegistrationData(config=dict(loc_type='FACILITY', **config), css_class='row_chart_all'),
                    RegistrationData(config=dict(loc_type='DISTRICT', **config), css_class='row_chart_all'),
                    RegistrationData(config=dict(loc_type='REGION', **config), css_class='row_chart_all')
                ]
            else:
                data_providers.append(SohPercentageTableData(config=config, css_class='row_chart_all'))
        return data_providers