update module interest history
This commit is contained in:
parent
89922d1b7a
commit
c7981a7c31
@ -0,0 +1,31 @@
|
||||
<?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('interest_histories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nomor_pinjaman',20);
|
||||
$table->string('periode_bunga',6);
|
||||
$table->string('nilai_bunga_intra');
|
||||
$table->string('nilai_bunga_extra');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('interest_histories');
|
||||
}
|
||||
};
|
16
Entities/InterestHistory.php
Normal file
16
Entities/InterestHistory.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Writeoff\Entities;
|
||||
|
||||
class InterestHistory extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'nomor_pinjaman',
|
||||
'periode_bunga',
|
||||
'nilai_bunga_intra',
|
||||
'nilai_bunga_extra',
|
||||
];
|
||||
}
|
@ -263,4 +263,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hitungBunga(){
|
||||
$hapusbuku = HapusBuku::all();
|
||||
|
||||
foreach($hapusbuku as $key => $value){
|
||||
$bunga = $value->suku_bunga / 100 * $value->baki_debet;
|
||||
$value->jumlah_bunga = $bunga;
|
||||
$value->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user