deep-risk/backend/app/models/tax_declaration.py
2025-12-14 20:08:27 +08:00

90 lines
2.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
税务申报表模型
"""
from datetime import date
from typing import Optional, TYPE_CHECKING
from sqlalchemy import (
Boolean,
Column,
Date,
Integer,
String,
Float,
)
from sqlalchemy.orm import Mapped, mapped_column
from app.models.base import BaseModel
if TYPE_CHECKING:
from .streamer import StreamerInfo, McnAgency
class TaxDeclaration(BaseModel):
"""
税务申报表
"""
__tablename__ = "tax_declaration"
vat_declaration_id: Mapped[str] = mapped_column(
String(50), unique=True, nullable=False, comment="增值税申报ID"
)
taxpayer_name: Mapped[str] = mapped_column(
String(200), nullable=False, comment="纳税人名称"
)
taxpayer_id: Mapped[str] = mapped_column(
String(18), nullable=False, comment="纳税人识别号"
)
tax_period: Mapped[str] = mapped_column(
String(20), nullable=False, comment="纳税期间YYYY-MM或YYYYQ1-4"
)
declaration_date: Mapped[date] = mapped_column(
Date, nullable=False, comment="申报日期"
)
tax_authority_code: Mapped[str] = mapped_column(
String(20), nullable=False, comment="主管税务机关代码"
)
tax_authority_name: Mapped[str] = mapped_column(
String(200), nullable=False, comment="主管税务机关名称"
)
taxpayer_type: Mapped[str] = mapped_column(
String(20),
nullable=False,
comment="纳税人类型general-一般纳税人small_scale-小规模纳税人",
)
tax_rate: Mapped[float] = mapped_column(
nullable=False, comment="税率"
)
sales_revenue: Mapped[float] = mapped_column(
nullable=False, comment="销售收入"
)
sales_revenue_taxable: Mapped[float] = mapped_column(
nullable=False, comment="销售收入应税"
)
output_tax: Mapped[float] = mapped_column(
nullable=False, comment="销项税额"
)
input_tax: Mapped[float] = mapped_column(
default=0, comment="进项税额"
)
input_tax_deductible: Mapped[float] = mapped_column(
default=0, comment="进项税额抵扣"
)
tax_payable: Mapped[float] = mapped_column(
nullable=False, comment="应纳税额"
)
tax_to_pay: Mapped[float] = mapped_column(
nullable=False, comment="应纳税额(已缴)"
)
refund_amount: Mapped[float] = mapped_column(
default=0, comment="退税金额"
)
declaration_status: Mapped[str] = mapped_column(
String(20),
nullable=False,
comment="申报状态draft-草稿submitted-已申报approved-已审核rejected-已退回",
)
is_reconciled: Mapped[bool] = mapped_column(
default=False, comment="是否已对账"
)