Exemplo n.º 1
0
    def query(self, query_params_dict):
        """
            Retrieve the exports we want to export
        """
        query = Task.get_valid_tasks()

        if 'start_date' in query_params_dict:
            start_date = query_params_dict['start_date']
            end_date = query_params_dict['end_date']
            query = self._filter_date(query, start_date, end_date)

        elif 'official_number' in query_params_dict:
            official_number = query_params_dict['official_number']
            financial_year = query_params_dict['financial_year']
            query = self._filter_number(
                query, official_number, financial_year, strict=True,
            )

        elif 'start_official_number' in query_params_dict:
            official_number = query_params_dict['start_official_number']
            financial_year = query_params_dict['financial_year']
            query = self._filter_number(
                query, official_number, financial_year, strict=False
            )

        if 'exported' not in query_params_dict or \
                not query_params_dict.get('exported'):
            query = query.filter(
                or_(
                    Invoice.exported == False,
                    CancelInvoice.exported == False,
                )
            )
        return query
Exemplo n.º 2
0
    def query(self, query_params_dict, form_name):
        query = Task.get_valid_tasks()

        if form_name == 'period_form':
            start_date = query_params_dict['start_date']
            end_date = query_params_dict['end_date']
            query = self._filter_date(query, start_date, end_date)

        elif form_name == 'invoice_number_form':
            start = query_params_dict['start']
            end = query_params_dict['end']
            financial_year = query_params_dict['financial_year']
            query = self._filter_number(query, start, end, financial_year)

        if 'exported' not in query_params_dict or \
                not query_params_dict.get('exported'):
            query = query.filter(
                or_(
                    Invoice.exported == False,
                    CancelInvoice.exported == False,
                ))

        return query
Exemplo n.º 3
0
    def query(self, query_params_dict):
        """
            Retrieve the exports we want to export
        """
        query = Task.get_valid_tasks()

        if 'start_date' in query_params_dict:
            start_date = query_params_dict['start_date']
            end_date = query_params_dict['end_date']
            query = self._filter_date(query, start_date, end_date)

        elif 'official_number' in query_params_dict:
            official_number = query_params_dict['official_number']
            financial_year = query_params_dict['financial_year']
            query = self._filter_number(
                query,
                official_number,
                financial_year,
                strict=True,
            )

        elif 'start_official_number' in query_params_dict:
            official_number = query_params_dict['start_official_number']
            financial_year = query_params_dict['financial_year']
            query = self._filter_number(query,
                                        official_number,
                                        financial_year,
                                        strict=False)

        if 'exported' not in query_params_dict or \
                not query_params_dict.get('exported'):
            query = query.filter(
                or_(
                    Invoice.exported == False,
                    CancelInvoice.exported == False,
                ))
        return query