DONE: remove cache, and remove dto financing
This commit is contained in:
@@ -26,9 +26,6 @@ class MarhunController extends Controller
|
||||
$marhun_all = [];
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->get();
|
||||
if ($marhun->isEmpty()) {
|
||||
$marhun = app(\App\Services\ShorakaNewGadaiService::class)->items($cawangan->kodcaw, $norujukan);
|
||||
}
|
||||
if(sizeof($marhun) != 0){
|
||||
array_push($marhun_all,$marhun);
|
||||
}
|
||||
@@ -43,9 +40,6 @@ class MarhunController extends Controller
|
||||
|
||||
$marhun = Marhun::on($cawangan['mysql'])->where('norujukan',$request->norujukan)->distinct()->pluck('karat')->toArray();
|
||||
|
||||
if (app(\App\Services\ShorakaNewGadaiService::class)->pending($request->kodcaw, $request->norujukan)) {
|
||||
$marhun = app(\App\Services\ShorakaNewGadaiService::class)->items($request->kodcaw, $request->norujukan)->pluck('karat')->unique()->all();
|
||||
}
|
||||
$mutu = HargaEmas::on('mysql7')->whereIn('karat',$marhun)->pluck('keterangan')->toArray();
|
||||
|
||||
return response()->json($mutu);
|
||||
@@ -66,7 +60,7 @@ class MarhunController extends Controller
|
||||
public function create($kodcaw,Request $request)
|
||||
{
|
||||
$order = \App\ShorakaTransaction::where('norujukan', $request->norujukan)->first();
|
||||
if ($order && !empty($order->request_payload['_new_gadai'])) {
|
||||
if ($order) {
|
||||
abort(409, 'Kontrak Shoraka telah dihantar dan tidak boleh diubah.');
|
||||
}
|
||||
|
||||
@@ -107,10 +101,6 @@ class MarhunController extends Controller
|
||||
};
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
$temporary = app(\App\Services\ShorakaNewGadaiService::class);
|
||||
if ($temporary->pending($kodcaw, $request->norujukan)) {
|
||||
return response()->json($temporary->changeItem($kodcaw, $request->norujukan, $marhunToCreate), 201);
|
||||
}
|
||||
$marhun = Marhun::on($cawangan['mysql'])->create($marhunToCreate);
|
||||
|
||||
$audit = new Audit();
|
||||
@@ -143,17 +133,10 @@ class MarhunController extends Controller
|
||||
public function deletemarhun($kodcaw,$norujukan,Request $request)
|
||||
{
|
||||
$order = \App\ShorakaTransaction::where('norujukan', $norujukan)->first();
|
||||
if ($order && !empty($order->request_payload['_new_gadai'])) {
|
||||
if ($order) {
|
||||
abort(409, 'Kontrak Shoraka telah dihantar dan tidak boleh diubah.');
|
||||
}
|
||||
|
||||
$temporary = app(\App\Services\ShorakaNewGadaiService::class);
|
||||
if ($temporary->pending($kodcaw, $norujukan)) {
|
||||
$temporary->changeItem($kodcaw, $norujukan, [], $request->recno, true);
|
||||
return response('Deleted Successfully', 200);
|
||||
}
|
||||
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
@@ -179,7 +162,7 @@ class MarhunController extends Controller
|
||||
public function editmarhun($kodcaw,$norujukan,Request $request)
|
||||
{
|
||||
$order = \App\ShorakaTransaction::where('norujukan', $norujukan)->first();
|
||||
if ($order && !empty($order->request_payload['_new_gadai'])) {
|
||||
if ($order) {
|
||||
abort(409, 'Kontrak Shoraka telah dihantar dan tidak boleh diubah.');
|
||||
}
|
||||
|
||||
@@ -190,17 +173,6 @@ class MarhunController extends Controller
|
||||
$harga = HargaEmas::on('mysql7')->where('karat',$request->karat)->first();
|
||||
$nilai_marhun = $request->berat * $harga['harga'];
|
||||
|
||||
$temporary = app(\App\Services\ShorakaNewGadaiService::class);
|
||||
if ($temporary->pending($kodcaw, $norujukan)) {
|
||||
$temporary->changeItem($kodcaw, $norujukan, [
|
||||
'karat' => $request->karat, 'marhun' => $request->marhun, 'nota' => $request->nota,
|
||||
'tag_permata' => $request->tag_permata,
|
||||
'berat_batu_permata' => $request->berat_batu_permata ?: null,
|
||||
'berat' => $request->berat, 'harga' => $harga['harga'], 'n_marhun' => $nilai_marhun,
|
||||
'bil' => $request->kuantiti,
|
||||
], $request->recno);
|
||||
return response()->json(true);
|
||||
}
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
// Lock the parent first so concurrent edits to this SAG are serialized.
|
||||
@@ -299,9 +271,6 @@ class MarhunController extends Controller
|
||||
|
||||
$marhuns = Marhun::on($cawangan['mysql'])->where('norujukan',$request->norujukan)->get();
|
||||
|
||||
if ($marhuns->isEmpty()) {
|
||||
$marhuns = app(\App\Services\ShorakaNewGadaiService::class)->items($request->kodcaw, $request->norujukan);
|
||||
}
|
||||
$totalnilaimarhun = 0;
|
||||
|
||||
foreach($marhuns as $index=>$marhun){
|
||||
@@ -315,11 +284,6 @@ class MarhunController extends Controller
|
||||
|
||||
public function getMarhunCaw($kodcaw,$norujukan)
|
||||
{
|
||||
$temporary = app(\App\Services\ShorakaNewGadaiService::class);
|
||||
if ($temporary->pending($kodcaw, $norujukan)) {
|
||||
return response()->json($temporary->items($kodcaw, $norujukan)->sum('n_marhun'));
|
||||
}
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
$data = Marhun::on($cawangan['mysql'])
|
||||
->where('norujukan','=', $norujukan)
|
||||
|
||||
Reference in New Issue
Block a user