create service count floor level and retributions
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('master_parameters', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('parameter_code', 255)->unique()->comment('Kode unik parameter');
|
||||
$table->string('parameter_name', 255)->comment('Nama parameter');
|
||||
$table->decimal('default_value', 15, 6)->default(0.000000)->comment('Nilai default parameter');
|
||||
$table->string('unit', 50)->nullable()->comment('Satuan parameter');
|
||||
$table->text('description')->nullable()->comment('Deskripsi parameter');
|
||||
$table->timestamps();
|
||||
|
||||
// Add indexes for better performance
|
||||
$table->index('parameter_name', 'idx_master_parameters_name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('master_parameters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('master_formulas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('formula_code', 255)->unique()->comment('Kode unik formula');
|
||||
$table->string('formula_name', 255)->comment('Nama formula');
|
||||
$table->text('formula_expression')->comment('Formula matematika');
|
||||
$table->string('formula_category', 255)->nullable()->comment('Kategori formula');
|
||||
$table->text('description')->nullable()->comment('Deskripsi formula');
|
||||
$table->text('usage_notes')->nullable()->comment('Catatan penggunaan');
|
||||
$table->timestamps();
|
||||
|
||||
// Add indexes for better performance
|
||||
$table->index('formula_category', 'idx_master_formulas_category');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('master_formulas');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('formula_parameters', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('formula_id')->constrained('master_formulas')->onDelete('cascade')->comment('ID formula');
|
||||
$table->foreignId('parameter_id')->constrained('master_parameters')->onDelete('cascade')->comment('ID parameter');
|
||||
$table->timestamps();
|
||||
|
||||
// Composite unique constraint to prevent duplicate relations
|
||||
$table->unique(['formula_id', 'parameter_id'], 'unique_formula_parameter');
|
||||
|
||||
// Indexes for better performance
|
||||
$table->index('formula_id', 'idx_formula_parameters_formula');
|
||||
$table->index('parameter_id', 'idx_formula_parameters_parameter');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('formula_parameters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('building_function_formula_configs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('building_function_id')->constrained('building_functions')->onDelete('cascade')->comment('ID fungsi bangunan');
|
||||
$table->foreignId('formula_id')->constrained('master_formulas')->onDelete('cascade')->comment('ID formula yang digunakan');
|
||||
$table->integer('floor_level')->comment('Level lantai (1, 2, 3, dst. 0 untuk semua lantai)');
|
||||
$table->integer('min_floor')->nullable()->comment('Minimum lantai yang berlaku (opsional)');
|
||||
$table->integer('max_floor')->nullable()->comment('Maximum lantai yang berlaku (opsional)');
|
||||
$table->decimal('multiplier', 8, 4)->default(1.0000)->comment('Pengali khusus untuk lantai ini');
|
||||
$table->boolean('is_active')->default(true)->comment('Status aktif konfigurasi');
|
||||
$table->integer('priority')->default(0)->comment('Prioritas jika ada konflik (angka lebih besar = prioritas lebih tinggi)');
|
||||
$table->text('notes')->nullable()->comment('Catatan konfigurasi');
|
||||
$table->timestamps();
|
||||
|
||||
// Composite unique constraint untuk mencegah duplikasi konfigurasi
|
||||
$table->unique(['building_function_id', 'formula_id', 'floor_level'], 'unique_building_formula_floor');
|
||||
|
||||
// Indexes untuk performa
|
||||
$table->index(['building_function_id', 'floor_level'], 'idx_building_floor');
|
||||
$table->index(['building_function_id', 'is_active'], 'idx_building_active');
|
||||
$table->index(['floor_level', 'is_active'], 'idx_floor_active');
|
||||
$table->index('priority', 'idx_priority');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('building_function_formula_configs');
|
||||
}
|
||||
};
|
||||
216
database/seeders/BuildingFunctionFormulaConfigSeeder.php
Normal file
216
database/seeders/BuildingFunctionFormulaConfigSeeder.php
Normal file
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\BuildingFunctionFormulaConfig;
|
||||
use App\Models\BuildingFunction;
|
||||
use App\Models\MasterFormula;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class BuildingFunctionFormulaConfigSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$now = Carbon::now();
|
||||
|
||||
// Mapping Building Function Codes to IDs (sesuai dengan BuildingFunctionSeeder)
|
||||
$buildingFunctionMapping = [
|
||||
'AGAMA' => 1, // Fungsi Keagamaan
|
||||
'SOSIAL_BUDAYA' => 2, // Fungsi Sosial Budaya
|
||||
'CAMPURAN_KECIL' => 6, // Campuran Kecil
|
||||
'CAMPURAN_BESAR' => 7, // Campuran Besar
|
||||
'USAHA_KECIL' => 8, // UMKM
|
||||
'USAHA_BESAR' => 9, // Usaha Besar (Non-Mikro)
|
||||
'HUNIAN_SEDERHANA' => 10, // Hunian Sederhana <100
|
||||
'HUNIAN_TIDAK_SEDERHANA' => 11, // Hunian Tidak Sederhana >100
|
||||
];
|
||||
|
||||
// Get Formula IDs (akan dibuat di MasterFormulaSeeder)
|
||||
$formulaMapping = [
|
||||
'BEBAS' => 'RETRIBUSI_BEBAS',
|
||||
'DASAR' => 'RETRIBUSI_DASAR',
|
||||
'LENGKAP' => 'RETRIBUSI_DENGAN_PRASARANA'
|
||||
];
|
||||
|
||||
// Configurations per Building Function dan Floor Level
|
||||
$configs = [];
|
||||
|
||||
// 1. FUNGSI KEAGAMAAN - Bebas Retribusi (semua lantai)
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['AGAMA'],
|
||||
'formula_code' => 'RETRIBUSI_BEBAS',
|
||||
'floor_level' => 0, // Berlaku untuk semua lantai
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => 'Bangunan keagamaan bebas retribusi untuk semua lantai'
|
||||
];
|
||||
|
||||
// 2. FUNGSI SOSIAL BUDAYA - Formula dengan parameter khusus
|
||||
for ($floor = 1; $floor <= 6; $floor++) {
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['SOSIAL_BUDAYA'],
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'floor_level' => $floor,
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => "Sosial budaya lantai {$floor} - menggunakan parameter khusus sosial budaya"
|
||||
];
|
||||
}
|
||||
|
||||
// 3. CAMPURAN KECIL - Formula per lantai
|
||||
for ($floor = 1; $floor <= 6; $floor++) {
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['CAMPURAN_KECIL'],
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'floor_level' => $floor,
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => "Campuran kecil lantai {$floor} - parameter fungsi 0.6"
|
||||
];
|
||||
}
|
||||
|
||||
// 4. CAMPURAN BESAR - Formula per lantai
|
||||
for ($floor = 1; $floor <= 6; $floor++) {
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['CAMPURAN_BESAR'],
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'floor_level' => $floor,
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => "Campuran besar lantai {$floor} - parameter fungsi 0.8"
|
||||
];
|
||||
}
|
||||
|
||||
// 5. UMKM - Formula per lantai
|
||||
for ($floor = 1; $floor <= 6; $floor++) {
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['USAHA_KECIL'],
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'floor_level' => $floor,
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => "UMKM lantai {$floor} - parameter fungsi 0.5"
|
||||
];
|
||||
}
|
||||
|
||||
// 6. USAHA BESAR - Formula per lantai
|
||||
for ($floor = 1; $floor <= 6; $floor++) {
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['USAHA_BESAR'],
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'floor_level' => $floor,
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => "Usaha besar lantai {$floor} - parameter fungsi 0.7"
|
||||
];
|
||||
}
|
||||
|
||||
// 7. HUNIAN SEDERHANA - Formula khusus dengan IP Kompleksitas 0.3
|
||||
for ($floor = 1; $floor <= 6; $floor++) {
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['HUNIAN_SEDERHANA'],
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'floor_level' => $floor,
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => "Hunian sederhana lantai {$floor} - parameter fungsi 0.15, IP kompleksitas 0.3"
|
||||
];
|
||||
}
|
||||
|
||||
// 8. HUNIAN TIDAK SEDERHANA - Formula standar
|
||||
for ($floor = 1; $floor <= 6; $floor++) {
|
||||
$configs[] = [
|
||||
'building_function_id' => $buildingFunctionMapping['HUNIAN_TIDAK_SEDERHANA'],
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'floor_level' => $floor,
|
||||
'min_floor' => null,
|
||||
'max_floor' => null,
|
||||
'multiplier' => 1.0000,
|
||||
'is_active' => true,
|
||||
'priority' => 1,
|
||||
'notes' => "Hunian tidak sederhana lantai {$floor} - parameter fungsi 0.17"
|
||||
];
|
||||
}
|
||||
|
||||
// Insert configurations
|
||||
foreach ($configs as $config) {
|
||||
// Get formula ID
|
||||
$formula = DB::table('master_formulas')
|
||||
->where('formula_code', $config['formula_code'])
|
||||
->first();
|
||||
|
||||
if ($formula) {
|
||||
DB::table('building_function_formula_configs')->updateOrInsert(
|
||||
[
|
||||
'building_function_id' => $config['building_function_id'],
|
||||
'formula_id' => $formula->id,
|
||||
'floor_level' => $config['floor_level']
|
||||
],
|
||||
[
|
||||
'min_floor' => $config['min_floor'],
|
||||
'max_floor' => $config['max_floor'],
|
||||
'multiplier' => $config['multiplier'],
|
||||
'is_active' => $config['is_active'],
|
||||
'priority' => $config['priority'],
|
||||
'notes' => $config['notes'],
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->command->info('Building Function Formula Configurations seeded successfully!');
|
||||
$this->command->info('=== CONFIGURATION SUMMARY ===');
|
||||
$this->command->info('Total configurations created: ' . count($configs));
|
||||
|
||||
// Summary per building function
|
||||
$summary = [];
|
||||
foreach ($configs as $config) {
|
||||
$buildingFunctionId = $config['building_function_id'];
|
||||
if (!isset($summary[$buildingFunctionId])) {
|
||||
$summary[$buildingFunctionId] = 0;
|
||||
}
|
||||
$summary[$buildingFunctionId]++;
|
||||
}
|
||||
|
||||
foreach ($buildingFunctionMapping as $code => $id) {
|
||||
$count = $summary[$id] ?? 0;
|
||||
$this->command->info("{$code}: {$count} configurations");
|
||||
}
|
||||
|
||||
$this->command->info('=== KEY FEATURES ===');
|
||||
$this->command->info('✓ Fungsi Keagamaan: Bebas retribusi semua lantai');
|
||||
$this->command->info('✓ Setiap fungsi bangunan memiliki parameter berbeda');
|
||||
$this->command->info('✓ Setiap lantai memiliki IP ketinggian berbeda');
|
||||
$this->command->info('✓ Hunian sederhana: IP kompleksitas khusus 0.3');
|
||||
$this->command->info('✓ Formula dapat disesuaikan per fungsi dan lantai');
|
||||
}
|
||||
}
|
||||
106
database/seeders/MasterFormulaSeeder.php
Normal file
106
database/seeders/MasterFormulaSeeder.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\MasterFormula;
|
||||
use App\Models\MasterParameter;
|
||||
use App\Models\FormulaParameter;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class MasterFormulaSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$now = Carbon::now();
|
||||
|
||||
// 1. Master Formulas
|
||||
$formulas = [
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_DASAR',
|
||||
'formula_name' => 'Formula Retribusi Dasar',
|
||||
'formula_expression' => '{koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_bangunan} * ({ip_permanen} + {ip_kompleksitas} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})',
|
||||
'formula_category' => 'basic',
|
||||
'description' => 'Formula dasar untuk perhitungan retribusi PBG tanpa prasarana',
|
||||
'usage_notes' => 'Menggunakan rumus: 1*D5*(N5*tarif_dasar*H5*1) dimana H5=E5*(F5+G5+(0.5*H3))'
|
||||
],
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_DENGAN_PRASARANA',
|
||||
'formula_name' => 'Formula Retribusi dengan Prasarana',
|
||||
'formula_expression' => '({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_bangunan} * ({ip_permanen} + {ip_kompleksitas} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})) + ({asumsi_prasarana} * ({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_bangunan} * ({ip_permanen} + {ip_kompleksitas} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})))',
|
||||
'formula_category' => 'complete',
|
||||
'description' => 'Formula lengkap retribusi PBG termasuk prasarana',
|
||||
'usage_notes' => 'Formula utama: (dasar) + (prasarana * dasar). Sesuai rumus Excel yang diberikan'
|
||||
],
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_BEBAS',
|
||||
'formula_name' => 'Formula Retribusi Bebas',
|
||||
'formula_expression' => '0',
|
||||
'formula_category' => 'free',
|
||||
'description' => 'Formula untuk bangunan yang bebas retribusi',
|
||||
'usage_notes' => 'Digunakan untuk bangunan keagamaan dan MBR'
|
||||
],
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_PER_LANTAI',
|
||||
'formula_name' => 'Formula Perhitungan per Lantai (H5)',
|
||||
'formula_expression' => '{fungsi_bangunan} * ({ip_permanen} + {ip_kompleksitas} + ({multiplier_ketinggian} * {ip_ketinggian}))',
|
||||
'formula_category' => 'component',
|
||||
'description' => 'Formula untuk menghitung nilai per lantai (H5 dalam Excel)',
|
||||
'usage_notes' => 'Rumus: E5*(F5+G5+(0.5*H3)) - komponen perhitungan per lantai'
|
||||
],
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_HUNIAN_SEDERHANA',
|
||||
'formula_name' => 'Formula Retribusi Hunian Sederhana',
|
||||
'formula_expression' => '({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_hunian_sederhana} * ({ip_permanen_hunian_sederhana} + {ip_kompleksitas_hunian_sederhana} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})) + ({asumsi_prasarana} * ({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_hunian_sederhana} * ({ip_permanen_hunian_sederhana} + {ip_kompleksitas_hunian_sederhana} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})))',
|
||||
'formula_category' => 'residential',
|
||||
'description' => 'Formula khusus untuk hunian sederhana dengan IP kompleksitas 0.3',
|
||||
'usage_notes' => 'Menggunakan parameter khusus hunian sederhana'
|
||||
],
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_HUNIAN_TIDAK_SEDERHANA',
|
||||
'formula_name' => 'Formula Retribusi Hunian Tidak Sederhana',
|
||||
'formula_expression' => '({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_hunian_tidak_sederhana} * ({ip_permanen_hunian_tidak_sederhana} + {ip_kompleksitas_hunian_tidak_sederhana} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})) + ({asumsi_prasarana} * ({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_hunian_tidak_sederhana} * ({ip_permanen_hunian_tidak_sederhana} + {ip_kompleksitas_hunian_tidak_sederhana} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})))',
|
||||
'formula_category' => 'residential',
|
||||
'description' => 'Formula khusus untuk hunian tidak sederhana',
|
||||
'usage_notes' => 'Menggunakan parameter khusus hunian tidak sederhana'
|
||||
],
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_SOSIAL_BUDAYA',
|
||||
'formula_name' => 'Formula Retribusi Sosial Budaya',
|
||||
'formula_expression' => '({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_sosial_budaya} * ({ip_permanen_sosial_budaya} + {ip_kompleksitas_sosial_budaya} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})) + ({asumsi_prasarana} * ({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_sosial_budaya} * ({ip_permanen_sosial_budaya} + {ip_kompleksitas_sosial_budaya} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})))',
|
||||
'formula_category' => 'social',
|
||||
'description' => 'Formula khusus untuk bangunan sosial budaya',
|
||||
'usage_notes' => 'Menggunakan parameter fungsi sosial budaya'
|
||||
],
|
||||
[
|
||||
'formula_code' => 'RETRIBUSI_USAHA',
|
||||
'formula_name' => 'Formula Retribusi Usaha',
|
||||
'formula_expression' => '({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_usaha_besar} * ({ip_permanen_usaha_besar} + {ip_kompleksitas_usaha_besar} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})) + ({asumsi_prasarana} * ({koefisien_dasar} * {luas_bangunan} * ({indeks_lokalitas} * {tarif_dasar} * ({fungsi_usaha_besar} * ({ip_permanen_usaha_besar} + {ip_kompleksitas_usaha_besar} + ({multiplier_ketinggian} * {ip_ketinggian}))) * {koefisien_dasar})))',
|
||||
'formula_category' => 'commercial',
|
||||
'description' => 'Formula khusus untuk bangunan usaha',
|
||||
'usage_notes' => 'Menggunakan parameter fungsi usaha besar'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($formulas as $formula) {
|
||||
DB::table('master_formulas')->updateOrInsert(
|
||||
['formula_code' => $formula['formula_code']],
|
||||
array_merge($formula, [
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
$this->command->info('Master Formulas seeded successfully!');
|
||||
$this->command->info('=== FORMULA SUMMARY ===');
|
||||
foreach ($formulas as $formula) {
|
||||
$this->command->info($formula['formula_code'] . ': ' . $formula['formula_name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
387
database/seeders/MasterParameterSeeder.php
Normal file
387
database/seeders/MasterParameterSeeder.php
Normal file
@@ -0,0 +1,387 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\MasterParameter;
|
||||
use App\Models\BuildingFunction;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class MasterParameterSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$now = Carbon::now();
|
||||
|
||||
// 1. General Parameters (Parameter Umum)
|
||||
$generalParameters = [
|
||||
[
|
||||
'parameter_code' => 'luas_bangunan',
|
||||
'parameter_name' => 'Luas Bangunan',
|
||||
'default_value' => 0.000000,
|
||||
'unit' => 'm²',
|
||||
'description' => 'Luas total bangunan dalam meter persegi'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'tarif_dasar',
|
||||
'parameter_name' => 'Tarif Dasar',
|
||||
'default_value' => 7035000.000000,
|
||||
'unit' => 'Rupiah',
|
||||
'description' => 'Tarif dasar retribusi per meter persegi (7.035.000)'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'koefisien_dasar',
|
||||
'parameter_name' => 'Koefisien Dasar',
|
||||
'default_value' => 1.000000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Koefisien dasar perhitungan'
|
||||
]
|
||||
];
|
||||
|
||||
// 2. IP Ketinggian Parameters per Lantai (Data dari tabel)
|
||||
$floorHeightParameters = [
|
||||
[
|
||||
'parameter_code' => 'ip_ketinggian_1',
|
||||
'parameter_name' => 'IP Ketinggian Lantai 1',
|
||||
'default_value' => 1.000000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks ketinggian untuk lantai 1'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_ketinggian_2',
|
||||
'parameter_name' => 'IP Ketinggian Lantai 2',
|
||||
'default_value' => 1.090000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks ketinggian untuk lantai 2'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_ketinggian_3',
|
||||
'parameter_name' => 'IP Ketinggian Lantai 3',
|
||||
'default_value' => 1.120000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks ketinggian untuk lantai 3'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_ketinggian_4',
|
||||
'parameter_name' => 'IP Ketinggian Lantai 4',
|
||||
'default_value' => 1.135000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks ketinggian untuk lantai 4'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_ketinggian_5',
|
||||
'parameter_name' => 'IP Ketinggian Lantai 5',
|
||||
'default_value' => 1.162000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks ketinggian untuk lantai 5'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_ketinggian_6',
|
||||
'parameter_name' => 'IP Ketinggian Lantai 6',
|
||||
'default_value' => 1.197000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks ketinggian untuk lantai 6'
|
||||
]
|
||||
];
|
||||
|
||||
// 3. Building Function Specific Parameters (Data dari tabel)
|
||||
$buildingFunctionParameters = [
|
||||
// FUNGSI KEAGAMAAN - Bebas retribusi
|
||||
[
|
||||
'parameter_code' => 'fungsi_keagamaan',
|
||||
'parameter_name' => 'Fungsi Bangunan Keagamaan',
|
||||
'default_value' => 0.000000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi bangunan keagamaan (bebas retribusi)'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_keagamaan',
|
||||
'parameter_name' => 'IP Permanen Keagamaan',
|
||||
'default_value' => 0.000000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk bangunan keagamaan'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_keagamaan',
|
||||
'parameter_name' => 'IP Kompleksitas Keagamaan',
|
||||
'default_value' => 0.000000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk bangunan keagamaan'
|
||||
],
|
||||
|
||||
// FUNGSI SOSIAL BUDAYA - 0.3
|
||||
[
|
||||
'parameter_code' => 'fungsi_sosial_budaya',
|
||||
'parameter_name' => 'Fungsi Bangunan Sosial Budaya',
|
||||
'default_value' => 0.300000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi bangunan sosial budaya'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_sosial_budaya',
|
||||
'parameter_name' => 'IP Permanen Sosial Budaya',
|
||||
'default_value' => 0.400000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk bangunan sosial budaya'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_sosial_budaya',
|
||||
'parameter_name' => 'IP Kompleksitas Sosial Budaya',
|
||||
'default_value' => 0.600000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk bangunan sosial budaya'
|
||||
],
|
||||
|
||||
// CAMPURAN KECIL - 0.6
|
||||
[
|
||||
'parameter_code' => 'fungsi_campuran_kecil',
|
||||
'parameter_name' => 'Fungsi Bangunan Campuran Kecil',
|
||||
'default_value' => 0.600000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi bangunan campuran kecil'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_campuran_kecil',
|
||||
'parameter_name' => 'IP Permanen Campuran Kecil',
|
||||
'default_value' => 0.400000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk bangunan campuran kecil'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_campuran_kecil',
|
||||
'parameter_name' => 'IP Kompleksitas Campuran Kecil',
|
||||
'default_value' => 0.600000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk bangunan campuran kecil'
|
||||
],
|
||||
|
||||
// CAMPURAN BESAR - 0.8
|
||||
[
|
||||
'parameter_code' => 'fungsi_campuran_besar',
|
||||
'parameter_name' => 'Fungsi Bangunan Campuran Besar',
|
||||
'default_value' => 0.800000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi bangunan campuran besar'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_campuran_besar',
|
||||
'parameter_name' => 'IP Permanen Campuran Besar',
|
||||
'default_value' => 0.400000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk bangunan campuran besar'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_campuran_besar',
|
||||
'parameter_name' => 'IP Kompleksitas Campuran Besar',
|
||||
'default_value' => 0.600000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk bangunan campuran besar'
|
||||
],
|
||||
|
||||
// UMKM - 0.5
|
||||
[
|
||||
'parameter_code' => 'fungsi_umkm',
|
||||
'parameter_name' => 'Fungsi Bangunan UMKM',
|
||||
'default_value' => 0.500000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi bangunan UMKM'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_umkm',
|
||||
'parameter_name' => 'IP Permanen UMKM',
|
||||
'default_value' => 0.400000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk bangunan UMKM'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_umkm',
|
||||
'parameter_name' => 'IP Kompleksitas UMKM',
|
||||
'default_value' => 0.600000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk bangunan UMKM'
|
||||
],
|
||||
|
||||
// USAHA BESAR - 0.7
|
||||
[
|
||||
'parameter_code' => 'fungsi_usaha_besar',
|
||||
'parameter_name' => 'Fungsi Bangunan Usaha Besar',
|
||||
'default_value' => 0.700000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi bangunan usaha besar'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_usaha_besar',
|
||||
'parameter_name' => 'IP Permanen Usaha Besar',
|
||||
'default_value' => 0.400000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk bangunan usaha besar'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_usaha_besar',
|
||||
'parameter_name' => 'IP Kompleksitas Usaha Besar',
|
||||
'default_value' => 0.600000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk bangunan usaha besar'
|
||||
],
|
||||
|
||||
// HUNIAN SEDERHANA - 0.15
|
||||
[
|
||||
'parameter_code' => 'fungsi_hunian_sederhana',
|
||||
'parameter_name' => 'Fungsi Hunian Sederhana',
|
||||
'default_value' => 0.150000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi hunian sederhana'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_hunian_sederhana',
|
||||
'parameter_name' => 'IP Permanen Hunian Sederhana',
|
||||
'default_value' => 0.400000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk hunian sederhana'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_hunian_sederhana',
|
||||
'parameter_name' => 'IP Kompleksitas Hunian Sederhana',
|
||||
'default_value' => 0.300000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk hunian sederhana (0.3)'
|
||||
],
|
||||
|
||||
// HUNIAN TIDAK SEDERHANA - 0.17
|
||||
[
|
||||
'parameter_code' => 'fungsi_hunian_tidak_sederhana',
|
||||
'parameter_name' => 'Fungsi Hunian Tidak Sederhana',
|
||||
'default_value' => 0.170000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Parameter fungsi hunian tidak sederhana'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_permanen_hunian_tidak_sederhana',
|
||||
'parameter_name' => 'IP Permanen Hunian Tidak Sederhana',
|
||||
'default_value' => 0.400000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Permanen untuk hunian tidak sederhana'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'ip_kompleksitas_hunian_tidak_sederhana',
|
||||
'parameter_name' => 'IP Kompleksitas Hunian Tidak Sederhana',
|
||||
'default_value' => 0.600000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'IP Kompleksitas untuk hunian tidak sederhana'
|
||||
]
|
||||
];
|
||||
|
||||
// 4. Indeks Lokalitas Parameters
|
||||
$localityParameters = [
|
||||
[
|
||||
'parameter_code' => 'indeks_lokalitas_03',
|
||||
'parameter_name' => 'Indeks Lokalitas 0.3%',
|
||||
'default_value' => 0.003000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks lokalitas 0.3% (untuk bangunan tertentu)'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'indeks_lokalitas_04',
|
||||
'parameter_name' => 'Indeks Lokalitas 0.4%',
|
||||
'default_value' => 0.004000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks lokalitas 0.4% (untuk hunian sederhana dan tidak sederhana)'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'indeks_lokalitas_05',
|
||||
'parameter_name' => 'Indeks Lokalitas 0.5%',
|
||||
'default_value' => 0.005000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Indeks lokalitas 0.5% (untuk bangunan komersial)'
|
||||
]
|
||||
];
|
||||
|
||||
// 5. Multiplier Parameters
|
||||
$multiplierParameters = [
|
||||
[
|
||||
'parameter_code' => 'multiplier_prasarana',
|
||||
'parameter_name' => 'Multiplier Prasarana',
|
||||
'default_value' => 0.500000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Multiplier untuk perhitungan prasarana (50%)'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'multiplier_ketinggian',
|
||||
'parameter_name' => 'Multiplier Ketinggian',
|
||||
'default_value' => 0.500000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Multiplier untuk indeks ketinggian dalam formula (0.5)'
|
||||
]
|
||||
];
|
||||
|
||||
// 4. Additional Parameters (Parameter Tambahan)
|
||||
$additionalParameters = [
|
||||
[
|
||||
'parameter_code' => 'asumsi_prasarana',
|
||||
'parameter_name' => 'Asumsi Prasarana',
|
||||
'default_value' => 0.500000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Persentase asumsi prasarana dalam perhitungan retribusi'
|
||||
],
|
||||
[
|
||||
'parameter_code' => 'multiplier_ketinggian',
|
||||
'parameter_name' => 'Multiplier Ketinggian',
|
||||
'default_value' => 0.500000,
|
||||
'unit' => 'decimal',
|
||||
'description' => 'Multiplier untuk perhitungan ketinggian (0.5 dalam rumus Excel)'
|
||||
]
|
||||
];
|
||||
|
||||
// Combine all parameters
|
||||
$allParameters = array_merge(
|
||||
$generalParameters,
|
||||
$floorHeightParameters,
|
||||
$buildingFunctionParameters,
|
||||
$localityParameters,
|
||||
$multiplierParameters,
|
||||
$additionalParameters
|
||||
);
|
||||
|
||||
// Insert parameters
|
||||
foreach ($allParameters as $param) {
|
||||
DB::table('master_parameters')->updateOrInsert(
|
||||
['parameter_code' => $param['parameter_code']],
|
||||
array_merge($param, [
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
// Summary output
|
||||
$this->command->info('Master Parameters seeded successfully!');
|
||||
$this->command->info('=== SUMMARY ===');
|
||||
$this->command->info('General Parameters: ' . count($generalParameters));
|
||||
$this->command->info('Floor Height Parameters: ' . count($floorHeightParameters));
|
||||
$this->command->info('Building Function Parameters: ' . count($buildingFunctionParameters));
|
||||
$this->command->info('Locality Parameters: ' . count($localityParameters));
|
||||
$this->command->info('Multiplier Parameters: ' . count($multiplierParameters));
|
||||
$this->command->info('Additional Parameters: ' . count($additionalParameters));
|
||||
$this->command->info('Total Parameters: ' . count($allParameters));
|
||||
|
||||
// Display parameter mapping
|
||||
$this->command->info('=== BUILDING FUNCTION PARAMETER MAPPING ===');
|
||||
$this->command->info('KEAGAMAAN: Fungsi=0.000, IP_Permanen=0.000, IP_Kompleksitas=0.000');
|
||||
$this->command->info('SOSIAL_BUDAYA: Fungsi=0.300, IP_Permanen=0.400, IP_Kompleksitas=0.600');
|
||||
$this->command->info('CAMPURAN_KECIL: Fungsi=0.600, IP_Permanen=0.400, IP_Kompleksitas=0.600');
|
||||
$this->command->info('CAMPURAN_BESAR: Fungsi=0.800, IP_Permanen=0.400, IP_Kompleksitas=0.600');
|
||||
$this->command->info('UMKM: Fungsi=0.500, IP_Permanen=0.400, IP_Kompleksitas=0.600');
|
||||
$this->command->info('USAHA_BESAR: Fungsi=0.700, IP_Permanen=0.400, IP_Kompleksitas=0.600');
|
||||
$this->command->info('HUNIAN_SEDERHANA: Fungsi=0.150, IP_Permanen=0.400, IP_Kompleksitas=0.300');
|
||||
$this->command->info('HUNIAN_TIDAK_SEDERHANA: Fungsi=0.170, IP_Permanen=0.400, IP_Kompleksitas=0.600');
|
||||
|
||||
$this->command->info('=== IP KETINGGIAN PER LANTAI ===');
|
||||
$this->command->info('Lantai 1: 1.000, Lantai 2: 1.090, Lantai 3: 1.120');
|
||||
$this->command->info('Lantai 4: 1.135, Lantai 5: 1.162, Lantai 6: 1.197');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user