update laporam khas kb1

This commit is contained in:
Nur Izzati Zulkifli
2022-09-12 09:07:26 +08:00
parent f44d0ba065
commit eaa291a976
10 changed files with 1167 additions and 44 deletions
-25
View File
@@ -1316,11 +1316,7 @@ class LelongController extends Controller
}
public function senaraimarhunsimulasi($lelongid, $cawid){
// $marhun = LelongBid::->get();
$keuntungan = 0;
$marhuns = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
->where('lelong_id','=',$lelongid)->where('caw_id','=',$cawid)
->select(
@@ -1343,28 +1339,9 @@ class LelongController extends Controller
->get()->toArray();
foreach ($marhuns as $index1=> $cal) {
// $customer = Customer::on('mysql2')
// ->where('kpbaru','=',$cal['nokp'])
// ->orWhere('kplama','=',$cal['nokp'])
// ->first();
// $total_untung_rebet = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$cal['norujukan'])->sum('keuntungan_rebet');
// $total_untung_asal = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$cal['norujukan'])->sum('bayaran_keuntungan');
// $beza_keuntungan = $total_untung_asal - $total_untung_rebet;
// // dd($total_untung_rebet);
// // $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $beza_keuntungan)-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) );
// $keuntungan = bcdiv(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm'],1,1)-$beza_keuntungan;
// // dd($keuntungan);
// $marhuns[$index1]['keuntungan'] = bcdiv($keuntungan,1,1);
// // dd(bcdiv($keuntungan,1,1));
// $marhuns[$index1]['nama'] = $customer;
$simulasilel = Lelong::where('id',$lelongid)->get();
$sumcajlelong = $cal['hargaasas'] * ($simulasilel[0]['cajlelong']/100);
$totalbaki = $cal['hargaasas'] - $cal['pinjaman'] - $cal['bakiupah'] - bcdiv($sumcajlelong,1,1);
$marhuns[$index1]['cajlelong'] = bcdiv($sumcajlelong,1,1);
$marhuns[$index1]['baki'] = $totalbaki;
}
@@ -1376,8 +1353,6 @@ class LelongController extends Controller
->select('lelong_id','tarikh_lelong','lelong.fasa')
->groupBy('lelong_id')
->get()->toArray();
foreach($lelong_id as $laporan)
{
$details = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')