def data_providers(self): config = self.report_config report_type = self.request.GET.get('report_type', None) if self.is_reporting_type(): self.split = True if self.is_rendered_as_email and self.is_rendered_as_print: return [ FacilityReportData(config), InventoryManagementData(config) ] elif self.is_rendered_as_email: return [ FacilityReportData(config) ] else: return [ FacilityReportData(config), StockLevelsLegend(config), InputStock(config), UsersData(config), InventoryManagementData(config), ProductSelectionPane(config, hide_columns=False) ] self.split = False if report_type == 'stockouts': config.update(self.stockouts_data()) return [ ProductSelectionPane(config=config, hide_columns=False), StockoutsProduct(config=config), StockoutTable(config=config) ] elif report_type == 'asi': config.update(self.data()) if self.is_rendered_as_email and not self.is_rendered_as_print: return [ ProductSelectionPane(config=config), MonthOfStockProduct(config=config), StockoutTable(config=config) ] return [ ProductSelectionPane(config=config), ProductAvailabilityData(config=config), MonthOfStockProduct(config=config), StockoutsProduct(config=config), StockoutTable(config=config) ] else: config.update(self.data()) providers = [ ProductSelectionPane(config=config), ProductAvailabilityData(config=config), MonthOfStockProduct(config=config) ] if self.is_rendered_as_email and not self.is_rendered_as_print: providers.pop(1) return providers
def data_providers(self): config = self.report_config if self.is_reporting_type(): self.split = True if self.is_rendered_as_email and self.is_rendered_as_print: return [ FacilityReportData(config), InventoryManagementData(config) ] elif self.is_rendered_as_email: return [FacilityReportData(config)] else: return [ FacilityReportData(config), StockLevelsLegend(config), InputStock(config), UsersData(config), InventoryManagementData(config), ProductSelectionPane(config, hide_columns=False) ] self.split = False config.update(self.reporting_rates()) if self.is_rendered_as_print: return self.print_providers elif self.is_rendered_as_email: return self.email_providers data_providers = [ AlertsData(config=config), ReportingRates(config=config), ReportingDetails(config=config) ] location = SQLLocation.objects.get(location_id=config['location_id']) if config['location_id'] and location.location_type.name.lower() in [ 'country', 'region' ]: data_providers.append(SummaryReportingRates(config=config)) data_providers.extend( [NonReporting(config=config), InCompleteReports(config=config)]) return data_providers
def inventory_management(request, domain): inventory_management_ds = InventoryManagementData( config=dict(program=None, products=None, domain=domain, startdate=force_to_datetime(request.GET.get('startdate')), enddate=force_to_datetime(request.GET.get('enddate')), location_id=request.GET.get('location_id'), custom_date=True)) return HttpResponse(json.dumps(inventory_management_ds.charts[0].data, default=json_handler), content_type='application/json')
def data_providers(self): config = self.report_config if self.is_reporting_type(): self.emailable = True self.split = True if self.is_rendered_as_email: return [FacilityReportData(config)] else: return [ FacilityReportData(config), StockLevelsLegend(config), InputStock(config), UsersData(config), InventoryManagementData(config), ProductSelectionPane(config, hide_columns=False) ] self.split = False self.emailable = False config.update(self.data()) return [ ProductAvailabilityData(config=config), ReportingRates(config=config), ReportingDetails(config=config) ]