فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
A05: verify cheque clearing offset, payment method and business date in read-only reconciliation
davoodmehraban89 committed
Oct 23, 2026 at 14:45 UTC
ee58e578b516f65ebb3a446961e344ed135b1561
1 file changed
+26
src/core/ReconciliationCore.mjs
+26
@@ -181,6 +181,32 @@ export function reconcileFinancialData({
181
report('CHEQUE_CLEARING_LEDGER_MISMATCH',
182
'سطر بانک سند وصول با حساب انتخابشده و مبلغ چک تطبیق ندارد', cheque.id);
183
}
184
+ // Complete the two-leg accounting proof for new explicitly
185
+ // bank-selected clearances; a balanced journal alone cannot prove
186
+ // the cheque asset/liability was cleared for the correct drawer.
187
+ const expectedChequeCode = cheque.direction === 'inbound' ? '105' : '203';
188
+ const hasChequeOffset = statusLines.some(line =>
189
+ chart.get(line.accountId)?.code === expectedChequeCode &&
190
+ line.contactId === cheque.contactId &&
191
+ line.debit === (cheque.direction === 'outbound' ? cheque.amount : 0) &&
192
+ line.credit === (cheque.direction === 'inbound' ? cheque.amount : 0));
193
+ if (statusLines.length !== 2 || !hasChequeOffset) {
194
+ report('CHEQUE_CLEARING_OFFSET_MISMATCH',
195
+ 'طرف مقابل سند وصول با حساب اسناد و صادرکننده چک تطبیق ندارد', cheque.id);
196
+ }
197
+ for (const transaction of money) {
198
+ if (transaction.method !== 'cheque' ||
199
+ (cheque.direction === 'inbound' && transaction.fromAccountId != null) ||
200
+ (cheque.direction === 'outbound' && transaction.toAccountId != null)) {
201
+ report('CHEQUE_CLEARING_METHOD_MISMATCH',
202
+ 'روش یا جهت حساب مقابل تراکنش وصول چک نامعتبر است', cheque.id);
203
+ }
204
+ if (cheque.statusBusinessDate && (transaction.date !== cheque.statusBusinessDate ||
205
+ final?.date !== cheque.statusBusinessDate)) {
206
+ report('CHEQUE_CLEARING_DATE_MISMATCH',
207
+ 'تاریخ تراکنش یا سند وصول با تاریخ تأییدشده رویداد مالی یکسان نیست', cheque.id);
208
+ }
209
+ }
210
}
211
} else if (money.length) {
212
report('NONCLEARED_CHEQUE_HAS_CASH', 'چک وصولنشده دارای دریافت یا پرداخت خزانه است', cheque.id);