Merge branch 'finadev' of https://bitbucket.org/arrahn-pkb/api_arrahn into ujrah_master

This commit is contained in:
Afrina Alimi
2023-12-03 11:15:24 +08:00
6 changed files with 114 additions and 4 deletions
+13 -1
View File
@@ -133,6 +133,7 @@ class GadaiController extends Controller
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
try{
@@ -247,11 +248,22 @@ class GadaiController extends Controller
$total_nilai_marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('n_marhun');
$total_berat = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('berat');
<<<<<<< HEAD
$kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first();
=======
//query kadar upah baru
$kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->where('group_id',$cawagan['group_id'])->first();
dd($kadar_raw);
// query kadar upah lama
// $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first();
>>>>>>> f15cf924e7152a396316ea99d81e2535c56977f0
$onepercentservices = new OnePercentServices();
$keuntungan = $onepercentservices->kiraanKeuntunganSebenar($request->pinjaman,$total_nilai_marhun,$kadar_raw['kadarujrah'],$margin_pinjam);
// $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100);
// $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100);
// $upah6 = $upah1 * 6;
// $upah12 = $upah1 * 12;
$upah1 = $keuntungan['keuntungan'];
+1 -1
View File
@@ -74,7 +74,7 @@ class OnePercentServices
public function getKadarUjrah(float $nilaimarhun = 0.0) : Float{
$kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->get()->toArray();
$kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',$cawagan['group_id'])->get()->toArray();
return isset($kadarujrah[0]) ? $kadarujrah[0]['kadarujrah'] : 0;
}
@@ -42,7 +42,7 @@ class AddColumnsToKomuditiTransaksi extends Migration
{
$online_arrahn_connection_array = array_filter(config('database.connections'), function($connection) {
if($connection['database'] === 'online_arrahn'){
if($connection['database'] === 'online_arrahn' || $connection['database'] === 'master_krk'){
return true;
}
@@ -53,7 +53,7 @@ class AddColumnsToKomuditiTransaksi extends Migration
if(empty($online_arrahn_connection_array)){
throw new Exception("online_arrahn doesn't exist in config.database.connections array");
throw new Exception("online_arrahn or master_krk doesn't exist in config.database.connections array");
}
return array_keys($online_arrahn_connection_array)[0];
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateGroupTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group', function (Blueprint $table) {
$table->id();
$table->string('slug')->nullable();
$table->string('description')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddGroupIdToKadarupahTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('kadarupah', function (Blueprint $table) {
//
$table->integer('group_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('mysql7')->table('kadarupah', function (Blueprint $table) {
$table->dropColumn(['group_id']);
});
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddGroupIdToArrahnMasterDbTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('arrahn_master_db', function (Blueprint $table) {
//
$table->integer('group_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('mysql7')->table('arrahn_master_db', function (Blueprint $table) {
$table->dropColumn(['group_id']);
});
}
}