Hoan thien core finance v2 - Calculation Pipeline, Form Templates

This commit is contained in:
2026-04-28 03:57:18 +00:00
parent 002c9a8b99
commit 49aa20a634
24 changed files with 1043 additions and 875 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Services\Calculation;
enum RoundingRule: string
{
case NONE = 'none'; // Không làm tròn
case UNIT = 'unit'; // Làm tròn đến đồng (số nguyên)
case THOUSAND = 'thousand'; // Làm tròn đến nghìn
case MILLION = 'million'; // Làm tròn đến triệu
public function apply(float $value): int
{
return match ($this) {
self::NONE => (int) $value,
self::UNIT => (int) round($value),
self::THOUSAND => (int) (round($value / 1000) * 1000),
self::MILLION => (int) (round($value / 1000000) * 1000000),
};
}
}