separation pasal version1 and version2 fix upah xdetect
This commit is contained in:
@@ -23,7 +23,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use PDO;
|
||||
|
||||
class Penebusan extends Tawarruq
|
||||
class Penebusan
|
||||
{
|
||||
protected $kodcaw;
|
||||
protected $cawangan_info;
|
||||
@@ -77,6 +77,65 @@ class Penebusan extends Tawarruq
|
||||
return $hargatebus;
|
||||
}
|
||||
|
||||
public function kiraupahTawarruq($kodcaw,$norujukan){
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw','=',$kodcaw)
|
||||
->first();
|
||||
|
||||
$gadai_data = Gadai::on($cawangan['mysql'])
|
||||
->where('norujukan','=',$norujukan)
|
||||
->first();
|
||||
|
||||
if($gadai_data['tempoh'] >= 12.0){
|
||||
$tempoh = 12;
|
||||
}else{
|
||||
$tempoh = $gadai_data['tempoh'];
|
||||
}
|
||||
$bilang_bln = $tempoh - $gadai_data['tempohbayar'];
|
||||
|
||||
$upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']);
|
||||
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
if(strpos($upah_semasa_round,',')){
|
||||
$upah_semasa_round = str_replace(',','',$upah_semasa_round);
|
||||
}
|
||||
$upah_semasa = substr($upah_semasa_round, 0, -1);
|
||||
if(strpos($upah_semasa,',')){
|
||||
$upah_semasa = str_replace(',','',$upah_semasa);
|
||||
}
|
||||
|
||||
return $upah_semasa;
|
||||
}
|
||||
|
||||
public function kiraUpahRebet($norujukan){
|
||||
$cawangan = $this->cawangan_info;
|
||||
|
||||
$gadai_data = Gadai::on($cawangan['mysql'])
|
||||
->where('norujukan','=',$norujukan)
|
||||
->first();
|
||||
|
||||
if($gadai_data['tempoh'] >= 12.0){
|
||||
$tempoh = 12;
|
||||
}else{
|
||||
$tempoh = $gadai_data['tempoh'];
|
||||
}
|
||||
|
||||
$bilang_bln = $tempoh - $gadai_data['tempohbayar'];
|
||||
|
||||
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_rebet_round = number_format($upahrebet_raw,2);
|
||||
if(strpos($upah_rebet_round,',')){
|
||||
$upah_rebet_round = str_replace(',','',$upah_rebet_round);
|
||||
}
|
||||
$upah_rebet = substr($upah_rebet_round, 0, -1);
|
||||
if(strpos($upah_rebet,',')){
|
||||
$upah_rebet = str_replace(',','',$upah_rebet);
|
||||
}
|
||||
|
||||
return $upah_rebet;
|
||||
}
|
||||
|
||||
public function kiraUpahRebetSebenar($kodcaw,$norujukan){
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw','=',$kodcaw)
|
||||
@@ -363,7 +422,7 @@ class Penebusan extends Tawarruq
|
||||
->where('norujukan','=',$norujukan)
|
||||
->sum('keuntungan_rebet');
|
||||
|
||||
$upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan);
|
||||
$upah_rebet = $this->kiraUpahRebet($norujukan);
|
||||
|
||||
$rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet;
|
||||
|
||||
@@ -536,7 +595,7 @@ class Penebusan extends Tawarruq
|
||||
't_update' => $current->toDateString(),
|
||||
));
|
||||
|
||||
$upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan);
|
||||
$upah_rebet = $this->kiraUpahRebet($norujukan);
|
||||
|
||||
$create_tebus = Tebus::on($cawangan['mysql'])->create([
|
||||
'kodcaw'=> $kodcaw,
|
||||
|
||||
Reference in New Issue
Block a user