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%' ) ");
}