Merge branch 'ujrah_master_fix' of https://bitbucket.org/arrahn-pkb/api_arrahn into test-simulator-nisha
This commit is contained in:
@@ -3120,12 +3120,6 @@ class AdminPageController extends Controller
|
|||||||
$year = $current->year;
|
$year = $current->year;
|
||||||
$month = $tarikh->month;
|
$month = $tarikh->month;
|
||||||
|
|
||||||
// $test = Gadai::on($cawangan['mysql'])
|
|
||||||
// ->whereBetween('tempoh',[0.5,1])
|
|
||||||
// ->where('sttebus','<>','')
|
|
||||||
// ->whereYear('t_gadai',$current->year())
|
|
||||||
// ->pluck('norujukan');
|
|
||||||
|
|
||||||
$get_norujukan = Gadai::on($cawangan['mysql'])
|
$get_norujukan = Gadai::on($cawangan['mysql'])
|
||||||
->selectRaw("norujukan,CASE WHEN (YEAR(t_gadai) = YEAR(t_update) and MONTH(t_gadai) = MONTH(t_update)) THEN '1' ELSE '0' END AS result")
|
->selectRaw("norujukan,CASE WHEN (YEAR(t_gadai) = YEAR(t_update) and MONTH(t_gadai) = MONTH(t_update)) THEN '1' ELSE '0' END AS result")
|
||||||
->whereNotNull('hargajualan')
|
->whereNotNull('hargajualan')
|
||||||
@@ -3135,53 +3129,19 @@ class AdminPageController extends Controller
|
|||||||
->where('sttebus','<>','')
|
->where('sttebus','<>','')
|
||||||
->pluck('norujukan');
|
->pluck('norujukan');
|
||||||
|
|
||||||
$sum_keun_tebus = Transaction::on('mysql7')
|
$sum_keun = Transaction::on('mysql7')
|
||||||
|
->selectRaw("trans.norujukan,SUM(CASE WHEN (transaction.trans_type) = 'T' THEN (trans.keuntungan_rebet) ELSE 0 END) AS sum_keun,SUM(CASE WHEN (transaction.trans_type) = 'A' THEN (trans.bayaran_keuntungan) ELSE 0 END) AS sum_bayaran")
|
||||||
->leftJoin('transaksi_keuntungan as trans', function($join)
|
->leftJoin('transaksi_keuntungan as trans', function($join)
|
||||||
{
|
{
|
||||||
$join->on('transaction.norujukan', '=', 'trans.norujukan');
|
$join->on('transaction.norujukan', '=', 'trans.norujukan');
|
||||||
$join->on('transaction.created_at', '=', 'trans.tarikh_bayaran');
|
$join->on('transaction.created_at', '=', 'trans.tarikh_bayaran');
|
||||||
})
|
})
|
||||||
->whereIn('trans.norujukan',$get_norujukan)
|
->whereIn('trans.norujukan',$get_norujukan)->get()->toArray();
|
||||||
->where('transaction.trans_type','T')
|
|
||||||
->where('margin_semasa','=',0)
|
|
||||||
->sum('keuntungan_rebet');
|
|
||||||
|
|
||||||
$sum_keun_ansuran = Transaction::on('mysql7')
|
|
||||||
->leftJoin('transaksi_keuntungan as trans', function($join)
|
|
||||||
{
|
|
||||||
$join->on('transaction.norujukan', '=', 'trans.norujukan');
|
|
||||||
$join->on('transaction.created_at', '=', 'trans.tarikh_bayaran');
|
|
||||||
})
|
|
||||||
->whereIn('trans.norujukan',$get_norujukan)
|
|
||||||
->where('transaction.trans_type','A')
|
|
||||||
->where('margin_semasa','=',0)
|
|
||||||
->sum('bayaran_keuntungan');
|
|
||||||
|
|
||||||
|
|
||||||
$sagbaru_norujukan = Gadai::on($cawangan['mysql'])
|
|
||||||
->selectRaw("norujukan,CASE WHEN (YEAR(t_gadai) = YEAR(t_update) and MONTH(t_gadai) = MONTH(t_update)) THEN '1' ELSE '0' END AS result")
|
|
||||||
->whereNotNull('hargajualan')
|
|
||||||
->having('result','=',1)
|
|
||||||
->whereYear('t_gadai','=',$year)
|
|
||||||
->whereMonth('t_gadai','<=',$month)
|
|
||||||
->where('sttebus','=','')
|
|
||||||
->where('tagbaru',1)
|
|
||||||
->pluck('norujukan');
|
|
||||||
|
|
||||||
$keuntungan_baru = Transaction::on('mysql7')
|
|
||||||
->leftJoin('transaksi_keuntungan as trans', function($join)
|
|
||||||
{
|
|
||||||
$join->on('transaction.norujukan', '=', 'trans.norujukan');
|
|
||||||
$join->on('transaction.created_at', '=', 'trans.tarikh_bayaran');
|
|
||||||
})
|
|
||||||
->whereIn('trans.norujukan',$sagbaru_norujukan)
|
|
||||||
->where('transaction.trans_type','A')
|
|
||||||
->sum('bayaran_keuntungan');
|
|
||||||
|
|
||||||
|
|
||||||
$total = $sum_keun_tebus + $sum_keun_ansuran + $keuntungan_baru;
|
|
||||||
|
|
||||||
|
$sum_keuntungan = ($sum_keun) ? $sum_keun[0]['sum_keun'] : 0;
|
||||||
|
$sum_bayaran = ($sum_keun) ? $sum_keun[0]['sum_bayaran'] : 0;
|
||||||
|
|
||||||
|
$total = $sum_keuntungan + $sum_bayaran;
|
||||||
return response()->json($total);
|
return response()->json($total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1101,7 +1101,7 @@ class LelongController extends Controller
|
|||||||
$lelong_to_be_inserted->hargaasas = $index['hargaasas'];
|
$lelong_to_be_inserted->hargaasas = $index['hargaasas'];
|
||||||
$lelong_to_be_inserted->hargajual = $index['hargajual'];
|
$lelong_to_be_inserted->hargajual = $index['hargajual'];
|
||||||
$lelong_to_be_inserted->glcode = "1000/010";
|
$lelong_to_be_inserted->glcode = "1000/010";
|
||||||
$lelong_to_be_inserted->t_jual = $index['t_lelong'];
|
$lelong_to_be_inserted->t_jual = $index['t_jual'];
|
||||||
$lelong_to_be_inserted->nopembeli = $no_pembeli_data;
|
$lelong_to_be_inserted->nopembeli = $no_pembeli_data;
|
||||||
$lelong_to_be_inserted->jbg = $index['jbg'];
|
$lelong_to_be_inserted->jbg = $index['jbg'];
|
||||||
$lelong_to_be_inserted->kadarupah = $index['kadarupah'];
|
$lelong_to_be_inserted->kadarupah = $index['kadarupah'];
|
||||||
@@ -1668,10 +1668,38 @@ class LelongController extends Controller
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){
|
public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){
|
||||||
$master = new MasterServices($kodcaw);
|
// $master = new MasterServices($kodcaw);
|
||||||
$response = $master->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan);
|
// $response = $master->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan);
|
||||||
|
|
||||||
return $response;
|
// return $response;
|
||||||
|
$cawangan = Cawangan::on('mysql7')
|
||||||
|
->where('kodcaw','=',$kodcaw)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$onepercentservices = new Calculation();
|
||||||
|
|
||||||
|
// $cawangan = $kodcaw;
|
||||||
|
|
||||||
|
$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'];
|
||||||
|
$array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']);
|
||||||
|
// $ujrah_rounded = $onepercentservices->getRoundedMethod($array_upah['ujrah']);
|
||||||
|
// $keuntungan_rounded = $onepercentservices->getRoundedMethod($array_upah['onepercent']);
|
||||||
|
$ujrah = $bilang_bln * $array_upah['ujrah'];
|
||||||
|
$onepercent = $bilang_bln * $array_upah['onepercent'];
|
||||||
|
$ujrah = $onepercentservices->getRoundedMethod($ujrah);
|
||||||
|
$onepercent = $onepercentservices->getRoundedMethod($onepercent);
|
||||||
|
|
||||||
|
return ['ujrah' => $ujrah, 'onepercent' => $onepercent];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
|
<?php
|
||||||
<?php
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'database' => env('TENNANT_MASTER_DB','master_erahn')
|
'database' => env('TENNANT_MASTER_DB','master_erahn')
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user