new calculation upah
This commit is contained in:
@@ -265,27 +265,24 @@ class GadaiController extends Controller
|
||||
->first();
|
||||
|
||||
if($gadai_data['tempoh'] > 6){
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}else{
|
||||
if($gadai_data['tempoh'] == 6){
|
||||
if($gadai_data['bakiupah'] != 0){
|
||||
$upah_semasa = $gadai_data['bakiupah'];
|
||||
}else{
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}
|
||||
}else{
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}
|
||||
}
|
||||
@@ -346,7 +343,8 @@ class GadaiController extends Controller
|
||||
'bakiupah' => $baki_upah,
|
||||
'jbg' => 0,
|
||||
't_update' => $current->toDateString(),
|
||||
'bakihargajualan' => $baki_hargajualan
|
||||
'bakihargajualan' => $baki_hargajualan,
|
||||
'tempohbayar' => $gadai['tempoh']
|
||||
));
|
||||
return response()->json($update_gadai, 200);
|
||||
}
|
||||
@@ -404,7 +402,8 @@ class GadaiController extends Controller
|
||||
'bakiupah' => $baki_upah,
|
||||
'jbg' => 0,
|
||||
't_update' => $current->toDateString(),
|
||||
'bakihargajualan' => $baki_hargajualan
|
||||
'bakihargajualan' => $baki_hargajualan,
|
||||
'tempohbayar' => $gadai['tempoh']
|
||||
));
|
||||
return response()->json($update_gadai, 200);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Komuditi;
|
||||
use App\KomuditiPurchase;
|
||||
use App\KomuditiTransaksi;
|
||||
use App\KomuditiProduk;
|
||||
use App\Cawangan;
|
||||
use DB;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
@@ -77,7 +78,7 @@ class KomuditiController extends Controller
|
||||
'harga'=> $komuditi_asal['nilai']
|
||||
]);
|
||||
|
||||
return response()->json($komuditi_purchase);
|
||||
return response()->json('berjaya');
|
||||
}
|
||||
|
||||
public function rekodKomuditi(){
|
||||
@@ -179,8 +180,8 @@ class KomuditiController extends Controller
|
||||
|
||||
return response()->json($komuditi_transaksi);
|
||||
}
|
||||
public function jumlahKomoditiDashboard()
|
||||
{
|
||||
|
||||
public function jumlahKomoditiDashboard(){
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$komoditi = [];
|
||||
@@ -195,8 +196,7 @@ class KomuditiController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function statistikKomoditiDashboard(Request $request)
|
||||
{
|
||||
public function statistikKomoditiDashboard(Request $request){
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$weekly = Carbon::now();
|
||||
@@ -286,4 +286,15 @@ class KomuditiController extends Controller
|
||||
|
||||
return response()->json($array_totalup);
|
||||
}
|
||||
|
||||
public function rekodTransaksiKomoditi(Request $request){
|
||||
$rekod = KomuditiTransaksi::on('mysql7')->selectRaw('SUM(unit_komuditi) as totalkomoditi')->addSelect('kodcaw')->where('tarikh','=',$request->tarikh)->groupBy('kodcaw')->get();
|
||||
$rekodkomoditi = [];
|
||||
foreach($rekod as $index=>$rekodtransaksi){
|
||||
$cawangan =Cawangan::on('mysql7')->select('details_caw')->where('kodcaw','=',$rekodtransaksi['kodcaw'])->first();
|
||||
array_push($rekodkomoditi,['totalkomoditi'=>$rekodtransaksi['totalkomoditi'],'cawangan'=>$cawangan['details_caw']]);
|
||||
}
|
||||
|
||||
return response()->json($rekodkomoditi);
|
||||
}
|
||||
}
|
||||
@@ -67,8 +67,8 @@ class TebusController extends Controller
|
||||
->first();
|
||||
|
||||
if($gadai_data['tempoh'] > 6){
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}else{
|
||||
@@ -76,17 +76,15 @@ class TebusController extends Controller
|
||||
if($gadai_data['bakiupah'] != 0){
|
||||
$upah_semasa = $gadai_data['bakiupah'];
|
||||
}else{
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}
|
||||
}else{
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user