hapus gadai dan notifikasi baiki
This commit is contained in:
@@ -1095,4 +1095,49 @@ class GadaiController extends Controller
|
||||
|
||||
return response()->json($petibesi_cawangan);
|
||||
}
|
||||
|
||||
|
||||
public function GadaiHapus($kodcaw,$norujukan,Request $request)
|
||||
{
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->get();
|
||||
|
||||
if($gadai[0]['historygadaian'] != "0")
|
||||
{
|
||||
Gadai::on($cawangan['mysql'])->where('norujukan','=',$gadai[0]['historygadaian'])->update(['sttebus' => '']);
|
||||
|
||||
Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->delete();
|
||||
|
||||
Tebus::on($cawangan['mysql'])->where('norujukan','=',$gadai[0]['historygadaian'])->delete();
|
||||
|
||||
return response('Deleted Successfully', 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->delete();
|
||||
|
||||
return response('Deleted Successfully', 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function TebusHapus($kodcaw,$norujukan)
|
||||
{
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$tebus = Tebus::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->get();
|
||||
|
||||
if($tebus[0]['jenistebus'] == 'T')
|
||||
{
|
||||
Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(['sttebus' => '']);
|
||||
|
||||
Tebus::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->delete();
|
||||
|
||||
return response('Deleted Successfully', 200);
|
||||
}
|
||||
else
|
||||
return response('Bukan-Tebus');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user