From 8f9a00f319a0a785ee3b1cdf945e1078866312b7 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sat, 5 Sep 2026 11:27:42 +0330 Subject: [PATCH] Fix asnad via root POST like Hamkar; show accounting code label. Co-authored-by: Cursor --- .../integrations/tahesab/documents.service.ts | 4 +- .../integrations/tahesab/tahesab-methods.ts | 40 ++++++++++++++----- apps/web/src/views/PersonProfileView.vue | 18 ++++----- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/apps/api/src/integrations/tahesab/documents.service.ts b/apps/api/src/integrations/tahesab/documents.service.ts index 8651f78..9c29ca2 100644 --- a/apps/api/src/integrations/tahesab/documents.service.ts +++ b/apps/api/src/integrations/tahesab/documents.service.ts @@ -84,9 +84,9 @@ export class TahesabDocumentsService { ); const link = await this.requireLink(organizationId, personId, resolvedId); const { api } = await this.connections.getApi(organizationId, resolvedId); - // Count_Last = -1 مثل همکار (مانده ردیف‌به‌ردیف / همه در بازه) + // Count_Last مثل تست‌های همکار (۲۰۰) — مقدار ۱- گاهی سمت ته‌حساب خطا/۵۰۲ می‌دهد const raw = await api.doListAsnad( - -1, + 200, link.moshtariCode, fromNorm, toNorm, diff --git a/apps/api/src/integrations/tahesab/tahesab-methods.ts b/apps/api/src/integrations/tahesab/tahesab-methods.ts index 8a89629..c72db02 100644 --- a/apps/api/src/integrations/tahesab/tahesab-methods.ts +++ b/apps/api/src/integrations/tahesab/tahesab-methods.ts @@ -224,15 +224,37 @@ export class TahesabApi { fromShamsi: string, toShamsi: string, ) { - // مثل همکار: فقط ۴ پارامتر (Count_Last, Code, از, تا) — پارامتر اضافه باعث خطای ته‌حساب می‌شود - return this.call( - 'DoListAsnad', - 'DoListAsnad', - [countLast, moshtariCode, fromShamsi, toShamsi], - 'POST', - 55_000, - { emptyResultOnError: /رکوردی یافت نشد/i }, - ); + // همکار: POST به baseUrl بدون path، با کلید body = DoListAsnad و ۴ آرگومان + const args = [countLast, moshtariCode, fromShamsi, toShamsi]; + const empty = { emptyResultOnError: /رکوردی یافت نشد/i }; + const timeoutMs = 55_000; + const rootCall = () => + this.http.call({ + ...this.creds, + path: '', + bodyKey: 'DoListAsnad', + args, + method: 'POST' as const, + timeoutMs, + ...empty, + }); + const pathCall = () => + this.http.call({ + ...this.creds, + path: 'DoListAsnad', + bodyKey: 'DoListAsnad', + args, + method: 'POST' as const, + timeoutMs, + ...empty, + }); + return rootCall().catch(async (err) => { + try { + return await pathCall(); + } catch { + throw err; + } + }); } doListNameSekeh() { diff --git a/apps/web/src/views/PersonProfileView.vue b/apps/web/src/views/PersonProfileView.vue index 7468921..5bac745 100644 --- a/apps/web/src/views/PersonProfileView.vue +++ b/apps/web/src/views/PersonProfileView.vue @@ -584,9 +584,9 @@ watch(() => route.query.tab, readTab, { immediate: true });

{{ fullName }} - {{ - tahesabMoshtariCode - }} + کد حسابداری {{ toFaDigits(String(tahesabMoshtariCode)) }} VIP

{{ subtitle }}

@@ -622,9 +622,9 @@ watch(() => route.query.tab, readTab, { immediate: true });

{{ fullName }} - {{ - tahesabMoshtariCode - }} + کد حسابداری {{ toFaDigits(String(tahesabMoshtariCode)) }}

{{ subtitle }}

@@ -1096,13 +1096,13 @@ watch(() => route.query.tab, readTab, { immediate: true }); } .tahesab-code { - font-size: 0.85rem; + font-size: 0.78rem; font-weight: 700; color: #0f766e; background: color-mix(in srgb, #0f766e 12%, transparent); border-radius: 8px; - padding: 0.1rem 0.45rem; - letter-spacing: 0.02em; + padding: 0.12rem 0.5rem; + letter-spacing: 0; } .sub {