Preserve shared budget adapter and limited technical acceptance

This commit is contained in:
2026-10-29 13:25:06 +02:00
parent 3b1689ca0f
commit 57f6b3cc36
11 changed files with 164 additions and 172 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
namespace App\Models;
use App\Models\Concerns\BelongsToTenant;
use Brick\Math\BigDecimal;
use Illuminate\Database\Eloquent\Model;
use Tempo\Finance\Budget\BudgetControl;
/** @property int $id
* @property int $amount_minor
@@ -22,7 +22,7 @@ class Budget extends Model
{
$sum = BudgetReinforcement::query()->where('budget_id', $this->id)->where('status', 'approved')->sum('amount_minor');
return BigDecimal::of((string) $sum)->plus($this->amount_minor)->toInt();
return BudgetControl::approvedTotal((int) $this->amount_minor, (int) $sum);
}
protected static function booted(): void