НДС в DI2: дефолтный период — вся история витрины, KPI «К уплате» — за квартал

- summary: без фильтров дат период = весь доступный диапазон nds_monthly (с 2025-01)
- «К уплате» теперь всегда квартальный: квартал выбранного периода, если он внутри одного
  квартала, иначе квартал последнего месяца в данных (НДС не копится между кварталами)
- карточки KPI: «Начислено»/«Вычет» за период с подписью, «К уплате» с меткой квартала
This commit is contained in:
2026-09-29 09:15:43 +03:00
parent de9bbfe17a
commit b9ef0b2152
2 changed files with 55 additions and 16 deletions

View File

@@ -645,7 +645,8 @@ function VatTab({ data, quarters, balance, sync, markers }: { data: any; quarter
const salesByRate = (data.byRate ?? []).filter((r: any) => r.direction === "sales");
const purchasesByRate = (data.byRate ?? []).filter((r: any) => r.direction === "purchases");
const totals = data.totals ?? { accrued: 0, deducted: 0, toPay: 0 };
const totals = data.totals ?? { accrued: 0, deducted: 0 };
const quarter = data.currentQuarter ?? null;
const redRows: any[] = markers?.rows ?? [];
const markerCounts: any[] = markers?.byMarker ?? [];
@@ -661,6 +662,7 @@ function VatTab({ data, quarters, balance, sync, markers }: { data: any; quarter
<span className="text-sm text-muted-foreground">Начислено</span>
</div>
<p className="text-xl font-bold text-foreground tabular-nums" data-testid="text-income-vat">{formatCurrency(totals.accrued)}</p>
<p className="text-xs text-muted-foreground mt-0.5">за период{data.dateFrom && data.dateTo ? ` ${data.dateFrom} — ${data.dateTo}` : ""}</p>
</CardContent>
</Card>
<Card>
@@ -672,6 +674,7 @@ function VatTab({ data, quarters, balance, sync, markers }: { data: any; quarter
<span className="text-sm text-muted-foreground">Вычет</span>
</div>
<p className="text-xl font-bold text-foreground tabular-nums" data-testid="text-expense-vat">{formatCurrency(totals.deducted)}</p>
<p className="text-xs text-muted-foreground mt-0.5">за период</p>
</CardContent>
</Card>
<Card>
@@ -682,8 +685,11 @@ function VatTab({ data, quarters, balance, sync, markers }: { data: any; quarter
</div>
<span className="text-sm text-muted-foreground">К уплате</span>
</div>
<p className={`text-xl font-bold tabular-nums ${totals.toPay >= 0 ? "text-destructive" : "text-success"}`} data-testid="text-vat-to-pay">
{formatCurrency(totals.toPay)}
<p className={`text-xl font-bold tabular-nums ${(quarter?.toPay ?? 0) >= 0 ? "text-destructive" : "text-success"}`} data-testid="text-vat-to-pay">
{formatCurrency(quarter?.toPay ?? 0)}
</p>
<p className="text-xs text-muted-foreground mt-0.5">
{quarter ? `квартал ${formatQuarterLabel(quarter.dateFrom)}` : ""}
</p>
</CardContent>
</Card>