This commit is contained in:
Shubhankar45
2026-10-27 12:03:31 +00:00
parent 2ed3945b5d
commit 4e5e95775d
104 changed files with 5210 additions and 606 deletions
@@ -0,0 +1,44 @@
"""the Expense Statement company form
One row per day of travel: place of visit, fare, daily allowance, postage, other expenses
and business achieved. Like the fare chart, each MR has their own copy, and the Area
Manager checks (approves) it.
Revision ID: p6f2b8d4e1a3
Revises: o5e1a7c3d0f2
Create Date: 2026-10-25
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "p6f2b8d4e1a3"
down_revision: str | None = "o5e1a7c3d0f2"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
COLUMNS = (
"name", "designation", "headquarter", "month", "serial_no", "report_date", "from_location", "to_location",
"fare", "da_hq", "da_ex", "da_out", "postage", "other_expense", "total", "business_achieved",
)
def upgrade() -> None:
op.create_table(
"expense_statement",
sa.Column("id", sa.UUID(), nullable=False),
sa.Column("source_row_number", sa.Integer(), nullable=False),
sa.Column("owner_user_id", sa.UUID(), sa.ForeignKey("user.id", ondelete="SET NULL"), nullable=True),
*(sa.Column(column, sa.Text(), nullable=True) for column in COLUMNS),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("source_row_number", name="uq_expense_statement_source_row"),
)
op.create_index("ix_expense_statement_owner", "expense_statement", ["owner_user_id"])
def downgrade() -> None:
op.drop_index("ix_expense_statement_owner", table_name="expense_statement")
op.drop_table("expense_statement")