

SELECT
	*
FROM
	dbo.Note_Terbit_Master
WHERE
  No_Ref = '2015.085363'




SELECT dbo.func_GetUmur('1988-08-28', '2014-12-30') as Umur
---------------------------------------------------------------------
SELECT
	*
FROM
	dbo.Note_Terbit_Master
WHERE
  No_Ref = '2015.085363'

SELECT
	*
FROM
	dbo.Note_Terbit_Detail
WHERE
  No_Ref = '2015.085363'

SELECT
	*
FROM
  dbo.Peserta_Produk_Detail
WHERE
  No_Ref = '2015.085363'

SELECT
	ppd.Jumlah
--UPDATE
--  ntd
--SET
--  Jumlah = ppd.Jumlah
FROM
	dbo.Note_Terbit_Detail AS ntd INNER JOIN
	dbo.Peserta_Produk_Detail AS ppd ON ntd.No_Ref = ppd.No_Ref
	                                    AND ntd.Sub_Kelompok = ppd.Sub_Kelompok
WHERE
  ntd.No_Ref = '2015.085363'

--
SELECT
	SUM(Total)
FROM
  dbo.Note_Terbit_Detail
WHERE
  No_Ref = '2015.085363'

--UPDATE
--	dbo.Note_Terbit_Master
--SET
--  Jml_Terbit = 1238802
--WHERE
--  No_Ref = '2015.085363'


----------
--SELECT
--	SUM(Jumlah)
--FROM
--  dbo.Peserta_Produk_Detail
--WHERE
--  No_Ref = '2015.085363'
--  AND Sub_Kelompok = '0200'
  
--SELECT
--	*
--UPDATE
--  ntd
--SET
--  Jumlah = ppd.Jumlah
--FROM
--	dbo.Note_Terbit_Detail AS ntd INNER JOIN
--	(
--	  SELECT
--	    SUM(Jumlah) AS Jumlah,
--	    Sub_Kelompok,
--	    No_Ref
--    FROM
--	    dbo.Peserta_Produk_Detail
--    WHERE
--      No_Ref = '2015.085363'
--    GROUP BY
--      Sub_Kelompok,
--	    No_Ref
--	) AS ppd ON ntd.No_Ref = ppd.No_Ref
--	            AND ntd.Sub_Kelompok = ppd.Sub_Kelompok
--WHERE
--  ntd.No_Ref = '2015.085363'
  
--
SELECT
	SUM(Total)
FROM
  dbo.Note_Terbit_Detail
WHERE
  No_Ref = '2015.085363'

UPDATE
	dbo.Note_Terbit_Master
SET
  Jml_Terbit = 769613525
WHERE
  No_Ref = '2015.085363'


--UPDATE
--	dbo.Note_Terbit_Master
--SET
--  Tgl_Buat = '2015-11-12'
--WHERE
--  No_Ref = '2015.085363'

--UPDATE
--	dbo.Note_Terbit_Master
--SET
--  Change_By = 'IMN'
--WHERE
--  No_Ref = '2015.085363'

--UPDATE
--	dbo.Note_Terbit_Master
--SET
--  Status = 'I'
--WHERE
--  No_Ref = '2015.085363'