Вы находитесь на странице: 1из 49

IF NOT EXISTS (SELECT * FROM sys.

database_principals WHERE name = N'BUILTIN\Users') CREATE USER [BUILTIN\Users] FOR LOGIN [BUILTIN\Users] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_REMISI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_REMISI]( [DREG_ID] [bigint] NULL, [DREM_TGL_MOHON] [datetime] NULL, [DREM_TGL_KIRIM] [datetime] NULL, [DREM_TGL_TERIMA_MA] [datetime] NULL, [DREM_KET] [varchar](2000) NULL, [DREM_PENDAPAT] [varchar](2000) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_TANGGAL]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_TANGGAL]( [DREG_ID] [bigint] NULL, [DTGL_TANGGAL] [datetime] NULL, [FUNGSI] [int] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_KE] [bigint] NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_TEKS]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_TEKS]( [DREG_ID] [bigint] NULL, [DTEKS_TEKS] [text] NULL, [FUNGSI] [int] NULL, [DATA_KE] [bigint] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_LINK] [varchar](200) NULL, [DBAP_KE] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_PENGGELEDAHAN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_PENGGELEDAHAN]( [DREG_ID] [bigint] NULL, [DGEL_TGL_PERMOHONAN] [datetime] NULL, [DGEL_TGL_IJIN] [datetime] NULL, [DGEL_NO_IJIN] [varchar](50) NULL, [DGEL_PELAKSANA] [varchar](200) NULL, [DGEL_TERSANGKA] [varchar](200) NULL, [DGEL_HASIL] [text] NULL, [DGEL_KETERANGAN] [varchar](200) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_PENYITAAN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_PENYITAAN]( [DREG_ID] [bigint] NULL, [DSIT_TGL_PERMOHONAN] [datetime] NULL, [DSIT_PELAKSANA] [varchar](50) NULL, [DSIT_TERSANGKA] [varchar](200) NULL, [DSIT_HASIL] [text] NULL, [DSIT_KETERANGAN] [varchar](200) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TVM_SETTING]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TVM_SETTING]( [TVMS_ID] [int] IDENTITY(1,1) NOT NULL, [TVMS_KODE] [char](10) NULL, [TVMS_TEXT] [varchar](6000) NULL, [TVMS_DESC] [int] NULL, [TVMS_SORT] [int] NULL

) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_MAJELIS]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_MAJELIS]( [DREG_ID] [bigint] NULL, [DMAJ_KETUA_ID] [bigint] NULL, [DMAJ_ANGGOTA1_ID] [bigint] NULL, [DMAJ_ANGGOTA2_ID] [bigint] NULL, [DMAJ_PP_ID] [bigint] NULL, [DMAJ_TGL_PMH] [datetime] NULL, [DMAJ_KET_PMH] [varchar](200) NULL, [FUNGSI] [int] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_JENIS_PENAHANAN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_JENIS_PENAHANAN]( [MJPEN_ID] [int] IDENTITY(1,1) NOT NULL, [MJPEN_NAMA] [varchar](200) NULL, [MJPEN_SORT] [int] NULL, [MJPEN_PARENT] [int] NULL, [MJPEN_DESC] [varchar](400) NULL, [MJPEN_AKTIF] [bit] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_PK]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_PK]( [DREG_ID] [bigint] NULL, [DPK_NO_PERK] [varchar](50) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DPK_TGL_PERMOHONAN] [datetime] NULL, [DPK_PEMOHON] [varchar](50) NULL, [DPK_TGL_PBT_PK] [datetime] NULL, [DPK_TGL_PEN_PERIKSA_PK] [datetime] NULL, [DPK_TGL_PERIKSA_PK] [datetime] NULL,

[DPK_TGL_KIRIM_BERKAS] [datetime] NULL, [DPK_NO_KIRIM_BERKAS] [varchar](50) NULL, [DPK_TGL_TERIMA_KEMBALI_BERKAS] [datetime] NULL, [DPK_TGL_PUTUSAN] [datetime] NULL, [DPK_NO_PUTUSAN] [varchar](50) NULL, [DPK_AMAR] [text] NULL, [DPK_TGL_PBT_SALPUT_KE_PU] [datetime] NULL, [DPK_TGL_PBT_SALPUT_KE_TERDAKWA] [datetime] NULL, [DPK_KETERANGAN] [varchar](500) NULL, [DPK_PENDAPAT_HAKIM] [varchar](2000) NULL, [DPK_PENDAPAT_JAKSA] [varchar](2000) NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](50) NULL, [DPK_TGL_PBT_MOHON_PK] [datetime] NULL, [DPK_TGL_PENDAPAT_HAKIM] [datetime] NULL, [DPK_TGL_PENDAPAT_JAKSA] [datetime] NULL, [DPK_TGL_MA_TERIMA_BERKAS] [datetime] NULL, [DPK_TGL_TRMA_JWB_PK] [datetime] NULL, [DPK_TGL_SERAH_JWB_PK] [datetime] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_RIWAYAT_PERKARA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_RIWAYAT_PERKARA]( [DREG_ID] [bigint] NULL, [DRIW_TANGGAL] [datetime] NULL, [DRIW_KETERANGAN] [varchar](2000) NULL, [DRIW_KODE] [int] NULL, [FUNGSI] [int] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_BIODATA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_BIODATA]( [DREG_ID] [bigint] NULL, [FUNGSI] [int] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DBIO_NAMA] [varchar](200) NULL, [DBIO_UMUR] [varchar](10) NULL, [DBIO_PEKERJAAN] [varchar](100) NULL, [DBIO_ALAMAT] [varchar](1000) NULL, [DBIO_KELAMIN] [bit] NULL, [DBIO_AGAMA] [varchar](20) NULL,

[DBIO_PENDIDIKAN] [varchar](50) NULL, [DBIO_KEWARGANEGARAAN] [varchar](100) NULL, [DBIO_TGL_LAHIR] [varchar](20) NULL, [DATA_KE] [int] NULL, [DBIO_TEMPAT_LAHIR] [varchar](100) NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_PENAHANAN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_PENAHANAN]( [DREG_ID] [bigint] NULL, [MJPEN_ID] [bigint] NULL, [DPEN_NO] [varchar](50) NULL, [DPEN_TANGGAL] [datetime] NULL, [DPEN_PEJABAT] [varchar](100) NULL, [DPEN_TGL_MULAI] [datetime] NULL, [DPEN_TGL_SELESAI] [datetime] NULL, [FUNGSI] [int] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_LINK] [varchar](200) NULL, [DPEN_JENIS] [varchar](100) NULL, [MPPEN_ID] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_MODEL_VAR2]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_MODEL_VAR2]( [MMDL_ID] [int] IDENTITY(1,1) NOT NULL, [MMDL_NAMA] [varchar](100) NULL, [MMDL_TABEL] [varchar](25) NULL, [MMDL_MAP] [text] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_USER_GROUP]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_USER_GROUP]( [MUGROUP_ID] [int] IDENTITY(1,1) NOT NULL, [MUGROUP_NAMA] [varchar](200) NULL,

[MUGROUP_DESC] [varchar](2000) NULL, [MUGROUP_AKTIF] [bit] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_MASTER_LINK]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_MASTER_LINK]( [MLINK_ID] [int] NULL, [MLINK_TABEL] [varchar](100) NULL, [MLINK_FDATA] [varchar](100) NULL, [MLINK_FPARENT] [varchar](100) NULL, [MLINK_FLINK] [varchar](100) NULL, [MLINK_NAMA] [varchar](100) NULL, [MLINK_DESC] [varchar](500) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[USER_LOGIN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[USER_LOGIN]( [username] [varchar](50) NULL, [password] [varchar](50) NULL, [level] [varchar](50) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_LALULINTAS]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_LALULINTAS]( [id_lalin] [int] NULL, [no_tilang] [text] NULL, [tgl_tilang] [datetime] NULL, [nama_terdakwa] [text] NULL, [alamat_terdakwa] [text] NULL, [pasal] [text] NULL, [barang_bukti] [text] NULL, [tgl_putusan_pengadilan] [datetime] NULL, [denda] [int] NULL, [subsidair] [text] NULL, [biaya_perkara] [int] NULL, [eksekusi_bb] [text] NULL,

[jenis_kendaraan] [text] NULL, [SSBP] [text] NULL, [kategori] [varchar](50) NULL, [keterangan] [varchar](50) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_DASAR_PUTUSAN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_DASAR_PUTUSAN]( [MDPUT_ID] [int] NULL, [MDPUT_NAMA] [varchar](100) NULL, [MDPUT_AKTIF] [tinyint] NULL, [MDPUT_SORT] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_USER]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_USER]( [MUSR_ID] [int] IDENTITY(1,1) NOT NULL, [MUSR_NAMA] [varchar](200) NULL, [MUSR_LOGIN] [varchar](30) NULL, [MUSR_PASSWORD] [varchar](100) NULL, [MUSR_HAK_AKSES_PIDANA] [varchar](3000) NULL, [MUSR_HAK_AKSES_PERDATA] [varchar](3000) NULL, [MUSR_AKTIF] [bit] NULL, [MUSR_ALLOWCHANGEPWD] [bit] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_BAP]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_BAP]( [MBAP_GROUP] [int] NULL, [MBAP_JENIS] [int] NULL, [MBAP_TANYA] [text] NULL, [MBAP_JAWAB] [text] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON

GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_STATUS]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_STATUS]( [DREG_ID] [bigint] NULL, [DSTAT_ID] [varchar](20) NULL, [DSTAT_VALUE] [varchar](25) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_UPLOAD]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_UPLOAD]( [DREG_ID] [bigint] NULL, [UPL_DATE] [datetime] NULL, [MUMEN_ID] [int] NULL, [UPL_FILENAME] [varchar](100) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_JENIS_PERKARA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_JENIS_PERKARA]( [JNSPERK_ID] [bigint] NULL, [JNSPERK_NAMA] [varchar](200) NULL, [JNSPERK_STATUS] [int] NULL, [JNSPERK_AKTIF] [int] NULL, [JNSPERK_PARENT] [bigint] NULL, [JNSPERK_SORT] [bigint] NULL, [JNSPERK_KODE] [bigint] NULL, [JNSPERK_KLAS] [varchar](50) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_BANK_PASAL_KUALIFIKASI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_BANK_PASAL_KUALIFIKASI]( [MPSL_KUALIFIKASI_ID] [int] IDENTITY(1,1) NOT NULL, [MPSL_KUALIFIKASI_NAMA] [varchar](400) NULL

) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_JENIS_PUTUSAN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_JENIS_PUTUSAN]( [JNSPUT_KODE] [int] NULL, [JNSPUT_NAMA] [varchar](50) NULL, [JNSPUT_SORT] [int] NULL, [JNSPUT_AKTIF] [tinyint] NULL, [JNSPUT_PARENT] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_KELOMPOK_PERKARA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_KELOMPOK_PERKARA]( [MKPERK_ID] [char](1) NULL, [MKPERK_KODE] [char](5) NULL, [MKPERK_NAMA] [varchar](100) NULL, [MKPERK_SORT] [int] NULL, [MKPERK_GROUP] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_RUANG_SIDANG]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_RUANG_SIDANG]( [MRS_ID] [int] NULL, [MRS_NAMA] [varchar](100) NULL, [MRS_KETERANGAN] [varchar](500) NULL, [MRS_SORT] [int] NULL, [MRS_AKTIF] [bit] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_SETTING]') AND type in (N'U'))

BEGIN CREATE TABLE [dbo].[MS_SETTING]( [MSET_ID] [bigint] NULL, [MSET_TYPE] [int] NULL, [MSET_VALUE] [text] NULL, [MSET_KEY] [varchar](50) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_VAR]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_VAR]( [VAR_NO] [int] NULL, [VAR_NAMA] [varchar](300) NULL, [VAR_DESC] [varchar](5000) NULL, [VAR_DEFAULT] [text] NULL, [VAR_TYPE] [int] NULL, [VAR_FIELD] [varchar](100) NULL, [VAR_KODE] [int] NULL, [VAR_MODEL] [int] NULL, [VAR_SQL_LOAD] [text] NULL, [VAR_SQL_SAVE] [text] NULL, [VAR_LIST] [text] NULL, [VAR_LINK] [text] NULL, [VAR_REFF] [bigint] NULL, [VAR_CEKSIDANG] [bit] NULL, [VAR_PARENT] [int] NULL, [VAR_TABLE] [varchar](100) NULL, [VAR_OPEN_FORMULA] [text] NULL, [VAR_PREVIEW_FORMULA] [text] NULL, [VAR_SAVE_FORMULA] [text] NULL, [VAR_VALIDATION_FORMULA] [text] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_BANK_PASAL_2]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_BANK_PASAL_2]( [MPSL_ID] [bigint] NOT NULL, [MPSL_PARENT] [bigint] NULL, [MPSL_KODE] [varchar](50) NULL, [MPSL_JENIS_KODE] [int] NULL, [MPSL_CONTENT] [text] NULL, [MPSL_KUALIFIKASI_ID] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO

SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_BANK_PASAL]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_BANK_PASAL]( [MPSL_ID] [bigint] IDENTITY(1,1) NOT NULL, [MPSL_PARENT] [bigint] NULL, [MPSL_KODE] [varchar](50) NULL, [MPSL_JENIS_KODE] [int] NULL, [MPSL_CONTENT] [text] NULL, [MPSL_KUALIFIKASI_ID] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_JPU]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_JPU]( [MJPU_ID] [int] IDENTITY(1,1) NOT NULL, [MJPU_NAMA] [varchar](200) NULL, [MJPU_TMPT_LAHIR] [varchar](50) NULL, [MJPU_UMUR] [varchar](20) NULL, [MJPU_KELAMIN] [bit] NULL, [MJPU_KEBANGSAAN] [varchar](30) NULL, [MJPU_ALAMAT] [varchar](300) NULL, [MJPU_AGAMA] [varchar](20) NULL, [MJPU_PEKERJAAN] [varchar](50) NULL, [MJPU_PENDIDIKAN] [varchar](30) NULL, [MJPU_AKTIF] [bit] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_KASASI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_KASASI]( [DREG_ID] [bigint] NULL, [DKAS_NO_PERK] [varchar](50) NULL, [DKAS_TGL_PERMOHONAN_JPU] [datetime] NULL, [DKAS_TGL_PERMOHONAN_TER] [datetime] NULL, [DKAS_PEMOHON] [varchar](50) NULL, [DKAS_TGL_PBT_KASASI_TER] [datetime] NULL, [DKAS_TGL_TERIMA_MEMORI_JPU] [datetime] NULL, [DKAS_TGL_TERIMA_MEMORI_TER] [datetime] NULL, [DKAS_TGL_PENYERAHAN_MEMORI_TER] [datetime] NULL, [DKAS_TGL_TERIMA_KONTRA_MEMORI_TER] [datetime] NULL,

[DKAS_TGL_PENYERAHAN_KONTRA_MEMORI_TER] [datetime] NULL, [DKAS_TGL_PENYERAHAN_TEMBUSAN_KONTRA_MEMORI] [datetime] NULL, [DKAS_TGL_KIRIM_BERKAS] [datetime] NULL, [DKAS_NO_KIRIM_BERKAS] [varchar](50) NULL, [DKAS_TGL_TERIMA_BERKAS] [datetime] NULL, [DKAS_TGL_PUTUSAN] [datetime] NULL, [DKAS_NO_PUTUSAN] [varchar](50) NULL, [DKAS_TGL_CABUT] [datetime] NULL, [DKAS_TGL_PBT_PUT_KE_PU] [datetime] NULL, [DKAS_TGL_PBT_PUT_KE_TERDAKWA] [datetime] NULL, [DKAS_TGL_MINUTASI] [datetime] NULL, [DKAS_TGL_PBT_JPU_PERIKSA_BERKAS] [datetime] NULL, [DKAS_TGL_PBT_TER_PERIKSA_BERKAS] [datetime] NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](50) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DKAS_AMAR] [text] NULL, [DKAS_TGL_MEMORI] [datetime] NULL, [DKAS_TGL_PBT_KASASI_JPU] [datetime] NULL, [DKAS_TGL_PENYERAHAN_MEMORI_JPU] [datetime] NULL, [DKAS_TGL_TERIMA_KONTRA_MEMORI_JPU] [datetime] NULL, [DKAS_TGL_PENYERAHAN_KONTRA_MEMORI_JPU] [datetime] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_BANDING]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_BANDING]( [DREG_ID] [bigint] NULL, [DBDG_NO_PERK] [varchar](50) NULL, [DBDG_TGL_PERMOHONAN_JPU] [datetime] NULL, [DBDG_TGL_PERMOHONAN_TER] [datetime] NULL, [DBDG_PEMBANDING] [varchar](150) NULL, [DBDG_TGL_PBT_BANDING_TER] [datetime] NULL, [DBDG_TGL_TERIMA_MEMORI_JPU] [datetime] NULL, [DBDG_TGL_TERIMA_MEMORI_TER] [datetime] NULL, [DBDG_TGL_PENYERAHAN_MEMORI_TER] [datetime] NULL, [DBDG_TGL_TERIMA_KONTRA_MEMORI_TER] [datetime] NULL, [DBDG_TGL_PENYERAHAN_KONTRA_MEMORI_TER] [datetime] NULL, [DBDG_TGL_KIRIM_BERKAS] [datetime] NULL, [DBDG_NO_KIRIM_BERKAS] [varchar](50) NULL, [DBDG_TGL_TERIMA_BERKAS_DI_PT] [datetime] NULL, [DBDG_TGL_PUTUSAN] [datetime] NULL, [DBDG_NO_PUTUSAN] [varchar](50) NULL, [DBDG_TGL_CABUT] [datetime] NULL, [DBDG_TGL_PBT_PUT_KE_JPU] [datetime] NULL, [DBDG_TGL_PBT_PUT_KE_TERDAKWA] [datetime] NULL, [DBDG_TGL_MINUTASI] [datetime] NULL, [DBDG_TGL_PBT_JPU_PERIKSA_BERKAS] [datetime] NULL, [DBDG_TGL_PBT_TER_PERIKSA_BERKAS] [datetime] NULL, [DBDG_AMAR_SELA] [text] NULL, [DBDG_AMAR] [text] NULL,

[FUNGSI] [int] NULL, [DATA_LINK] [varchar](50) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DBDG_TGL_PBT_BANDING_JPU] [datetime] NULL, [DBDG_TGL_PENYERAHAN_MEMORI_JPU] [datetime] NULL, [DBDG_TGL_TERIMA_KONTRA_MEMORI_JPU] [datetime] NULL, [DBDG_TGL_PENYERAHAN_KONTRA_MEMORI_JPU] [datetime] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MSB_DESA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MSB_DESA]( [DESA_KODE] [int] NULL, [PROP_KODE] [int] NULL, [KAB_KODE] [int] NULL, [KEC_KODE] [int] NULL, [DESA_NAMA] [varchar](100) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MSB_KAB]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MSB_KAB]( [KAB_KODE] [int] NULL, [PROP_KODE] [int] NULL, [KAB_NAMA] [varchar](100) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MSB_KEC]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MSB_KEC]( [KEC_KODE] [int] NULL, [PROP_KODE] [int] NULL, [KAB_KODE] [int] NULL, [KEC_NAMA] [varchar](100) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MSB_PROP]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MSB_PROP]( [PROP_KODE] [int] NULL, [PROP_NAMA] [varchar](100) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_KUASA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_KUASA]( [DREG_ID] [bigint] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DKUASA_NAMA] [varchar](200) NULL, [DKUASA_ALAMAT] [varchar](1000) NULL, [DKUASA_UMUR] [int] NULL, [DKUASA_PEKERJAAN] [varchar](100) NULL, [DKUASA_AGAMA] [varchar](50) NULL, [DKUASA_PENDIDIKAN] [varchar](100) NULL, [FUNGSI] [bigint] NULL, [DKUASA_KELAMIN] [bit] NULL, [DKUASA_TGL_TUNJUK] [datetime] NULL, [DKUASA_TGL_PECAT] [datetime] NULL, [DKUASA_TGL_SURAT] [datetime] NULL, [DKUASA_NO_SURAT] [varbinary](50) NULL, [DKUASA_SORT] [int] NULL, [DATA_LINK] [varchar](200) NULL, [DKUASA_TEMPAT_LAHIR] [varchar](40) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TEMPMEDIASI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TEMPMEDIASI]( [TM_NAMA] [varchar](100) NULL, [TM_ALAMAT] [varchar](200) NULL, [TM_PENGALAMAN] [varchar](300) NULL, [TM_KETERANGAN] [varchar](400) NULL, [TM_SORT] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TEMPBIPERK]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TEMPBIPERK]( [TBP_JENIS] [int] NULL, [TBP_PERKIRAAN] [varchar](100) NULL, [TBP_BIAYA] [int] NULL, [TBP_SORT] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_TREE]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_TREE]( [TREE_ID] [int] NOT NULL, [TREE_PARENT] [int] NULL, [TREE_NAMA] [varchar](100) NULL, [TREE_TYPE] [char](1) NULL, [TREE_REPORT] [varchar](20) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TV_INSTANSI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[TV_INSTANSI]( [TVINSTANSI_KD] [int] NOT NULL, [TVINSTANSI_PARENT] [int] NULL, [LINSTANSIJNS_KD] [varchar](15) NOT NULL, [TVINSTANSI_NM] [varchar](100) NOT NULL, [TVINSTANSI_ALAMAT] [text] NULL, [TVINSTANSI_KABUPATEN] [varchar](50) NULL, [TVINSTANSI_PROPINSI] [varchar](50) NULL, [TVINSTANSI_PHONE] [varchar](15) NULL, [TVINSTANSI_FAX] [varchar](15) NULL, [LINSTANSIKLS_KD] [varchar](15) NULL, [LSTRUKTURORGJNS_KD] [varchar](15) NOT NULL, [TVINSTANSI_SORT] [varchar](10) NULL, [TVINSTANSI_AKTIF] [bit] NULL, [TVINSTANSI_TGL_UPDATE] [varchar](20) NULL, [TVINSTANSI_INDUK] [bit] NOT NULL, [TVINSTANSI_BUTUH_HAKIM] [int] NULL, [TVINSTANSI_BUTUH_PP] [int] NULL, [TVINSTANSI_BUTUH_JSP] [int] NULL, [TVINSTANSI_BUTUH_JS] [int] NULL, [TVINSTANSI_JML_PERKARA] [int] NULL,

[NIR_Backup_ID] [uniqueidentifier] NOT NULL, [TVINSTANSI_KD_REG] [varchar](20) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UPDATE_APLIKASI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[UPDATE_APLIKASI]( [UP_ID] [int] NOT NULL, [UP_NAMAFILE] [varchar](100) NULL, [UP_DATE] [datetime] NULL, [UP_DESC] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VW_NAMA_PE]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[VW_NAMA_PE]( [DREG_ID] [bigint] NULL, [NAMA] [char](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VW_NAMA_TERDAKWA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[VW_NAMA_TERDAKWA]( [DREG_ID] [bigint] NULL, [NAMA] [char](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_LALIN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_LALIN]( [LALIN_ID] [decimal](18, 0) IDENTITY(1,1) NOT NULL, [LALIN_NOPERK] [varchar](20) NULL, [LALIN_NAMA] [varchar](50) NULL,

[LALIN_TMPTGL] [varchar](100) NULL, [LALIN_TGLLAHIR] [datetime] NULL, [LALIN_JENISKELAMIN] [varchar](20) NULL, [LALIN_PEKERJAAN] [varchar](100) NULL, [LALIN_PASAL] [varchar](50) NULL, [LALIN_TGLPUTUS] [datetime] NULL, [LALIN_DENKUR] [varchar](50) NULL, [LALIN_TGLVERTEK] [datetime] NULL, [LALIN_KET] [varchar](50) NULL, CONSTRAINT [PK_DATA_LALIN] PRIMARY KEY CLUSTERED ( [LALIN_ID] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VW_NAMA_TER]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[VW_NAMA_TER]( [DREG_ID] [bigint] NOT NULL, [NAMA] [char](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_LINK]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_LINK]( [MLINK_ID] [int] NULL, [MLINK_NAMA] [varchar](50) NULL, [MLINK_TABEL] [varchar](50) NULL, [MLINK_PARENT_FIELD] [varchar](50) NULL, [MLINK_KEY_FIELD] [varchar](50) NULL, [MLINK_DISP_FIELD] [varchar](50) NULL, [MLINK_DESC_FIELD] [varchar](50) NULL, [MLINK_SORT_FIELD] [varchar](50) NULL, [MLINK_DATABASE] [tinyint] NULL, [MLINK_FORMULA_FILTER] [text] NULL, [MLINK_FILTER_FIELD] [varchar](50) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_PEJABAT_PENAHAN]') AND type in (N'U'))

BEGIN CREATE TABLE [dbo].[MS_PEJABAT_PENAHAN]( [MPPEN_ID] [int] IDENTITY(1,1) NOT NULL, [MPPEN_NAMA] [varchar](50) NULL, [MPPEN_DESC] [varchar](100) NULL, [MPPEN_SORT] [int] NULL, [MPPEN_AKTIF] [tinyint] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_MODEL_VAR]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_MODEL_VAR]( [MMDL_ID] [int] NULL, [MMDL_NAMA] [varchar](100) NULL, [MMDL_TABEL] [varchar](25) NULL, [MMDL_MAP] [text] NULL, [MMDL_HAVE_FUNGSI] [bit] NULL, [MMDL_MULTI_ENABLED] [bit] NULL, [MMDL_FIELD_SORT] [varchar](50) NULL, [MMDL_SORT] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_KASASI_PIHAK]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_KASASI_PIHAK]( [DISD_TGL_PERMOHONAN_KAS] [datetime] NULL, [DISD_TGL_PEMBERITAHUAN_KAS] [datetime] NULL, [DISD_TGL_TERIMA_MEMORI_KAS] [datetime] NULL, [DISD_TGL_SERAH_MEMORI_KAS] [datetime] NULL, [DISD_TGL_TERIMA_KONTRA_MEMORI_KAS] [datetime] NULL, [DISD_TGL_SERAH_KONTRA_MEMORI_KAS] [datetime] NULL, [DISD_TGL_PERIKSA_BERKAS_KAS] [datetime] NULL, [DISD_TGL_PBT_PUT_BDG_KAS] [datetime] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_BANDING_PIHAK]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_BANDING_PIHAK]( [DISD_TGL_PERMOHONAN_BDG] [datetime] NULL,

[DISD_TGL_PEMBERITAHUAN_BDG] [datetime] NULL, [DISD_TGL_TERIMA_MEMORI_BDG] [datetime] NULL, [DISD_TGL_SERAH_MEMORI_BDG] [datetime] NULL, [DISD_TGL_TERIMA_KONTRA_MEMORI_BDG] [datetime] NULL, [DISD_TGL_SERAH_KONTRA_MEMORI_BDG] [datetime] NULL, [DISD_TGL_PERIKSA_BERKAS_BDG] [datetime] NULL, [DISD_TGL_PBT_PUT_BDG_BDG] [datetime] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[USER_LOG]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[USER_LOG]( [DREG_ID] [bigint] NULL, [VAR_NO] [int] NULL, [VAR_SUB_NO] [int] NULL, [MUSER_ID] [int] NULL, [LOG_TIME] [datetime] NULL, [ACTIVITY] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_SAKSI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_SAKSI]( [DSAK_NAMA] [varchar](50) NULL, [DSAK_UMUR] [int] NULL, [DSAK_TEMPAT_LHR] [varchar](50) NULL, [DSAK_TGL_LAHIR] [datetime] NULL, [DSAK_AGAMA] [char](10) NULL, [DSAK_PEKERJAAN] [varchar](50) NULL, [DSAK_ALAMAT] [varchar](50) NULL, [DSAK_HUB_DGN_TER] [varchar](1000) NULL, [DSAK_TJ_DGN_KETUA] [text] NULL, [DSAK_TJ_DGN_HKM_ANG_1] [text] NULL, [DSAK_TJ_DGN_HKM_ANG_2] [text] NULL, [DSAK_TJ_DGN_PU] [text] NULL, [DSAK_TJ_DGN_PH] [text] NULL, [DSAK_KET_TER] [varchar](1000) NULL, [DREG_ID] [bigint] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_LINK] [varchar](50) NULL, [DATA_KE] [int] NULL, [DBAP_KE] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO

SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DateToIndoS]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) BEGIN execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo]. [DateToIndoS] ( @Param1 datetime ) RETURNS varchar(30) AS BEGIN DECLARE @@Hasil varchar(30) DECLARE @@Bulan int if @Param1 is begin RETURN NULL end null

SET @@Bulan = Month(@Param1) if @@Bulan = 1 SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else if @@Bulan = SET @@Hasil else SET @@Hasil = ''Jan'' 2 = ''Feb'' 3 = ''Mar'' 4 = ''Apr'' 5 = ''Mei'' 6 = ''Jun'' 7 = ''Jul'' 8 = ''Ags'' 9 = ''Sep'' 10 = ''Okt'' 11 = ''Nov'' = ''Des''

RETURN RTRIM( CAST( DAY( @Param1 ) as char ) ) + '' '' + @@Hasil + '' '' + RTRIM( CAST( YEAR( @Param1 ) as char ) ) END '

END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_REGISTER]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_REGISTER]( [NO_PERK] [char](9) NULL, [DREG_TGL_DAFTAR] [datetime] NULL, [DREG_TGL_CABUT] [datetime] NULL, [DREG_TGL_PUTUSAN] [datetime] NULL, [DREG_TGL_PUTUS2] [datetime] NULL, [JNSPUT_KODE] [int] NULL, [DREG_TGL_MINUTASI] [datetime] NULL, [MDPUT_ID] [varchar](100) NULL, [DREG_ISI_DAKWAAN] [text] NULL, [DREG_TGL_PHS] [datetime] NULL, [DREG_TGL_TUNTUTAN] [datetime] NULL, [DREG_ISI_TUNTUTAN] [text] NULL, [DREG_AMAR] [text] NULL, [DREG_TGL_PBT_PETIKAN_PUTUSAN] [datetime] NULL, [DREG_TGL_TERIMA_BAIK_PUTUSAN_TERDAKWA] [datetime] NULL, [DREG_TGL_TERIMA_BAIK_PUTUSAN_PU] [datetime] NULL, [DREG_TGL_KIRIM_SALPUT_PU] [datetime] NULL, [DREG_TGL_KIRIM_SALPUT_PENYIDIK] [datetime] NULL, [JNSPERK_ID] [bigint] NULL, [DREG_TGL_PELIMPAHAN_JAKSA] [datetime] NULL, [DREG_NO_PELIMPAHAN_JAKSA] [varchar](100) NULL, [DATA_LINK] [varchar](10) NULL, [DREG_DASAR_PUTUSAN] [text] NULL, [DREG_ISI_DAKWAAN_LENGKAP] [text] NULL, [MJPU_ID] [int] NULL, [DREG_PASAL] [varchar](250) NULL, [DREG_ID] [bigint] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_KEUANGAN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_KEUANGAN]( [DREG_ID] [bigint] NULL, [DKEU_TANGGAL] [datetime] NULL, [MTRANS_ID] [int] NULL, [DKEU_NILAI] [float] NULL, [DKEU_KETERANGAN] [varchar](50) NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY]

END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_NON_PERKARA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_NON_PERKARA]( [MNPERK_ID] [int] NULL, [MNPERK_NAMA] [varchar](50) NULL, [MNPERK_DESC] [nchar](10) NULL, [VAR_NO] [int] NULL, [MNPERK_KEYFIELD1_TEXT] [varchar](50) NULL, [MNPERK_KEYFIELD1] [varchar](50) NULL, [MNPERK_KEYFIELD2_TEXT] [varchar](50) NULL, [MNPERK_KEYFIELD2] [varchar](50) NULL, [MNPERK_CONVERTIBLE] [smallint] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_TRANSAKSI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_TRANSAKSI]( [MTRANS_ID] [int] NULL, [MTRANS_PARET] [int] NULL, [MTRANS_DESC] [varchar](100) NULL, [MTRANS_SHORT_DESC] [char](10) NULL, [MTRANS_DEBET] [bit] NULL, [MTRANS_DEF_TRANS] [bit] NULL, [MTRANS_TGL_AWAL] [int] NULL, [MTRANS_NIL_AWAL] [float] NULL, [MTRANS_PRIORITY] [int] NULL, [MTRANS_AKTIF] [bit] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_NON_PERKARA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_NON_PERKARA]( [DNPERK_ID] [bigint] IDENTITY(1,1) NOT NULL, [DNPERK_ACTIVE] [bit] NULL, [DNPERK_KETERANGAN] [varchar](100) NULL, [MUSR_ID_CREATE] [int] NULL, [DNPERK_CREATE_DATE] [datetime] NULL, [MNPERK_ID] [nchar](10) NULL,

[DNPERK_CONV_DATE] [datetime] NULL, [DNPERK_CONVREGID] [bigint] NULL, [MUSR_ID_CONV] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_SIDANG_TER]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_SIDANG_TER]( [DTER_TJ_DGN_KETUA] [text] NULL, [DTER_TJ_DGN_HKM_ANG_1] [text] NULL, [DTER_TJ_DGN_HKM_ANG_2] [text] NULL, [DTER_TJ_DGN_PU] [text] NULL, [DTER_TJ_DGN_PH] [text] NULL, [DREG_ID] [bigint] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_LINK] [varchar](50) NULL, [DBAP_KE] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_PERKARA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_PERKARA]( [DREG_ID] [bigint] IDENTITY(1,1) NOT NULL, [ARSP_LOKASI] [varchar](10) NULL, [ARSP_NO_RAK] [varchar](10) NULL, [ARSP_KODE_RAK] [varchar](10) NULL, [ARSP_NO_BOX] [varchar](10) NULL, [ARSP_TANGGAL] [datetime] NULL, [ARSP_KETERANGAN] [varchar](10) NULL, [DPERK_LOCK] [text] NULL, [DPERK_OWNER] [varchar](100) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_INFORMASI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_INFORMASI]( [MINF_ID] [int] NULL, [MINF_NAMA] [varchar](30) NULL, [MINF_SQL_COUNT] [text] NULL,

[MINF_SQL] [text] NULL, [MINF_PERSON] [tinyint] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_SIDANG]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_SIDANG]( [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DREG_ID] [bigint] NULL, [DSID_TANGGAL] [datetime] NULL, [DSID_AGENDA] [varchar](200) NULL, [MRS_ID] [int] NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](200) NULL, [DSID_HASIL] [varchar](100) NULL, [DBAP_KE] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_DOKUMEN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_DOKUMEN]( [MDOK_ID] [bigint] IDENTITY(1,1) NOT NULL, [MDOK_NAMA] [varchar](1000) NULL, [MDOK_FILE] [varchar](1000) NULL, [MDOK_OWNER] [varchar](1000) NULL, [MDOK_AKTIF] [bit] NULL, [MDOK_FILTER] [varchar](2000) NULL, [MUMEN_ID] [bigint] NULL, [MDOK_DESC] [varchar](1000) NULL, [MDOK_CONTENT] [text] NULL, [MDOK_SORT] [int] NULL, [MDOK_OPEN_FORMULA] [text] NULL, [MDOK_STORAGE] [text] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_USER_MENU]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_USER_MENU]( [MUMEN_ID] [bigint] IDENTITY(1,1) NOT NULL,

[MUMEN_PARENT] [bigint] NULL, [MUMEN_NAMA] [varchar](100) NULL, [MUMEN_DESC] [varchar](500) NULL, [MUMEN_SORT] [int] NULL, [MUMEN_SPECIAL] [int] NULL, [MUGROUP_ID] [bigint] NULL, [MUMEN_AKTIF] [bit] NULL, [MUMEN_CONTENT] [text] NULL, [MUMEN_OPEN_FORMULA] [text] NULL, [MUMEN_IS_BAP] [bit] NULL, [MNPERK_ID] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_PP]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_PP]( [MPP_ID] [bigint] IDENTITY(1,1) NOT NULL, [MPP_NAMA] [varchar](200) NULL, [MPP_KODE] [varchar](5) NULL, [MPP_TGL_AKTIF] [datetime] NULL, [MPP_TGL_DEAKTIF] [datetime] NULL, [MPP_TIM] [int] NULL, [MPP_FILTER] [varchar](1000) NULL, [MUSR_ID] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MS_HAKIM]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[MS_HAKIM]( [MHKM_ID] [bigint] IDENTITY(1,1) NOT NULL, [MHKM_NAMA] [varchar](200) NULL, [MHKM_KODE] [varchar](5) NULL, [MHKM_TGL_AKTIF] [datetime] NULL, [MHKM_TGL_DEAKTIF] [datetime] NULL, [MHKM_TIM] [int] NULL, [MHKM_FILTER] [varchar](1000) NULL, [MUSR_ID] [int] NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_ANGKA]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_ANGKA]( [DREG_ID] [bigint] NULL, [DANGKA_ANGKA] [bigint] NULL, [FUNGSI] [int] NULL, [DATA_KE] [int] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_DOKUMEN]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_DOKUMEN]( [DREG_ID] [bigint] NULL, [MUMEN_ID] [bigint] NULL, [MDOK_ID] [bigint] NULL, [DBAP_KE] [int] NULL, [FUNGSI] [int] NULL, [DDOK_UPDATE] [datetime] NULL, [DDOK_CREATE] [datetime] NULL, [MUSR_ID] [bigint] NULL, [MUSR_ID_CREATE] [int] NULL, [MUSR_ID_UPDATE] [int] NULL, [DDOK_FORM_HISTORY] [text] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_BAP]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_BAP]( [DREG_ID] [bigint] NULL, [DBAP_TANYA] [text] NULL, [DBAP_JAWAB] [text] NULL, [FUNGSI] [int] NULL, [DBAP_KE] [int] NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [DATA_KE] [int] NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON

GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_EKSEKUSI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_EKSEKUSI]( [DREG_ID] [bigint] NULL, [DEKS_TGL_PERMOHONAN] [datetime] NULL, [DEKS_TGL_PEN_TEGORAN] [datetime] NULL, [DEKS_TGL_SELESAI] [datetime] NULL, [DEKS_ALASAN] [varchar](1000) NULL, [DEKS_HASIL] [varchar](1000) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](200) NULL ) ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DATA_GRASI]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[DATA_GRASI]( [DREG_ID] [bigint] NULL, [DGRAS_TGL_PERMOHONAN] [datetime] NULL, [DGRAS_PEMOHON] [varchar](50) NULL, [DGRAS_TGL_KIRIM_BERKAS] [datetime] NULL, [DGRAS_NO_KIRIM_BERKAS] [varchar](50) NULL, [DGRAS_TGL_TERIMA_MA] [datetime] NULL, [DGRAS_TGL_TERIMA_BERKAS] [datetime] NULL, [DGRAS_NO_PUTUSAN] [varchar](50) NULL, [DGRAS_TGL_PUTUSAN] [datetime] NULL, [DGRAS_AMAR] [text] NULL, [DGRAS_KET] [varchar](2000) NULL, [DGRAS_TGL_PBT_PUT_KE_TER] [datetime] NULL, [DGRAS_TGL_PBT_PUT_KE_KEJAKSAAN] [datetime] NULL, [DGRAS_TGL_PBT_BAP_PUT_DARI_PU] [datetime] NULL, [DGRAS_PENDAPAT] [varchar](2000) NULL, [DATA_ID] [bigint] IDENTITY(1,1) NOT NULL, [FUNGSI] [int] NULL, [DATA_LINK] [varchar](200) NULL, [DGRAS_TGL_KIRIM_BERKAS_MA] [datetime] NULL, [DGRAS_NO_KIRIM_BERKAS_MA] [varchar](30) NULL, [DGRAS_STATUS] [varchar](20) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MajelisHakim]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) BEGIN

execute dbo.sp_executesql @statement = N' CREATE FUNCTION [dbo].[MajelisHakim](@__sTanggalLaporan DATETIME) RETURNS @TabelHasil TABLE (DREG_ID bigint, TGL_PMH datetime, KET_PMH varchar(1000), KODE_MAJELIS varchar(100), NAMA_MAJELIS varchar(3000), KETUA_ID BIGINT, ANGGOTA1_ID BIGINT, ANGGOTA2_ID BIGINT, PP_ID BIGINT) AS BEGIN DECLARE @__iDREGID bigint, @__iActiveDREGID bigint, @__dTglPMH datetime, @__sKetPMH varchar(8000), @__sKodeMajelis varchar(8000), @__sNamaMajelis varchar(8000), @__iKetuaID bigint, @__iAnggota1ID bigint, @__iAnggota2ID bigint, @__iPPID bigint, @cur_DAFTAR_MAJELIS CURSOR -- Deklarasi cursor SET @cur_DAFTAR_MAJELIS = CURSOR FOR SELECT A.DREG_ID, A.DMAJ_TGL_PMH, A.DMAJ_KET_PMH, CASE WHEN MH1.MHKM_KODE IS NULL THEN '''' ELSE MH1.MHKM_KODE END '','' + CASE WHEN MH2.MHKM_KODE IS NULL THEN '''' ELSE MH2.MHKM_KODE END '','' + CASE WHEN MH3.MHKM_KODE IS NULL THEN '''' ELSE MH3.MHKM_KODE END '','' + CASE WHEN MPP.MPP_KODE IS NULL THEN '''' ELSE MPP.MPP_KODE END, CASE WHEN MH1.MHKM_NAMA IS NULL THEN '''' ELSE MH1.MHKM_NAMA END '','' + CASE WHEN MH2.MHKM_NAMA IS NULL THEN '''' ELSE MH2.MHKM_NAMA END '','' + CASE WHEN MH3.MHKM_NAMA IS NULL THEN '''' ELSE MH3.MHKM_NAMA END '','' + CASE WHEN MPP.MPP_NAMA IS NULL THEN '''' ELSE MPP.MPP_NAMA END, A.DMAJ_KETUA_ID, A.DMAJ_ANGGOTA1_ID, A.DMAJ_ANGGOTA2_ID, A.DMAJ_PP_ID FROM DATA_MAJELIS A LEFT JOIN MS_HAKIM MH1 ON A.DMAJ_KETUA_ID=MH1.MHKM_ID LEFT JOIN MS_HAKIM MH2

+ + + + + +

ON A.DMAJ_ANGGOTA1_ID=MH2.MHKM_ID LEFT JOIN MS_HAKIM MH3 ON A.DMAJ_ANGGOTA2_ID=MH3.MHKM_ID LEFT JOIN MS_PP MPP ON A.DMAJ_PP_ID=MPP.MPP_ID WHERE A.DMAJ_TGL_PMH <= @__sTanggalLaporan ORDER BY A.DREG_ID, A.DMAJ_TGL_PMH DESC OPEN @cur_DAFTAR_MAJELIS -- update data FETCH NEXT FROM @cur_DAFTAR_MAJELIS INTO @__iDREGID, @__dTglPMH, @__sKetPMH, @__sKodeMajelis, @__sNamaMajelis, @__iKetuaID, @__iAnggota1ID, @__iAnggota2ID, @__iPPID SET @__iActiveDREGID = @__iDREGID WHILE 1=1 BEGIN FETCH NEXT FROM @cur_DAFTAR_MAJELIS INTO @__iDREGID, @__dTglPMH, @__sKetPMH, @__sKodeMajelis, @__sNamaMajelis, @__iKetuaID, @__iAnggota1ID, @__iAnggota2ID, @__iPPID IF (@__iActiveDREGID <> @__iDREGID) OR (@@FETCH_STATUS <> 0) BEGIN IF (@__iActiveDREGID <> @__iDREGID) BEGIN INSERT INTO @TabelHasil (DREG_ID,TGL_PMH,KET_PMH,KODE_MAJELIS,NAMA_MAJELIS,KETUA_ID,ANGGOTA1_ID ,ANGGOTA2_ID,PP_ID) VALUES (@__iDREGID, @__dTglPMH, @__sKetPMH, @__sKodeMajelis, @__sNamaMajelis, @__iKetuaID, @__iAnggota1ID, @__iAnggota2ID, @__iPPID) END IF @@FETCH_STATUS <> 0 BEGIN BREAK END SET @__iActiveDREGID = @__iDREGID END END

CLOSE @cur_DAFTAR_MAJELIS DEALLOCATE @cur_DAFTAR_MAJELIS RETURN END' END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO

IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[qry_pid_lap_keg_hakim]')) EXEC dbo.sp_executesql @statement = N'CREATE VIEW [dbo]. [qry_pid_lap_keg_hakim] AS SELECT dbo.DATA_MAJELIS.DMAJ_KETUA_ID, dbo.DATA_MAJELIS.DMAJ_ANGGOTA1_ID, dbo.DATA_MAJELIS.DMAJ_ANGGOTA2_ID, dbo.DATA_REGISTER.DREG_TGL_DAFTAR, dbo.DATA_REGISTER.NO_PERK, dbo.DATA_REGISTER.DREG_TGL_PUTUSAN, dbo.DATA_REGISTER.DREG_TGL_MINUTASI FROM dbo.DATA_MAJELIS INNER JOIN dbo.DATA_REGISTER ON dbo.DATA_MAJELIS.DREG_ID = dbo.DATA_REGISTER.DREG_ID ' GO IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_DiagramPane1' , N'SCHEMA',N'dbo', N'VIEW',N'qry_pid_lap_keg_hakim', NULL,NULL)) EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00] Begin DesignProperties = Begin PaneConfigurations = Begin PaneConfiguration = 0 NumPanes = 4 Configuration = "(H (1[40] 4[20] 2[20] 3) )" End Begin PaneConfiguration = 1 NumPanes = 3 Configuration = "(H (1 [50] 4 [25] 3))" End Begin PaneConfiguration = 2 NumPanes = 3 Configuration = "(H (1 [50] 2 [25] 3))" End Begin PaneConfiguration = 3 NumPanes = 3 Configuration = "(H (4 [30] 2 [40] 3))" End Begin PaneConfiguration = 4 NumPanes = 2 Configuration = "(H (1 [56] 3))" End Begin PaneConfiguration = 5 NumPanes = 2 Configuration = "(H (2 [66] 3))" End Begin PaneConfiguration = 6 NumPanes = 2 Configuration = "(H (4 [50] 3))" End Begin PaneConfiguration = 7 NumPanes = 1 Configuration = "(V (3))" End Begin PaneConfiguration = 8 NumPanes = 3 Configuration = "(H (1[56] 4[18] 2) )"

End Begin PaneConfiguration = 9 NumPanes = 2 Configuration = "(H (1 [75] 4))" End Begin PaneConfiguration = 10 NumPanes = 2 Configuration = "(H (1[66] 2) )" End Begin PaneConfiguration = 11 NumPanes = 2 Configuration = "(H (4 [60] 2))" End Begin PaneConfiguration = 12 NumPanes = 1 Configuration = "(H (1) )" End Begin PaneConfiguration = 13 NumPanes = 1 Configuration = "(V (4))" End Begin PaneConfiguration = 14 NumPanes = 1 Configuration = "(V (2))" End ActivePaneConfig = 0 End Begin DiagramPane = Begin Origin = Top = 0 Left = 0 End Begin Tables = Begin Table = "DATA_MAJELIS" Begin Extent = Top = 6 Left = 38 Bottom = 125 Right = 232 End DisplayFlags = 280 TopColumn = 0 End Begin Table = "DATA_REGISTER" Begin Extent = Top = 6 Left = 270 Bottom = 125 Right = 597 End DisplayFlags = 280 TopColumn = 0 End End End Begin SQLPane = End

Begin DataPane = Begin ParameterDefaults = "" End Begin ColumnWidths = 9 Width = 284 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 Width = 1500 End End Begin CriteriaPane = Begin ColumnWidths = 11 Column = 1440 Alias = 900 Table = 1170 Output = 720 Append = 1400 NewValue = 1170 SortType = 1350 SortOrder = 1410 GroupBy = 1350 Filter = 1350 Or = 1350 Or = 1350 Or = 1350 End End End ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'qry_pid_lap_keg_hakim' GO IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_DiagramPaneCount' , N'SCHEMA',N'dbo', N'VIEW',N'qry_pid_lap_keg_hakim', NULL,NULL)) EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'qry_pid_lap_keg_hakim' GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[IdentitasParaPihak]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) BEGIN execute dbo.sp_executesql @statement = N' CREATE FUNCTION [dbo].[IdentitasParaPihak](@__iFungsi int) RETURNS @TabelHasil TABLE (DREG_ID bigint, BIODATA text, DEWASA_PRIA int,

AS BEGIN DECLARE @__iDREGID bigint, @__iActiveDREGID bigint, @__sIdentitas varchar(8000), @__sTempBiodata varchar(8000), @__iNo int, @__sUmur varchar(30), @__iKelamin int, @__iDewasaP int, @__iDewasaW int, @__iAnakP int, @__iAnakW int, @cur_DAFTAR_PIHAK CURSOR -- Deklarasi cursor SET @cur_DAFTAR_PIHAK = CURSOR FOR SELECT DREG_ID, CASE WHEN DBIO_NAMA IS NULL THEN '''' ELSE RTRIM(DBIO_NAMA) END + '', '' + CASE WHEN DBIO_TEMPAT_LAHIR IS NULL THEN '''' ELSE RTRIM(DBIO_TEMPAT_LAHIR) END + '', '' + CASE WHEN DBIO_UMUR IS NULL THEN '''' ELSE RTRIM(DBIO_UMUR) END + '' tahun, '' + CASE WHEN DBIO_TGL_LAHIR IS NULL THEN '''' ELSE RTRIM(DBIO_TGL_LAHIR) END + '', '' + CASE WHEN DBIO_TEMPAT_LAHIR IS NULL THEN '''' ELSE RTRIM(DBIO_TEMPAT_LAHIR) END + '', '' + CASE WHEN DBIO_KELAMIN = 1 THEN ''Laki-laki'' ELSE ''Perempuan'' END + '', '' + CASE WHEN DBIO_KEWARGANEGARAAN IS NULL THEN '''' ELSE RTRIM(DBIO_KEWARGANEGARAAN) END + '', '' + CASE WHEN DBIO_ALAMAT IS NULL THEN '''' ELSE RTRIM(DBIO_ALAMAT) END + '', '' + CASE WHEN DBIO_AGAMA IS NULL THEN '''' ELSE RTRIM(DBIO_AGAMA) END + '', '' + CASE WHEN DBIO_PEKERJAAN IS NULL THEN '''' ELSE RTRIM(DBIO_PEKERJAAN) END, DBIO_UMUR, DBIO_KELAMIN FROM DATA_BIODATA WHERE FUNGSI=@__iFungsi ORDER BY DREG_ID,DATA_KE OPEN @cur_DAFTAR_PIHAK -- update data FETCH NEXT FROM @cur_DAFTAR_PIHAK INTO @__iDREGID, @__sIdentitas, @__sUmur, @__iKelamin

DEWASA_WANITA int, ANAK_PRIA int, ANAK_WANITA int)

SET SET SET SET

@__iDewasaP @__iDewasaW @__iAnakP = @__iAnakW =

= 0 = 0 0 0

SET @__iNo = 2 SET @__sTempBiodata = ''1. '' + @__sIdentitas SET @__iActiveDREGID = @__iDREGID IF @__iKelamin = 1 BEGIN IF @__sUmur > ''17'' SET @__iDewasaP ELSE SET @__iAnakP = END ELSE BEGIN IF @__sUmur > ''19'' SET @__iDewasaW ELSE SET @__iAnakW = END

= 1 1

= 1 1

WHILE 1=1 BEGIN FETCH NEXT FROM @cur_DAFTAR_PIHAK INTO @__iDREGID, @__sIdentitas, @__sUmur, @__iKelamin IF (@__iActiveDREGID <> @__iDREGID) OR (@@FETCH_STATUS <> 0) BEGIN -SET @__sTempBiodata = CASE WHEN @__iNo > 2 THEN ''1. '' + @__sTempBiodata ELSE @__sTempBiodata END INSERT INTO @TabelHasil (DREG_ID,BIODATA,DEWASA_PRIA,DEWASA_WANITA,ANAK_PRIA,ANAK_WANITA) VALUES (@__iActiveDREGID,@__sTempBiodata,@__iDewasaP,@__iDewasaW,@__iAnakP,@__ iAnakW) IF @@FETCH_STATUS <> 0 BEGIN BREAK END SET SET SET SET @__iDewasaP @__iDewasaW @__iAnakP = @__iAnakW = = 0 = 0 0 0

SET @__iNo = 2 SET @__sTempBiodata = ''1. '' + @__sIdentitas SET @__iActiveDREGID = @__iDREGID

IF @__iKelamin = 1 BEGIN IF @__sUmur > ''17'' SET @__iDewasaP ELSE SET @__iAnakP = END ELSE BEGIN IF @__sUmur > ''19'' SET @__iDewasaW ELSE SET @__iAnakW = END END ELSE BEGIN

= 1 1

= 1 1

SET @__sTempBiodata = @__sTempBiodata + ''<br><br>'' + RTRIM(CAST(@__iNo AS CHAR)) + ''. '' + @__sIdentitas SET @__iNo = @__iNo + 1 IF @__iKelamin = 1 BEGIN IF @__sUmur > ''17'' SET @__iDewasaP ELSE SET @__iAnakP = END ELSE BEGIN IF @__sUmur > ''19'' SET @__iDewasaW ELSE SET @__iAnakW = END END END CLOSE @cur_DAFTAR_PIHAK DEALLOCATE @cur_DAFTAR_PIHAK RETURN END' END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NamaParaPihak]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) BEGIN

= @__iDewasaP + 1 @__iAnakP + 1

= @__iDewasaW + 1 @__iAnakW + 1

execute dbo.sp_executesql @statement = N' CREATE FUNCTION [dbo].[NamaParaPihak](@__iFungsi int,@__iParDREGID bigint) RETURNS @TabelHasil TABLE (DREG_ID bigint, NAMA text) AS BEGIN DECLARE @__iDREGID bigint, @__iActiveDREGID bigint, @__sIdentitas varchar(8000), @__sTempBiodata varchar(8000), @__iNo int, @cur_DAFTAR_PIHAK CURSOR -- Deklarasi cursor IF @__iParDREGID=0 BEGIN SET @cur_DAFTAR_PIHAK = CURSOR FOR SELECT DREG_ID, CASE WHEN DBIO_NAMA IS NULL THEN '''' ELSE RTRIM(DBIO_NAMA) END FROM DATA_BIODATA WHERE FUNGSI=@__iFungsi ORDER BY DREG_ID,DATA_KE END ELSE BEGIN SET @cur_DAFTAR_PIHAK = CURSOR FOR SELECT DREG_ID, CASE WHEN DBIO_NAMA IS NULL THEN '''' ELSE RTRIM(DBIO_NAMA) END FROM DATA_BIODATA WHERE FUNGSI=@__iFungsi AND DREG_ID=@__iParDREGID ORDER BY DREG_ID,DATA_KE END OPEN @cur_DAFTAR_PIHAK FETCH NEXT FROM @cur_DAFTAR_PIHAK INTO @__iDREGID, @__sIdentitas SET @__sTempBiodata = @__sIdentitas SET @__iActiveDREGID = @__iDREGID SET @__iNo = 2 WHILE 1=1 BEGIN FETCH NEXT FROM @cur_DAFTAR_PIHAK INTO @__iDREGID, @__sIdentitas IF (@__iActiveDREGID <> @__iDREGID) OR (@@FETCH_STATUS <> 0) BEGIN SET @__sTempBiodata = CASE WHEN @__iNo > 2 THEN ''1. '' + @__sTempBiodata ELSE @__sTempBiodata END

INSERT INTO @TabelHasil (DREG_ID,NAMA) VALUES (@__iActiveDREGID,@__sTempBiodata) IF @@FETCH_STATUS <> 0 BEGIN BREAK END SET @__iNo = 2 SET @__sTempBiodata = @__sIdentitas SET @__iActiveDREGID = @__iDREGID

END ELSE BEGIN

SET @__sTempBiodata = @__sTempBiodata + CHAR(13) + RTRIM(CAST(@__iNo AS CHAR)) + ''. '' + @__sIdentitas SET @__iNo = @__iNo + 1 END END CLOSE @cur_DAFTAR_PIHAK DEALLOCATE @cur_DAFTAR_PIHAK RETURN END' END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RekapRiwayatPenahanan]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) BEGIN execute dbo.sp_executesql @statement = N' CREATE function [dbo].[RekapRiwayatPenahanan](@__iParDREGID bigint) returns @TabelHasil TABLE (DREG_ID bigint, RIWAYAT varchar(8000) ) AS begin DECLARE @__iDREGID bigint, @__iActiveDREGID bigint, @__MPejabatPenahanID bigint, @__sRiwayat varchar(8000), @__sTglMulai char(10), @__sTglSelesai char(10), --@__FirstExecute bit, @cur_DAFTAR_PENAHANAN CURSOR -- Deklarasi cursor if @__iParDREGID=0 begin

set @cur_DAFTAR_PENAHANAN = CURSOR FOR SELECT DREG_ID,MPPEN_ID,CONVERT(CHAR(10),DPEN_TGL_MULAI,106),CONVERT(CHAR(10), DPEN_TGL_SELESAI,106) FROM DATA_PENAHANAN ORDER BY DREG_ID,DPEN_TANGGAL,DPEN_TGL_MULAI end else begin set @cur_DAFTAR_PENAHANAN = CURSOR FOR SELECT DREG_ID,MPPEN_ID,CONVERT(CHAR(10),DPEN_TGL_MULAI,106),CONVERT(CHAR(10), DPEN_TGL_SELESAI,106) FROM DATA_PENAHANAN WHERE DREG_ID=@__iParDREGID ORDER BY DREG_ID,DPEN_TANGGAL,DPEN_TGL_MULAI end OPEN @cur_DAFTAR_PENAHANAN -- update data --FETCH NEXT FROM @cur_DAFTAR_PENAHANAN INTO @__iDREGID, @__MPejabatPenahanID, @__sTglMulai, @__sTglSelesai --set @__FirstExecute=1 set @__sRiwayat = '''' set @__iActiveDREGID = 0--@__iDREGID WHILE 1=1 begin FETCH NEXT FROM @cur_DAFTAR_PENAHANAN INTO @__iDREGID, @__MPejabatPenahanID, @__sTglMulai, @__sTglSelesai if (@__iActiveDREGID <> @__iDREGID) OR (@@FETCH_STATUS <> 0) begin INSERT INTO @TabelHasil (DREG_ID,RIWAYAT ) VALUES (@__iActiveDREGID,SUBSTRING(@__sRiwayat,3,8000)) if @@FETCH_STATUS <> 0 begin BREAK end set @__sRiwayat = '''' set @__iActiveDREGID = @__iDREGID -/* 1 2 end --if ELSE begin Penyidik Penuntut Umum

3 8 10 12 14 16 */

Ketua Hakim Ketua Hakim Ketua Hakim

PN PT (1) Tinggi (1) MA (1) Agung (1) = 1 /* Penyidik */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai = 2 /* Penuntut Umum */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai = 3 /* Ketua PN */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai = 8 /* Hakim */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai = 10 /* Ketua PT */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai = 12 /* Hakim Tinggi */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai = 14 /* Ketua MA */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai = 16 /* Hakim Agung */ @__sRiwayat + CHAR(13) + CHAR(10) + @__sTglSelesai

if @__MPejabatPenahanID begin set @__sRiwayat = ''a.'' + @__sTglMulai + '' s/d '' + end ELSE if @__MPejabatPenahanID begin set @__sRiwayat = ''b.'' + @__sTglMulai + '' s/d '' + end else if @__MPejabatPenahanID begin set @__sRiwayat = ''c.'' + @__sTglMulai + '' s/d '' + end else if @__MPejabatPenahanID begin set @__sRiwayat = ''c.'' + @__sTglMulai + '' s/d '' + end else if @__MPejabatPenahanID begin set @__sRiwayat = ''d.'' + @__sTglMulai + '' s/d '' + end else if @__MPejabatPenahanID begin set @__sRiwayat = ''d.'' + @__sTglMulai + '' s/d '' + end else if @__MPejabatPenahanID begin set @__sRiwayat = ''e.'' + @__sTglMulai + '' s/d '' + end else if @__MPejabatPenahanID begin set @__sRiwayat = ''e.'' + @__sTglMulai + '' s/d '' + end end --else end --while

CLOSE @cur_DAFTAR_PENAHANAN DEALLOCATE @cur_DAFTAR_PENAHANAN return end --create function' END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RiwayatPenahanan]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) BEGIN execute dbo.sp_executesql @statement = N' CREATE function [dbo].[RiwayatPenahanan](@__iParDREGID bigint) returns @TabelHasil TABLE (DREG_ID bigint, PENYIDIK_1 BIGINT, PENYIDIK_2 BIGINT, PENYIDIK_3 BIGINT, PENYIDIK_4 BIGINT, JAKSA_1 BIGINT, JAKSA_2 BIGINT, JAKSA_3 BIGINT, JAKSA_4 BIGINT, KETUA_PN_1 BIGINT, KETUA_PN_2 BIGINT, KETUA_PN_3 BIGINT, KETUA_PN_4 BIGINT, HAKIM_1 BIGINT, HAKIM_2 BIGINT, HAKIM_3 BIGINT, HAKIM_4 BIGINT, KETUA_PT_1 BIGINT, KETUA_PT_2 BIGINT, KETUA_PT_3 BIGINT, KETUA_PT_4 BIGINT, HAKIM_TINGGI_1 BIGINT, HAKIM_TINGGI_2 BIGINT, HAKIM_TINGGI_3 BIGINT, HAKIM_TINGGI_4 BIGINT, KETUA_MA_1 BIGINT, KETUA_MA_2 BIGINT, KETUA_MA_3 BIGINT, KETUA_MA_4 BIGINT, HAKIM_AGUNG_1 BIGINT, HAKIM_AGUNG_2 BIGINT, HAKIM_AGUNG_3 BIGINT, HAKIM_AGUNG_4 BIGINT ) AS begin DECLARE @__iDREGID bigint,

@__iActiveDREGID bigint, @__iDataID bigint, @__MPejabatPenahanID bigint, @__PENYIDIK_1 BIGINT, @__PENYIDIK_2 BIGINT, @__PENYIDIK_3 BIGINT, @__PENYIDIK_4 BIGINT, @__JAKSA_1 BIGINT, @__JAKSA_2 BIGINT, @__JAKSA_3 BIGINT, @__JAKSA_4 BIGINT, @__KETUA_PN_1 BIGINT, @__KETUA_PN_2 BIGINT, @__KETUA_PN_3 BIGINT, @__KETUA_PN_4 BIGINT, @__HAKIM_1 BIGINT, @__HAKIM_2 BIGINT, @__HAKIM_3 BIGINT, @__HAKIM_4 BIGINT, @__KETUA_PT_1 BIGINT, @__KETUA_PT_2 BIGINT, @__KETUA_PT_3 BIGINT, @__KETUA_PT_4 BIGINT, @__HAKIM_TINGGI_1 BIGINT, @__HAKIM_TINGGI_2 BIGINT, @__HAKIM_TINGGI_3 BIGINT, @__HAKIM_TINGGI_4 BIGINT, @__KETUA_MA_1 BIGINT, @__KETUA_MA_2 BIGINT, @__KETUA_MA_3 BIGINT, @__KETUA_MA_4 BIGINT, @__HAKIM_AGUNG_1 BIGINT, @__HAKIM_AGUNG_2 BIGINT, @__HAKIM_AGUNG_3 BIGINT, @__HAKIM_AGUNG_4 BIGINT, @cur_DAFTAR_PENAHANAN CURSOR -- Deklarasi cursor if @__iParDREGID=0 begin set @cur_DAFTAR_PENAHANAN = CURSOR FOR SELECT DREG_ID,DATA_ID,MPPEN_ID FROM DATA_PENAHANAN ORDER BY DREG_ID,DPEN_TANGGAL,DPEN_TGL_MULAI end else begin set @cur_DAFTAR_PENAHANAN = CURSOR FOR SELECT DREG_ID,DATA_ID,MPPEN_ID FROM DATA_PENAHANAN WHERE DREG_ID=@__iParDREGID ORDER BY DREG_ID,DPEN_TANGGAL,DPEN_TGL_MULAI end OPEN @cur_DAFTAR_PENAHANAN

-- update data --FETCH NEXT FROM @cur_DAFTAR_PENAHANAN INTO @__iDREGID, @__iDataID, @__MPejabatPenahanID set set set set set set set set set set set set set set set set set set set set set set set set set set set set set set set set @__PENYIDIK_1 = 0 @__PENYIDIK_2 = 0 @__PENYIDIK_3 = 0 @__PENYIDIK_4 = 0 @__JAKSA_1 = 0 @__JAKSA_2 = 0 @__JAKSA_3 = 0 @__JAKSA_4 = 0 @__KETUA_PN_1 = 0 @__KETUA_PN_2 = 0 @__KETUA_PN_3 = 0 @__KETUA_PN_4 = 0 @__HAKIM_1 = 0 @__HAKIM_2 = 0 @__HAKIM_3 = 0 @__HAKIM_4 = 0 @__KETUA_PT_1 = 0 @__KETUA_PT_2 = 0 @__KETUA_PT_3 = 0 @__KETUA_PT_4 = 0 @__HAKIM_TINGGI_1 = 0 @__HAKIM_TINGGI_2 = 0 @__HAKIM_TINGGI_3 = 0 @__HAKIM_TINGGI_4 = 0 @__KETUA_MA_1 = 0 @__KETUA_MA_2 = 0 @__KETUA_MA_3 = 0 @__KETUA_MA_4 = 0 @__HAKIM_AGUNG_1 = 0 @__HAKIM_AGUNG_2 = 0 @__HAKIM_AGUNG_3 = 0 @__HAKIM_AGUNG_4 = 0

set @__iActiveDREGID = 0--@__iDREGID WHILE 1=1 begin FETCH NEXT FROM @cur_DAFTAR_PENAHANAN INTO @__iDREGID, @__iDataID, @__MPejabatPenahanID if (@__iActiveDREGID <> @__iDREGID) OR (@@FETCH_STATUS <> 0) begin INSERT INTO @TabelHasil (DREG_ID, PENYIDIK_1, PENYIDIK_2, PENYIDIK_3, PENYIDIK_4, JAKSA_1, JAKSA_2, JAKSA_3,

JAKSA_4, KETUA_PN_1, KETUA_PN_2, KETUA_PN_3, KETUA_PN_4, HAKIM_1, HAKIM_2, HAKIM_3, HAKIM_4, KETUA_PT_1, KETUA_PT_2, KETUA_PT_3, KETUA_PT_4, HAKIM_TINGGI_1, HAKIM_TINGGI_2, HAKIM_TINGGI_3, HAKIM_TINGGI_4, KETUA_MA_1, KETUA_MA_2, KETUA_MA_3, KETUA_MA_4, HAKIM_AGUNG_1, HAKIM_AGUNG_2, HAKIM_AGUNG_3, HAKIM_AGUNG_4 ) VALUES (@__iActiveDREGID, @__PENYIDIK_1, @__PENYIDIK_2, @__PENYIDIK_3, @__PENYIDIK_4, @__JAKSA_1, @__JAKSA_2, @__JAKSA_3, @__JAKSA_4, @__KETUA_PN_1, @__KETUA_PN_2, @__KETUA_PN_3, @__KETUA_PN_4, @__HAKIM_1, @__HAKIM_2, @__HAKIM_3, @__HAKIM_4, @__KETUA_PT_1, @__KETUA_PT_2, @__KETUA_PT_3, @__KETUA_PT_4, @__HAKIM_TINGGI_1, @__HAKIM_TINGGI_2, @__HAKIM_TINGGI_3, @__HAKIM_TINGGI_4, @__KETUA_MA_1, @__KETUA_MA_2, @__KETUA_MA_3, @__KETUA_MA_4, @__HAKIM_AGUNG_1, @__HAKIM_AGUNG_2,

@__HAKIM_AGUNG_3, @__HAKIM_AGUNG_4) if @@FETCH_STATUS <> 0 begin BREAK end set set set set set set set set set set set set set set set set set set set set set set set set set set set set set set set set -/* 1 @__PENYIDIK_1 = 0 @__PENYIDIK_2 = 0 @__PENYIDIK_3 = 0 @__PENYIDIK_4 = 0 @__JAKSA_1 = 0 @__JAKSA_2 = 0 @__JAKSA_3 = 0 @__JAKSA_4 = 0 @__KETUA_PN_1 = 0 @__KETUA_PN_2 = 0 @__KETUA_PN_3 = 0 @__KETUA_PN_4 = 0 @__HAKIM_1 = 0 @__HAKIM_2 = 0 @__HAKIM_3 = 0 @__HAKIM_4 = 0 @__KETUA_PT_1 = 0 @__KETUA_PT_2 = 0 @__KETUA_PT_3 = 0 @__KETUA_PT_4 = 0 @__HAKIM_TINGGI_1 = 0 @__HAKIM_TINGGI_2 = 0 @__HAKIM_TINGGI_3 = 0 @__HAKIM_TINGGI_4 = 0 @__KETUA_MA_1 = 0 @__KETUA_MA_2 = 0 @__KETUA_MA_3 = 0 @__KETUA_MA_4 = 0 @__HAKIM_AGUNG_1 = 0 @__HAKIM_AGUNG_2 = 0 @__HAKIM_AGUNG_3 = 0 @__HAKIM_AGUNG_4 = 0 set @__iActiveDREGID = @__iDREGID end --if ELSE begin Penyidik Penuntut Umum Ketua PN Hakim Ketua PT (1) Hakim Tinggi (1) Ketua MA (1) Hakim Agung (1) if @__MPejabatPenahanID = 1 /* Penyidik */

2 3 8 10 12 14 16

*/

begin

if @__PENYIDIK_1 = 0 begin set @__PENYIDIK_1 end else if @__PENYIDIK_2 = 0 begin set @__PENYIDIK_2 end else if @__PENYIDIK_3 = 0 begin set @__PENYIDIK_3 end else if @__PENYIDIK_4 = 0 begin set @__PENYIDIK_4 end

= @__iDataID

= @__iDataID

= @__iDataID

= @__iDataID

end ELSE if @__MPejabatPenahanID = 2 /* Penuntut Umum */ begin if @__JAKSA_1 = 0 begin set @__JAKSA_1 = @__iDataID end else if @__JAKSA_2 = 0 begin set @__JAKSA_2 = @__iDataID end else if @__JAKSA_3 = 0 begin set @__JAKSA_3 = @__iDataID end else if @__JAKSA_4 = 0 begin set @__JAKSA_4 = @__iDataID end end else if @__MPejabatPenahanID = 3 /* Ketua PN */ begin if @__KETUA_PN_1 = 0 begin set @__KETUA_PN_1 = @__iDataID end else if @__KETUA_PN_2 = 0 begin set @__KETUA_PN_2 = @__iDataID end else

end else if @__MPejabatPenahanID = 8 /* Hakim */ begin if @__HAKIM_1 = 0 begin set @__HAKIM_1 = @__iDataID end else if @__HAKIM_2 = 0 begin set @__HAKIM_2 = @__iDataID end else if @__HAKIM_3 = 0 begin set @__HAKIM_3 = @__iDataID end else if @__HAKIM_4 = 0 begin set @__HAKIM_4 = @__iDataID end end else if @__MPejabatPenahanID = 10 /* Ketua PT */ begin if @__KETUA_PT_1 = 0 begin set @__KETUA_PT_1 = @__iDataID end else if @__KETUA_PT_2 = 0 begin set @__KETUA_PT_2 = @__iDataID end else if @__KETUA_PT_3 = 0 begin set @__KETUA_PT_3 = @__iDataID end else if @__KETUA_PT_4 = 0 begin set @__KETUA_PT_4 = @__iDataID end end else

if @__KETUA_PN_3 = 0 begin set @__KETUA_PN_3 = @__iDataID end else if @__KETUA_PN_4 = 0 begin set @__KETUA_PN_4 = @__iDataID end

if @__MPejabatPenahanID = 12 /* Hakim Tinggi */ begin if @__HAKIM_TINGGI_1 = 0 begin set @__HAKIM_TINGGI_1 = @__iDataID end else if @__HAKIM_TINGGI_2 = 0 begin set @__HAKIM_TINGGI_2 = @__iDataID end else if @__HAKIM_TINGGI_3 = 0 begin set @__HAKIM_TINGGI_3 = @__iDataID end else if @__HAKIM_TINGGI_4 = 0 begin set @__HAKIM_TINGGI_4 = @__iDataID end end else if @__MPejabatPenahanID = 14 /* Ketua MA */ begin if @__KETUA_MA_1 = 0 begin set @__KETUA_MA_1 = @__iDataID end else if @__KETUA_MA_2 = 0 begin set @__KETUA_MA_2 = @__iDataID end else if @__KETUA_MA_3 = 0 begin set @__KETUA_MA_3 = @__iDataID end else if @__KETUA_MA_4 = 0 begin set @__KETUA_MA_4 = @__iDataID end end else if @__MPejabatPenahanID = 16 /* Hakim Agung */ begin if @__HAKIM_AGUNG_1 = 0 begin set @__HAKIM_AGUNG_1 = @__iDataID end else if @__HAKIM_AGUNG_2 = 0 begin set @__HAKIM_AGUNG_2 = @__iDataID end

else if @__HAKIM_AGUNG_3 = 0 begin set @__HAKIM_AGUNG_3 = @__iDataID end else if @__HAKIM_AGUNG_4 = 0 begin set @__HAKIM_AGUNG_4 = @__iDataID end end end --else end --while CLOSE @cur_DAFTAR_PENAHANAN DEALLOCATE @cur_DAFTAR_PENAHANAN return end --create function' END GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RiwayatSidang]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) BEGIN execute dbo.sp_executesql @statement = N' CREATE FUNCTION [dbo].[RiwayatSidang]() RETURNS @TabelHasil TABLE (DREG_ID bigint, RIWAYAT_SIDANG text) AS BEGIN DECLARE @__iDREGID bigint, @__iActiveDREGID bigint, @__sTglSidang CHAR(10), @__sAlasanTunda VARCHAR(1000), @__sTempSidang varchar(8000), @cur_DAFTAR_SIDANG CURSOR -- Deklarasi cursor SET @cur_DAFTAR_SIDANG = CURSOR FOR SELECT DREG_ID, CASE WHEN DSID_TANGGAL IS NULL THEN '''' ELSE RTRIM(CONVERT(CHAR,DSID_TANGGAL,106)) END, CASE WHEN DSID_HASIL IS NULL THEN '''' ELSE DSID_HASIL END FROM DATA_SIDANG ORDER BY DREG_ID,DSID_TANGGAL OPEN @cur_DAFTAR_SIDANG

-- update data FETCH NEXT FROM @cur_DAFTAR_SIDANG INTO @__iDREGID, @__sTglSidang, @__sAlasanTunda SET @__sTempSidang = @__sTglSidang SET @__iActiveDREGID = @__iDREGID WHILE 1=1 BEGIN FETCH NEXT FROM @cur_DAFTAR_SIDANG INTO @__iDREGID, @__sTglSidang, @__sAlasanTunda IF (@__iActiveDREGID <> @__iDREGID) OR (@@FETCH_STATUS <> 0) BEGIN INSERT INTO @TabelHasil (DREG_ID,RIWAYAT_SIDANG) VALUES (@__iActiveDREGID,@__sTempSidang) IF @@FETCH_STATUS <> 0 BEGIN BREAK END SET @__sTempSidang = @__sTglSidang SET @__iActiveDREGID = @__iDREGID

END ELSE BEGIN

SET @__sTempSidang = @__sTempSidang + char(13) + char(10) + ''c. '' + @__sTglSidang + char(13) + char(10) + ''d. '' + @__sAlasanTunda END END CLOSE @cur_DAFTAR_SIDANG DEALLOCATE @cur_DAFTAR_SIDANG RETURN END' END