This commit is contained in:
Afiq Zakwan
2023-12-20 08:04:51 +08:00
parent f9d812f326
commit b8ff35e804
6 changed files with 71 additions and 13 deletions
+16
View File
@@ -213,4 +213,20 @@ class MarhunController extends Controller
return response()->json($marhun);
}
public function getNilaiMarhunLatest(Request $request){
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
$marhuns = Marhun::on($cawangan['mysql'])->where('norujukan',$request->norujukan)->get();
$totalnilaimarhun = 0;
foreach($marhuns as $index=>$marhun){
$harga = HargaEmas::on('mysql7')->where('karat',$marhun->karat)->first();
$nilai_marhun = $marhun->berat * $harga->harga;
$totalnilaimarhun = $totalnilaimarhun + $nilai_marhun;
}
return response()->json($totalnilaimarhun);
}
}