Bugs Fix Ubah SPD
This commit is contained in:
@@ -553,13 +553,30 @@ class RealisasiBelanjaController extends Controller
|
||||
public function ubahSPD(Request $request, $id)
|
||||
{
|
||||
$req = $request->all();
|
||||
$SPDs = DB::select(DB::raw(
|
||||
"SELECT x.I_SPDNO_DOK, x.D_SPDNO, sum(z.V_SPP) AS JML
|
||||
/* $SPDs = DB::select(DB::raw(
|
||||
"SELECT x.I_SPDNO_DOKx, x.D_SPDNO, sum(z.V_SPP) AS JML
|
||||
FROM NEWSIPKD.TMSPD x
|
||||
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJ y ON x.I_ID = y.I_IDSPD
|
||||
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJRSK z ON y.I_IDSPP = z.I_IDSPP
|
||||
WHERE z.I_IDRSK=".$id." GROUP BY x.I_SPDNO_DOK, x.D_SPDNO ORDER BY x.D_SPDNO "
|
||||
)); */
|
||||
$detailRSK = DB::select(DB::raw("SELECT * FROM SAMASA.VW_DPA_RSK WHERE I_ID = $id"));
|
||||
$detailRSK = json_decode(json_encode($detailRSK[0]),true);
|
||||
$SPDs = DB::select(DB::raw(
|
||||
"SELECT a.I_SPDNO_DOK, a.D_SPDNO, b.JML
|
||||
FROM NEWSIPKD.TMSPD a
|
||||
INNER JOIN (
|
||||
SELECT I_IDSPD, SUM(V_SPD) AS JML
|
||||
FROM NEWSIPKD.TMSPDRINCIBLJ x
|
||||
LEFT JOIN NEWSIPKD.TMDPASUBGIAT y
|
||||
ON x.I_IDSUBGIAT = y.I_ID
|
||||
WHERE y.C_SUBGIAT = '".$detailRSK["c_subgiat"]."'
|
||||
AND y.I_IDOPD = '".$detailRSK["i_idopd"]."'
|
||||
GROUP BY I_IDSPD
|
||||
) b
|
||||
ON a.I_ID = b.I_IDSPD"
|
||||
));
|
||||
|
||||
$redirect = URL::to($req["redirect"]);
|
||||
|
||||
if ($request->isMethod('post')) {
|
||||
@@ -567,8 +584,8 @@ class RealisasiBelanjaController extends Controller
|
||||
DB::beginTransaction();
|
||||
|
||||
$itemSPD = isset($req["spd"])?$req["spd"]:[];
|
||||
if (count($itemSPD)>0)
|
||||
{
|
||||
// if (count($itemSPD)>0)
|
||||
// {
|
||||
BelanjaRealisasiSPD::where("id_rsk",$id)->delete();
|
||||
$SPDs = (array) $SPDs;
|
||||
foreach($itemSPD as $rowSPD)
|
||||
@@ -587,9 +604,9 @@ class RealisasiBelanjaController extends Controller
|
||||
|
||||
DB::commit();
|
||||
return redirect($redirect)->with('success','Data SPD berhasil di input!');
|
||||
}else{
|
||||
return redirect($redirect)->with('error', "Data SPD belum dipilih!");
|
||||
}
|
||||
// }else{
|
||||
// return redirect($redirect)->with('error', "Data SPD belum dipilih!");
|
||||
// }
|
||||
|
||||
}catch(\Exception $e){
|
||||
throw new \Exception($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user