update kemaskini data notis
This commit is contained in:
@@ -1293,7 +1293,7 @@ class NotisController extends Controller
|
||||
$notis_all[$index1]["cust_info"] = $customers_keyBy_noKp[$gadai->nokp];
|
||||
}
|
||||
$total_berat = $total_berat + $gadai['berat'];
|
||||
$total_pinjaman = $total_pinjaman + $gadai['[pinjaman]'];
|
||||
$total_pinjaman = $total_pinjaman + $gadai['pinjaman'];
|
||||
$total_bakipjm = $total_bakipjm + $gadai['bakipjm'];
|
||||
$total_nilaimarhun = $total_nilaimarhun + $gadai['nilaimarhun'];
|
||||
$total_bakiupah = $total_bakiupah + $gadai['bakiupah'];
|
||||
@@ -1313,41 +1313,46 @@ class NotisController extends Controller
|
||||
'cawanganDetail'));
|
||||
}
|
||||
|
||||
public function kemaskinidatanotis($tarikhnotis)
|
||||
public function kemaskinidatanotis(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$data = [];
|
||||
|
||||
$notis_all = Notis::with(['cawangan', 'notisBid','cawanganNotis'])->where('tarikh_notis',$tarikhnotis)->get();
|
||||
|
||||
foreach ($notis_all as $notisall) {
|
||||
$cawanganAll = $notisall->cawangan;
|
||||
// dump($notisall['id']);
|
||||
$notisBidGroupByCawId = $notisall->notisBid->groupBy('caw_id');
|
||||
$notisbid_pluck_by_norujukan = $notisall->notisBid->pluck('norujukan')->toArray();
|
||||
$notisbid_keyby_norujukan = $notisall->notisBid->keyBy('norujukan');
|
||||
$tarikhnotis = $request->tarikhnotis;
|
||||
$notisid = $request->notisid;
|
||||
$notis = Notis::with(['cawangan', 'notisBid','cawanganNotis'])->where('tarikh_notis',$tarikhnotis)->get();
|
||||
foreach ($notis as $not) {
|
||||
$cawanganAll = $not->cawangan;
|
||||
$notBidGroupByCawId = $not->notisBid->groupBy('caw_id');
|
||||
$notBidGroupByCawnotis = $not->cawanganNotis->groupBy('caw_id');
|
||||
$notisbid_pluck_by_norujukan = $not->notisBid->pluck('norujukan')->toArray();
|
||||
foreach ($cawanganAll as $caw_key_by_id) {
|
||||
$cawanganDetail = $cawanganAll->find($caw_key_by_id['id']);
|
||||
$gadai_all = Gadai::on($cawanganDetail['caw_code'])->whereIn('norujukan', $notisbid_pluck_by_norujukan)
|
||||
->select('sttebus','kadarupah','nokp','tempoh','tempohbayar','norujukan','berat','nilaimarhun','pinjaman','bakipjm','bakiupah','hargajualan','bakihargajualan')
|
||||
->orderBy('norujukan','ASC')
|
||||
->get();
|
||||
|
||||
$gadai_all_groupby_norujukan = $gadai_all->groupBy('norujukan');
|
||||
|
||||
$transaksi_all = TransaksiKeuntungan::on('main')->whereIn('norujukan', $notisbid_pluck_by_norujukan)
|
||||
->select('keuntungan_rebet','bayaran_keuntungan','norujukan')
|
||||
->get();
|
||||
// dd($transaksi_all);
|
||||
$transaksi_all_groupby_norujukan = $transaksi_all->groupBy('norujukan');
|
||||
|
||||
if ($notisBidGroupByCawId[$caw_key_by_id['id']]); {
|
||||
$caw_key_by_id['notisBid'] = $notisBidGroupByCawId[$caw_key_by_id['id']];
|
||||
|
||||
if ($notBidGroupByCawId[$caw_key_by_id['id']]); {
|
||||
$caw_key_by_id['datagadai'] = $gadai_all_groupby_norujukan;
|
||||
}
|
||||
|
||||
foreach($gadai_all as $data)
|
||||
{
|
||||
// dd($gadai_true['data_transaksi']);
|
||||
}
|
||||
foreach($cawanganAll as $cawnot)
|
||||
{
|
||||
foreach ($cawnot['datagadai'] as $index=>$dataG) {
|
||||
$data = $dataG[0];
|
||||
|
||||
if($data['sttebus'] == "T" || $data['sttebus'] == "L")
|
||||
{
|
||||
$lelongtebus = new LelongTebus;
|
||||
@@ -1355,7 +1360,7 @@ class NotisController extends Controller
|
||||
$lelongtebus->kodcaw = $cawanganDetail['caw_code'];
|
||||
$lelongtebus->teller = $user->name;
|
||||
$lelongtebus->norujukan = $data['norujukan'];
|
||||
$lelongtebus->batch_no = $notisall['id'];
|
||||
$lelongtebus->batch_no = $not['id'];
|
||||
$lelongtebus->nilaimarhun = $data['nilaimarhun'];
|
||||
$lelongtebus->pinjaman = $data['pinjaman'];
|
||||
$lelongtebus->upah = $data['bakiupah'];
|
||||
@@ -1376,10 +1381,10 @@ class NotisController extends Controller
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->norujukan = $data['norujukan'];
|
||||
if($data['sttebus'] == "T"){
|
||||
$loguser->nota = 'OUT NOTIS TEBUS '.$notisall['id'];
|
||||
$loguser->nota = 'OUT NOTIS TEBUS '.$not['id'];
|
||||
}
|
||||
else if($data['sttebus'] == "L"){
|
||||
$loguser->nota = 'OUT NOTIS LELONG '.$notisall['id'];
|
||||
$loguser->nota = 'OUT NOTIS LELONG '.$not['id'];
|
||||
}
|
||||
|
||||
$loguser->save();
|
||||
@@ -1388,7 +1393,7 @@ class NotisController extends Controller
|
||||
$updatelelong->delete();
|
||||
|
||||
$checksag = NotisBid::where('kodcaw',$cawanganDetail['caw_code'])
|
||||
->where('notis_id',$notisall['id'])
|
||||
->where('notis_id',$not['id'])
|
||||
->first();
|
||||
// dd($checksag);
|
||||
|
||||
@@ -1403,15 +1408,26 @@ class NotisController extends Controller
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->nota = 'HAPUS CAW NOTIS '.$notisall['id'];
|
||||
$loguser->nota = 'HAPUS CAW NOTIS '.$not['id'];
|
||||
$loguser->save();
|
||||
}
|
||||
}
|
||||
else{
|
||||
//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 = 'KEMASKINI NOTIS'.$not['id'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return redirect()->route('notisperingatan.shownotisperingatanall',[$tarikhnotis,$notisall['id']])
|
||||
}return redirect()->route('notisperingatan.shownotisperingatanall',[$tarikhnotis,$not['id']])
|
||||
->with('success','Kemaskini Berjaya');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function jananotisperingatan2($notisid,$cawid)
|
||||
|
||||
Reference in New Issue
Block a user