Example #1
0
 def get_context_data(self, **kwargs):
     context = super(InvoiceBuyReport, self).get_context_data(**kwargs)
     period = get_period(self.request.GET.get(PERIOD_KEY), self.request.GET.get('period_start'),
                         self.request.GET.get('period_end'))
     context['report'] = InvoiceReportProcessor(period[0], period[1]).process()
     self.log_info('Пользователь %s, запросил отчет по приемке товара с %s по %s' % (self.request.user, format_date(period[0]), format_date(period[1])))
     return context
Example #2
0
    def get_context_data(self, **kwargs):
        context = super(BaseProductSellCustomerReportView,
                        self).get_context_data(**kwargs)
        add_customer_data(context)

        period = get_period(self.request.GET.get(PERIOD_KEY),
                            self.request.GET.get('period_start'),
                            self.request.GET.get('period_end'))
        raw_product_kind_ids = self.request.GET.get('productKindIds')
        raw_customer_ids = self.request.GET.get('customerIds')
        product_kind_ids = []
        customer_ids = []
        if raw_product_kind_ids is not None and len(raw_product_kind_ids) > 0:
            product_kind_ids = raw_product_kind_ids.split(',')
        if raw_customer_ids is not None and len(raw_customer_ids) > 0:
            customer_ids = raw_customer_ids.split(',')

        context['report'] = CustomerSellProfitReport(period[0], period[1],
                                                     product_kind_ids,
                                                     customer_ids).process()

        self.log_info(
            message='Пользователь %s, запросил отчет по покупателям!' %
            self.request.user)
        return context
Example #3
0
    def get_context_data(self, **kwargs):
        context = super(ProductSellProfitReportView, self).get_context_data(**kwargs)
        period = get_period(self.request.GET.get(PERIOD_KEY), self.request.GET.get('period_start'),
                            self.request.GET.get('period_end'))
        context['report'] = ProductSellProfitReport(period[0], period[1]).process()

        self.log_info(message='Пользователь %s, запросил отчет по прибыли!' % self.request.user)
        return context
Example #4
0
 def get_context_data(self, **kwargs):
     context = super(ProductSellEmployerReport, self).get_context_data(**kwargs)
     empl_id = kwargs['pk']
     period = get_period(self.request.GET.get(PERIOD_KEY), self.request.GET.get('period_start'), self.request.GET.get('period_end'))
     context['report'] = ReportEmployerForPeriodProcessor(empl_id, period[0], period[1])
     context['employer_id'] = empl_id
     self.log_info(message='Пользователь %s, запросил отчет по работе сотрудника[id=%s]' % (self.request.user, empl_id))
     return context
Example #5
0
    def get_context_data(self, **kwargs):
        context = super(ProductSellReport, self).get_context_data(**kwargs)
        if self.request.user.id != int(kwargs['pk']):
            context['access_error'] = True
            return context

        period = get_period(self.request.GET.get(PERIOD_KEY), self.request.GET.get('period_start'),
                            self.request.GET.get('period_end'))
        context['report'] = ProductSellReportForPeriod(period[0], period[1]).process()

        self.log_info(message='Пользователь %s, запросил отчет по продажам!' % self.request.user)
        return context
Example #6
0
    def get_context_data(self, **kwargs):
        context = super(ProductSellProfitReportView,
                        self).get_context_data(**kwargs)
        period = get_period(self.request.GET.get(PERIOD_KEY),
                            self.request.GET.get('period_start'),
                            self.request.GET.get('period_end'))
        context['report'] = ProductSellProfitReport(period[0],
                                                    period[1]).process()

        self.log_info(message='Пользователь %s, запросил отчет по прибыли!' %
                      self.request.user)
        return context
Example #7
0
 def get_context_data(self, **kwargs):
     context = super(InvoiceBuyReport, self).get_context_data(**kwargs)
     period = get_period(self.request.GET.get(PERIOD_KEY),
                         self.request.GET.get('period_start'),
                         self.request.GET.get('period_end'))
     context['report'] = InvoiceReportProcessor(period[0],
                                                period[1]).process()
     self.log_info(
         'Пользователь %s, запросил отчет по приемке товара с %s по %s' %
         (self.request.user, format_date(period[0]), format_date(
             period[1])))
     return context
Example #8
0
 def get_context_data(self, **kwargs):
     context = super(ProductSellEmployerReport,
                     self).get_context_data(**kwargs)
     empl_id = kwargs['pk']
     period = get_period(self.request.GET.get(PERIOD_KEY),
                         self.request.GET.get('period_start'),
                         self.request.GET.get('period_end'))
     context['report'] = ReportEmployerForPeriodProcessor(
         empl_id, period[0], period[1])
     context['employer_id'] = empl_id
     self.log_info(
         message=
         'Пользователь %s, запросил отчет по работе сотрудника[id=%s]' %
         (self.request.user, empl_id))
     return context
Example #9
0
    def get_context_data(self, **kwargs):
        context = super(ProductSellReport, self).get_context_data(**kwargs)
        add_customer_data(context)

        period = get_period(self.request.GET.get(PERIOD_KEY),
                            self.request.GET.get('period_start'),
                            self.request.GET.get('period_end'))
        raw_customer_ids = self.request.GET.get('customerIds')
        customer_ids = []
        if raw_customer_ids is not None and len(raw_customer_ids) > 0:
            customer_ids = raw_customer_ids.split(',')

        context['report'] = ProductSellReportForPeriod(period[0], period[1],
                                                       customer_ids).process()

        self.log_info(message='Пользователь %s, запросил отчет по продажам!' %
                      self.request.user)
        return context