Пример #1
0
    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
Пример #2
0
    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
Пример #3
0
 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)
     ]