USE [IndInsurance]
GO
/****** Object:  StoredProcedure [dbo].[proc_text_info_curr_polis_termaslahat_web]    Script Date: 11/05/2012 23:00:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[proc_text_info_curr_polis_termaslahat_web]
@pi_no_polis varchar(12)
AS
--DECLARE @Image nVarchar(4000), @urut int --@id_polis varchar(12), @tanggal datetime, @checksum int, @checksum_old int
--SET @Image=''
-- select * from polis_termaslahat

--DECLARE Master_Cursor CURSOR FOR
--SELECT no_urut
--FROM polis_termaslahat INNER JOIN 
--  hubungan ON polis_termaslahat.id_hubungan = hubungan.id_hubungan INNER JOIN
--  polis ON polis_termaslahat.id_polis = polis.id_polis  
--WHERE polis.no_polis=@pi_no_polis and polis.aktif_ya=1

--OPEN Master_Cursor;
--FETCH NEXT FROM Master_Cursor INTO @urut;

--WHILE @@FETCH_STATUS = 0
--  BEGIN
    SELECT 
    CAST(polis_termaslahat.no_urut as varchar(3)) AS no_urut,
    polis_termaslahat.nama_ahli_waris,
    hubungan.deskripsi,
    --dbo.func_date_format('mm-dd-yyyy',polis_termaslahat.tgl_lahir) AS tgl_lahir
    polis_termaslahat.tgl_lahir
  FROM polis_termaslahat INNER JOIN 
    hubungan ON polis_termaslahat.id_hubungan = hubungan.id_hubungan INNER JOIN
    polis ON polis_termaslahat.id_polis = polis.id_polis  
  WHERE polis.no_polis=@pi_no_polis  and polis.aktif_ya=1 --and polis_termaslahat.no_urut=@urut;

--      FETCH NEXT FROM Master_Cursor INTO @urut;
--   END;
--CLOSE Master_Cursor;
--DEALLOCATE Master_Cursor;

