Уточнить ответ о заработке через учетный финрезультат
This commit is contained in:
@@ -1032,6 +1032,10 @@ function buildCompactBusinessOverviewReply(
|
||||
const cashflowPolarityRequested = compactCashflowRequested && requestsCashflowPolarityAnswer(turnMeaning, graph);
|
||||
const directAccountingProfitRequested = requestsDirectAccountingProfitAnswer(turnMeaning, graph);
|
||||
const rawMessage = toNonEmptyString(turnMeaning?.raw_message) ?? toNonEmptyString(turnMeaning?.effective_message);
|
||||
const earningsAmountRequested = /(?:\u0437\u0430\u0440\u0430\u0431\u043e\u0442|\u0434\u043e\u0445\u043e\u0434\p{L}*)/iu.test(
|
||||
normalizeQuestionText(rawMessage ?? "")
|
||||
);
|
||||
const accountingFinancialResultForEarnings = toRecordObject(overview.accounting_financial_result);
|
||||
const rawMessageComparable = compactComparable(rawMessage);
|
||||
const organizationScopeComparable = compactComparable(organizationScope);
|
||||
const plainOrganizationClarificationSelection = Boolean(
|
||||
@@ -1045,6 +1049,47 @@ function buildCompactBusinessOverviewReply(
|
||||
!/(?:сравн|подтвержд|деньг|сколько|что\s+|покаж|дай|вывод|нельзя|клиент|поставщик|\?)/iu.test(rawMessage)
|
||||
);
|
||||
|
||||
if (
|
||||
compactCashflowRequested &&
|
||||
!rankingNeed &&
|
||||
!profitMarginBoundary &&
|
||||
!cashflowPolarityRequested &&
|
||||
earningsAmountRequested &&
|
||||
accountingFinancialResultForEarnings
|
||||
) {
|
||||
const direction = toNonEmptyString(accountingFinancialResultForEarnings.final_result_direction);
|
||||
const amount = moneyText(accountingFinancialResultForEarnings.final_result_amount_human_ru);
|
||||
const periodScope = toNonEmptyString(accountingFinancialResultForEarnings.period_scope) ?? period;
|
||||
const marginPct =
|
||||
typeof accountingFinancialResultForEarnings.net_margin_to_revenue_pct === "number" &&
|
||||
Number.isFinite(accountingFinancialResultForEarnings.net_margin_to_revenue_pct)
|
||||
? `${accountingFinancialResultForEarnings.net_margin_to_revenue_pct}%`
|
||||
: null;
|
||||
const directionText =
|
||||
direction === "profit"
|
||||
? "\u0443\u0447\u0435\u0442\u043d\u0430\u044f \u043f\u0440\u0438\u0431\u044b\u043b\u044c"
|
||||
: direction === "loss"
|
||||
? "\u0443\u0447\u0435\u0442\u043d\u044b\u0439 \u0443\u0431\u044b\u0442\u043e\u043a"
|
||||
: "\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u044b\u0439 \u0444\u0438\u043d\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442";
|
||||
const amountText = amount
|
||||
? direction === "loss"
|
||||
? `\u043c\u0438\u043d\u0443\u0441 ${amount}`
|
||||
: amount
|
||||
: "\u0441\u0443\u043c\u043c\u0430 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u0430";
|
||||
lines.push(
|
||||
`${organizationPrefix}\u0437\u0430 ${periodScope} \u043f\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044e \u0441\u0447\u0435\u0442\u043e\u0432 90/91/99 \u0432 1\u0421 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0430 ${directionText}: ${amountText}${marginPct ? `; \u043c\u0430\u0440\u0436\u0430 \u043a \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0440\u0443\u0447\u043a\u0435 ${marginPct}` : ""}.`
|
||||
);
|
||||
if (incomingAmount || outgoingAmount || netAmount) {
|
||||
lines.push(
|
||||
`\u0414\u043b\u044f \u0441\u0432\u0435\u0440\u043a\u0438 \u043f\u043e \u0434\u0435\u043d\u044c\u0433\u0430\u043c: \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 ${incomingAmount ?? "0 \u0440\u0443\u0431."}; \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u043b\u0438/\u0441\u043f\u0438\u0441\u0430\u043b\u0438 ${outgoingAmount ?? "0 \u0440\u0443\u0431."}; \u0434\u0435\u043d\u0435\u0436\u043d\u043e\u0435 \u043d\u0435\u0442\u0442\u043e ${sentenceAmount(netAmount) ?? netAmount ?? "0 \u0440\u0443\u0431."}.`
|
||||
);
|
||||
}
|
||||
lines.push(
|
||||
"\u0412\u0430\u0436\u043d\u043e: \u0443\u0447\u0435\u0442\u043d\u044b\u0439 \u0444\u0438\u043d\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043d\u0435\u0433 - \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438; \u043d\u0435 \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u044e \u0438\u0445 \u0432 \u043e\u0434\u043d\u0443 \"\u043f\u0440\u0438\u0431\u044b\u043b\u044c\"."
|
||||
);
|
||||
return joinBusinessReplyLines(lines);
|
||||
}
|
||||
|
||||
if (compactCashflowRequested && !rankingNeed && (incomingAmount || outgoingAmount || netAmount)) {
|
||||
const netDisplay = sentenceAmount(netAmount) ?? netAmount ?? "0 \u0440\u0443\u0431.";
|
||||
const signedNetDisplay =
|
||||
|
||||
Reference in New Issue
Block a user