SPS Pindah ke custom AKB

This commit is contained in:
Pusdatin BPKD Jkt
2023-01-05 16:22:17 +07:00
parent 0e6cfe7f72
commit 2cfae01c0e
7 changed files with 63 additions and 39 deletions
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\Admin;
use App\Models\MappingDbhSkpd;
use App\Models\Sps_pendapatan;
use App\Models\AkbPendapatan;
use App\Models\VwRekeningPendapatan;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
@@ -33,32 +35,33 @@ class MappingDbhSkpdController extends Controller
public function store(Request $request)
{
$request->validate([
'id_sps' => 'required',
'tahun' => 'required',
'id_rekening' => 'required',
// 'tahun' => 'required',
'kode_rekening' => 'required',
'txt_id_skpd'=>'required'
//'txt_id_skpd'=>'required'
]);
$req = $request->all();
MappingDbhSkpd::where("id_sps", $req["id_sps"])->delete();
foreach($req["txt_id_skpd"] as $row_req)
{
$data["id_sps"] = $req["id_sps"];
$data["tahun"] = $req["tahun"];
$data["kode_rekening"] = $req["kode_rekening"];
$data["kode_skpd"] = $row_req;
MappingDbhSkpd::where("kode_rekening", $req["kode_rekening"])->delete();
if (isset($req["txt_id_skpd"])){
foreach($req["txt_id_skpd"] as $row_req)
{
$data["id_rekening"] = $req["id_rekening"];
// $data["tahun"] = $req["tahun"];
$data["kode_rekening"] = $req["kode_rekening"];
$data["kode_skpd"] = $row_req;
MappingDbhSkpd::create($data);
MappingDbhSkpd::create($data);
}
}
return redirect("/admin/MappingDbhSkpd")->with('success','Mapping Rekening DBH/DAK ke SKPD berhasil dibuat.');
return redirect("/admin/MappingDbhSkpd")->with('success','Mapping Rekening DBH/DAK ke SKPD berhasil dibuat!');
}
public function show($MappingDbhSkpd)
{
$sps = sps_pendapatan::where("id",$MappingDbhSkpd)->firstorNew();
$sps = VwRekeningPendapatan::where("id",$MappingDbhSkpd)->firstorNew();
$mappingSKPD = DB::select(DB::raw("SELECT x.*,y.N_OPD FROM SAMASA.MAPPING_DBH_SKPD x
LEFT JOIN NEWSIPKD.TROPD y ON x.KODE_SKPD = y.C_OPD WHERE x.id_sps = $MappingDbhSkpd"));
LEFT JOIN NEWSIPKD.TROPD y ON x.KODE_SKPD = y.C_OPD WHERE x.id_rekening = $MappingDbhSkpd"));
// MappingDbhSkpd::where("id_sps",$MappingDbhSkpd)->get();
$this->setSubtitle("Detail Data Mapping");
return view('admin.mapping_dbh_skpd.show',compact('mappingSKPD','sps'));
@@ -104,11 +107,10 @@ class MappingDbhSkpdController extends Controller
$limit = $post["length"];
$src = isset($post["search"]["value"]) ? strtolower($post["search"]["value"]):"";
$srcTA = $post["srcTA"];
$select = DB::raw("ID,KODE_REKENING, NAMA_REKENING");
$sqlstr = Sps_pendapatan::select($select)
->whereRaw("TAHUN=$srcTA AND SKPD_ID = 980 AND KODE_REKENING LIKE '4.2%'");
$select = DB::raw("ID, KODE_REKENING, NAMA_REKENING");
$sqlstr = VwRekeningPendapatan::select($select);
$dataTotal = $sqlstr->count();
$data = $sqlstr->orderBy("ID");
$data = $sqlstr->orderBy("KODE_REKENING");
if (!empty($src)){
$data->whereRaw(" ( lower(KODE_REKENING) like '%$src%' OR lower(NAMA_REKENING) like '%$src%' ) ");
}
@@ -16,6 +16,7 @@ use App\Models\BelanjaRealisasi;
use App\Models\MstJenisDana;
use App\Models\MstJenisBelanja;
use App\Models\MstSubJenisBelanja;
use App\Models\VwRekeningPendapatan;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
@@ -140,13 +141,13 @@ class ItemSearchController extends Controller
$jenis = $request->jenis;
if (getRole()=="skpd"){
$sps = DB::select(DB::raw("SELECT x.ID_SPS as ID,x.KODE_REKENING||' | '||z.NAMA_REKENING as name
$sps = DB::select(DB::raw("SELECT x.ID_REKENING as ID,x.KODE_REKENING||' | '||z.NAMA_REKENING as name
FROM SAMASA.MAPPING_DBH_SKPD x
LEFT JOIN PROKSI.SPS_PENDAPATAN z ON x.ID_SPS = z.ID
WHERE x.tahun = $ta AND x.kode_skpd='".Auth::user()->nrk."'"));
LEFT JOIN SAMASA.VW_REKENING_PENDAPATAN z ON x.ID_REKENING = z.ID
WHERE x.kode_skpd='".Auth::user()->nrk."'"));
}else{
$select = DB::raw("ID,KODE_REKENING||' | '||NAMA_REKENING as name");
$sps = Sps_pendapatan::select($select)->whereRaw("TAHUN=$ta AND SKPD_ID = 980");
$sps = VwRekeningPendapatan::select($select);
if (!empty($search)){
$sps->whereRaw(" (LOWER(KODE_REKENING) LIKE '%$search%' OR LOWER(NAMA_REKENING) LIKE '%$search%') ");