Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 3, 18:15 UTC
feat(trace): expose source Excel rows, account codes and mapping IDs for each statement note
davoodmehraban89 committed
Nov 1, 2026 at 00:05 UTC
fa81de3a6971b283863dabe686b51ea7f203998d
1 file changed
+36
backend/src/aram_backend/desktop_five_statement_details.py
+36
@@ -245,6 +245,42 @@ def build_preview_details(
245
movement=account.debit_net_movement, closing=account.closing,
246
state=state,
247
))
248
+ # One explicit source-account->note mapping row, not an inferred
249
+ # presentation amount. The source closing exposure is shown in the
250
+ # "source" column only. An included workbook mapping is not a trusted
251
+ # accounting approval.
252
+ statement_names = {
253
+ "BS": "ترازنامه",
254
+ "IS": "سود و زیان",
255
+ "EQ": "تغییرات حقوق مالکانه",
256
+ "CF": "جریان وجوه نقد",
257
+ }
258
+ for mapping in result.mapping_coverage.mappings:
259
+ statement = statement_names.get(mapping.target_statement)
260
+ if statement is None:
261
+ raise CoverageError("DESKTOP_DETAIL_MAPPING_STATEMENT_INVALID")
262
+ rows.append(_row(
263
+ statement,
264
+ f"حساب {mapping.account_code} / {mapping.account_name}",
265
+ _note_reference(
266
+ mapping.target_section, mapping.target_note,
267
+ mapping.target_subnote,
268
+ ),
269
+ (
270
+ f"اکسل {mapping.account_excel_row} / منبع {mapping.source_row}"
271
+ ),
272
+ opening=mapping.closing_exposure,
273
+ trace=(
274
+ f"نگاشت {mapping.mapping_id} / ردیف نگاشت "
275
+ f"{mapping.mapping_excel_row} | "
276
+ "وضعیت بر اساس فایل، فاقد تأیید مستقل"
277
+ ),
278
+ state=(
279
+ state if mapping.included
280
+ else "نگاشت مسدود؛ صرفاً تشخیصی"
281
+ ),
282
+ ))
283
+
284
if len(rows) > MAX_DETAIL_ROWS:
285
raise CoverageError("DESKTOP_DETAIL_ROW_LIMIT_EXCEEDED")
286
return tuple(rows)