update notis lelong fasa 1 dan fasa 2 (hardcode) operasi nak 15/1
This commit is contained in:
@@ -34,6 +34,7 @@ use App\Models\FailedJob;
|
||||
use Carbon\Carbon;
|
||||
use PDF;
|
||||
use DateTime;
|
||||
use IntlCalendar;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Excel;
|
||||
use App\Models\LelongCawangan;
|
||||
@@ -259,7 +260,6 @@ class NotisController extends Controller
|
||||
->where('cawangan_lelong.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
|
||||
$pdf = PDF::loadView('pdf.jananotis',compact('marhuns','lelong_id','lelongid','caw','tarikh_cetak','customer','listsag'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
@@ -288,7 +288,7 @@ class NotisController extends Controller
|
||||
|
||||
$arraynorujukan = LelongBid::where('lelong_id', $lelong_id)->where('kodcaw', $caw->caw_code)->pluck('norujukan');
|
||||
|
||||
$marhuns = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan')->orderBy('nokp', 'asc')->get();
|
||||
$marhuns = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan','bakipjm')->orderBy('nokp', 'asc')->get();
|
||||
|
||||
$marhuns_pluck_nokp = $marhuns->pluck('nokp');
|
||||
|
||||
@@ -311,8 +311,19 @@ class NotisController extends Controller
|
||||
if ($customers_keyBy_noKp[$marhun->nokp]) {
|
||||
$marhuns[$index]['nama'] = $customers_keyBy_noKp[$marhun->nokp];
|
||||
}
|
||||
}
|
||||
//apigetkeuntungan
|
||||
$getkeuntungansemasa = Http::get(config('app.api_url'). 'kiraUpahTawarruq',[
|
||||
'kodcaw' => $user->kodcaw,
|
||||
'norujukan' => $marhun->norujukan,
|
||||
])->json();
|
||||
|
||||
$marhuns[$index]['keuntungan'] = $getkeuntungansemasa;
|
||||
$nilaips = (float) $getkeuntungansemasa['keuntungan'] + (float) $getkeuntungansemasa['bakipjm'];
|
||||
$nilaitebus = (float) $getkeuntungansemasa['keuntunganrebet'] + (float) $getkeuntungansemasa['bakipjm'];
|
||||
// dd($nilaips);
|
||||
$marhuns[$index]['nilaitebus'] = $nilaitebus;
|
||||
$marhuns[$index]['nilaips'] = $nilaips;
|
||||
}
|
||||
$pdf = PDF::loadView('pdf.jananotis', compact('marhuns', 'lelongid', 'caw', 'tarikh_cetak'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
@@ -574,63 +585,59 @@ class NotisController extends Controller
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
||||
->first();
|
||||
$caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first();
|
||||
|
||||
$lelong_id = $lelong_id;
|
||||
$currentdate = Carbon::now();
|
||||
$tarikh_cetak = $currentdate->toDateString();
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
$current_date_time = $currentdate->toDateTimeString();
|
||||
|
||||
$marhun = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->where('lelong_id','=',$lelong_id)
|
||||
->where('lelongbid.kodcaw','=',$user->kodcaw);
|
||||
Log::info("Jana notis fasa 1: " . $user->kodcaw . ", " . $user->name);
|
||||
NotifyJanaNotis::dispatch($user->id, $user->kodcaw, $user->name, 'Jana Notis Fasa 1', $current_date_time);
|
||||
|
||||
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
|
||||
$datalelong = $marhun->get();
|
||||
$marhuns = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->select('nokp','norujukan')
|
||||
->get();
|
||||
// dd($marhuns);
|
||||
$arraysag = [];
|
||||
|
||||
$current_date_time = $current->toDateTimeString();
|
||||
$lelongid = Lelong::find($lelong_id);
|
||||
|
||||
Log::info("Jana notis fasa 2: " . $user->kodcaw . ", " . $user->name);
|
||||
NotifyJanaNotis::dispatch($user->id, $user->kodcaw, $user->name, 'Jana Notis Fasa 2', $current_date_time);
|
||||
$arraynorujukan = LelongBid::where('lelong_id', $lelong_id)->where('kodcaw', $caw->caw_code)->pluck('norujukan');
|
||||
|
||||
foreach($marhuns as $index1=>$cal){
|
||||
$customer = Customer::where('kpbaru','=',$cal['nokp'])
|
||||
->orWhere('kplama','=',$cal['nokp'])
|
||||
->join('poskod','customer.poskod','=','poskod.poskod')
|
||||
->join('daerah','poskod.koddaerah','=','daerah.koddaerah')
|
||||
->join('negeri','poskod.kodnegeri','=','negeri.kodnegeri')
|
||||
->first();
|
||||
$marhuns = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan','bakipjm')->orderBy('nokp', 'asc')->get();
|
||||
|
||||
$listsag = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->where('nokp','=',$cal['nokp'])
|
||||
$marhuns_pluck_nokp = $marhuns->pluck('nokp');
|
||||
|
||||
$customers = Customer::whereIn('kpbaru', $marhuns_pluck_nokp)
|
||||
->orWhereIn('kplama', $marhuns_pluck_nokp)
|
||||
->join('poskod', 'customer.poskod', '=', 'poskod.poskod')
|
||||
->join('daerah', 'poskod.koddaerah', '=', 'daerah.koddaerah')
|
||||
->join('negeri', 'poskod.kodnegeri', '=', 'negeri.kodnegeri')
|
||||
->get();
|
||||
// dd($listsag);
|
||||
foreach($listsag as $index=>$listing){
|
||||
|
||||
$bayaran = $listing['hargajualan'] - $listing['bakihargajualan'];
|
||||
|
||||
$customers_keyBy_noKp = $customers->keyBy(function ($item) {
|
||||
if ($item->kpbaru != '') {
|
||||
return $item->kpbaru;
|
||||
} else if ($item->kplama != '') {
|
||||
return $item->kplama;
|
||||
}
|
||||
$marhuns[$index1]['nama'] = ($customer) ? $customer : dd($cal['nokp']);
|
||||
$marhuns[$index1]['listsag'] = $listsag;
|
||||
});
|
||||
|
||||
|
||||
foreach ($marhuns as $index => $marhun) {
|
||||
if ($customers_keyBy_noKp[$marhun->nokp]) {
|
||||
$marhuns[$index]['nama'] = $customers_keyBy_noKp[$marhun->nokp];
|
||||
}
|
||||
//apigetkeuntungan
|
||||
$getkeuntungansemasa = Http::get(config('app.api_url'). 'kiraUpahTawarruq',[
|
||||
'kodcaw' => $user->kodcaw,
|
||||
'norujukan' => $marhun->norujukan,
|
||||
])->json();
|
||||
|
||||
$marhuns[$index]['keuntungan'] = $getkeuntungansemasa;
|
||||
$nilaips = (float) $getkeuntungansemasa['keuntungan'] + (float) $getkeuntungansemasa['bakipjm'];
|
||||
$nilaitebus = (float) $getkeuntungansemasa['keuntunganrebet'] + (float) $getkeuntungansemasa['bakipjm'];
|
||||
// dd($nilaips);
|
||||
$marhuns[$index]['nilaitebus'] = $nilaitebus;
|
||||
$marhuns[$index]['nilaips'] = $nilaips;
|
||||
}
|
||||
|
||||
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('cawangan.caw_code','=',$user->kodcaw)
|
||||
->where('cawangan_lelong.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
// return view('pdf.jananotisfasa2',compact('marhuns','lelong_id','lelongid','caw','tarikh_cetak','customer','listsag'));
|
||||
$pdf = PDF::loadView('pdf.jananotisfasa2',compact('marhuns','lelong_id','lelongid','caw','tarikh_cetak','customer','listsag'))
|
||||
$pdf = PDF::loadView('pdf.jananotisfasa2',compact('marhuns', 'lelongid', 'caw', 'tarikh_cetak'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Penjanaan Notis Fasa 2:Batch Lelong '.$lelong_id.'.pdf');
|
||||
|
||||
Reference in New Issue
Block a user