import React from 'react'; import { ResidentReportContent } from '../../types'; import { Download, Printer } from 'lucide-react'; interface ResidentReportViewProps { content: ResidentReportContent; buildingAddress?: string; period?: string; } export const ResidentReportView: React.FC = ({ content, buildingAddress, period }) => { const formatCurrency = (amount: number) => { return new Intl.NumberFormat('ru-RU', { style: 'currency', currency: 'RUB', minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(amount); }; const formatNumber = (num: number) => { return new Intl.NumberFormat('ru-RU', { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(num); }; const handleDownloadCSV = () => { // TODO: Реализовать экспорт в CSV alert('Экспорт в CSV будет реализован'); }; const handlePrint = () => { window.print(); }; return (
{/* Кнопки действий */}
{/* Параметры */} {content.parameters && (

Параметры:

Период: {content.parameters.periodStart && content.parameters.periodEnd ? `${new Date(content.parameters.periodStart).toLocaleDateString('ru-RU', { day: '2-digit', month: '2-digit', year: 'numeric' })} - ${new Date(content.parameters.periodEnd).toLocaleDateString('ru-RU', { day: '2-digit', month: '2-digit', year: 'numeric' })}` : period || 'Не указан'}

Начало периода:

Конец периода:

Дом: {content.parameters.building || buildingAddress || 'Не указан'}

{content.parameters.residentialArea && (

Ж (кв.м)

{formatNumber(content.parameters.residentialArea)}

)} {content.parameters.nonResidentialArea && (

НЖ (кв.м) в т.ч.:

{formatNumber(content.parameters.nonResidentialArea)}

)} {content.parameters.parkingArea && (

Парковка

{formatNumber(content.parameters.parkingArea)}

)} {content.parameters.totalArea && (

Итого (кв.м)

{formatNumber(content.parameters.totalArea)}

)}
{content.tariffs && (

Тариф

{formatNumber(content.tariffs.tariff)}

Резервный фонд

{formatNumber(content.tariffs.reserveFund)}

)}
)} {/* Тарифы */} {content.tariffs && (

Тариф

{formatNumber(content.tariffs.tariff)}

Резервный фонд

{formatNumber(content.tariffs.reserveFund)}

)} {/* Услуги */} {content.services && content.services.length > 0 && (

Услуги

{content.services .sort((a, b) => a.order - b.order) .map((service, index) => ( ))}
Услуга Долг Начислено Оплачено % от плана Порядок
{service.name} {formatCurrency(service.debt)} {formatCurrency(service.accrued)} {formatCurrency(service.paid)} {formatNumber(service.percentOfPlan)} {formatNumber(service.order)}
)} {/* Сальдо */} {content.balance && (

Сальдо

{content.balance.reserveFundFromAccrued !== undefined && ( )} {content.balance.reserveFundFromReceived !== undefined && ( )}
Сальдо Сумма
Исходя из начисленных {formatCurrency(content.balance.fromAccrued || 0)}
Исходя из поступивших средств {formatCurrency(content.balance.fromReceived || 0)}
Сальдо Резервного фонда на начало периода исходя из Начисленых средств {formatCurrency(content.balance.reserveFundFromAccrued)}
Сальдо Резервного фонда на начало периода исходя из Поступивших средств {formatCurrency(content.balance.reserveFundFromReceived)}
)} {/* Статьи затрат */} {content.expenseItems && content.expenseItems.length > 0 && (

Статьи затрат

{content.expenseItems.map((item, index) => ( {item.children && item.children.map((child, childIndex) => ( {child.children && child.children.map((grandchild, grandchildIndex) => ( ))} ))} ))}
№ п/п Статья затрат В месяц Сумма руб/кв.м в месяц
{item.number} {item.name} {formatCurrency(item.perMonth)} {formatCurrency(item.total)} {formatNumber(item.perSquareMeter)}
{child.number} {child.name} {formatCurrency(child.perMonth)} {formatCurrency(child.total)} {formatNumber(child.perSquareMeter)}
{grandchild.number} {grandchild.name} {formatCurrency(grandchild.perMonth)} {formatCurrency(grandchild.total)} {formatNumber(grandchild.perSquareMeter)}
)} {/* Итоги */} {content.totals && (

Итоги

{content.totals.recalculation > 0 && ( )} {content.totals.otherIncome > 0 && (() => { const periodMonths = content.parameters?.totalArea ? (new Date(content.parameters.periodEnd).getTime() - new Date(content.parameters.periodStart).getTime()) / (1000 * 60 * 60 * 24 * 30) : 1; const otherIncomePerM2 = content.parameters?.totalArea ? content.totals.otherIncome / (content.parameters.totalArea * periodMonths) : 0; return ( ); })()}
Итого {formatCurrency(content.totals.totalExpenses / (content.parameters?.totalArea ? (new Date(content.parameters.periodEnd).getTime() - new Date(content.parameters.periodStart).getTime()) / (1000 * 60 * 60 * 24 * 30) : 1))} {formatCurrency(content.totals.totalExpenses)} {formatNumber(content.parameters?.totalArea ? (content.totals.totalExpenses / (content.parameters.totalArea * ((new Date(content.parameters.periodEnd).getTime() - new Date(content.parameters.periodStart).getTime()) / (1000 * 60 * 60 * 24 * 30)))) : 0)}
НДС {formatCurrency(content.totals.vat)}
Перерасчет (механизированная уборка, резервный фонд) {formatCurrency(content.totals.recalculation)}
Итого расходов с учетом перерасчета (без НДС) {formatCurrency(content.totals.totalWithRecalculation)}
Итого расходов с учетом перерасчета {formatCurrency(content.totals.totalWithRecalculationWithVAT / (content.parameters?.totalArea ? (new Date(content.parameters.periodEnd).getTime() - new Date(content.parameters.periodStart).getTime()) / (1000 * 60 * 60 * 24 * 30) : 1))} {formatCurrency(content.totals.totalWithRecalculationWithVAT)}
Возврат долга {content.totals.debtReturn > 0 ? formatCurrency(content.totals.debtReturn) : ''}
Итого тариф {formatCurrency(content.totals.totalTariff / (content.parameters?.totalArea ? (new Date(content.parameters.periodEnd).getTime() - new Date(content.parameters.periodStart).getTime()) / (1000 * 60 * 60 * 24 * 30) : 1))} {formatCurrency(content.totals.totalTariff)} {formatNumber(content.parameters?.totalArea ? (content.totals.totalTariff / (content.parameters.totalArea * ((new Date(content.parameters.periodEnd).getTime() - new Date(content.parameters.periodStart).getTime()) / (1000 * 60 * 60 * 24 * 30)))) : 0)}
Прочие доходы {formatCurrency(content.totals.otherIncome / periodMonths)} {formatCurrency(content.totals.otherIncome)} {formatNumber(otherIncomePerM2)}
)} {/* Финансовые результаты */} {content.financialResults && (

Финансовый результат

Финансовый результат по содержанию
исходя из начисленых {formatCurrency(content.financialResults.maintenanceFromAccrued || 0)} {formatNumber(content.parameters?.totalArea ? ((content.financialResults.maintenanceFromAccrued || 0) / content.parameters.totalArea) : 0)}
исходя из поступивших средств {formatCurrency(content.financialResults.maintenanceFromReceived || 0)} {formatNumber(content.parameters?.totalArea ? ((content.financialResults.maintenanceFromReceived || 0) / content.parameters.totalArea) : 0)}
Финансовый результат по резервному фонду
исходя из начисленых {formatCurrency(content.financialResults.reserveFundFromAccrued || 0)} {formatNumber(content.parameters?.totalArea ? ((content.financialResults.reserveFundFromAccrued || 0) / content.parameters.totalArea) : 0)}
исходя из поступивших средств {formatCurrency(content.financialResults.reserveFundFromReceived || 0)} {formatNumber(content.parameters?.totalArea ? ((content.financialResults.reserveFundFromReceived || 0) / content.parameters.totalArea) : 0)}
)} {/* Подпись директора */}

Директор

_________________

); };