After database verification, VBAL is a VIEW (not a table) that exists
in each company schema with a different structure than initially assumed.
Backend Changes:
- Updated models (trial_balance.py):
- Changed column names to match real VBAL VIEW
- CONT (account number)
- DENUMIRE (account description, not DCONT)
- PRECDEB/PRECCRED (previous balance, not SD_PREC/SC_PREC)
- RULDEB/RULCRED (monthly movement, not RD_LUNA/RC_LUNA)
- SOLDDEB/SOLDCRED (final balance, not SD_FINAL/SC_FINAL)
- Made DENUMIRE optional (can be NULL in VIEW)
- Updated router (trial_balance.py):
- Removed COD_FIRMA filter (not in VIEW)
- Query now uses: {schema}.VBAL WHERE AN = :an AND LUNA = :luna
- Fixed column names in SELECT (DENUMIRE instead of DCONT)
- Updated sort columns validation
- Fixed result processing to match new column order
Frontend Changes:
- Updated TrialBalanceView.vue:
- Changed field from 'dcont' to 'denumire' in DataTable column
Database Verification:
- VBAL VIEW confirmed in ROMFAST schema (24,217 records)
- Current data available up to November 2025
- Structure verified with 22 columns
- VIEW exists in all company schemas
Testing Notes:
- Backend endpoint ready for testing
- Frontend field names now match API response
- Ready for manual testing with real company data
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
91 lines
3.5 KiB
Python
91 lines
3.5 KiB
Python
"""
|
|
Pydantic models for Trial Balance (Balanță de Verificare)
|
|
Maps to Oracle VBAL VIEW (exists in each company schema)
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
from typing import Optional, List
|
|
from decimal import Decimal
|
|
|
|
class TrialBalanceItem(BaseModel):
|
|
"""
|
|
Individual trial balance record from VBAL VIEW
|
|
Real structure from Oracle:
|
|
- CONT: account number
|
|
- DENUMIRE: account description
|
|
- PRECDEB/PRECCRED: previous balance debit/credit
|
|
- RULDEB/RULCRED: monthly movement debit/credit
|
|
- SOLDDEB/SOLDCRED: final balance debit/credit
|
|
"""
|
|
cont: str = Field(description="Număr cont contabil (CONT)")
|
|
denumire: Optional[str] = Field(default="", description="Denumire cont (DENUMIRE)")
|
|
sold_precedent_debit: Decimal = Field(description="Sold precedent debit (PRECDEB)", decimal_places=2)
|
|
sold_precedent_credit: Decimal = Field(description="Sold precedent credit (PRECCRED)", decimal_places=2)
|
|
rulaj_lunar_debit: Decimal = Field(description="Rulaj lunar debit (RULDEB)", decimal_places=2)
|
|
rulaj_lunar_credit: Decimal = Field(description="Rulaj lunar credit (RULCRED)", decimal_places=2)
|
|
sold_final_debit: Decimal = Field(description="Sold final debit (SOLDDEB)", decimal_places=2)
|
|
sold_final_credit: Decimal = Field(description="Sold final credit (SOLDCRED)", decimal_places=2)
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class TrialBalanceFilters(BaseModel):
|
|
"""
|
|
Filters applied to trial balance data
|
|
"""
|
|
luna: int = Field(description="Luna (1-12)")
|
|
an: int = Field(description="An")
|
|
cont_filter: Optional[str] = Field(default=None, description="Filtru număr cont (partial match)")
|
|
denumire_filter: Optional[str] = Field(default=None, description="Filtru denumire cont (partial match, case-insensitive)")
|
|
|
|
|
|
class TrialBalancePagination(BaseModel):
|
|
"""
|
|
Pagination metadata
|
|
"""
|
|
total_items: int = Field(description="Total number of items")
|
|
total_pages: int = Field(description="Total number of pages")
|
|
current_page: int = Field(description="Current page number")
|
|
page_size: int = Field(description="Items per page")
|
|
|
|
|
|
class TrialBalanceResponse(BaseModel):
|
|
"""
|
|
Complete response for trial balance endpoint
|
|
"""
|
|
success: bool = Field(default=True, description="Request success status")
|
|
data: dict = Field(description="Trial balance data with items, pagination, and filters")
|
|
|
|
class Config:
|
|
schema_extra = {
|
|
"example": {
|
|
"success": True,
|
|
"data": {
|
|
"items": [
|
|
{
|
|
"cont": "4111",
|
|
"dcont": "Furnizori interni",
|
|
"sold_precedent_debit": 0.00,
|
|
"sold_precedent_credit": 15000.00,
|
|
"rulaj_lunar_debit": 5000.00,
|
|
"rulaj_lunar_credit": 8000.00,
|
|
"sold_final_debit": 0.00,
|
|
"sold_final_credit": 18000.00
|
|
}
|
|
],
|
|
"pagination": {
|
|
"total_items": 150,
|
|
"total_pages": 3,
|
|
"current_page": 1,
|
|
"page_size": 50
|
|
},
|
|
"filters_applied": {
|
|
"luna": 11,
|
|
"an": 2025,
|
|
"cont_filter": None,
|
|
"denumire_filter": "furnizori"
|
|
}
|
|
}
|
|
}
|
|
}
|