SELECT
  *
FROM
  dbo.Klaim_Header_Online
WHERE
  Id_Klaim = '2016.02963'
  AND No_Klaim IS NULL
  AND Kode_Provider = 864
  AND No_Peserta = '1991008544-2'

SELECT
	*
FROM
	dbo.Sub_Kelompok

SELECT
	*
FROM
	dbo.Peserta
WHERE
  No_Peserta = '1991008544-2'

SELECT
	*
FROM
	dbo.Peserta_Produk
WHERE
  No_Peserta = '1991008544-2'


SELECT 
  * 
FROM 
  Klaim_Detail_OnLine 
WHERE 
  Id_Klaim = '2016.02963'
  AND Kode_Provider = 864

-------------- cek -----------


    SELECT 
      pa.No_Prs, 
      p.No_Proposal, 
      pa.No_Polis,
      p.grade
    FROM 
      Peserta p
      INNER JOIN 
      Polis_Asuransi pa
      ON p.No_Proposal = pa.No_Proposal
    WHERE
      (p.No_Peserta = '1991008544-2') --AND 
      --(p.Tgl_Mulai <= '2015-07-23') AND 
      --(p.Tgl_Selesai >= '2015-07-23') AND 
      --(p.Tgl_Lahir = '1964-11-10')
    ORDER BY 
      p.No_Proposal DESC
      
    SELECT 
      pa.No_Prs, 
      p.No_Proposal,  
      pa.No_Polis,
      p.grade
    FROM   
      dbo.Peserta p
      INNER JOIN
      dbo.Polis_Asuransi pa
      ON p.No_Proposal = pa.No_Proposal
    WHERE  
      (p.No_Peserta = '2015014711-1') AND 
      (p.Tgl_Mulai <= '2015-07-23') AND 
      (p.Tgl_Selesai >= '2015-07-23')
    ORDER BY 
      p.No_Proposal DESC
      
-------------------

  SELECT  
    dbo.Peserta_Produk.Id_Produk, 
    dbo.Produk_Polis.Keluarga    
  FROM 
    dbo.Peserta_Produk 
    INNER JOIN
    dbo.Produk_Polis 
    ON (dbo.Peserta_Produk.Id_Produk = dbo.Produk_Polis.Id_Produk) AND 
       (dbo.Peserta_Produk.No_Proposal = dbo.Produk_Polis.No_Proposal) 
  WHERE 
    (dbo.Peserta_Produk.Sub_Kelompok = '0301') AND 
    (dbo.Produk_Polis.No_Proposal = '2015.0540') AND
    (dbo.Produk_Polis.Status = 'I') AND
    (dbo.Peserta_Produk.no_peserta = 
      CASE 
        WHEN dbo.Produk_Polis.Keluarga = 0 THEN '1991008544-2' 
        ELSE LEFT('1991008544-2',11) + '0' 
      END
    )
-----------------------------------------------
--08010
--00006
--0804
SELECT dbo.func_get_mapping_item_santunan_polis('1991.0150.0', 10, '0804')
SELECT 
  --@No_Klaim, 
  dbo.func_get_mapping_item_santunan_polis('1991.0150.0', 10, dbo.Klaim_Detail_Online.Kode_Santunan),
  dbo.Benefit_Polis.Benefit, 
  0, 
  SUM(COALESCE(Klaim_Detail_Online.Jml_Adm, 0)) AS adm, 
  --@Tgl_Kwitansi AS kuitansi, 
  SUM(Klaim_Detail_Online.Jml_Diajukan) AS diajukan, 
  SUM(Klaim_Detail_Online.Jml_Dispensasi) AS dispensasi, 
  0
FROM  
  dbo.Klaim_Header_Online 
  INNER JOIN
  dbo.Klaim_Detail_Online 
  ON (dbo.Klaim_Header_Online.Id_Klaim = dbo.Klaim_Detail_Online.Id_Klaim)  AND 
     (dbo.Klaim_Header_Online.Kode_Provider = dbo.Klaim_Detail_Online.Kode_Provider) 
  INNER JOIN
  dbo.Benefit_Polis 
  ON (dbo.Benefit_Polis.Id_Produk = '2015.02503') AND 
     (dbo.func_get_mapping_item_santunan_polis('1991.0150.0', 10, dbo.Klaim_Detail_Online.Kode_Santunan) = dbo.Benefit_Polis.Kode_Santunan)
  INNER JOIN
  dbo.Peserta_Produk 
  ON (dbo.Peserta_Produk.No_Proposal = '2015.0540') AND 
     (dbo.Peserta_Produk.No_Peserta = '1991008544-0') AND 
     (dbo.Benefit_Polis.Kelas = dbo.Peserta_Produk.Kelas) AND 
     (dbo.Peserta_Produk.Id_Produk = '2015.02503')
WHERE 
  (dbo.Klaim_Detail_Online.Id_Klaim = '2016.02963') AND 
  (dbo.Klaim_Header_Online.Kode_Provider = '864')
GROUP BY 
  dbo.func_get_mapping_item_santunan_polis('1991.0150.0', 10, dbo.Klaim_Detail_Online.Kode_Santunan),
  dbo.Benefit_Polis.Benefit
----------------
SELECT * FROM Klaim_Detail_Online WHERE Id_Klaim = '2015.18569' AND Kode_Provider = '2064'
SELECT * FROM Klaim_Header_Online WHERE Kode_Provider = '2064'
SELECT * FROM Benefit_Polis WHERE Id_Produk = '2015.01557'
--00000
--01100
--FG003
--IS015
--LM001
SELECT dbo.func_get_mapping_item_santunan_polis('2015.0093.0', 2, 'IS015') -- = dbo.Benefit_Polis.Kode_Santunan)
--------------------------------------------------
SELECT 
  dbo.Benefit_Polis.Kode_Santunan, 
  dbo.Benefit_Polis.Benefit
FROM 
  dbo.Benefit_Polis 
  INNER JOIN 
  dbo.Peserta_Produk 
  ON (dbo.Benefit_Polis.Id_Produk = dbo.Peserta_Produk.Id_Produk) AND 
     (dbo.Benefit_Polis.Kelas = dbo.Peserta_Produk.Kelas)
WHERE 
  (dbo.Peserta_Produk.Id_Produk = '2015.01557') AND 
  (dbo.Peserta_Produk.No_Proposal = '2015.0308') AND 
  (dbo.Peserta_Produk.No_Peserta = '2015014711-0')

-- cek di klaim --

SELECT
	*
FROM
	dbo.Klaim_Peserta
WHERE
  No_Peserta = '2015014711-1'
  AND Tgl_Kwitansi = '2015-07-23'
  AND Sub_Kelompok = '0301'
  AND Kode_Diagnosa = 'M79.1'
  AND Kode_Provider = '2064'


