add spatial plannings retribution calculations
This commit is contained in:
@@ -12,19 +12,23 @@ class BuildingFunctionParameter extends Model
|
||||
'fungsi_bangunan',
|
||||
'ip_permanen',
|
||||
'ip_kompleksitas',
|
||||
'ip_ketinggian',
|
||||
'indeks_lokalitas',
|
||||
'is_active',
|
||||
'notes'
|
||||
'asumsi_prasarana',
|
||||
'koefisien_dasar',
|
||||
'faktor_penyesuaian',
|
||||
'custom_parameters',
|
||||
'parameter_notes'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'fungsi_bangunan' => 'decimal:6',
|
||||
'ip_permanen' => 'decimal:6',
|
||||
'ip_kompleksitas' => 'decimal:6',
|
||||
'ip_ketinggian' => 'decimal:6',
|
||||
'indeks_lokalitas' => 'decimal:6',
|
||||
'is_active' => 'boolean'
|
||||
'asumsi_prasarana' => 'decimal:6',
|
||||
'koefisien_dasar' => 'decimal:6',
|
||||
'faktor_penyesuaian' => 'decimal:6',
|
||||
'custom_parameters' => 'array'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -52,8 +56,11 @@ class BuildingFunctionParameter extends Model
|
||||
'fungsi_bangunan' => $this->fungsi_bangunan,
|
||||
'ip_permanen' => $this->ip_permanen,
|
||||
'ip_kompleksitas' => $this->ip_kompleksitas,
|
||||
'ip_ketinggian' => $this->ip_ketinggian,
|
||||
'indeks_lokalitas' => $this->indeks_lokalitas
|
||||
'indeks_lokalitas' => $this->indeks_lokalitas,
|
||||
'asumsi_prasarana' => $this->asumsi_prasarana,
|
||||
'koefisien_dasar' => $this->koefisien_dasar,
|
||||
'faktor_penyesuaian' => $this->faktor_penyesuaian,
|
||||
'custom_parameters' => $this->custom_parameters
|
||||
];
|
||||
}
|
||||
|
||||
@@ -66,8 +73,62 @@ class BuildingFunctionParameter extends Model
|
||||
'Fungsi Bangunan' => $this->fungsi_bangunan,
|
||||
'IP Permanen' => $this->ip_permanen,
|
||||
'IP Kompleksitas' => $this->ip_kompleksitas,
|
||||
'IP Ketinggian' => $this->ip_ketinggian,
|
||||
'Indeks Lokalitas' => $this->indeks_lokalitas . '%'
|
||||
'Indeks Lokalitas' => $this->indeks_lokalitas,
|
||||
'Asumsi Prasarana' => $this->asumsi_prasarana,
|
||||
'Koefisien Dasar' => $this->koefisien_dasar,
|
||||
'Faktor Penyesuaian' => $this->faktor_penyesuaian
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate floor result using the main formula
|
||||
*/
|
||||
public function calculateFloorResult(float $ipKetinggian): float
|
||||
{
|
||||
return $this->fungsi_bangunan * (
|
||||
$this->ip_permanen +
|
||||
$this->ip_kompleksitas +
|
||||
(0.5 * $ipKetinggian)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate full retribution for given building area and floor result
|
||||
*/
|
||||
public function calculateRetribution(float $luasBangunan, float $floorResult): float
|
||||
{
|
||||
$baseValue = 70350; // Base retribution value
|
||||
$mainCalculation = 1 * $luasBangunan * ($this->indeks_lokalitas * $baseValue * $floorResult * 1);
|
||||
$additionalCalculation = 0.5 * $mainCalculation;
|
||||
|
||||
return $mainCalculation + $additionalCalculation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply custom parameters if available
|
||||
*/
|
||||
public function getParameterValue(string $key, $default = null)
|
||||
{
|
||||
// First check if it's a standard parameter
|
||||
if (property_exists($this, $key) && $this->$key !== null) {
|
||||
return $this->$key;
|
||||
}
|
||||
|
||||
// Then check custom parameters
|
||||
if ($this->custom_parameters && is_array($this->custom_parameters)) {
|
||||
return $this->custom_parameters[$key] ?? $default;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom parameter
|
||||
*/
|
||||
public function setCustomParameter(string $key, $value): void
|
||||
{
|
||||
$customParams = $this->custom_parameters ?? [];
|
||||
$customParams[$key] = $value;
|
||||
$this->custom_parameters = $customParams;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user