سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 17:00 UTC
test: verify cheque settlement counting and document treasury limits
JVK committed
Nov 13, 2026 at 09:21 UTC
a7c912386fe70bc59a514519d29f61ab4be1ff61
5 files changed
+33
-2
PROJECT_STATE.md
+6
@@ -263,3 +263,9 @@ Owner requests layer-by-layer click/functional testing of all controls and compa
263
264
### 2026-11-11 — Contact operational balance repair
265
- Owner reports treasury payments without invoice allocation do not reduce supplier balance. Scoped read-only repair: exact selected company, effective corrected/not-reversed payments, allocated settlements counted once, signed advances, no raw unposted cheque settlement. Use posted trade documents only and explicitly distinguish operational summary from complete ledger/opening balances. No financial source writes or migration. Add baseline failing browser coverage before implementation.
266
+
267
+### 2026-11-13 — Treasury continuation and contact summary candidate
268
+- Root resumed persisted work after specialist execution became unavailable; no independent final-review claim. Payment amount PR198 ce5bf86 exact Quality43086846384/Security43086846388 SUCCESS,242/242 browser and all3DB. Protected merge2e869c1 released through Quality43399412247/Security43399412532,gate43400042808,Pages43400112210 SUCCESS. Public byte readback tracked in PR198. Interrupted local runs were excluded.
269
+- Contact summary reproduced two real failures before implementation, then both directions and real unallocated-payment save/reload PASS. Summary now uses exact active company, posted trade invoices and effective payments once, ignores reversed/corrected ancestors, excludes invalid allocations and unposted cheque payments, retains signed advances and displays reconciliation/opening-balance limitations. Posted cheque settlement rows count once even if the register also lists the instrument. No production rows changed.
270
+- Initial static invariant required a named net expression; retained the expression and updated its description, without weakening financial assertions. A synthetic foreign-company purchase fixture originally shared the first company's voucher; corrected its company-specific voucher instead of accepting the invalid link. Three focused source/Pages cases passed; final expanded assertions/full regression and exact-head CI are separate gates recorded in this PR.
271
+- Cheque registration still has no posting adapter. The existing generic payment profile credits cash even for cheque method; the staged server helper cannot yet accept entity-backed counterparty dimensions. Do not claim that changing the contact display repairs missing journals. Next: authoritative cheque issuance plus linked settlement, lifecycle/duplicate guards, entity-dimension contract and historical reconciliation; no automatic backfill, production migration or G1 approval requested.
docs/TREASURY_REPAIR_2026-11-13.md
new
+16
@@ -0,0 +1,16 @@
1
+# اصلاح خزانهداری — ۱۳ نوامبر ۲۰۲۶
2
+
3
+هدف: مبلغ خوانا، ماندهٔ درست طرف حساب و ثبت یکبارهٔ اثر چک در حسابداری. اطلاعات مشتری در این سند ذخیره نمیشود.
4
+
5
+| موضوع | نتیجه / وضعیت |
6
+|---|---|
7
+| جداکنندهٔ مبلغ دریافت/پرداخت | PR198 منتشر؛ ورود/چسباندن رقم فارسی، عربی و لاتین و ویرایش مبلغ با ذخیرهٔ عددی؛ ۲۴۲ آزمون GitHub موفق |
8
+| پرداخت بدون تخصیص و اختلاط شرکت در مرور حساب | اصلاح کاندیدا؛ بازتولید قبل از اصلاح و آزمون ذخیره/بارگذاری مجدد موفق؛ انتشار مستقل پس از گیتها |
9
+| چک بدون سند | نقص تأیید شد؛ ثبت فعلی سند ایجاد نمیکند؛ اصلاح مانده بهتنهایی این نقص را حل نمیکند |
10
+| پرداخت با روش چک | پروفایل فعلی نقد/بانک است؛ نیازمند اتصال به ابزار پرداخت و قرارداد مستقل حسابداری |
11
+
12
+مرور عملیاتی از فروش/خرید قطعی و دریافت/پرداخت مؤثر شرکت انتخابشده ساخته میشود. تخصیص به فاکتور فقط یک بار محاسبه میشود؛ پرداخت بدون تخصیص نیز مانده را کاهش میدهد. مازاد پرداخت یا دریافت بهصورت پیشپرداخت/پیشدریافت حفظ میشود. چک خام، تخصیص ناسازگار و پرداخت چکی بدون سند حسابداری، تسویه فرض نمیشوند. ثبتهای قدیمی نیازمند تطبیق با هشدار مشخصاند. این مرور جایگزین دفتر کل شامل افتتاحیه و اسناد دستی نیست.
13
+
14
+کار بعدی برای چک: ثبت صدور باید پرداختنی تجاری را بدهکار و اسناد پرداختنی را بستانکار کند؛ بانک در صدور تغییر نمیکند. پرداخت واقعی بانک در رویداد وصول ثبت میشود. ابطال یا برگشت رویداد مستقل و قابلردیابی لازم دارد. شناسهٔ چک، پرداخت مرتبط و سند باید در یک تراکنش ساخته شوند؛ تکرار درخواست یا نمایش در دو فرم نباید اثر مالی دوم بسازد. اتصال سوابق قدیمی صرفاً بر اساس مبلغ یا نام شخص مجاز نیست.
15
+
16
+پیشنیازهای باز: قرارداد تفصیلی اشخاص سمت سرور، مجوز و جداسازی شرکت، کنترل تکرار در دو نشست، نتیجهٔ نامطمئن شبکه، حفاظت از سند قطعی، آزمون برگشت/نصب مجدد و بستهٔ G1. هنوز هیچ migration یا سابقهٔ مالی عملیاتی تغییر نکرده است.
js/drilldown.js
+2
-1
@@ -44,7 +44,8 @@ function contactOperationalSummary(contactId){
44
const payable=gross(postedPurchases)-payments.filter(r=>r.direction==='outbound').reduce((n,r)=>n+amount(r),0);
45
const unpostedCheques=cheques.filter(r=>!['bounced','cancelled'].includes(r.status)&&
46
!(r.journalVoucherId&&jeSourceVoucher(r)?.status==='posted')).length;
47
- return {sales:postedSales,purchases:postedPurchases,payments,cheques,receivable,payable,net:receivable-payable,review,unpostedCheques};
47
+ const net=receivable-payable;
48
+ return {sales:postedSales,purchases:postedPurchases,payments,cheques,receivable,payable,net,review,unpostedCheques};
49
}
50
function contactSummaryNotice(summary){
51
return '<p class="af-hint">ماندهٔ عملیاتی شرکت انتخابشده؛ شامل فاکتورهای قطعی و دریافت/پرداختها. ماندهٔ افتتاحیه و اسناد دستی را در دفتر حسابداری بررسی کنید.</p>'+
scripts/accounting-document-workflow.spec.js
+8
@@ -747,6 +747,14 @@ for(const direction of ['outbound','inbound'])test('contact operational balance
747
await expect(body.locator('[data-contact-net]')).toHaveAttribute('data-contact-net',direction==='outbound'?'-500':'500');
748
await expect(body).not.toContainText('DRAFT-EXCLUDED');await expect(body).not.toContainText('FOREIGN-EXCLUDED');await expect(body).not.toContainText('PROFORMA-EXCLUDED');
749
expect(await page.evaluate(()=>JSON.stringify([datastore.invoices,datastore.purchases,datastore.payments,datastore.journalVouchers,datastore.cheques])===window.__contactBefore)).toBe(true);
750
+ await page.evaluate(({direction,USER})=>{
751
+ datastore.journalVouchers.push({id:'J_CHEQUE',ownerUserId:USER,companyId:'QA_CO',status:'posted'});
752
+ const scope={ownerUserId:USER,companyId:'QA_CO',contactId:'QA_CONTACT',direction,amount:100,journalVoucherId:'J_CHEQUE'};
753
+ datastore.payments.push({...scope,id:'PAY_CHEQUE',method:'cheque'});
754
+ datastore.cheques.push({...scope,id:'REGISTER_CHEQUE',status:'registered'});
755
+ renderContacts();openContactLedger('QA_CONTACT');
756
+ },{direction,USER});
757
+ await expect(body.locator('[data-contact-net]')).toHaveAttribute('data-contact-net',direction==='outbound'?'-400':'400');
758
await page.evaluate(()=>{closeFinoraDrill();getMySettings().default_company_id='QA_OTHER';renderContacts();openContactLedger('QA_CONTACT')});
759
await expect(body.locator('[data-contact-net]')).toHaveAttribute('data-contact-net',direction==='outbound'?'1000':'-1000');
760
await expect(body).toContainText(direction==='outbound'?'پیشپرداخت':'پیشدریافت');
scripts/quality-check.mjs
+1
-1
@@ -58,7 +58,7 @@ const securityWorkflow=fs.readFileSync(path.join(root,'.github','workflows','sec
58
for(const needle of ['github/codeql-action/init@v3','github/codeql-action/analyze@v3','actions/dependency-review-action@v4'])if(!securityWorkflow.includes(needle))throw new Error('Security workflow missing '+needle);
59
console.log('Static quality and security invariants passed for '+files.length+' JavaScript modules.');
60
if(all['invoices.js']?.includes('inboundSettlements'))throw new Error('Dashboard must not double count cheque settlements');
61
-if(!all['drilldown.js']?.includes('const net=receivable-payable'))throw new Error('Contact ledger must use allocated invoice balances');
61
+if(!all['drilldown.js']?.includes('const net=receivable-payable'))throw new Error('Contact operational summary must net scoped receivables and payables');
62
63
for(const view of ['view-journal','view-accounting-foundation','view-dashboard','view-invoices','view-purchases','view-payments','view-cheques','view-expenses','view-contacts','view-products','view-reports','view-settings'])
64
if(!all['ui.js'].includes("'"+view+"'"))throw new Error('Shell canonical view mapping missing '+view);