Bugfix/list clickup issue (#5)
Reviewed-on: #5 Co-authored-by: ISMAIL MASSERAN <ismail@koppkb.com> Co-committed-by: ISMAIL MASSERAN <ismail@koppkb.com>
This commit was merged in pull request #5.
This commit is contained in:
@@ -2,25 +2,23 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Simulasi;
|
||||
use App\Models\CawanganSimulasi;
|
||||
use App\Models\SimKarat;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\SimulasiBid;
|
||||
use App\Models\CawanganSimulasi;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\SimulasiBidMarhun;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LogUser;
|
||||
use DateTime;
|
||||
use App\Models\SimKarat;
|
||||
use App\Models\Simulasi;
|
||||
use App\Models\SimulasiBid;
|
||||
use App\Models\SimulasiBidMarhun;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LelongUjrahController extends Controller
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
@@ -35,21 +33,18 @@ class LelongUjrahController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
public function index() {}
|
||||
|
||||
public function create($id)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$simulasi = Simulasi::where('id','=',$id)->first();
|
||||
$cawangansim = CawanganSimulasi::where('simulasi_id','=',$id)->get();
|
||||
$simkarat = SimKarat::where('simulasi_id','=',$id)->get();
|
||||
$simulasi = Simulasi::where('id', '=', $id)->first();
|
||||
$cawangansim = CawanganSimulasi::where('simulasi_id', '=', $id)->get();
|
||||
$simkarat = SimKarat::where('simulasi_id', '=', $id)->get();
|
||||
|
||||
|
||||
$lelong = new Lelong();
|
||||
$lelong = new Lelong;
|
||||
$lelong->tarikh_lelong = $simulasi->tarikh_lelong;
|
||||
$lelong->harga_emas_asas = $simulasi->harga_emas_asas;
|
||||
$lelong->jbg = $simulasi->jbg;
|
||||
@@ -59,9 +54,7 @@ class LelongUjrahController extends Controller
|
||||
$lelong->tagujrah = 1;
|
||||
$lelong->save();
|
||||
|
||||
|
||||
foreach($simkarat as $simulasikarat)
|
||||
{
|
||||
foreach ($simkarat as $simulasikarat) {
|
||||
$lelkarat = new LelKarat;
|
||||
$lelkarat->lelong_id = $lelong->id;
|
||||
$lelkarat->karat = $simulasikarat->karat;
|
||||
@@ -71,15 +64,11 @@ class LelongUjrahController extends Controller
|
||||
$lelkarat->save();
|
||||
}
|
||||
|
||||
foreach($cawangansim as $caw)
|
||||
{
|
||||
$cawanganlel = CawanganLelong::where('caw_id','=',$caw->caw_id)->orderBy('id','desc')->first();
|
||||
if($cawanganlel)
|
||||
{
|
||||
$batchno = $cawanganlel->batchlel+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($cawangansim as $caw) {
|
||||
$cawanganlel = CawanganLelong::where('caw_id', '=', $caw->caw_id)->orderBy('id', 'desc')->first();
|
||||
if ($cawanganlel) {
|
||||
$batchno = $cawanganlel->batchlel + 1;
|
||||
} else {
|
||||
$batchno = 1;
|
||||
}
|
||||
$caw_lelong = new CawanganLelong;
|
||||
@@ -93,102 +82,93 @@ class LelongUjrahController extends Controller
|
||||
$caw_lelong->tagujrah = 1;
|
||||
$caw_lelong->save();
|
||||
|
||||
$datasimbid = SimulasiBid::where('caw_id','=',$caw->caw_id)->where('simulasi_id',$id)->get();
|
||||
$datasimbid = SimulasiBid::where('caw_id', '=', $caw->caw_id)->where('simulasi_id', $id)->get();
|
||||
$suratcaw = $datasimbid->all();
|
||||
foreach(array_chunk($suratcaw,100) as $data_chunk)
|
||||
{
|
||||
//dd($data);
|
||||
foreach($data_chunk as $data)
|
||||
{
|
||||
//dd($simulasi->id);
|
||||
$lelongbid = LelongBid::create([
|
||||
"lelong_id" => $lelong->id,
|
||||
"caw_id" => $data->caw_id,
|
||||
"kodcaw" => $data->kodcaw,
|
||||
"norujukan" => $data->norujukan,
|
||||
"t_lelong" => $data->t_lelong,
|
||||
"hargaasas" => $data->hargaasas,
|
||||
"hargajual" => 0.00,
|
||||
"jbg" => $data->jbg,
|
||||
"kadarupah" => $data->kadarupah,
|
||||
"ansuran" => $data->ansuran,
|
||||
"nilaimarhun" => $data->nilaimarhun,
|
||||
"pinjaman" => $data->pinjaman,
|
||||
"bakiupah" => $data->bakiupah,
|
||||
"upahsimpan" => $data->bakiupah,
|
||||
"cajlain" => $data->cajlain,
|
||||
"cajlelong" => 0.00,
|
||||
"baki" => 0.00,
|
||||
"berat" => $data->berat,
|
||||
"marhun" => $data->marhun,
|
||||
"percent" => $data->percent,
|
||||
"status_jual" => 0,
|
||||
"status_payment" => 0,
|
||||
"mora_upah" => 0,
|
||||
"fasa" => $data->fasa,
|
||||
"tagujrah" => 1,
|
||||
"onepercent" => $data->onepercent,
|
||||
"ujrah" => $data->ujrah
|
||||
]);
|
||||
|
||||
|
||||
$simulasibidmarhun = SimulasiBidMarhun::where('simulasibid_id','=',$data->id)->get();
|
||||
foreach($simulasibidmarhun as $simbidmarhun)
|
||||
{
|
||||
$lelongbidmarhun = new LelongBidMarhun;
|
||||
$lelongbidmarhun->lelongbid_id = $lelongbid->id;
|
||||
$lelongbidmarhun->bil = $simbidmarhun->bil;
|
||||
$lelongbidmarhun->marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->nota = $simbidmarhun->nota;
|
||||
$lelongbidmarhun->old_marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->old_karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->old_berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->old_harga = $simbidmarhun->old_harga;
|
||||
$lelongbidmarhun->old_nmarhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->old_hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->harga = $simbidmarhun->harga;
|
||||
$lelongbidmarhun->n_marhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->save();
|
||||
|
||||
}
|
||||
|
||||
if($lelongbidmarhun->save())
|
||||
{
|
||||
// $updategadai = Gadai::where('norujukan','=', $data->norujukan)->first();
|
||||
// $updategadai->taglel = 1;
|
||||
// $updategadai->save();
|
||||
|
||||
$hapussimulasi = SimulasiBid::where('norujukan','=',$data->norujukan)->first();
|
||||
$hapussimulasi->delete();
|
||||
|
||||
//insert loguser
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = $user->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->norujukan = $data->norujukan;
|
||||
$loguser->nota = 'Daftar Batch Lelong Ujrah'.$lelong->id;
|
||||
$loguser->save();
|
||||
}
|
||||
foreach (array_chunk($suratcaw, 100) as $data_chunk) {
|
||||
// dd($data);
|
||||
foreach ($data_chunk as $data) {
|
||||
// dd($simulasi->id);
|
||||
$lelongbid = LelongBid::create([
|
||||
'lelong_id' => $lelong->id,
|
||||
'caw_id' => $data->caw_id,
|
||||
'kodcaw' => $data->kodcaw,
|
||||
'norujukan' => $data->norujukan,
|
||||
't_lelong' => $data->t_lelong,
|
||||
'hargaasas' => $data->hargaasas,
|
||||
'hargajual' => 0.00,
|
||||
'jbg' => $data->jbg,
|
||||
'kadarupah' => $data->kadarupah,
|
||||
'ansuran' => $data->ansuran,
|
||||
'nilaimarhun' => $data->nilaimarhun,
|
||||
'pinjaman' => $data->pinjaman,
|
||||
'bakiupah' => $data->bakiupah,
|
||||
'upahsimpan' => $data->bakiupah,
|
||||
'cajlain' => $data->cajlain,
|
||||
'cajlelong' => 0.00,
|
||||
'baki' => 0.00,
|
||||
'berat' => $data->berat,
|
||||
'marhun' => $data->marhun,
|
||||
'percent' => $data->percent,
|
||||
'status_jual' => 0,
|
||||
'status_payment' => 0,
|
||||
'mora_upah' => 0,
|
||||
'fasa' => $data->fasa,
|
||||
'tagujrah' => 1,
|
||||
'onepercent' => $data->onepercent,
|
||||
'ujrah' => $data->ujrah,
|
||||
]);
|
||||
|
||||
$simulasibidmarhun = SimulasiBidMarhun::where('simulasibid_id', '=', $data->id)->get();
|
||||
foreach ($simulasibidmarhun as $simbidmarhun) {
|
||||
$lelongbidmarhun = new LelongBidMarhun;
|
||||
$lelongbidmarhun->lelongbid_id = $lelongbid->id;
|
||||
$lelongbidmarhun->bil = $simbidmarhun->bil;
|
||||
$lelongbidmarhun->marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->nota = $simbidmarhun->nota;
|
||||
$lelongbidmarhun->old_marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->old_karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->old_berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->old_harga = $simbidmarhun->old_harga;
|
||||
$lelongbidmarhun->old_nmarhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->old_hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->harga = $simbidmarhun->harga;
|
||||
$lelongbidmarhun->n_marhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->save();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($lelongbidmarhun->save()) {
|
||||
// $updategadai = Gadai::where('norujukan','=', $data->norujukan)->first();
|
||||
// $updategadai->taglel = 1;
|
||||
// $updategadai->save();
|
||||
|
||||
$hapussimulasi = SimulasiBid::where('norujukan', '=', $data->norujukan)->first();
|
||||
$hapussimulasi->delete();
|
||||
|
||||
// insert loguser
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = $user->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->norujukan = $data->norujukan;
|
||||
$loguser->nota = 'Daftar Batch Lelong Ujrah'.$lelong->id;
|
||||
$loguser->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$simulasi = Simulasi::where('id','=',$id)->where('tagujrah', 1)->first();
|
||||
$simulasi = Simulasi::where('id', '=', $id)->where('tagujrah', 1)->first();
|
||||
// dd($role);
|
||||
$simulasi->delete();
|
||||
|
||||
return redirect()->route('lelong.senarailelong')
|
||||
->with('success','Pendaftaran Lelong Berjaya');
|
||||
->with('success', 'Pendaftaran Lelong Berjaya');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user