prepare(" UPDATE fuel_vouchers SET status = 'cancelled' WHERE driver_id = ? AND status = 'issued' "); $st->execute([$driverId]); if ($st->rowCount() === 0) { jsonError('لا توجد قسيمة قابلة للإلغاء'); } $obligation = fuelObligation($con, $driverId); $state = $obligation ? fuelCreditState($con, $obligation) : null; jsonSuccess([ 'cancelled' => true, 'available' => $state['available'] ?? null, ], 'أُلغيت القسيمة وعاد المبلغ إلى سقفك');