tangguh lelong operasi

This commit is contained in:
Amir
2022-07-24 15:05:07 +08:00
parent ab93b87dbb
commit bea531c835
2 changed files with 108 additions and 150 deletions
+17 -5
View File
@@ -39,6 +39,7 @@ use App\Models\Negeri;
use Carbon\Carbon;
use App\Models\LelongTebus;
use App\Models\TangguhLelong;
use App\Models\Tetapan;
use App\Models\TransaksiKeuntungan;
@@ -1065,7 +1066,8 @@ class LelongController extends Controller
}
public function deletemarhun(Request $request){
// dd($request->checkboxdata);
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateTimeString();
$data = $request->checkboxdata;
foreach($data as $index=>$norujukan)
{
@@ -1074,13 +1076,23 @@ class LelongController extends Controller
$currentdate = $currentdate->toDateTimeString();
$marhun = LelongBid::where('norujukan','=',$norujukan)->first();
$marhunTangguhLelong = new TangguhLelong;
$marhunTangguhLelong->lelong_id = $marhun->lelong_id;
$marhunTangguhLelong->lelongbid_id = $marhun->id; //lelongbid_id
$marhunTangguhLelong->norujukan = $marhun->norujukan;
$marhunTangguhLelong->pinjaman = $marhun->pinjaman;
$marhunTangguhLelong->tarikhtangguh = $currentdate; //tarikhtangguh
$marhunTangguhLelong->ditangguh_oleh = $user->id; //ditangguh_oleh
$marhunTangguhLelong->ditangguh_pada = $currentdate; //ditangguh_oleh
$marhunTangguhLelong->nota = "Ditangguh Oleh Operasi (" . $user->name . ")"; //ditangguh_oleh
$marhunTangguhLelong->save();
$marhun->delete();
$updategadai = Gadai::where('norujukan','=', $norujukan)->first();
$updategadai->taglel = 0;
$updategadai->save();
// $updategadai = Gadai::where('norujukan','=', $norujukan)->first();
// $updategadai->taglel = 0;
// $updategadai->save();
//insert loguser
$loguser = new LogUser;
$loguser->user_id = $user->id;
$loguser->date = $currentdate;