2021-11-04 23:49:56 +08:00
|
|
|
from django_filters.rest_framework import FilterSet
|
|
|
|
from django_filters.filters import *
|
2021-12-26 23:00:08 +08:00
|
|
|
from apps.purchase.models import *
|
2021-12-26 23:24:52 +08:00
|
|
|
from apps.sales.models import *
|
2021-12-29 02:07:37 +08:00
|
|
|
from apps.finance.models import *
|
2021-11-04 23:49:56 +08:00
|
|
|
|
|
|
|
|
2021-12-26 23:00:08 +08:00
|
|
|
class PurchaseReportFilter(FilterSet):
|
2022-04-02 23:06:18 +08:00
|
|
|
category = NumberFilter(field_name='goods__category', label='产品分类')
|
2021-12-26 23:24:52 +08:00
|
|
|
creator = NumberFilter(field_name='sales_order__creator', label='创建人')
|
2021-12-26 23:00:08 +08:00
|
|
|
start_date = DateFilter(field_name='purchase_order__create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='purchase_order__create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = PurchaseGoods
|
2021-12-26 23:24:52 +08:00
|
|
|
fields = ['category', 'creator', 'start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class SalesReportFilter(FilterSet):
|
2022-04-02 23:06:18 +08:00
|
|
|
category = NumberFilter(field_name='goods__category', label='产品分类')
|
2021-12-26 23:24:52 +08:00
|
|
|
creator = NumberFilter(field_name='sales_order__creator', label='创建人')
|
|
|
|
start_date = DateFilter(field_name='sales_order__create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='sales_order__create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = SalesGoods
|
|
|
|
fields = ['category', 'creator', 'start_date', 'end_date']
|
2021-11-04 23:49:56 +08:00
|
|
|
|
2021-12-26 23:00:08 +08:00
|
|
|
|
2021-12-28 00:26:32 +08:00
|
|
|
class SalesHotGoodsFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='sales_order__create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='sales_order__create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = SalesGoods
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class SalesTrendFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = SalesOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
2021-12-29 02:07:37 +08:00
|
|
|
class PaymentOrderDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = PaymentOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class CollectionOrderDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = CollectionOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class IncomeChargeOrderDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = ChargeOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class ExpenditureChargeOrderDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = ChargeOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class PurchasePaymentDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = PurchaseOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class PurchaseReturnCollectionDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = PurchaseReturnOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class SalesCollectionDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = SalesOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
|
|
|
class SalesReturnPaymentDetialFilter(FilterSet):
|
|
|
|
start_date = DateFilter(field_name='create_time', required=True, lookup_expr='gte', label='开始日期')
|
|
|
|
end_date = DateFilter(field_name='create_time', required=True, lookup_expr='lt', label='结束日期')
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = SalesReturnOrder
|
|
|
|
fields = ['start_date', 'end_date']
|
|
|
|
|
|
|
|
|
2021-12-26 23:00:08 +08:00
|
|
|
__all__ = [
|
2021-12-26 23:24:52 +08:00
|
|
|
'PurchaseReportFilter', 'SalesReportFilter',
|
2022-03-07 16:27:10 +08:00
|
|
|
'SalesHotGoodsFilter', 'SalesTrendFilter',
|
2021-12-29 02:07:37 +08:00
|
|
|
'PaymentOrderDetialFilter', 'CollectionOrderDetialFilter',
|
|
|
|
'IncomeChargeOrderDetialFilter', 'ExpenditureChargeOrderDetialFilter',
|
|
|
|
'PurchasePaymentDetialFilter', 'PurchaseReturnCollectionDetialFilter',
|
|
|
|
'SalesCollectionDetialFilter', 'SalesReturnPaymentDetialFilter',
|
2021-11-04 23:49:56 +08:00
|
|
|
]
|