<?php

//===GET===
$sql['pop_up_list'] = "
SELECT
   a.usulanRkpId,
   usulanRkpNoRkp,
   barangNama,
   IFNULL(SUM(usulanBrgStjTotal1),0) AS total1,
   IFNULL(SUM(usulanBrgStjTotal2),0) AS total2,
   IFNULL(SUM(usulanBrgDetJmlApprove),0) AS jmlBrg
FROM
   usulan_brg_rkp a
   JOIN usulan_det_brg_rkp b ON b.usulanRkpId = a.usulanRkpId
   JOIN usulan_brg_det ON usulanBrgDetId = usulanKodeBrg
   JOIN barang_ref ON barangId = usulanBrgDetBrgId
WHERE
   a.usulanRkpId NOT IN
   (
      SELECT pengadaanRkpUsulanId
      FROM pengadaan_detail_rekap_usulan
      WHERE pengadaanId != %s
   )
GROUP BY
   a.usulanRkpId
HAVING
   jmlBrg > 0
";
?>
