Merge branch 'ujrah_master' of https://bitbucket.org/arrahn-pkb/api_arrahn into ainiedev

This commit is contained in:
Ainie Hayatie
2024-01-24 16:30:19 +08:00
6 changed files with 237 additions and 107 deletions
+16 -14
View File
@@ -1332,25 +1332,27 @@ class CallCenterController extends Controller
$notisjbgbycaw = NotisPeringatan::on('mysql7')
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw)
->where('notisperingatan.peringatan',2)
->distinct()
->get();
//->distinct() //asal
->orderBy('nokp')
->get(); //asal
$arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray();
$notisnokp = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan)
$arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray(); //asal
$notisnokp = NotisPeringatan::whereIn('norujukan', $arraynorujukan)
->where('notisperingatan.peringatan',2)
->select('nokp')
->groupBy('nokp')
->get();
->get(); // asal
foreach($notisnokp as $index1=>$cal){
$customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp'])
foreach($notisnokp as $index=>$cal){ //asal
//$customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) //asal
$customer = Customer::where('kpbaru','=',$cal['nokp'])
->orWhere('kplama','=',$cal['nokp'])
->first();
$listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan)
// ->where('nokp','=',$cal['nokp'])
->where('nokp', 'like', '%'.$cal['nokp'].'%')
->where('notisperingatan.peringatan',2)
//$listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan) //asal
$listnotis = NotisPeringatan::whereIn('norujukan', $arraynorujukan)
->where('nokp','=',$cal['nokp'])
->get();
$listsag = Gadai::on($cawangan['mysql'])
@@ -1375,9 +1377,9 @@ class CallCenterController extends Controller
$listsag[$index2]['keuntungan'] = $response;
}
$notisnokp[$index1]['info'] = $customer;
$notisnokp[$index1]['listsag'] = $listsag;
$notisnokp[$index1]['listnotis'] = $listnotis;
$notisnokp[$index]['info'] = $customer;
$notisnokp[$index]['listsag'] = $listsag;
$notisnokp[$index]['listnotis'] = $listnotis;
}
+7 -3
View File
@@ -71,7 +71,7 @@ class KomuditiController extends Controller
$current = Carbon::now();
$current = new Carbon();
$komuditi_asal = KomuditiPurchase::on('mysql7')->where('no_sijil','=',$request->nosijil)->first();
$komuditi_asal = KomuditiPurchase::on('mysql7')->where('no_sijil','=',$request->nosijil)->latest()->first();
$komuditi_purchase = KomuditiPurchase::on('mysql7')->where('no_sijil','=',$request->nosijil)->update(['unit_komuditi' => 0]);
@@ -89,8 +89,12 @@ class KomuditiController extends Controller
return response()->json('berjaya');
}
public function rekodKomuditi(){
$rekodkomuditi = Komuditi::on('mysql7')->orderBy('date_purchase','desc')->orderBy('time_purchase','desc')->get();
public function rekodKomuditi(Request $request){
if(isset($request->limit_view)) {
$rekodkomuditi = Komuditi::on('mysql7')->orderBy('date_purchase','desc')->orderBy('time_purchase','desc')->limit($request->limit_view)->get();
} else {
$rekodkomuditi = Komuditi::on('mysql7')->orderBy('date_purchase','desc')->orderBy('time_purchase','desc')->get();
}
return response()->json($rekodkomuditi);
}
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Reports;
use App\Helper;
use App\Http\Controllers\Controller;
use App\Services\Reports\KawalanStokService;
use App\Services\Reports\RingkasanHarianService as ReportRingkasanHarianService;
use Illuminate\Http\Request;
@@ -12,8 +13,15 @@ class RingkasanHarianController extends Controller
public function getLaporanCawangan(string $kod_cawangan, Request $request)
{
$reportGadaianService = new ReportRingkasanHarianService($kod_cawangan, $request);
return $reportGadaianService->getLaporanCawangan();
$reportRingkasanHarianService = new ReportRingkasanHarianService($kod_cawangan, $request);
$reportKawalanStokService = new KawalanStokService($kod_cawangan, $request);
$reports = [
'reportRingkasanHarian' => $reportRingkasanHarianService->getLaporanCawangan(),
'reportKawalanStok' => $reportKawalanStokService->getLaporanCawangan(),
];
return response()->json($reports);
}
public function getSummaryLaporanRingkasanHarian()