Add TVA balance display to Telegram dashboard with exclusive calculation logic
Implements VAT (TVA) balance tracking for both previous and current month with mutually exclusive calculations (either payable OR recoverable per period). Backend Changes: - Add 4 TVA fields to DashboardSummary model - Implement TVA query from vbal table (accounts 4423, 4424, 4426, 4427) - Add exclusive calculation logic: * Previous month: difference between account 4423 (payable) OR 4424 (recoverable) * Current month: difference 4427-4426 (payable if >0, recoverable if <0) Telegram Bot Changes: - Add compact TVA section to dashboard formatter - Display only when values > 0 - Format: "TVA de plată/recuperat precedent/curent" Example output: **Solduri TVA:** - TVA de plată precedent: 7,284 RON - TVA de recuperat curent: 3,200 RON 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,24 @@ def format_dashboard_response(data: Dict[str, Any], company_name: str = None) ->
|
||||
else:
|
||||
text += f" - Net: {furnizori_sold_net:,} RON"
|
||||
|
||||
# Solduri TVA - rotunjit la leu
|
||||
tva_plata_prec = round(float(data.get('tva_plata_precedent', 0)))
|
||||
tva_recup_prec = round(float(data.get('tva_recuperat_precedent', 0)))
|
||||
tva_plata_cur = round(float(data.get('tva_plata_curent', 0)))
|
||||
tva_recup_cur = round(float(data.get('tva_recuperat_curent', 0)))
|
||||
|
||||
# Afișează secțiunea doar dacă există cel puțin o valoare > 0
|
||||
if tva_plata_prec > 0 or tva_recup_prec > 0 or tva_plata_cur > 0 or tva_recup_cur > 0:
|
||||
text += "\n\n**Solduri TVA:**\n"
|
||||
if tva_plata_prec > 0:
|
||||
text += f" - TVA de plată precedent: {tva_plata_prec:,} RON\n"
|
||||
if tva_recup_prec > 0:
|
||||
text += f" - TVA de recuperat precedent: {tva_recup_prec:,} RON\n"
|
||||
if tva_plata_cur > 0:
|
||||
text += f" - TVA de plată curent: {tva_plata_cur:,} RON\n"
|
||||
if tva_recup_cur > 0:
|
||||
text += f" - TVA de recuperat curent: {tva_recup_cur:,} RON\n"
|
||||
|
||||
return text
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user