Commit 67d7a31c authored by DevPilot's avatar DevPilot

fix(accounting): إلغاء رسم المقاصة يرجع للرسم المعتمد للفرع لو المبلغ مش متسجّل على الشيك

parent 72b1eb8f
...@@ -85,6 +85,23 @@ final class ChequeClearingFeeService ...@@ -85,6 +85,23 @@ final class ChequeClearingFeeService
} }
$fee = self::money((string) ($chq['clearing_fee_amount'] ?? '0')); $fee = self::money((string) ($chq['clearing_fee_amount'] ?? '0'));
// شيكات قديمة اتعلّم عليها إنها محمّلة من غير ما يتسجّل المبلغ.
// في الحالة دي بنرجع للرسم المعتمد لفرع الخطة، وإلا الإلغاء
// هيعدّي من غير ما يعمل حاجة وإحنا فاكرينه اشتغل.
if (bccomp($fee, '0.01', self::SCALE) < 0) {
$branch = $db->selectOne(
"SELECT m.branch_id FROM installment_plans ip
LEFT JOIN members m ON m.id = ip.member_id
WHERE ip.id = ?",
[(int) $chq['installment_plan_id']]
);
$fee = BranchFeeService::amount(
'cheque_clearing_fee',
!empty($branch['branch_id']) ? (int) $branch['branch_id'] : null
);
}
if (bccomp($fee, '0.01', self::SCALE) < 0) { if (bccomp($fee, '0.01', self::SCALE) < 0) {
return ['reversed' => false, 'amount' => '0.00', 'error' => null]; return ['reversed' => false, 'amount' => '0.00', 'error' => null];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment