separation pasal version1 and version2 fix upah xdetect

This commit is contained in:
Hafifie PKB
2023-12-11 09:50:21 +08:00
parent 2a8e972b34
commit fb8b82c897
14 changed files with 171 additions and 53 deletions
+4 -4
View File
@@ -143,9 +143,9 @@ class GadaiV1
->first();
if($gadai_data['tempoh'] >= 12.0){
$tempoh = 12;
$tempoh = 12;
}else{
$tempoh = $gadai_data['tempoh'];
$tempoh = $gadai_data['tempoh'];
}
$bilang_bln = $tempoh - $gadai_data['tempohbayar'];
@@ -199,8 +199,8 @@ class GadaiV1
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first();
$upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan);
$upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan);
$upahsemasa = $this->kiraupahTawarruq($norujukan);
$upahrebet = $this->kiraUpahRebet($norujukan);
$total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk');
+62 -3
View File
@@ -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,