change recent
This commit is contained in:
@@ -204,6 +204,44 @@ class TebusController extends Controller
|
||||
return floatval(number_format($rebet,2));
|
||||
}
|
||||
|
||||
function rebetselepastawarruq($kodcaw,$norujukan)
|
||||
{
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw','=',$kodcaw)
|
||||
->first();
|
||||
|
||||
$gadai_data = Gadai::on($cawangan['mysql'])
|
||||
->where('norujukan','=',$norujukan)
|
||||
->first();
|
||||
|
||||
$upahsemasa = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$transaction = Transaction::on('mysql7')
|
||||
->where('norujukan','=',$norujukan)
|
||||
->get();
|
||||
|
||||
$transaction_keuntungan = TransaksiKeuntungan::on('mysql7')
|
||||
->where('norujukan','=',$norujukan)
|
||||
->get();
|
||||
|
||||
$totalBayaranKeuntungan = 0;
|
||||
$totalBayaran = 0;
|
||||
|
||||
foreach($transaction as $index=>$trans){
|
||||
$totalBayaran += $trans['duit_masuk'];
|
||||
}
|
||||
|
||||
foreach($transaction_keuntungan as $index=>$untung){
|
||||
$totalBayaranKeuntungan += $untung['bayaran_keuntungan'];
|
||||
}
|
||||
|
||||
$rebet = $gadai_data['upah12'] - $totalBayaranKeuntungan - $upahsemasa;
|
||||
|
||||
return floatval(number_format($rebet,2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function tebusUpdate($kodcaw,$norujukan,Request $request)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
@@ -211,7 +249,15 @@ class TebusController extends Controller
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$rebet = $this->rebet($kodcaw,$norujukan);
|
||||
if($request->jenisbayarantebus == "tawarruq")
|
||||
{
|
||||
$rebet = $this->rebetselepastawarruq($kodcaw,$norujukan);
|
||||
}
|
||||
else if($request->jenisbayarantebus == "nottawarruq")
|
||||
{
|
||||
$rebet = $this->rebet($kodcaw,$norujukan);
|
||||
}
|
||||
|
||||
|
||||
$update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array(
|
||||
'sttebus' => "T",
|
||||
|
||||
Reference in New Issue
Block a user