SELECT
	*
FROM
	dbo.Note_Lunas_Master
WHERE
  No_Ref = '2015.064495'

SELECT
	*
FROM
	dbo.Note_Lunas_Detail
WHERE
  No_Ref = '2015.064495'

SELECT * FROM	dbo.Note_Terbit_Master WHERE No_Ref = '2015.064495'
SELECT * FROM	dbo.Note_Terbit_Detail WHERE No_Ref = '2015.064495'

-- step 1. delete
--DELETE FROM	dbo.Note_Lunas_Master WHERE No_Ref = '2015.064495' AND Tgl_Bayar = '2016-01-26' AND No_Bukti = '539P 2016/1/26-0001'
--DELETE FROM dbo.Note_Lunas_Detail WHERE No_Ref = '2015.064495' AND Tgl_Bayar = '2016-01-26' AND No_Bukti = '539P 2016/1/26-0001'
-- step 2. update nilai
--UPDATE dbo.Note_Terbit_Master SET Jml_Lunas = 1032762352, Tgl_Lunas = NULL WHERE No_Ref = '2015.064495'