add lapora barang kes

This commit is contained in:
Ain Izazi
2025-07-16 12:05:56 +08:00
parent 607d991911
commit aaf4dc803d
2 changed files with 50 additions and 0 deletions
@@ -0,0 +1,43 @@
<?php
namespace App\Http\Controllers;
use App\Audit;
use App\Polis;
use App\Cawangan;
use App\LookupAlasan;
use Illuminate\Http\Request;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
class BarangkesController extends Controller
{
public function LaporanBarangKes(Request $request)
{
$cawangan = Cawangan::on('mysql7')->where('kodcaw', $request->kodcaw)->first();
if (!$cawangan) {
return response()->json(['error' => 'Invalid kodcaw'], 403);
}
$query = DB::connection($cawangan['mysql'])->table('palsu')
->select([
'tarikh',
'norujukan',
'nota',
'pembiayaan',
'nilaimarhun',
'jbg',
'untung',
'untungonepercent',
'untungcajlain'
])
->whereBetween('tarikh', [$request->tarikh_mula, $request->tarikh_akhir]);
$result = $query->get();
return response()->json($result);
}
}
+7
View File
@@ -452,6 +452,13 @@ $router->group(['prefix'=>'api'], function () use ($router){
$router->get('laporan/lelong',['uses' => 'LelongController@LaporanLelong']);
$router->get('lookupbatchlel/{kodcaw}',['uses' => 'LelongController@LookupBatchLel']);
// $router->post('admin/BarangKes', ['uses' => 'BarangKesController@laporanBarangKes']);
// $router->get('barangkes/laporan', ['uses' => 'BarangKesController@LaporanBarangKes']);
$router->get('palsu/laporan', ['uses' => 'BarangkesController@LaporanBarangKes']);