mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-05-19 09:48:49 +02:00
Add municipal receipt module and convert navbar to sidebar
All checks were successful
Deploy to VPS / deploy (push) Successful in 58s
All checks were successful
Deploy to VPS / deploy (push) Successful in 58s
- New module: Municipalidad de Belén receipt extraction via pdftotext+regex - Backend: MunicipalReceipt + WaterMeterReading models, upload/list/detail/water-consumption endpoints - Auto-creates budget Transaction on upload (duplicate-safe via reference) - Frontend: ServiciosMunicipales page with summary cards, water consumption bar chart, receipt history, PDF upload - Convert top navbar to left sidebar with section headers (General, Finanzas, Servicios) - Desktop: fixed 220px sidebar, mobile: sheet overlay - Grouped nav: Dashboard | Presupuesto, Salarios, Pensiones, Analytics | Municipalidad Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -358,3 +358,75 @@ class BalanceOverrideRead(SQLModel):
|
||||
month: int
|
||||
override_balance: float
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
# --- Municipal Receipt ---
|
||||
|
||||
|
||||
class MunicipalReceiptBase(SQLModel):
|
||||
receipt_date: date
|
||||
due_date: date
|
||||
period: str # "YYYY-MM"
|
||||
account: str
|
||||
finca: str
|
||||
holder_name: str
|
||||
holder_cedula: str
|
||||
holder_address: str
|
||||
subtotal: float
|
||||
interests: float
|
||||
iva: float
|
||||
total: float
|
||||
raw_charges: list[dict] = Field(
|
||||
default_factory=list,
|
||||
sa_column=Column(JSON, nullable=False, server_default="[]"),
|
||||
)
|
||||
source_filename: str
|
||||
|
||||
|
||||
class MunicipalReceipt(MunicipalReceiptBase, table=True):
|
||||
__table_args__ = (UniqueConstraint("account", "period"),)
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
created_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
water_readings: list["WaterMeterReading"] = Relationship(
|
||||
back_populates="receipt",
|
||||
)
|
||||
|
||||
|
||||
class MunicipalReceiptCreate(MunicipalReceiptBase):
|
||||
pass
|
||||
|
||||
|
||||
class MunicipalReceiptRead(MunicipalReceiptBase):
|
||||
id: int
|
||||
created_at: datetime
|
||||
|
||||
|
||||
# --- Water Meter Reading ---
|
||||
|
||||
|
||||
class WaterMeterReadingBase(SQLModel):
|
||||
meter_id: str
|
||||
period: str # "YYYY-MM"
|
||||
reading_previous: float = 0
|
||||
reading_current: float = 0
|
||||
consumption_m3: float
|
||||
agua_potable: float = 0
|
||||
serv_ambientales: float = 0
|
||||
alcant_sanitario: float = 0
|
||||
iva: float = 0
|
||||
is_historical: bool = False
|
||||
receipt_id: Optional[int] = Field(default=None, foreign_key="municipalreceipt.id")
|
||||
|
||||
|
||||
class WaterMeterReading(WaterMeterReadingBase, table=True):
|
||||
__table_args__ = (UniqueConstraint("meter_id", "period", "is_historical"),)
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
created_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
receipt: Optional[MunicipalReceipt] = Relationship(
|
||||
back_populates="water_readings",
|
||||
)
|
||||
|
||||
|
||||
class WaterMeterReadingRead(WaterMeterReadingBase):
|
||||
id: int
|
||||
created_at: datetime
|
||||
|
||||
Reference in New Issue
Block a user