USE [AJK]
GO
/****** Object:  Trigger [CreateUserCompanyCode]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[CreateUserCompanyCode]'))
DROP TRIGGER [dbo].[CreateUserCompanyCode]
GO
/****** Object:  Trigger [CreateCompanyRegionCode]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[CreateCompanyRegionCode]'))
DROP TRIGGER [dbo].[CreateCompanyRegionCode]
GO
/****** Object:  Trigger [trig_insert_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[trig_insert_claim]'))
DROP TRIGGER [dbo].[trig_insert_claim]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_user_status]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_user_status]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_set_user_status]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_status_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_status_claim]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_set_status_claim]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_password]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_password]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_set_password]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_cancel_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_cancel_claim]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_set_cancel_claim]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_branch_status]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_branch_status]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_set_branch_status]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_amount_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_amount_claim]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_set_amount_claim]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_user]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_user]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_save_user]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_group_menu]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_save_group_menu]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_claim]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_save_claim]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_branch]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_branch]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_save_branch]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_process_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_process_claim]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_process_claim]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_lookup_customer]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_lookup_customer]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_lookup_customer]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_get_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_get_menu]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_get_menu]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_get_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_get_group_menu]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_get_group_menu]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_delete_document]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_delete_document]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_delete_document]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_del_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_del_group_menu]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_del_group_menu]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_claim_history]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_claim_history]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_claim_history]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_claim_document]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_claim_document]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_claim_document]
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_app_action_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_app_action_claim]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[proc_custport_app_action_claim]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___role___0D70AC3C]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user_role]'))
ALTER TABLE [dbo].[custport_m_user_role] DROP CONSTRAINT [FK__custport___role___0D70AC3C]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__04DB663B]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]'))
ALTER TABLE [dbo].[custport_m_user_company] DROP CONSTRAINT [FK__custport___compa__04DB663B]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___user___73B0DA39]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user]'))
ALTER TABLE [dbo].[custport_m_user] DROP CONSTRAINT [FK__custport___user___73B0DA39]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___role___7F228CE5]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]'))
ALTER TABLE [dbo].[custport_m_role_menu] DROP CONSTRAINT [FK__custport___role___7F228CE5]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___menu___0016B11E]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]'))
ALTER TABLE [dbo].[custport_m_role_menu] DROP CONSTRAINT [FK__custport___menu___0016B11E]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___trans__16FA1676]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_flow]'))
ALTER TABLE [dbo].[custport_m_flow] DROP CONSTRAINT [FK__custport___trans__16FA1676]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__6D03DCAA]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_company_region]'))
ALTER TABLE [dbo].[custport_m_company_region] DROP CONSTRAINT [FK__custport___compa__6D03DCAA]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__69334BC6]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_company_policy]'))
ALTER TABLE [dbo].[custport_m_company_policy] DROP CONSTRAINT [FK__custport___compa__69334BC6]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__263C5A06]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]'))
ALTER TABLE [dbo].[custport_m_claim_document] DROP CONSTRAINT [FK__custport___docum__263C5A06]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___claim__254835CD]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]'))
ALTER TABLE [dbo].[custport_m_claim_document] DROP CONSTRAINT [FK__custport___claim__254835CD]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__3F0807D0]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim_document_file]'))
ALTER TABLE [dbo].[custport_claim_document_file] DROP CONSTRAINT [FK__custport___docum__3F0807D0]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__3A4352B3]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim_document]'))
ALTER TABLE [dbo].[custport_claim_document] DROP CONSTRAINT [FK__custport___docum__3A4352B3]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___curre__33965524]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim]'))
ALTER TABLE [dbo].[custport_claim] DROP CONSTRAINT [FK__custport___curre__33965524]
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___claim__32A230EB]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim]'))
ALTER TABLE [dbo].[custport_claim] DROP CONSTRAINT [FK__custport___claim__32A230EB]
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_custport_s_log_date]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[custport_s_log] DROP CONSTRAINT [DF_custport_s_log_date]
END

GO
/****** Object:  Index [IX_custport_s_action_list_act_name]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_action_list]') AND name = N'IX_custport_s_action_list_act_name')
ALTER TABLE [dbo].[custport_s_action_list] DROP CONSTRAINT [IX_custport_s_action_list_act_name]
GO
/****** Object:  Index [UQ__custport__9424CFA7F3CCF690]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_type]') AND name = N'UQ__custport__9424CFA7F3CCF690')
ALTER TABLE [dbo].[custport_m_user_type] DROP CONSTRAINT [UQ__custport__9424CFA7F3CCF690]
GO
/****** Object:  Index [UQ__custport__B8D9ABA33275BF14]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_role]') AND name = N'UQ__custport__B8D9ABA33275BF14')
ALTER TABLE [dbo].[custport_m_user_role] DROP CONSTRAINT [UQ__custport__B8D9ABA33275BF14]
GO
/****** Object:  Index [UQ_custport_m_user_company_code]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]') AND name = N'UQ_custport_m_user_company_code')
ALTER TABLE [dbo].[custport_m_user_company] DROP CONSTRAINT [UQ_custport_m_user_company_code]
GO
/****** Object:  Index [UQ__custport__BFBB645394842EFE]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]') AND name = N'UQ__custport__BFBB645394842EFE')
ALTER TABLE [dbo].[custport_m_user_company] DROP CONSTRAINT [UQ__custport__BFBB645394842EFE]
GO
/****** Object:  Index [UQ_custport_m_user_username]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user]') AND name = N'UQ_custport_m_user_username')
ALTER TABLE [dbo].[custport_m_user] DROP CONSTRAINT [UQ_custport_m_user_username]
GO
/****** Object:  Index [UQ__custport__B9BE370E7A9BCB7D]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user]') AND name = N'UQ__custport__B9BE370E7A9BCB7D')
ALTER TABLE [dbo].[custport_m_user] DROP CONSTRAINT [UQ__custport__B9BE370E7A9BCB7D]
GO
/****** Object:  Index [UQ__custport__439ABFC09A999CFD]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_transaction_type]') AND name = N'UQ__custport__439ABFC09A999CFD')
ALTER TABLE [dbo].[custport_m_transaction_type] DROP CONSTRAINT [UQ__custport__439ABFC09A999CFD]
GO
/****** Object:  Index [UQ__custport__3683B5304EDE7025]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_status]') AND name = N'UQ__custport__3683B5304EDE7025')
ALTER TABLE [dbo].[custport_m_status] DROP CONSTRAINT [UQ__custport__3683B5304EDE7025]
GO
/****** Object:  Index [UQ__custport__7101AE8BA1E4DB3B]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]') AND name = N'UQ__custport__7101AE8BA1E4DB3B')
ALTER TABLE [dbo].[custport_m_role_menu] DROP CONSTRAINT [UQ__custport__7101AE8BA1E4DB3B]
GO
/****** Object:  Index [UQ__custport__760965CD51115919]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role]') AND name = N'UQ__custport__760965CD51115919')
ALTER TABLE [dbo].[custport_m_role] DROP CONSTRAINT [UQ__custport__760965CD51115919]
GO
/****** Object:  Index [UK_reason_type_code]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason_type]') AND name = N'UK_reason_type_code')
ALTER TABLE [dbo].[custport_m_reason_type] DROP CONSTRAINT [UK_reason_type_code]
GO
/****** Object:  Index [UQ__custport__846BB555E0871C78]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason]') AND name = N'UQ__custport__846BB555E0871C78')
ALTER TABLE [dbo].[custport_m_reason] DROP CONSTRAINT [UQ__custport__846BB555E0871C78]
GO
/****** Object:  Index [UQ__custport__4CA0FADD440CBC23]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_menu]') AND name = N'UQ__custport__4CA0FADD440CBC23')
ALTER TABLE [dbo].[custport_m_menu] DROP CONSTRAINT [UQ__custport__4CA0FADD440CBC23]
GO
/****** Object:  Index [UQ__custport__CEADC453ABE97402]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_stage]') AND name = N'UQ__custport__CEADC453ABE97402')
ALTER TABLE [dbo].[custport_m_flow_stage] DROP CONSTRAINT [UQ__custport__CEADC453ABE97402]
GO
/****** Object:  Index [IX_custport_m_flow_stage_code]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_stage]') AND name = N'IX_custport_m_flow_stage_code')
ALTER TABLE [dbo].[custport_m_flow_stage] DROP CONSTRAINT [IX_custport_m_flow_stage_code]
GO
/****** Object:  Index [UQ__custport__08AE9413EA792413]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_action]') AND name = N'UQ__custport__08AE9413EA792413')
ALTER TABLE [dbo].[custport_m_flow_action] DROP CONSTRAINT [UQ__custport__08AE9413EA792413]
GO
/****** Object:  Index [UK_custport_m_flow_action_code]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_action]') AND name = N'UK_custport_m_flow_action_code')
ALTER TABLE [dbo].[custport_m_flow_action] DROP CONSTRAINT [UK_custport_m_flow_action_code]
GO
/****** Object:  Index [UQ__custport__1DDE38A2CA66FCDC]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow]') AND name = N'UQ__custport__1DDE38A2CA66FCDC')
ALTER TABLE [dbo].[custport_m_flow] DROP CONSTRAINT [UQ__custport__1DDE38A2CA66FCDC]
GO
/****** Object:  Index [UK_custport_m_flow_flow_code]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow]') AND name = N'UK_custport_m_flow_flow_code')
ALTER TABLE [dbo].[custport_m_flow] DROP CONSTRAINT [UK_custport_m_flow_flow_code]
GO
/****** Object:  Index [UQ__custport__9666E8AD91275F46]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_document]') AND name = N'UQ__custport__9666E8AD91275F46')
ALTER TABLE [dbo].[custport_m_document] DROP CONSTRAINT [UQ__custport__9666E8AD91275F46]
GO
/****** Object:  Index [UQ__custport__C7F543D2E3067840]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_currency]') AND name = N'UQ__custport__C7F543D2E3067840')
ALTER TABLE [dbo].[custport_m_currency] DROP CONSTRAINT [UQ__custport__C7F543D2E3067840]
GO
/****** Object:  Index [UQ__custport__CAB9B8D17321E5ED]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_region]') AND name = N'UQ__custport__CAB9B8D17321E5ED')
ALTER TABLE [dbo].[custport_m_company_region] DROP CONSTRAINT [UQ__custport__CAB9B8D17321E5ED]
GO
/****** Object:  Index [UQ__custport__C7D57972C045D6EF]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_policy]') AND name = N'UQ__custport__C7D57972C045D6EF')
ALTER TABLE [dbo].[custport_m_company_policy] DROP CONSTRAINT [UQ__custport__C7D57972C045D6EF]
GO
/****** Object:  Index [UQ__custport__3E2672346D3D505E]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company]') AND name = N'UQ__custport__3E2672346D3D505E')
ALTER TABLE [dbo].[custport_m_company] DROP CONSTRAINT [UQ__custport__3E2672346D3D505E]
GO
/****** Object:  Index [IX_custport_m_bank_bank_name]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_bank]') AND name = N'IX_custport_m_bank_bank_name')
ALTER TABLE [dbo].[custport_m_bank] DROP CONSTRAINT [IX_custport_m_bank_bank_name]
GO
/****** Object:  Index [UK_custport_claim_document_file_code]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_document_file]') AND name = N'UK_custport_claim_document_file_code')
ALTER TABLE [dbo].[custport_claim_document_file] DROP CONSTRAINT [UK_custport_claim_document_file_code]
GO
/****** Object:  Index [UK_custport_claim_claim_no]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim]') AND name = N'UK_custport_claim_claim_no')
ALTER TABLE [dbo].[custport_claim] DROP CONSTRAINT [UK_custport_claim_claim_no]
GO
/****** Object:  View [dbo].[view_custport_valuta]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_valuta]'))
DROP VIEW [dbo].[view_custport_valuta]
GO
/****** Object:  View [dbo].[view_custport_user]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_user]'))
DROP VIEW [dbo].[view_custport_user]
GO
/****** Object:  View [dbo].[view_custport_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_group_menu]'))
DROP VIEW [dbo].[view_custport_group_menu]
GO
/****** Object:  View [dbo].[view_custport_flow]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_flow]'))
DROP VIEW [dbo].[view_custport_flow]
GO
/****** Object:  View [dbo].[view_custport_company_region]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_company_region]'))
DROP VIEW [dbo].[view_custport_company_region]
GO
/****** Object:  View [dbo].[view_custport_claim_history]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim_history]'))
DROP VIEW [dbo].[view_custport_claim_history]
GO
/****** Object:  View [dbo].[view_custport_claim_document_file]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim_document_file]'))
DROP VIEW [dbo].[view_custport_claim_document_file]
GO
/****** Object:  View [dbo].[view_custport_claim_document]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim_document]'))
DROP VIEW [dbo].[view_custport_claim_document]
GO
/****** Object:  View [dbo].[view_custport_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim]'))
DROP VIEW [dbo].[view_custport_claim]
GO
/****** Object:  View [dbo].[view_custport_bank]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_bank]'))
DROP VIEW [dbo].[view_custport_bank]
GO
/****** Object:  View [dbo].[view_custport_app_list_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_app_list_claim]'))
DROP VIEW [dbo].[view_custport_app_list_claim]
GO
/****** Object:  UserDefinedFunction [dbo].[func_custport_list_inpayment]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[func_custport_list_inpayment]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[func_custport_list_inpayment]
GO
/****** Object:  UserDefinedFunction [dbo].[func_custport_list_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[func_custport_list_claim]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[func_custport_list_claim]
GO
/****** Object:  Table [dbo].[custport_s_user_session]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_user_session]') AND type in (N'U'))
DROP TABLE [dbo].[custport_s_user_session]
GO
/****** Object:  Table [dbo].[custport_s_log]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_log]') AND type in (N'U'))
DROP TABLE [dbo].[custport_s_log]
GO
/****** Object:  Table [dbo].[custport_s_error_code]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_error_code]') AND type in (N'U'))
DROP TABLE [dbo].[custport_s_error_code]
GO
/****** Object:  Table [dbo].[custport_s_action_type]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_action_type]') AND type in (N'U'))
DROP TABLE [dbo].[custport_s_action_type]
GO
/****** Object:  Table [dbo].[custport_s_action_list]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_action_list]') AND type in (N'U'))
DROP TABLE [dbo].[custport_s_action_list]
GO
/****** Object:  Table [dbo].[custport_m_user_type]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_type]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_user_type]
GO
/****** Object:  Table [dbo].[custport_m_user_role]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_role]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_user_role]
GO
/****** Object:  Table [dbo].[custport_m_user_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_group_menu]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_user_group_menu]
GO
/****** Object:  Table [dbo].[custport_m_user_company]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_user_company]
GO
/****** Object:  Table [dbo].[custport_m_user]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_user]
GO
/****** Object:  Table [dbo].[custport_m_transaction_type]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_transaction_type]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_transaction_type]
GO
/****** Object:  Table [dbo].[custport_m_status]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_status]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_status]
GO
/****** Object:  Table [dbo].[custport_m_role_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_role_menu]
GO
/****** Object:  Table [dbo].[custport_m_role]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_role]
GO
/****** Object:  Table [dbo].[custport_m_reason_type]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason_type]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_reason_type]
GO
/****** Object:  Table [dbo].[custport_m_reason]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_reason]
GO
/****** Object:  Table [dbo].[custport_m_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_menu]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_menu]
GO
/****** Object:  Table [dbo].[custport_m_mapp_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_mapp_menu]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_mapp_menu]
GO
/****** Object:  Table [dbo].[custport_m_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_group_menu]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_group_menu]
GO
/****** Object:  Table [dbo].[custport_m_flow_stage]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_stage]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_flow_stage]
GO
/****** Object:  Table [dbo].[custport_m_flow_action]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_action]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_flow_action]
GO
/****** Object:  Table [dbo].[custport_m_flow]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_flow]
GO
/****** Object:  Table [dbo].[custport_m_document]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_document]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_document]
GO
/****** Object:  Table [dbo].[custport_m_currency]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_currency]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_currency]
GO
/****** Object:  Table [dbo].[custport_m_company_region]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_region]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_company_region]
GO
/****** Object:  Table [dbo].[custport_m_company_policy]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_policy]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_company_policy]
GO
/****** Object:  Table [dbo].[custport_m_company]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_company]
GO
/****** Object:  Table [dbo].[custport_m_claim_type]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_claim_type]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_claim_type]
GO
/****** Object:  Table [dbo].[custport_m_claim_document]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_claim_document]
GO
/****** Object:  Table [dbo].[custport_m_bank]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_bank]') AND type in (N'U'))
DROP TABLE [dbo].[custport_m_bank]
GO
/****** Object:  Table [dbo].[custport_claim_history]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_history]') AND type in (N'U'))
DROP TABLE [dbo].[custport_claim_history]
GO
/****** Object:  Table [dbo].[custport_claim_document_file]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_document_file]') AND type in (N'U'))
DROP TABLE [dbo].[custport_claim_document_file]
GO
/****** Object:  Table [dbo].[custport_claim_document]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_document]') AND type in (N'U'))
DROP TABLE [dbo].[custport_claim_document]
GO
/****** Object:  Table [dbo].[custport_claim]    Script Date: 13/09/2018 17:17:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim]') AND type in (N'U'))
DROP TABLE [dbo].[custport_claim]
GO
/****** Object:  Table [dbo].[custport_claim]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_claim](
	[claim_id] [int] IDENTITY(1,1) NOT NULL,
	[claim_no] [varchar](50) NOT NULL,
	[no_polis] [varchar](13) NULL,
	[id_peserta] [varchar](12) NULL,
	[certificate_no] [varchar](20) NOT NULL,
	[contract_no] [varchar](20) NOT NULL,
	[customer_name] [varchar](100) NOT NULL,
	[register_date] [date] NULL,
	[event_date] [date] NULL,
	[claim_type_code] [varchar](50) NOT NULL,
	[currency_code] [varchar](50) NULL,
	[claim_amount] [decimal](12, 2) NULL,
	[reference_no] [varchar](20) NULL,
	[status_code] [varchar](50) NOT NULL,
	[flow_stage_code] [varchar](50) NULL,
	[reason_code] [varchar](50) NULL,
	[notes] [varchar](600) NULL,
	[alt_phone] [varchar](50) NULL,
	[alt_email] [varchar](100) NULL,
	[account_no] [varchar](50) NULL,
	[account_beneficiary] [varchar](80) NULL,
	[account_currency_code] [varchar](5) NULL,
	[bank_id] [int] NULL,
	[bank_name] [varchar](100) NULL,
	[bank_code] [varchar](5) NULL,
	[bank_branch] [varchar](50) NULL,
	[company_code] [varchar](10) NULL,
	[company_region_code] [varchar](10) NULL,
	[tmp_guid] [varchar](50) NULL,
	[id_klaim_core] [varchar](12) NULL,
	[complete_doc_date] [datetime] NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK__custport__F9CC114572348F26] PRIMARY KEY CLUSTERED 
(
	[claim_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_claim_document]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_document]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_claim_document](
	[claim_document_id] [int] IDENTITY(1,1) NOT NULL,
	[claim_document_code] [varchar](50) NOT NULL,
	[claim_no] [varchar](50) NOT NULL,
	[document_code] [varchar](50) NOT NULL,
	[is_mandatory] [bit] NOT NULL,
	[description] [varchar](150) NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK__custport__5DEC7EA4CE7EF612] PRIMARY KEY CLUSTERED 
(
	[claim_document_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_claim_document_file]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_document_file]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_claim_document_file](
	[claim_document_file_id] [int] IDENTITY(1,1) NOT NULL,
	[claim_document_file_code] [varchar](50) NOT NULL,
	[claim_no] [varchar](50) NOT NULL,
	[document_code] [varchar](50) NOT NULL,
	[file_name] [varchar](100) NULL,
	[file_path] [varchar](100) NULL,
	[saved_file_name] [varchar](100) NULL,
	[upload_by] [varchar](15) NOT NULL,
	[upload_date] [datetime] NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK__custport__81C78D69392D5237] PRIMARY KEY CLUSTERED 
(
	[claim_document_file_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_claim_history]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_history]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_claim_history](
	[claim_history_id] [int] IDENTITY(1,1) NOT NULL,
	[claim_history_code] [varchar](50) NULL,
	[claim_no] [varchar](50) NOT NULL,
	[date] [datetime] NOT NULL,
	[action_code] [varchar](50) NOT NULL,
	[action_description] [varchar](60) NOT NULL,
	[reason_code] [varchar](50) NULL,
	[notes] [varchar](300) NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL CONSTRAINT [DF_custport_claim_history_is_active]  DEFAULT ((0)),
 CONSTRAINT [PK__custport__B00D50CB455DE191] PRIMARY KEY CLUSTERED 
(
	[claim_history_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_bank]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_bank]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_bank](
	[bank_id] [int] IDENTITY(1,1) NOT NULL,
	[bank_name] [varchar](100) NOT NULL,
	[bank_code] [varchar](5) NULL,
	[swiftcode] [varchar](20) NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL CONSTRAINT [DF_custport_m_bank_created_date]  DEFAULT (getdate()),
	[modified_by] [varchar](15) NULL,
	[modified_date] [datetime] NULL,
	[is_active] [bit] NOT NULL CONSTRAINT [DF_custport_m_bank_is_active]  DEFAULT ((1)),
 CONSTRAINT [PK_custport_m_bank] PRIMARY KEY CLUSTERED 
(
	[bank_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_claim_document]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_claim_document](
	[claim_document_id] [int] IDENTITY(1,1) NOT NULL,
	[claim_document_code] [varchar](50) NOT NULL,
	[claim_type_code] [varchar](50) NOT NULL,
	[document_code] [varchar](50) NOT NULL,
	[is_mandatory] [bit] NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__5DEC7EA41E10C9CC] PRIMARY KEY CLUSTERED 
(
	[claim_document_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_claim_type]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_claim_type]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_claim_type](
	[claim_type_id] [int] IDENTITY(1,1) NOT NULL,
	[claim_type_code] [varchar](50) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[claim_core_code] [varchar](1) NULL,
	[is_need_account] [bit] NOT NULL CONSTRAINT [DF_custport_m_claim_type_is_need_account]  DEFAULT ((0)),
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__E28CA1DCA9576026] PRIMARY KEY CLUSTERED 
(
	[claim_type_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_company]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_company](
	[company_id] [int] IDENTITY(1,1) NOT NULL,
	[company_code] [varchar](10) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__F4E508EBEFCC4703] PRIMARY KEY CLUSTERED 
(
	[company_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_company_policy]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_policy]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_company_policy](
	[company_policy_id] [int] IDENTITY(1,1) NOT NULL,
	[company_policy_code] [char](10) NOT NULL,
	[company_code] [varchar](10) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[policy_no] [varchar](12) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__5D8D42CE9E82E489] PRIMARY KEY CLUSTERED 
(
	[company_policy_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_company_region]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_region]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_company_region](
	[company_region_id] [int] IDENTITY(1,1) NOT NULL,
	[company_region_code] [varchar](10) NOT NULL,
	[company_code] [varchar](10) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__1F74E58F38E07009] PRIMARY KEY CLUSTERED 
(
	[company_region_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_currency]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_currency]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_currency](
	[currency_id] [int] IDENTITY(1,1) NOT NULL,
	[currency_code] [varchar](50) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__6008D0BBED69C5E3] PRIMARY KEY CLUSTERED 
(
	[currency_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_document]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_document]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_document](
	[document_id] [int] IDENTITY(1,1) NOT NULL,
	[document_code] [varchar](50) NOT NULL,
	[description] [varchar](150) NOT NULL,
	[id_item_dokumen_core] [varchar](4) NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__B1C534BF0F8E3E78] PRIMARY KEY CLUSTERED 
(
	[document_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_flow]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_flow](
	[flow_id] [int] IDENTITY(1,1) NOT NULL,
	[flow_code] [varchar](50) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[transaction_type_code] [varchar](50) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK__custport__2F3FDD09EEF36785] PRIMARY KEY CLUSTERED 
(
	[flow_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_flow_action]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_action]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_flow_action](
	[flow_action_id] [int] IDENTITY(1,1) NOT NULL,
	[flow_action_code] [varchar](50) NOT NULL,
	[flow_stage_code] [varchar](50) NOT NULL,
	[description] [varchar](150) NOT NULL,
	[is_external_process] [bit] NOT NULL CONSTRAINT [DF_custport_m_flow_action_is_external_process]  DEFAULT ((0)),
	[next_flow_stage] [varchar](50) NOT NULL,
	[next_status_code] [varchar](50) NULL,
	[is_need_reason] [bit] NOT NULL CONSTRAINT [DF_custport_m_flow_action_is_need_reason]  DEFAULT ((0)),
	[reason_type_code] [varchar](10) NULL,
	[is_reference_no] [bit] NOT NULL CONSTRAINT [DF_custport_m_flow_action_is_reference_no]  DEFAULT ((0)),
	[is_initial_action] [bit] NOT NULL CONSTRAINT [DF_custport_m_flow_action_is_initial_action]  DEFAULT ((0)),
	[is_final_action] [bit] NOT NULL CONSTRAINT [DF_custport_m_flow_action_is_final_action]  DEFAULT ((0)),
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL CONSTRAINT [DF_custport_m_flow_action_is_active]  DEFAULT ((0)),
 CONSTRAINT [PK__custport__81AFD39A488B28E2] PRIMARY KEY CLUSTERED 
(
	[flow_action_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_flow_stage]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_stage]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_flow_stage](
	[flow_stage_id] [int] IDENTITY(1,1) NOT NULL,
	[flow_stage_code] [varchar](50) NOT NULL,
	[flow_code] [varchar](50) NOT NULL,
	[description] [varchar](50) NOT NULL,
	[sequence_no] [tinyint] NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK__custport__AA8F029F3E9E66EC] PRIMARY KEY CLUSTERED 
(
	[flow_stage_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_group_menu]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_group_menu](
	[group_menu_id] [int] IDENTITY(1,1) NOT NULL,
	[description] [varchar](50) NULL,
	[created_by] [varchar](15) NULL,
	[created_date] [datetime] NULL,
	[modified_by] [varchar](15) NULL,
	[modified_date] [datetime] NULL,
	[is_active] [bit] NULL,
	[group_menu_icon] [varchar](50) NULL,
 CONSTRAINT [PK_custport_m_group_menu] PRIMARY KEY CLUSTERED 
(
	[group_menu_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_mapp_menu]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_mapp_menu]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_mapp_menu](
	[mapp_menu_id] [int] IDENTITY(1,1) NOT NULL,
	[group_menu_id] [int] NOT NULL,
	[menu_id] [int] NOT NULL,
	[created_by] [char](3) NULL,
	[created_date] [datetime] NULL,
	[modified_by] [char](3) NULL,
	[modified_date] [datetime] NULL,
	[is_Active] [bit] NULL,
 CONSTRAINT [PK_custport_m_mapp_menu] PRIMARY KEY CLUSTERED 
(
	[mapp_menu_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_menu]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_menu]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_menu](
	[menu_id] [int] IDENTITY(1,1) NOT NULL,
	[menu_code] [char](10) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
	[menu_url] [varchar](50) NULL,
	[menu_icon] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[menu_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_reason]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_reason](
	[reason_id] [int] IDENTITY(1,1) NOT NULL,
	[reason_code] [varchar](50) NOT NULL,
	[reason_type_code] [varchar](10) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK__custport__3CA7EBEA4608EB4E] PRIMARY KEY CLUSTERED 
(
	[reason_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_reason_type]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason_type]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_reason_type](
	[reason_type_id] [int] IDENTITY(1,1) NOT NULL,
	[reason_type_code] [varchar](10) NOT NULL,
	[description] [varchar](50) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK_custport_m_reason_type] PRIMARY KEY CLUSTERED 
(
	[reason_type_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_role]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_role](
	[role_id] [int] IDENTITY(1,1) NOT NULL,
	[role_code] [char](10) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[role_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_role_menu]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_role_menu](
	[role_menu_id] [int] IDENTITY(1,1) NOT NULL,
	[role_menu_code] [char](10) NOT NULL,
	[role_code] [char](10) NOT NULL,
	[menu_code] [char](10) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[role_menu_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_status]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_status]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_status](
	[status_id] [int] IDENTITY(1,1) NOT NULL,
	[status_code] [varchar](50) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[app_status] [varchar](1) NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NOT NULL,
 CONSTRAINT [PK__custport__4157B02074D655DB] PRIMARY KEY CLUSTERED 
(
	[status_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_transaction_type]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_transaction_type]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_transaction_type](
	[transaction_type_id] [int] IDENTITY(1,1) NOT NULL,
	[transaction_type_code] [varchar](50) NOT NULL,
	[description] [varchar](150) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__6443D79AEEF7BB1E] PRIMARY KEY CLUSTERED 
(
	[transaction_type_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_user]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_user](
	[user_id] [int] IDENTITY(1,1) NOT NULL,
	[username] [varchar](30) NOT NULL,
	[fullname] [varchar](100) NOT NULL,
	[email] [varchar](100) NULL,
	[user_type_code] [varchar](10) NULL,
	[password] [varchar](32) NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK_custport_m_user] PRIMARY KEY CLUSTERED 
(
	[user_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_user_company]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_user_company](
	[user_company_id] [int] IDENTITY(1,1) NOT NULL,
	[user_company_code] [varchar](10) NOT NULL,
	[username] [varchar](30) NOT NULL,
	[company_code] [varchar](10) NOT NULL,
	[company_region_code] [varchar](10) NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__64E6700A69297770] PRIMARY KEY CLUSTERED 
(
	[user_company_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_user_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_group_menu]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_user_group_menu](
	[user_group_menu_id] [int] IDENTITY(1,1) NOT NULL,
	[group_menu_id] [int] NOT NULL,
	[username] [varchar](30) NULL,
	[created_by] [varchar](15) NULL,
	[created_date] [datetime] NULL,
	[modified_by] [varchar](15) NULL,
	[modified_date] [datetime] NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK_custport_m_user_group_menu] PRIMARY KEY CLUSTERED 
(
	[user_group_menu_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_user_role]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_role]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_user_role](
	[user_role_id] [int] IDENTITY(1,1) NOT NULL,
	[user_role_code] [char](10) NOT NULL,
	[username] [char](10) NOT NULL,
	[role_code] [char](10) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[user_role_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_m_user_type]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_type]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_m_user_type](
	[user_type_id] [int] IDENTITY(1,1) NOT NULL,
	[user_type_code] [varchar](10) NOT NULL,
	[description] [varchar](100) NOT NULL,
	[created_by] [varchar](15) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](15) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_active] [bit] NULL,
 CONSTRAINT [PK__custport__CD0F8E2FA8AA739D] PRIMARY KEY CLUSTERED 
(
	[user_type_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_s_action_list]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_action_list]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_s_action_list](
	[action_id] [int] IDENTITY(1,1) NOT NULL,
	[action_name] [varchar](60) NULL,
	[action_type] [int] NOT NULL,
	[condition_field] [varchar](max) NULL,
	[result_object] [varchar](100) NULL,
	[result_field] [varchar](max) NULL,
	[default_order] [varchar](30) NULL,
	[max_result_row] [smallint] NULL,
	[datasource] [varchar](30) NULL CONSTRAINT [DF_custport_s_action_list_datasource]  DEFAULT ('default'),
	[created_by] [varchar](8) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](8) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_delete] [bit] NOT NULL CONSTRAINT [DF_custport_s_action_list_is_delete]  DEFAULT ((0)),
 CONSTRAINT [PK_custport_s_action_list] PRIMARY KEY CLUSTERED 
(
	[action_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_s_action_type]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_action_type]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_s_action_type](
	[id_action_type] [tinyint] NOT NULL,
	[description] [varchar](40) NULL,
	[created_by] [varchar](8) NOT NULL,
	[created_date] [datetime] NOT NULL,
	[modified_by] [varchar](8) NOT NULL,
	[modified_date] [datetime] NOT NULL,
	[is_delete] [bit] NOT NULL,
 CONSTRAINT [PK_custport_s_action_type] PRIMARY KEY CLUSTERED 
(
	[id_action_type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_s_error_code]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_error_code]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_s_error_code](
	[error_code] [smallint] NOT NULL,
	[error_description] [varchar](100) NULL
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[custport_s_log]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_log]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_s_log](
	[log_id] [bigint] IDENTITY(1,1) NOT NULL,
	[date] [datetime] NOT NULL,
	[request_parameter] [nvarchar](max) NULL,
	[response] [nvarchar](max) NULL,
 CONSTRAINT [PK_custport_s_log] PRIMARY KEY CLUSTERED 
(
	[log_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[custport_s_user_session]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_user_session]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[custport_s_user_session](
	[session_id] [varchar](50) NOT NULL,
	[signature] [varchar](100) NULL,
	[user_id] [int] NULL,
	[first_login] [datetime] NULL,
	[last_activity] [datetime] NULL,
	[session_expire] [datetime] NULL,
	[ip_address] [varchar](30) NULL,
	[user_agent] [varchar](300) NULL,
 CONSTRAINT [PK_custport_s_user_session] PRIMARY KEY CLUSTERED 
(
	[session_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  UserDefinedFunction [dbo].[func_custport_list_claim]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[func_custport_list_claim]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'
-- by Pribadi Pamungkas. 2018-07-10
-- catatan: jika ada penambahan/hapus (alter) kolom tabel yg dipake di function ini, query dibawah harus dijalankan (alter) lagi
-- karena ada bugs di sql server, dia enggak me-refresh secara otomatis kolom-kolom di function ini (jika pake bintang)
-- https://www.mssqltips.com/sqlservertip/1427/table-changes-not-automatically-reflected-in-a-sql-server-view/
-- https://stackoverflow.com/questions/43131121/table-valued-function-refresh
CREATE FUNCTION [dbo].[func_custport_list_claim] (
  @pi_username VARCHAR(15),
  @pi_period_from VARCHAR(20),
  @pi_period_to VARCHAR(20),
  @pi_customer_name VARCHAR(100),
  @pi_contract_no VARCHAR(20),
  @pi_register_no VARCHAR(50),
  @pi_status VARCHAR(5),
  @pi_tipe_data TINYINT = 0	-- 0: all/inquiry
							-- 1: os, status not in (cancel, complete)
)
RETURNS TABLE
AS
RETURN ( 
	SELECT DISTINCT
		cc.*,
		cms.description AS status,
		cmct.description AS claim_type
	FROM
		dbo.custport_claim AS cc INNER JOIN
		--(
		--	SELECT
		--		cmu.username,
		--		cmuc.company_code,
		--		cmuc.company_region_code
		--	FROM
		--		dbo.custport_m_user AS cmu INNER JOIN
		--		dbo.custport_m_user_company AS cmuc ON cmu.username = cmuc.username
		--	WHERE
		--		cmu.is_active = 1
		--		AND cmuc.is_active = 1
		--) AS company_region_create ON cc.created_by = company_region_create.username INNER JOIN
		(
			SELECT
				cmuc.company_code,
				cmuc.company_region_code
			FROM
				dbo.custport_m_user AS cmu INNER JOIN
				dbo.custport_m_user_company AS cmuc ON cmu.username = cmuc.username
			WHERE
				(cmu.username = @pi_username OR COALESCE(@pi_tipe_data, 0) <> 1)
				AND cmu.is_active = 1
				AND cmuc.is_active = 1
		) AS company_region_user ON --company_region_create.company_code = company_region_user.company_code
									--AND company_region_create.company_region_code = company_region_user.company_region_code INNER JOIN
									cc.company_code = company_region_user.company_code
									AND cc.company_region_code = company_region_user.company_region_code INNER JOIN
		dbo.custport_m_status AS cms ON cc.status_code = cms.status_code LEFT JOIN
		dbo.custport_m_claim_type AS cmct ON cc.claim_type_code = cmct.claim_type_code
	WHERE
		(cc.is_active = 1)
		AND (cms.is_active = 1)
		AND (cc.register_date >= CAST(@pi_period_from AS DATE) OR ISNULL(@pi_period_from, '''') = '''')
		AND (cc.register_date <= CAST(@pi_period_to AS DATE) OR ISNULL(@pi_period_to, '''') = '''')
		AND (cc.customer_name LIKE ''%''+@pi_customer_name+''%'' OR ISNULL(@pi_customer_name, '''') = '''')
		AND (cc.contract_no = @pi_contract_no OR ISNULL(@pi_contract_no, '''') = '''')
		AND (cc.claim_no = @pi_register_no OR ISNULL(@pi_register_no, '''') = '''')
		AND (cc.status_code = @pi_status OR ISNULL(@pi_status, '''') = '''')
		AND (cc.status_code NOT IN (''CNC'',''DRP'',''RJT'') OR COALESCE(@pi_tipe_data, 0) <> 1)

)

--CNC	Canceled
--DRP	Claim Dropped
--RJT	Claim Rejected
' 
END

GO
/****** Object:  UserDefinedFunction [dbo].[func_custport_list_inpayment]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[func_custport_list_inpayment]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'

-- by Pribadi Pamungkas. 2018-07-10
-- catatan: jika ada penambahan/hapus (alter) kolom tabel yg dipake di function ini, query dibawah harus dijalankan (alter) lagi
-- karena ada bugs di sql server, dia enggak me-refresh secara otomatis kolom-kolom di function ini (jika pake bintang)
-- https://www.mssqltips.com/sqlservertip/1427/table-changes-not-automatically-reflected-in-a-sql-server-view/
-- https://stackoverflow.com/questions/43131121/table-valued-function-refresh
CREATE FUNCTION [dbo].[func_custport_list_inpayment] (
  @pi_username VARCHAR(15),
  @pi_period_from VARCHAR(20),
  @pi_period_to VARCHAR(20),
  @pi_customer_name VARCHAR(100),
  @pi_contract_no VARCHAR(20),
  @pi_register_no VARCHAR(50)
)
RETURNS TABLE
AS
RETURN ( 
	SELECT DISTINCT
		cc.*,
		cms.description AS status,
		cmct.description AS claim_type
	FROM
		dbo.custport_claim AS cc INNER JOIN
		--(
		--	SELECT
		--		cmu.username,
		--		cmuc.company_code,
		--		cmuc.company_region_code
		--	FROM
		--		dbo.custport_m_user AS cmu INNER JOIN
		--		dbo.custport_m_user_company AS cmuc ON cmu.username = cmuc.username
		--	WHERE
		--		cmu.is_active = 1
		--		AND cmuc.is_active = 1
		--) AS company_region_create ON cc.created_by = company_region_create.username INNER JOIN
		(
			SELECT
				cmuc.company_code,
				cmuc.company_region_code
			FROM
				dbo.custport_m_user AS cmu INNER JOIN
				dbo.custport_m_user_company AS cmuc ON cmu.username = cmuc.username
			WHERE
				cmu.username = @pi_username
				AND cmu.is_active = 1
				AND cmuc.is_active = 1
		) AS company_region_user ON --company_region_create.company_code = company_region_user.company_code
									--AND company_region_create.company_region_code = company_region_user.company_region_code INNER JOIN
									cc.company_code = company_region_user.company_code
									AND cc.company_region_code = company_region_user.company_region_code INNER JOIN
		dbo.custport_m_status AS cms ON cc.status_code = cms.status_code LEFT JOIN
		dbo.custport_m_claim_type AS cmct ON cc.claim_type_code = cmct.claim_type_code
	WHERE
		(cc.is_active = 1)
		AND (cms.is_active = 1)
		AND (cc.register_date >= CAST(@pi_period_from AS DATE) OR ISNULL(@pi_period_from, '''') = '''')
		AND (cc.register_date <= CAST(@pi_period_to AS DATE) OR ISNULL(@pi_period_to, '''') = '''')
		AND (cc.customer_name LIKE ''%''+@pi_customer_name+''%'' OR ISNULL(@pi_customer_name, '''') = '''')
		AND (cc.contract_no = @pi_contract_no OR ISNULL(@pi_contract_no, '''') = '''')
		AND (cc.claim_no = @pi_register_no OR ISNULL(@pi_register_no, '''') = '''')
		AND (cc.status_code IN (''PAM''))	-- status Pending Amount

)

' 
END

GO
/****** Object:  View [dbo].[view_custport_app_list_claim]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_app_list_claim]'))
EXEC dbo.sp_executesql @statement = N'




-- created by Pribadi Pamungkas. 2018-07-11
CREATE VIEW [dbo].[view_custport_app_list_claim]
AS
	SELECT
		cms.app_status AS status,	
		cc.claim_no AS register_no,
		cc.no_polis, 
		cc.id_peserta, 
		cc.customer_name, 
		CAST(cc.register_date AS DATETIME) AS register_date, 
		CAST(cc.event_date AS DATETIME) AS event_date, 
		cc.claim_type_code, 
		cmct.description AS claim_type,
		cc.currency_code, -- mata uang klaim
		cc.claim_amount, 
		cc.reference_no, 
		cc.status_code, 
		cc.flow_stage_code, 
		cc.reason_code, 
		cc.notes, 
		cc.certificate_no, 
		cc.contract_no,
		cc.company_code, 
		cc.company_region_code, 
		cc.id_klaim_core,
		cc.created_by, 
		cc.created_date, 
		cc.modified_by, 
		cc.modified_date,
		cc.claim_id,
		cms.description AS claim_status,
		cc.claim_no,
		pst.tgl_lahir_1 AS tgl_lahir,
		pst.no_identitas,
		pst.tgl_mulai,
		pst.tgl_akhir,
		pst.uang_pertanggungan,
		pst.id_valuta,	-- mata uang peserta (polis)
		CASE pst.status
			WHEN ''I'' THEN ''Active''
			WHEN ''C'' THEN ''Cancel''
			WHEN ''D'' THEN ''Death''
			WHEN ''E'' THEN ''Verifikasi''
			WHEN ''G'' THEN ''Draft''
			WHEN ''M'' THEN ''Maturity''
			WHEN ''O'' THEN ''Keluar''
			WHEN ''R'' THEN ''Reject''
			WHEN ''L'' THEN ''Terminate''	-- ?
			ELSE ''Unknown''
		END AS participant_status,
		cmr.description AS reason,
		cmu.fullname AS created_user
	FROM
		dbo.custport_claim AS cc INNER JOIN
		dbo.custport_m_status AS cms ON cc.status_code = cms.status_code LEFT JOIN
		dbo.custport_m_claim_type AS cmct ON cc.claim_type_code = cmct.claim_type_code INNER JOIN
		dbo.peserta AS pst ON cc.no_polis = pst.no_polis
							  AND cc.id_peserta = pst.id_peserta LEFT JOIN
		dbo.custport_m_reason AS cmr ON cc.reason_code = cmr.reason_code INNER JOIN
		dbo.custport_m_user AS cmu ON cc.created_by = cmu.username
	WHERE
		(cc.is_active = 1)
		AND (cms.is_active = 1)
		AND (cmct.is_active = 1)
		AND (cc.status_code NOT IN (''DRF'',''CNC'',''PAM''))






' 
GO
/****** Object:  View [dbo].[view_custport_bank]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_bank]'))
EXEC dbo.sp_executesql @statement = N'
-- created by Pribadi Pamungkas. 2018-07-31
CREATE VIEW [dbo].[view_custport_bank]
AS

	SELECT 
		bank_id, 
		bank_name, 
		bank_code, 
		swiftcode, 
		created_by, 
		created_date, 
		modified_by, 
		modified_date
	FROM
		dbo.custport_m_bank
	WHERE
		is_active = 1

' 
GO
/****** Object:  View [dbo].[view_custport_claim]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim]'))
EXEC dbo.sp_executesql @statement = N'

-- last modified by Pribadi Pamungkas. 2018-07-31. => tambah kolom no_hp & email
-- created by Pribadi Pamungkas. 2018-07-11
CREATE VIEW [dbo].[view_custport_claim]
AS
	SELECT 
		cc.claim_no,
		cc.no_polis,
		cc.id_peserta,
		cc.contract_no,
		cc.certificate_no,
		cc.customer_name,
		dbo.func_date_format(''dd-mmm-YYYY'',p.tgl_mulai) + '' - '' + dbo.func_date_format(''dd-mmm-YYYY'',p.tgl_akhir) AS insurance_periode,
		dbo.func_date_format(''dd-mmm-YYYY'',p.tgl_lahir_1) AS date_of_birth,
		''IDR'' AS currency,	-- masih hardcode
		p.no_identitas AS ktp_id,
		p.uang_pertanggungan AS sum_insured,
		CASE p.status
			WHEN ''I'' THEN ''Active''
			WHEN ''C'' THEN ''Cancel''
			WHEN ''D'' THEN ''Death''
			WHEN ''E'' THEN ''Verifikasi''
			WHEN ''G'' THEN ''Draft''
			WHEN ''M'' THEN ''Maturity''
			WHEN ''O'' THEN ''Keluar''
			WHEN ''R'' THEN ''Reject''
			WHEN ''L'' THEN ''Terminate''	-- ?
			ELSE ''Unknown''
		END AS participant_status,
		p.no_hp,
		p.email,
		--cc.claim_id,
		cc.claim_no AS register_no,
		dbo.func_date_format(''dd-mmm-YYYY'',cc.register_date) AS register_date,
		CONVERT(VARCHAR(11), cc.register_date, 106) AS register_date_formatted,
		cms.description AS register_status,
		cmu.fullname AS created_by,
		cmr.description AS reason,
		--REPLACE(CONVERT(VARCHAR(30),cc.event_date,106), '' '', ''/'') AS event_date_singkat,
		dbo.func_date_format(''dd-mmm-YYYY'',cc.event_date) AS event_date_panjang,
		CONVERT(VARCHAR(11), cc.event_date, 106) AS event_date_formatted,
		RIGHT(''0'' + CAST(DAY(cc.event_date) AS VARCHAR),2) + ''/'' + DATENAME(MONTH,cc.event_date) + ''/'' + CAST(YEAR(cc.event_date) AS VARCHAR) AS event_date,
		cc.currency_code AS ''claim_currency'',
		cc.claim_type_code,
		cmct.description AS claim_type,
		cc.claim_amount,
		cc.notes,
		cc.tmp_guid,
		cmct.is_need_account,
		cc.alt_phone, 
		cc.alt_email, 
		cc.account_no, 
		cc.account_beneficiary, 
		cc.account_currency_code, 
		cc.bank_id, 
		cc.bank_name, 
		cc.bank_code, 
		cc.bank_branch
	FROM
		dbo.custport_claim AS cc 
		INNER JOIN
		dbo.peserta AS p ON cc.no_polis = p.no_polis
							AND cc.id_peserta = p.id_peserta
							--cc.certificate_no = p.no_peserta
							--AND cc.contract_no = p.no_kontrak_external
		INNER JOIN
		dbo.custport_m_status AS cms ON cc.status_code = cms.status_code
		INNER JOIN
		dbo.custport_m_user AS cmu ON cc.created_by = cmu.username 
		LEFT JOIN
		dbo.custport_m_reason AS cmr ON cc.reason_code = cmr.reason_code
		INNER JOIN
		dbo.custport_m_claim_type AS cmct ON cc.claim_type_code = cmct.claim_type_code
	WHERE
		cc.is_active = 1


' 
GO
/****** Object:  View [dbo].[view_custport_claim_document]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim_document]'))
EXEC dbo.sp_executesql @statement = N'

-- created by Pribadi Pamungkas. 2018-06-29
CREATE VIEW [dbo].[view_custport_claim_document]
AS
	SELECT
		md.document_code,
		md.description,
		mcd.is_mandatory,
		mcd.claim_type_code,
		mcd.claim_document_code,
		mcd.is_active
	FROM
		custport_m_claim_document AS mcd INNER JOIN
		custport_m_document AS md ON mcd.document_code = md.document_code
	WHERE
		mcd.is_active = 1
		AND md.is_active = 1


' 
GO
/****** Object:  View [dbo].[view_custport_claim_document_file]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim_document_file]'))
EXEC dbo.sp_executesql @statement = N'



-- created by Pribadi Pamungkas. 2018-07-11
CREATE VIEW [dbo].[view_custport_claim_document_file]
AS
	SELECT
		ccd.claim_no, 
		ccd.document_code, 
		ccd.is_mandatory, 
		ccd.description AS document, 
		ccdf.file_name, 
		ccdf.file_path, 
		ccdf.saved_file_name, 
		CASE
			WHEN COALESCE(ccdf.file_name,'''') = '''' THEN NULL
			ELSE ccdf.upload_by
		END AS upload_by,
		CASE
			WHEN COALESCE(ccdf.file_name,'''') = '''' THEN NULL
			ELSE ccdf.upload_date
		END AS upload_date
	FROM
		dbo.custport_claim_document AS ccd INNER JOIN
		dbo.custport_claim_document_file AS ccdf ON ccd.claim_no = ccdf.claim_no
													AND ccd.document_code = ccdf.document_code
	WHERE
		ccd.is_active = 1
		AND ccdf.is_active = 1


' 
GO
/****** Object:  View [dbo].[view_custport_claim_history]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_claim_history]'))
EXEC dbo.sp_executesql @statement = N'


-- created by Pribadi Pamungkas. 2018-07-13
CREATE VIEW [dbo].[view_custport_claim_history]
AS

	SELECT 
		cch.[claim_history_id],
		cch.[claim_no],
		cch.[date],
		cch.[action_code],
		cch.[action_description],
		cch.[reason_code],
		cmr.description AS reason,
		cch.[notes],
		cmu.fullname AS create_user,
		cch.[created_by],
		cch.[created_date],
		cch.[is_active]
	FROM 
		[dbo].[custport_claim_history] AS cch LEFT JOIN
		[dbo].[custport_m_user] AS cmu ON cch.created_by = cmu.username LEFT JOIN
		[dbo].[custport_m_reason] AS cmr ON cch.reason_code = cmr.reason_code
	WHERE
		cch.[is_active] = 1
		AND cmu.is_active = 1


' 
GO
/****** Object:  View [dbo].[view_custport_company_region]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_company_region]'))
EXEC dbo.sp_executesql @statement = N'

CREATE VIEW [dbo].[view_custport_company_region]
AS
	SELECT 
	    company_region_id,
		company_region_code, 
		company_code, 
		description, 
		created_by, 
		created_date, 
		modified_by, 
		modified_date, 
		is_active
  FROM dbo.custport_m_company_region  --where is_active=1

' 
GO
/****** Object:  View [dbo].[view_custport_flow]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_flow]'))
EXEC dbo.sp_executesql @statement = N'




-- created by Pribadi Pamungkas. 2018-07-06
CREATE VIEW [dbo].[view_custport_flow]
AS
	SELECT TOP 100 PERCENT
		mf.flow_id, mf.flow_code, mf.description AS flow_description, mf.transaction_type_code, 
		mfs.flow_stage_id, mfs.flow_stage_code, mfs.description AS flow_stage_description, mfs.sequence_no, 
		mfa.flow_action_id, mfa.flow_action_code, mfa.description AS flow_action_description, mfa.is_external_process, mfa.next_flow_stage, mfa.next_status_code, mfa.is_need_reason, mfa.reason_type_code, mfa.is_reference_no,
		next_stage.next_flow_stage_description
	FROM
		custport_m_flow AS mf INNER JOIN
		custport_m_flow_stage AS mfs ON mf.flow_code = mfs.flow_code INNER JOIN
		custport_m_flow_action AS mfa ON mfs.flow_stage_code = mfa.flow_stage_code LEFT JOIN
		(
			SELECT
				flow_stage_id, flow_stage_code, flow_code, description AS next_flow_stage_description
			FROM
				custport_m_flow_stage
			WHERE
				is_active = 1
		) AS next_stage ON mfa.next_flow_stage = next_stage.flow_stage_code
	WHERE
		mf.is_active = 1
		AND mfs.is_active = 1
		AND mfa.is_active = 1
	ORDER BY
		mfs.sequence_no



' 
GO
/****** Object:  View [dbo].[view_custport_group_menu]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_group_menu]'))
EXEC dbo.sp_executesql @statement = N'


CREATE VIEW [dbo].[view_custport_group_menu]
AS
	SELECT 
	    group_menu_id,
		description, 
		created_by, 
		created_date, 
		modified_by, 
		modified_date, 
		is_active
  FROM dbo.custport_m_group_menu  where is_active=1


' 
GO
/****** Object:  View [dbo].[view_custport_user]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_user]'))
EXEC dbo.sp_executesql @statement = N'
CREATE VIEW [dbo].[view_custport_user]
AS
	SELECT 
	   u.[user_id]
      ,u.username
      ,u.fullname
      ,u.email
      ,u.user_type_code
	  ,ur.description as branch_name
	  ,ur.company_region_id
	  ,ur.company_region_code
	  ,u.is_active as is_active
  FROM dbo.custport_m_user u
  inner join custport_m_user_company uc ON u.username=uc.username
  inner join custport_m_company_region ur ON uc.company_region_code=ur.company_region_code
  



' 
GO
/****** Object:  View [dbo].[view_custport_valuta]    Script Date: 13/09/2018 17:17:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_custport_valuta]'))
EXEC dbo.sp_executesql @statement = N'
-- created by Pribadi Pamungkas. 2018-07-31
CREATE VIEW [dbo].[view_custport_valuta]
AS
	SELECT 
		id_valuta, 
		deskripsi, 
		simbol, 
		valas
	FROM
		dbo.valuta
	WHERE
		status = ''I''

' 
GO
GO
SET IDENTITY_INSERT [dbo].[custport_m_bank] ON 

GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'BANK BRI', N'002', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'BANK EKSPOR INDONESIA', N'003', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'BANK MANDIRI', N'008', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'BANK BNI', N'009', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, N'BANK DANAMON', N'011', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'PERMATA BANK', N'013', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'BANK BCA', N'014', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'BANK BII MAYBANK', N'016', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'BANK PANIN', N'019', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (10, N'BANK ARTA NIAGA KENCANA', N'020', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (11, N'BANK CIMB NIAGA', N'022', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (12, N'BANK CIMB NIAGA SYARIAH', N'022', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (13, N'BANK BUANA IND', N'023', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (14, N'BANK UOB INDONESIA', N'023', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (15, N'BANK LIPPO', N'026', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (16, N'BANK OCBC NISP', N'028', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (17, N'AMERICAN EXPRESS BANK LTD', N'030', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (18, N'CITIBANK', N'031', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (19, N'CITIBANK N.A.', N'031', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (20, N'JP. MORGAN CHASE BANK, N.A.', N'032', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (21, N'BANK OF AMERICA, N.A', N'033', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (22, N'ING INDONESIA BANK', N'034', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (23, N'BANK MULTICOR', N'036', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (24, N'BANK ARTHA GRAHA', N'037', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (25, N'BANK CREDIT AGRICOLE INDOSUEZ', N'039', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (26, N'THE BANGKOK BANK COMP. LTD', N'040', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (27, N'THE HONGKONG & SHANGHAI B.C. (BANK HSBC)', N'041', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (28, N'THE BANK OF TOKYO MITSUBISHI UFJ LTD', N'042', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (29, N'BANK SUMITOMO MITSUI INDONESIA', N'045', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (30, N'BANK DBS INDONESIA', N'046', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (31, N'BANK RESONA PERDANIA', N'047', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (32, N'BANK MIZUHO INDONESIA', N'048', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (33, N'STANDARD CHARTERED BANK', N'050', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (34, N'BANK ABN AMRO', N'052', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (35, N'BANK KEPPEL TATLEE BUANA', N'053', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (36, N'BANK CAPITAL INDONESIA', N'054', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (37, N'BANK BNP PARIBAS INDONESIA', N'057', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (38, N'KOREA EXCHANGE BANK DANAMON', N'059', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (39, N'RABOBANK INTERNASIONAL INDONESIA', N'060', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (40, N'ANZ PANIN BANK', N'061', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (41, N'DEUTSCHE BANK AG.', N'067', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (42, N'BANK WOORI INDONESIA', N'068', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (43, N'BANK OF CHINA LIMITED', N'069', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (44, N'BANK BUMI ARTA', N'076', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (45, N'BANK EKONOMI', N'087', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (46, N'BANK ANTARDAERAH', N'088', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (47, N'BANK HAGA', N'089', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (48, N'BANK IFI', N'093', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (49, N'BANK CENTURY', N'095', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (50, N'BANK MAYAPADA', N'097', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (51, N'BANK JABAR', N'110', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (52, N'BANK DKI', N'111', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (53, N'BPD DIY', N'112', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (54, N'BANK JATENG', N'113', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (55, N'BANK JATIM', N'114', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (56, N'BPD JAMBI', N'115', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (57, N'BPD ACEH', N'116', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (58, N'BANK SUMUT', N'117', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (59, N'BANK NAGARI', N'118', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (60, N'BANK RIAU', N'119', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (61, N'BANK SUMSEL', N'120', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (62, N'BANK LAMPUNG', N'121', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (63, N'BPD KALSEL', N'122', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (64, N'BPD KALIMANTAN BARAT', N'123', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (65, N'BPD KALTIM', N'124', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (66, N'BPD KALTENG', N'125', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (67, N'BPD SULSEL', N'126', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (68, N'BANK SULUT', N'127', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (69, N'BPD NTB', N'128', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (70, N'BPD BALI', N'129', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (71, N'BANK NTT', N'130', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (72, N'BANK MALUKU', N'131', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (73, N'BPD PAPUA', N'132', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (74, N'BANK BENGKULU', N'133', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (75, N'BPD SULAWESI TENGAH', N'134', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (76, N'BANK SULTRA', N'135', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (77, N'BANK NUSANTARA PARAHYANGAN', N'145', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (78, N'BANK SWADESI', N'146', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (79, N'BANK MUAMALAT', N'147', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (80, N'BANK MESTIKA', N'151', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (81, N'BANK METRO EXPRESS', N'152', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (82, N'BANK SINARMAS', N'153', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (83, N'BANK MASPION', N'157', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (84, N'BANK HAGAKITA', N'159', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (85, N'BANK GANESHA', N'161', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (86, N'BANK WINDU KENTJANA', N'162', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (87, N'HALIM INDONESIA BANK', N'164', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (88, N'BANK HARMONI INTERNATIONAL', N'166', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (89, N'BANK QNB KESAWAN', N'167', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (90, N'BANK TABUNGAN NEGARA (BTN)', N'200', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (91, N'BANK HIMPUNAN SAUDARA 1906', N'212', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (92, N'BANK TABUNGAN PENSIUNAN NASIONAL (BTPN)', N'213', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (93, N'JENIUS', N'213', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (94, N'BANK SWAGUNA', N'405', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (95, N'BANK BRI SYARIAH', N'422', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (96, N'BANK MEGA', N'426', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (97, N'BANK BNI SYARIAH', N'427', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (98, N'BANK BUKOPIN', N'441', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (99, N'BANK SYARIAH MANDIRI', N'451', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (100, N'BANK BISNIS INTERNASIONAL', N'459', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (101, N'BANK SRI PARTHA', N'466', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (102, N'BANK JASA JAKARTA', N'472', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (103, N'BANK BINTANG MANUNGGAL', N'484', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (104, N'BANK MNC/BANK BUMIPUTERA', N'485', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (105, N'BANK YUDHA BHAKTI', N'490', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (106, N'BANK MITRANIAGA', N'491', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (107, N'BANK AGRO NIAGA', N'494', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (108, N'BANK INDOMONEX', N'498', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (109, N'BANK ROYAL INDONESIA', N'501', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (110, N'BANK ALFINDO', N'503', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (111, N'BANK SYARIAH MEGA', N'506', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (112, N'BANK INA PERDANA', N'513', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (113, N'BANK HARFA', N'517', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (114, N'PRIMA MASTER BANK', N'520', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (115, N'BANK PERSYARIKATAN INDONESIA', N'521', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (116, N'BANK DIPO INTERNATIONAL', N'523', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (117, N'BANK AKITA', N'525', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (118, N'LIMAN INTERNATIONAL BANK', N'526', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (119, N'ANGLOMAS INTERNASIONAL BANK', N'531', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (120, N'BANK KESEJAHTERAAN EKONOMI', N'535', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (121, N'BANK BCA SYARIAH', N'536', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (122, N'BANK ARTOS IND', N'542', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (123, N'BANK PURBA DANARTA', N'547', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (124, N'BANK MULTI ARTA SENTOSA', N'548', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (125, N'BANK MAYORA', N'553', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (126, N'BANK INDEX SELINDO', N'555', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (127, N'BANK EKSEKUTIF', N'558', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (128, N'CENTRATAMA NASIONAL BANK', N'559', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (129, N'BANK FAMA INTERNASIONAL', N'562', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (130, N'BANK SINAR HARAPAN BALI', N'564', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (131, N'BANK VICTORIA INTERNATIONAL', N'566', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (132, N'BANK HARDA', N'567', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (133, N'INDOSAT DOMPETKU', N'789', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (134, N'TELKOMSEL TCASH', N'911', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (135, N'BANK FINCONESIA', N'945', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (136, N'BANK MERINCORP', N'946', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (137, N'BANK MAYBANK INDOCORP', N'947', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (138, N'BANK OCBC – INDONESIA', N'948', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (139, N'BANK CHINA TRUST INDONESIA', N'949', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_bank] ([bank_id], [bank_name], [bank_code], [swiftcode], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (140, N'BANK COMMONWEALTH', N'950', NULL, N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), N'SYS', CAST(N'2018-08-01 09:52:34.730' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_bank] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_claim_document] ON 

GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'M0007', N'acc', N'01', 0, N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'M0008', N'acc', N'02', 0, N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'M0009', N'acc', N'03', 0, N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (28, N'M0013', N'death', N'04', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (29, N'M0014', N'death', N'05', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (30, N'M0015', N'death', N'06', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (31, N'M0016', N'death', N'07', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (32, N'M0017', N'death', N'08', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (33, N'M0018', N'death', N'09', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (34, N'M0019', N'hcp', N'04', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (35, N'M0020', N'hcp', N'10', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (36, N'M0021', N'hcp', N'11', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (37, N'M0022', N'hcp', N'12', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (38, N'M0023', N'hcp', N'13', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (39, N'M0024', N'tpd', N'04', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (40, N'M0025', N'tpd', N'14', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (41, N'M0026', N'tpd', N'15', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_document] ([claim_document_id], [claim_document_code], [claim_type_code], [document_code], [is_mandatory], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (42, N'M0027', N'tpd', N'13', 0, N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_claim_document] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_claim_type] ON 

GO
INSERT [dbo].[custport_m_claim_type] ([claim_type_id], [claim_type_code], [description], [claim_core_code], [is_need_account], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'acc', N'Accident', N'A', 1, N'SYS', CAST(N'2018-07-16 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-16 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_claim_type] ([claim_type_id], [claim_type_code], [description], [claim_core_code], [is_need_account], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'death', N'Death', N'D', 1, N'SYS', CAST(N'2018-07-03 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-03 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_type] ([claim_type_id], [claim_type_code], [description], [claim_core_code], [is_need_account], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'hcp', N'Hospitalized', N'H', 0, N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_claim_type] ([claim_type_id], [claim_type_code], [description], [claim_core_code], [is_need_account], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'tpd', N'TPD', N'T', 1, N'SYS', CAST(N'2018-07-16 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-16 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_claim_type] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_company] ON 

GO
INSERT [dbo].[custport_m_company] ([company_id], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'hci', N'Home Credit Indonesia', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_company] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_company_policy] ON 

GO
INSERT [dbo].[custport_m_company_policy] ([company_policy_id], [company_policy_code], [company_code], [description], [policy_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'hci_1     ', N'hci', N'-', N'16004-01-000', N'SYS', CAST(N'2018-06-28 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-28 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_company_policy] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_company_region] ON 

GO
INSERT [dbo].[custport_m_company_region] ([company_region_id], [company_region_code], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'hci_bdg', N'hci', N'HCI - Bandung', N'SYS', CAST(N'2018-06-28 00:00:00.000' AS DateTime), N'hci', CAST(N'2018-09-10 16:12:01.533' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_company_region] ([company_region_id], [company_region_code], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'hci_jkt', N'hci', N'HCI - Jakarta', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'hci', CAST(N'2018-09-10 16:11:55.890' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_company_region] ([company_region_id], [company_region_code], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'HCI00003', N'hci', N'Surabaya', N'hci', CAST(N'2018-09-10 15:54:54.490' AS DateTime), N'hci', CAST(N'2018-09-10 15:55:04.160' AS DateTime), NULL)
GO
INSERT [dbo].[custport_m_company_region] ([company_region_id], [company_region_code], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'HCI00004', N'hci', N'Palembang', N'hci', CAST(N'2018-09-10 15:55:11.820' AS DateTime), N'hci', CAST(N'2018-09-10 15:55:11.820' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_company_region] ([company_region_id], [company_region_code], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'HCI00005', N'hci', N'Surakarta', N'hci', CAST(N'2018-09-10 15:57:44.097' AS DateTime), N'hci', CAST(N'2018-09-10 15:57:44.097' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_company_region] ([company_region_id], [company_region_code], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (10, N'HCI00006', N'hci', N'Pulo gadung 5', N'hci', CAST(N'2018-09-10 16:01:32.503' AS DateTime), N'hci', CAST(N'2018-09-10 16:05:23.427' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_company_region] ([company_region_id], [company_region_code], [company_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (11, N'HCI00007', N'hci', N'ALL', N'UMAR', CAST(N'2018-09-12 16:33:42.517' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:33:42.517' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_company_region] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_currency] ON 

GO
INSERT [dbo].[custport_m_currency] ([currency_id], [currency_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'IDR', N'Rupiah', N'SYS', CAST(N'2018-07-04 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-04 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_currency] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_document] ON 

GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'01', N'KTP', NULL, N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'02', N'KK', NULL, N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'03', N'FPM', NULL, N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'04', N'Kartu Identitas seperti KTP/SIM/Paspor/Kitas (salinan berlegalisir)', N'0007', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, N'05', N'Surat Keterangan Meninggal dari Rumah Sakit (asli/salinan berlegalisir)', N'0006', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'06', N'Resume medis dari Rumah Sakit', N'0002', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'07', N'Surat Keterangan Kepolisian (jika meninggal karena kecelakaan)', N'0005', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'08', N'Surat Keterangan Kremasi (jika diperlukan)', N'9999', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'09', N'Semua dokumen yang tidak dikeluarkan di Indonesia wajib dilegalisir oleh Kedutaan Besar Republik Indonesia (jika dibutuhkan, untuk kasus tertentu)', N'9999', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (10, N'10', N'Surat keterangan keluar dari Rumah Sakit', N'9999', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (11, N'11', N'Kuitansi pembayaran selama perawatan di Rumah Sakit (Asli)', N'9999', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (12, N'12', N'Hasil pemeriksaan diagnostic, rincian obat-obatan, dan biaya (salinan berlegalisir)', N'9999', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (13, N'13', N'Surat Nikah / Kartu Keluarga (untuk klaim atas nama pasangan)', N'0008', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (14, N'14', N'Surat Keterangan dokter atas cacat fisik / tidak berfungsinya organ tubuh ditandatangai oleh dokter (salinan berlegalisir)', N'9999', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_document] ([document_id], [document_code], [description], [id_item_dokumen_core], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (15, N'15', N'Foto rontgen lokasi cacat dan foto jelas (close up) beserta foto seluruh tubuh', N'9999', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_document] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_flow] ON 

GO
INSERT [dbo].[custport_m_flow] ([flow_id], [flow_code], [description], [transaction_type_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'FLW00001', N'Claim Transaction', N'CLM', N'SYS', CAST(N'2018-07-05 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-05 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_flow] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_flow_action] ON 

GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'ACT00000', N'STG1800000', N'New Register', 0, N'STG1800001', N'DRF', 0, NULL, 0, 1, 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'ACT00001', N'STG1800001', N'Submit', 0, N'STG1800002', N'SBM', 0, NULL, 0, 0, 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'ACT00002', N'STG1800001', N'Drop', 0, N'STG1800009', N'DRP', 0, NULL, 0, 0, 1, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'ACT00003', N'STG1800002', N'Pending Document', 0, N'STG1800003', N'PEN', 1, N'PND', 0, 0, 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, N'ACT00005', N'STG1800003', N'Submit
', 0, N'STG1800002', N'SBM', 0, NULL, 0, 0, 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'ACT00006', N'STG1800004', N'Submit
', 1, N'STG1800005', N'STC', 0, NULL, 1, 0, 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'ACT00007', N'STG1800005', N'Reject
', 0, N'STG1800008', N'RJT', 1, N'RJT', 0, 0, 1, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'ACT00008', N'STG1800005', N'Approve', 0, N'STG1800006', N'APV', 0, NULL, 1, 0, 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (10, N'ACT00009', N'STG1800006', N'Paid', 0, N'STG1800007', N'PID', 1, N'RJT', 0, 0, 1, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_action] ([flow_action_id], [flow_action_code], [flow_stage_code], [description], [is_external_process], [next_flow_stage], [next_status_code], [is_need_reason], [reason_type_code], [is_reference_no], [is_initial_action], [is_final_action], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (14, N'ACT00004', N'STG1800002', N'Pending Amount
', 0, N'STG1800004', N'PAM', 0, NULL, 0, 0, 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_flow_action] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_flow_stage] ON 

GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'STG1800000', N'FLW00001', N'New', 0, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'STG1800001', N'FLW00001', N'Draft', 1, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'STG1800002', N'FLW00001', N'Claim Submitted', 2, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'STG1800003', N'FLW00001', N'Pending Document', 3, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, N'STG1800004', N'FLW00001', N'Pending Amount', 4, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'STG1800005', N'FLW00001', N'Submitted to Claim', 5, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'STG1800006', N'FLW00001', N'Claim Approved', 6, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'STG1800007', N'FLW00001', N'Paid', 7, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'STG1800008', N'FLW00001', N'Rejected
', 8, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (10, N'STG1800009', N'FLW00001', N'Dropped', 9, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_flow_stage] ([flow_stage_id], [flow_stage_code], [flow_code], [description], [sequence_no], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (11, N'STG1800010', N'FLW00001', N'Complete', 10, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_flow_stage] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_group_menu] ON 

GO
INSERT [dbo].[custport_m_group_menu] ([group_menu_id], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [group_menu_icon]) VALUES (1, N'Claim', N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), 1, N'ti-file')
GO
INSERT [dbo].[custport_m_group_menu] ([group_menu_id], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [group_menu_icon]) VALUES (2, N'InPayment', N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), 1, N'ti-pencil-alt')
GO
INSERT [dbo].[custport_m_group_menu] ([group_menu_id], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [group_menu_icon]) VALUES (3, N'Administrator', N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), 1, N'ti-user')
GO
INSERT [dbo].[custport_m_group_menu] ([group_menu_id], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [group_menu_icon]) VALUES (4, N'Claim Inquiry', N'SYS', CAST(N'2018-09-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-10 00:00:00.000' AS DateTime), 1, N'ti-search')
GO
SET IDENTITY_INSERT [dbo].[custport_m_group_menu] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_mapp_menu] ON 

GO
INSERT [dbo].[custport_m_mapp_menu] ([mapp_menu_id], [group_menu_id], [menu_id], [created_by], [created_date], [modified_by], [modified_date], [is_Active]) VALUES (1, 1, 2, N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_mapp_menu] ([mapp_menu_id], [group_menu_id], [menu_id], [created_by], [created_date], [modified_by], [modified_date], [is_Active]) VALUES (2, 1, 3, N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_mapp_menu] ([mapp_menu_id], [group_menu_id], [menu_id], [created_by], [created_date], [modified_by], [modified_date], [is_Active]) VALUES (3, 1, 5, N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_mapp_menu] ([mapp_menu_id], [group_menu_id], [menu_id], [created_by], [created_date], [modified_by], [modified_date], [is_Active]) VALUES (4, 2, 12, N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_mapp_menu] ([mapp_menu_id], [group_menu_id], [menu_id], [created_by], [created_date], [modified_by], [modified_date], [is_Active]) VALUES (5, 3, 9, N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_mapp_menu] ([mapp_menu_id], [group_menu_id], [menu_id], [created_by], [created_date], [modified_by], [modified_date], [is_Active]) VALUES (6, 3, 11, N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_mapp_menu] ([mapp_menu_id], [group_menu_id], [menu_id], [created_by], [created_date], [modified_by], [modified_date], [is_Active]) VALUES (7, 4, 5, N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_mapp_menu] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_menu] ON 

GO
INSERT [dbo].[custport_m_menu] ([menu_id], [menu_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [menu_url], [menu_icon]) VALUES (2, N'MENU0001  ', N'Registration', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1, N'?cust=participant-inquiry', NULL)
GO
INSERT [dbo].[custport_m_menu] ([menu_id], [menu_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [menu_url], [menu_icon]) VALUES (3, N'MENU0002  ', N'Outstanding List', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1, N'?cust=claim-list-os', NULL)
GO
INSERT [dbo].[custport_m_menu] ([menu_id], [menu_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [menu_url], [menu_icon]) VALUES (5, N'MENU0003  ', N' Inquiry Registration ', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1, N'?cust=claim-inquiry-reg', NULL)
GO
INSERT [dbo].[custport_m_menu] ([menu_id], [menu_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [menu_url], [menu_icon]) VALUES (9, N'MENU0004  ', N'User', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1, N'?cust=user', NULL)
GO
INSERT [dbo].[custport_m_menu] ([menu_id], [menu_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [menu_url], [menu_icon]) VALUES (11, N'MENU0005  ', N'Branch', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1, N'?cust=branch', NULL)
GO
INSERT [dbo].[custport_m_menu] ([menu_id], [menu_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active], [menu_url], [menu_icon]) VALUES (12, N'MENU0006  ', N'Outstanding List', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 1, N'?cust=inpayment-list-os', NULL)
GO
SET IDENTITY_INSERT [dbo].[custport_m_menu] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_reason] ON 

GO
INSERT [dbo].[custport_m_reason] ([reason_id], [reason_code], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'RJT001', N'RJT', N'Dokumen Tidak Jelas', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_reason] ([reason_id], [reason_code], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'RJT002', N'RJT', N'Dokumen Tidak Lengkap', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_reason] ([reason_id], [reason_code], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'CNC001', N'CNC', N'Pengajuan Dibatalkan', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_reason] ([reason_id], [reason_code], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'PND001', N'PND', N'Followup Dokumen', N'SYS', CAST(N'2018-07-13 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-13 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_reason] ([reason_id], [reason_code], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'PND002', N'PND', N'Sebab lain', N'SYS', CAST(N'2018-07-16 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-16 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_reason] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_reason_type] ON 

GO
INSERT [dbo].[custport_m_reason_type] ([reason_type_id], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'RJT', N'Reject', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_reason_type] ([reason_type_id], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'CNC', N'Cancel', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_reason_type] ([reason_type_id], [reason_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'PND', N'Pending', N'SYS', CAST(N'2018-07-13 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-13 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_reason_type] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_status] ON 

GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'DRF', N'Draft', NULL, N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'CNC', N'Canceled', NULL, N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'SBM', N'Submitted', N'G', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, N'PRC', N'On Process', N'I', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'PEN', N'Pending Document', NULL, N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'PID', N'Paid', N'O', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'PAM', N'Pending Amount', N'M', N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'STC', N'Submitted to Claim', NULL, N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-10 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (10, N'DRP', N'Claim Dropped', NULL, N'SYS', CAST(N'2018-08-13 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-13 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (11, N'RJT', N'Claim Rejected', NULL, N'SYS', CAST(N'2018-08-13 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-13 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_status] ([status_id], [status_code], [description], [app_status], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (12, N'APV', N'Claim Approved', NULL, N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_status] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_transaction_type] ON 

GO
INSERT [dbo].[custport_m_transaction_type] ([transaction_type_id], [transaction_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, N'CLM       ', N'Claim', N'SYS', CAST(N'2018-07-05 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-05 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_transaction_type] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_user] ON 

GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'hci', N'Home Credit Indonesia', N'hci@hci.com', N'up', N'702818a8294e9d554acaf62faf0a4563', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, N'prib', N'Pribadi HCI', N'pribadi.pamungkas@equity.id', N'up', N'add5b173eee317ef75b0477a163c75e5', N'SYS', CAST(N'2018-07-09 00:00:00.000' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:06:46.633' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'hci_jkt', N'Home Credit Indonesia Jkt', N'hci_jkt@hci.com', N'up', N'702818a8294e9d554acaf62faf0a4563', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'hci_bdg', N'Home Credit Indonesia Bdg', N'hci_bdg@hci.com', N'up', N'702818a8294e9d554acaf62faf0a4563', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'hci', CAST(N'2018-09-10 16:13:55.270' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'SYS', N'Equity Life Indonesia', NULL, NULL, NULL, N'SYS', CAST(N'2018-07-18 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-18 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, N'hci_fmj', N'Fahrul HCI', N'fahrul.mundjid@equity.id', N'up', N'9b5317575f071bdccef2175b72191004', N'hci_jkt', CAST(N'2018-09-07 18:17:04.187' AS DateTime), N'hci_jkt', CAST(N'2018-09-07 18:17:04.187' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (12, N'hci_test', N'Fahrul Mundjid 23', N'fahrul.mundjid@equity.id12', N'up', N'96e79218965eb72c92a549dd5a330112', N'hci_jkt', CAST(N'2018-09-07 23:20:18.503' AS DateTime), N'hci', CAST(N'2018-09-10 16:13:47.523' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (13, N'hci_test2', N'TEST', N'fahrul.mundjid@equity.id', N'up', N'e10adc3949ba59abbe56e057f20f883e', N'hci_jkt', CAST(N'2018-09-07 23:20:49.653' AS DateTime), N'fahrul', CAST(N'2018-09-13 09:15:23.200' AS DateTime), NULL)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (14, N'fahrul', N'Fahrul Mundjid', N'f4_mypartner@yahoo.com', N'up', N'9b5317575f071bdccef2175b72191004', N'hci_jkt', CAST(N'2018-09-08 00:14:48.773' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:33:35.110' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (16, N'JWT', N'Jaenul Waton', N'jaenul.waton@equity.id', N'up', N'e10adc3949ba59abbe56e057f20f883e', N'hci', CAST(N'2018-09-10 10:21:18.780' AS DateTime), N'hci', CAST(N'2018-09-10 10:21:18.780' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (18, N'UMAR', N'Umar Ahmad', N'umar.ahmad@equity.id', N'up', N'e10adc3949ba59abbe56e057f20f883e', N'fahrul', CAST(N'2018-09-12 15:36:00.450' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:36:00.450' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (19, N'DONI', N'Doni Indra', N'doni.indra@equity.id', N'up', N'e10adc3949ba59abbe56e057f20f883e', N'UMAR', CAST(N'2018-09-12 16:34:44.593' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:34:44.593' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (20, N'DONI1', N'Doni Indra 1', N'doni.indra1@equity.id', N'up', N'e10adc3949ba59abbe56e057f20f883e', N'UMAR', CAST(N'2018-09-12 16:36:22.303' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:38:00.470' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (21, N'DONI2', N'Doni Indra 2', N'doni.indra2@equity.id', N'up', N'e10adc3949ba59abbe56e057f20f883e', N'UMAR', CAST(N'2018-09-12 16:37:05.147' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:38:21.823' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (30, N'DONI3', N'Doni Indra 3', N'doni.indra3@equity.id', N'up', N'e10adc3949ba59abbe56e057f20f883e', N'umar', CAST(N'2018-09-12 16:50:05.217' AS DateTime), N'fahrul', CAST(N'2018-09-13 08:39:41.553' AS DateTime), NULL)
GO
INSERT [dbo].[custport_m_user] ([user_id], [username], [fullname], [email], [user_type_code], [password], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (38, N'johndoe', N'John Doe', N'john.doe@equity.id', N'up', N'25d55ad283aa400af464c76d713c07ad', N'fahrul', CAST(N'2018-09-13 10:55:39.260' AS DateTime), N'fahrul', CAST(N'2018-09-13 10:58:29.993' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_user] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_user_company] ON 

GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'xxx00001', N'hci', N'hci', N'hci_jkt', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, N'xxx00002', N'hci', N'hci', N'hci_bdg', N'SYS', CAST(N'2018-06-28 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-28 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, N'xxx00003', N'prib', N'hci', N'hci_jkt', N'SYS', CAST(N'2018-07-09 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-09 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, N'xxx00004', N'prib', N'hci', N'hci_bdg', N'SYS', CAST(N'2018-07-09 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-09 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, N'xxx00005', N'hci_jkt', N'hci', N'hci_jkt', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, N'xxx00006', N'hci_bdg', N'hci', N'hci_bdg', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (22, N'REG00007', N'hci_test', N'hci', N'hci_jkt', N'hci_jkt', CAST(N'2018-09-07 23:20:18.503' AS DateTime), N'hci', CAST(N'2018-09-10 10:24:17.133' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (23, N'REG00008', N'hci_test2', N'hci', N'hci_jkt', N'hci_jkt', CAST(N'2018-09-07 23:20:49.653' AS DateTime), N'hci', CAST(N'2018-09-10 18:04:12.887' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (24, N'REG00009', N'fahrul', N'hci', N'hci_bdg', N'hci_jkt', CAST(N'2018-09-08 00:14:48.780' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:33:35.110' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (25, N'REG00010', N'JWT', N'hci', N'hci_jkt', N'hci', CAST(N'2018-09-10 10:21:18.783' AS DateTime), N'hci', CAST(N'2018-09-10 10:21:18.783' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (26, N'REG00011', N'1111', N'hci', N'hci_jkt', N'hci', CAST(N'2018-09-10 10:24:56.827' AS DateTime), N'hci', CAST(N'2018-09-10 10:26:44.527' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (27, N'REG00012', N'UMAR', N'hci', N'HCI00006', N'fahrul', CAST(N'2018-09-12 15:36:00.453' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:36:00.453' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (28, N'REG00013', N'DONI', N'hci', N'HCI00007', N'UMAR', CAST(N'2018-09-12 16:34:44.613' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:34:44.613' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (29, N'REG00014', N'DONI1', N'hci', N'HCI00007', N'UMAR', CAST(N'2018-09-12 16:36:22.303' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:38:00.470' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (30, N'REG00015', N'DONI2', N'hci', N'HCI00007', N'UMAR', CAST(N'2018-09-12 16:37:05.147' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:38:21.823' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (31, N'REG00016', N'DONI3', N'hci', N'HCI00007', N'umar', CAST(N'2018-09-12 16:50:05.217' AS DateTime), N'umar', CAST(N'2018-09-12 16:50:05.217' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_company] ([user_company_id], [user_company_code], [username], [company_code], [company_region_code], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (32, N'REG00017', N'johndoe', N'hci', N'HCI00005', N'fahrul', CAST(N'2018-09-13 10:55:39.277' AS DateTime), N'fahrul', CAST(N'2018-09-13 10:55:39.277' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_user_company] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_user_group_menu] ON 

GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (1, 2, N'hci_test2', N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-10 17:45:30.510' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, 1, N'hci_test2', N'SYS', CAST(N'2018-09-10 17:47:19.450' AS DateTime), N'SYS', CAST(N'2018-09-10 17:47:19.450' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, 3, N'hci_test2', N'hci', CAST(N'2018-09-10 18:02:56.833' AS DateTime), N'hci', CAST(N'2018-09-10 18:02:56.833' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (4, 4, N'hci_test2', N'hci', CAST(N'2018-09-10 18:03:34.380' AS DateTime), N'hci', CAST(N'2018-09-10 18:03:34.380' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (5, 3, N'fahrul', N'hci', CAST(N'2018-09-12 08:36:28.393' AS DateTime), N'hci', CAST(N'2018-09-12 08:36:28.393' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (6, 1, N'fahrul', N'hci', CAST(N'2018-09-12 09:40:08.820' AS DateTime), N'hci', CAST(N'2018-09-12 09:40:08.820' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (7, 3, N'fahrul', N'hci', CAST(N'2018-09-12 10:06:28.650' AS DateTime), N'hci', CAST(N'2018-09-12 10:06:28.650' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (8, 2, N'fahrul', N'hci', CAST(N'2018-09-12 10:09:34.517' AS DateTime), N'hci', CAST(N'2018-09-12 10:09:34.517' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (9, 4, N'fahrul', N'fahrul', CAST(N'2018-09-12 10:55:14.290' AS DateTime), N'fahrul', CAST(N'2018-09-12 10:55:14.290' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (10, 3, N'prib', N'fahrul', CAST(N'2018-09-12 15:06:53.933' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:06:53.933' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (11, 1, N'fahrul', N'fahrul', CAST(N'2018-09-12 15:33:20.213' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:33:20.213' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (12, 3, N'UMAR', N'fahrul', CAST(N'2018-09-12 15:36:16.993' AS DateTime), N'fahrul', CAST(N'2018-09-12 15:36:16.993' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (13, 4, N'UMAR', N'UMAR', CAST(N'2018-09-12 15:40:29.733' AS DateTime), N'UMAR', CAST(N'2018-09-12 15:40:29.733' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (14, 1, N'UMAR', N'UMAR', CAST(N'2018-09-12 15:41:19.893' AS DateTime), N'UMAR', CAST(N'2018-09-12 15:41:19.893' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (15, 4, N'DONI', N'UMAR', CAST(N'2018-09-12 16:35:15.587' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:35:15.587' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (16, 1, N'DONI1', N'UMAR', CAST(N'2018-09-12 16:37:38.017' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:37:38.017' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (17, 4, N'DONI1', N'UMAR', CAST(N'2018-09-12 16:37:45.083' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:37:45.083' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (18, 2, N'DONI2', N'UMAR', CAST(N'2018-09-12 16:38:34.497' AS DateTime), N'UMAR', CAST(N'2018-09-12 16:38:34.497' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (19, 1, N'DONI3', N'umar', CAST(N'2018-09-12 16:50:32.800' AS DateTime), N'umar', CAST(N'2018-09-12 16:50:32.800' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (20, 4, N'DONI3', N'umar', CAST(N'2018-09-12 16:50:39.287' AS DateTime), N'umar', CAST(N'2018-09-12 16:50:39.287' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (21, 2, N'DONI3', N'umar', CAST(N'2018-09-12 16:50:45.753' AS DateTime), N'umar', CAST(N'2018-09-12 16:50:45.753' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (22, 1, N'DONI', N'fahrul', CAST(N'2018-09-13 08:59:15.190' AS DateTime), N'fahrul', CAST(N'2018-09-13 08:59:15.190' AS DateTime), 0)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (23, 1, N'johndoe', N'fahrul', CAST(N'2018-09-13 11:03:26.433' AS DateTime), N'fahrul', CAST(N'2018-09-13 11:03:26.433' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (24, 2, N'UMAR', N'Umar', CAST(N'2018-09-13 11:12:00.210' AS DateTime), N'Umar', CAST(N'2018-09-13 11:12:00.210' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (25, 2, N'fahrul', N'fahrul', CAST(N'2018-09-13 11:36:48.057' AS DateTime), N'fahrul', CAST(N'2018-09-13 11:36:48.057' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (26, 1, N'prib', N'prib', CAST(N'2018-09-13 14:22:59.140' AS DateTime), N'prib', CAST(N'2018-09-13 14:22:59.140' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (27, 4, N'prib', N'prib', CAST(N'2018-09-13 14:23:20.497' AS DateTime), N'prib', CAST(N'2018-09-13 14:23:20.497' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_group_menu] ([user_group_menu_id], [group_menu_id], [username], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (28, 2, N'prib', N'prib', CAST(N'2018-09-13 14:24:47.187' AS DateTime), N'prib', CAST(N'2018-09-13 14:24:47.187' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_user_group_menu] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_m_user_type] ON 

GO
INSERT [dbo].[custport_m_user_type] ([user_type_id], [user_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (3, N'eli', N'User Equity', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), 1)
GO
INSERT [dbo].[custport_m_user_type] ([user_type_id], [user_type_code], [description], [created_by], [created_date], [modified_by], [modified_date], [is_active]) VALUES (2, N'up', N'User Partner', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), 1)
GO
SET IDENTITY_INSERT [dbo].[custport_m_user_type] OFF
GO
SET IDENTITY_INSERT [dbo].[custport_s_action_list] ON 

GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (1, N'login', 9, N'username, password', NULL, N'sid, user, fullname, email, user_type_code, company_region, error_code, error_description', NULL, NULL, N'default', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (2, N'logout', 9, N'sid', NULL, NULL, NULL, NULL, N'default', N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-06 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (3, N'lookup_customer', 5, N'no_polis, contract_no, customer_name, ktp_id', N'proc_custport_lookup_customer', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (4, N'claim_type', 1, N'claim_type_id, claim_type_code, description, is_active', N'custport_m_claim_type', N'claim_type_id, claim_type_code, description, claim_core_code, is_need_account, is_active', N'description', NULL, N'default', N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (5, N'claim_document_old', 1, N'document_code, description, is_mandatory, claim_type_code, claim_document_code, is_active', N'view_custport_claim_document', N'document_code, description, is_mandatory, claim_type_code, claim_document_code', NULL, NULL, N'default', N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-06-29 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (6, N'save_claim_old', 5, N'claim_no, certificate_no, contract_no, customer_name, register_date, event_date, claim_type_code, currency_code, claim_amount, reference_no, status_code, reason_code, user_id', N'proc_custport_save_claim', N'messsage', NULL, NULL, N'default', N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-02 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (7, N'save_claim', 9, N'claim_no,certificate_no,contract_no,customer_name,event_date,claim_type_code,currency_code,claim_amount,user_id,documents,notes', N'save_claim', NULL, NULL, NULL, N'default', N'SYS', CAST(N'2018-07-03 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-03 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (8, N'flow', 1, N'flow_id,flow_code,flow_description,transaction_type_code,flow_stage_id,flow_stage_code,flow_stage_description,sequence_no,flow_action_id,flow_action_code,flow_action_description,next_flow_stage,is_need_reason,is_reference_no,next_flow_stage_description', N'view_custport_flow', N'flow_id,flow_code,flow_description,transaction_type_code,flow_stage_id,flow_stage_code,flow_stage_description,sequence_no,flow_action_id,flow_action_code,flow_action_description,next_flow_stage,is_need_reason,is_reference_no,next_flow_stage_description', N'sequence_no', NULL, N'default', N'SYS', CAST(N'2018-07-06 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-06 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (10, N'submit_claim', 9, N'claim_no,certificate_no,contract_no,customer_name,event_date,claim_type_code,currency_code,claim_amount,user_id,documents,notes', N'submit_claim', NULL, NULL, NULL, N'default', N'SYS', CAST(N'2018-07-09 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-09 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (11, N'list_claim', 7, N'username, period_from, period_to, customer_name, contract_no, register_no, status, tipe_data', N'func_custport_list_claim', NULL, N'claim_id', NULL, N'default', N'SYS', CAST(N'2018-07-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-10 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (12, N'history_claim_old', 1, N'claim_history_id, claim_no, date, action_code, action_description, notes, create_user, created_by, created_date, is_active', N'view_custport_claim_history', N'claim_history_id, claim_no, date, action_code, action_description, reason_code, reason, notes, create_user, created_by, created_date, is_active', N'date', NULL, N'default', N'SYS', CAST(N'2018-07-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-10 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (13, N'claim_document', 5, N'claim_type_code', N'proc_custport_claim_document', NULL, NULL, NULL, N'default', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (14, N'edit_claim', 9, N'claim_no', N'edit_claim', NULL, NULL, NULL, N'default', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (16, N'status', 1, N'status_id, status_code, description, is_active', N'custport_m_status', N'status_id, status_code, description, is_active', N'status_id', NULL, N'deafult', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (17, N'set_cancel', 5, N'claim_no, user_id', N'proc_custport_set_cancel_claim', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-11 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (18, N'delete_document', 5, N'claim_no, document_code, user_id', N'proc_custport_delete_document', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-07-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-12 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (19, N'mata_uang', 1, N'id_valuta, deskripsi, simbol, valas', N'view_custport_valuta', N'id_valuta, deskripsi, simbol, valas', N'id_valuta', NULL, N'default', N'SYS', CAST(N'2018-07-31 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-07-31 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (20, N'bank', 1, N'bank_id, bank_name, bank_code, swiftcode, created_by, created_date, modified_by, modified_date, is_active', N'custport_m_bank', N'bank_id, bank_name, bank_code, swiftcode, created_by, created_date, modified_by, modified_date', N'bank_name', NULL, N'default', N'SYS', CAST(N'2018-08-01 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-01 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (21, N'list_inpayment', 7, N'username, period_from, period_to, customer_name, contract_no, register_no', N'func_custport_list_inpayment', NULL, N'claim_id', NULL, N'default', N'SYS', CAST(N'2018-08-28 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-28 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (22, N'set_amount_claim', 5, N'claim_no, currency_code, claim_amount, user_id', N'proc_custport_set_amount_claim', NULL, NULL, NULL, N'default', N'SYS', CAST(N'2018-08-28 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-28 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (27, N'user', 1, N'user_id,username,fullname,branch_name,company_region_code,company_region_id,is_active', N'view_custport_user', N'user_id,username,fullname,email,user_type_code,branch_name,company_region_id,company_region_code,is_active', N'fullname', NULL, N'default', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-28 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (28, N'history_claim', 5, N'claim_history_id, claim_no, date, action_code, action_description, notes, create_user, created_by, created_date, is_active', N'proc_custport_claim_history', N'claim_history_id, claim_no, date, action_code, action_description, reason_code, reason, notes, create_user, created_by, created_date, is_active', NULL, NULL, N'default', N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-08-30 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (30, N'company_region', 1, N'company_region_id, company_region_code, company_code, description, is_active', N'view_custport_company_region', N'company_region_id, company_region_code, company_code, description, created_by, created_date, modified_by, modified_date, is_active', N'description', NULL, N'deafult', N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (33, N'save_user', 5, N'user_id,username,fullname,email,user_type_code,company_region_code,password,created_by', N'proc_custport_save_user', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (34, N'set_user_status', 5, N'username,status_id,modified_by', N'proc_custport_set_user_status', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-07 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (35, N'group_menu', 1, N'group_menu_id,description,is_active', N'view_custport_group_menu', N'group_menu_id,description,is_active', N'description', NULL, N'default', N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (36, N'user_group_menu', 1, N'user_group_menu_id,group_menu_id,description,username,is_active', N'view_user_group_menu', N'user_group_menu_id,group_menu_id,description,username,is_active', N'description', NULL, N'default', N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (37, N'set_new_password', 5, N'username,password,modified_by,is_active', N'proc_custport_set_password', N'message', NULL, NULL, N'deafult', N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-08 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (38, N'set_branch_status', 5, N'company_region_id,status_id,modified_by', N'proc_custport_set_branch_status', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2019-09-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2019-09-10 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (40, N'save_branch', 5, N'company_region_id,description,created_by', N'proc_custport_save_branch', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-09-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-10 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (47, N'save_group_menu', 5, N'username,group_menu_id,created_by', N'proc_custport_save_group_menu', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-09-10 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-10 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (49, N'del_user_group_menu', 5, N'username,group_menu_id,created_by', N'proc_custport_del_group_menu', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (50, N'get_group_menu', 5, N'username', N'proc_custport_get_group_menu', N'message', NULL, NULL, N'default', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_list] ([action_id], [action_name], [action_type], [condition_field], [result_object], [result_field], [default_order], [max_result_row], [datasource], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (51, N'get_sub_menu', 5, N'group_menu_id', N'proc_custport_get_menu', N'message', N'', NULL, N'default', N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), N'SYS', CAST(N'2018-09-12 00:00:00.000' AS DateTime), 0)
GO
SET IDENTITY_INSERT [dbo].[custport_s_action_list] OFF
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (1, N'view', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (2, N'insert', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (3, N'update', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (4, N'delete', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (5, N'proc', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (6, N'scalar_func', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (7, N'tabular_func', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_action_type] ([id_action_type], [description], [created_by], [created_date], [modified_by], [modified_date], [is_delete]) VALUES (9, N'custom_file', N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), N'PPM', CAST(N'2017-05-19 10:07:58.547' AS DateTime), 0)
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (0, N'No Error')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (100, N'Invalid username or password, please try again')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (101, N'Session Expired. Please relogin.')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (102, N'Session Already Exist.')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (103, N'Invalid Signature.')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (200, N'OK')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (201, N'Missing Condition Field.')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (202, N'Unknown Condition Field.')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (403, N'Forbidden')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (404, N'Data not found')
GO
INSERT [dbo].[custport_s_error_code] ([error_code], [error_description]) VALUES (422, N'Unprocessable Entity')
GO

SET ANSI_PADDING ON

GO
/****** Object:  Index [UK_custport_claim_claim_no]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim]') AND name = N'UK_custport_claim_claim_no')
ALTER TABLE [dbo].[custport_claim] ADD  CONSTRAINT [UK_custport_claim_claim_no] UNIQUE NONCLUSTERED 
(
	[claim_no] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UK_custport_claim_document_file_code]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_claim_document_file]') AND name = N'UK_custport_claim_document_file_code')
ALTER TABLE [dbo].[custport_claim_document_file] ADD  CONSTRAINT [UK_custport_claim_document_file_code] UNIQUE NONCLUSTERED 
(
	[claim_document_file_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_custport_m_bank_bank_name]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_bank]') AND name = N'IX_custport_m_bank_bank_name')
ALTER TABLE [dbo].[custport_m_bank] ADD  CONSTRAINT [IX_custport_m_bank_bank_name] UNIQUE NONCLUSTERED 
(
	[bank_name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__3E2672346D3D505E]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company]') AND name = N'UQ__custport__3E2672346D3D505E')
ALTER TABLE [dbo].[custport_m_company] ADD  CONSTRAINT [UQ__custport__3E2672346D3D505E] UNIQUE NONCLUSTERED 
(
	[company_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__C7D57972C045D6EF]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_policy]') AND name = N'UQ__custport__C7D57972C045D6EF')
ALTER TABLE [dbo].[custport_m_company_policy] ADD  CONSTRAINT [UQ__custport__C7D57972C045D6EF] UNIQUE NONCLUSTERED 
(
	[company_policy_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__CAB9B8D17321E5ED]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_company_region]') AND name = N'UQ__custport__CAB9B8D17321E5ED')
ALTER TABLE [dbo].[custport_m_company_region] ADD  CONSTRAINT [UQ__custport__CAB9B8D17321E5ED] UNIQUE NONCLUSTERED 
(
	[company_region_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__C7F543D2E3067840]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_currency]') AND name = N'UQ__custport__C7F543D2E3067840')
ALTER TABLE [dbo].[custport_m_currency] ADD  CONSTRAINT [UQ__custport__C7F543D2E3067840] UNIQUE NONCLUSTERED 
(
	[currency_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__9666E8AD91275F46]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_document]') AND name = N'UQ__custport__9666E8AD91275F46')
ALTER TABLE [dbo].[custport_m_document] ADD  CONSTRAINT [UQ__custport__9666E8AD91275F46] UNIQUE NONCLUSTERED 
(
	[document_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UK_custport_m_flow_flow_code]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow]') AND name = N'UK_custport_m_flow_flow_code')
ALTER TABLE [dbo].[custport_m_flow] ADD  CONSTRAINT [UK_custport_m_flow_flow_code] UNIQUE NONCLUSTERED 
(
	[flow_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__1DDE38A2CA66FCDC]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow]') AND name = N'UQ__custport__1DDE38A2CA66FCDC')
ALTER TABLE [dbo].[custport_m_flow] ADD  CONSTRAINT [UQ__custport__1DDE38A2CA66FCDC] UNIQUE NONCLUSTERED 
(
	[flow_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UK_custport_m_flow_action_code]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_action]') AND name = N'UK_custport_m_flow_action_code')
ALTER TABLE [dbo].[custport_m_flow_action] ADD  CONSTRAINT [UK_custport_m_flow_action_code] UNIQUE NONCLUSTERED 
(
	[flow_action_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__08AE9413EA792413]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_action]') AND name = N'UQ__custport__08AE9413EA792413')
ALTER TABLE [dbo].[custport_m_flow_action] ADD  CONSTRAINT [UQ__custport__08AE9413EA792413] UNIQUE NONCLUSTERED 
(
	[flow_action_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_custport_m_flow_stage_code]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_stage]') AND name = N'IX_custport_m_flow_stage_code')
ALTER TABLE [dbo].[custport_m_flow_stage] ADD  CONSTRAINT [IX_custport_m_flow_stage_code] UNIQUE NONCLUSTERED 
(
	[flow_stage_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__CEADC453ABE97402]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_flow_stage]') AND name = N'UQ__custport__CEADC453ABE97402')
ALTER TABLE [dbo].[custport_m_flow_stage] ADD  CONSTRAINT [UQ__custport__CEADC453ABE97402] UNIQUE NONCLUSTERED 
(
	[flow_stage_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__4CA0FADD440CBC23]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_menu]') AND name = N'UQ__custport__4CA0FADD440CBC23')
ALTER TABLE [dbo].[custport_m_menu] ADD UNIQUE NONCLUSTERED 
(
	[menu_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UQ__custport__846BB555E0871C78]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason]') AND name = N'UQ__custport__846BB555E0871C78')
ALTER TABLE [dbo].[custport_m_reason] ADD  CONSTRAINT [UQ__custport__846BB555E0871C78] UNIQUE NONCLUSTERED 
(
	[reason_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UK_reason_type_code]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_reason_type]') AND name = N'UK_reason_type_code')
ALTER TABLE [dbo].[custport_m_reason_type] ADD  CONSTRAINT [UK_reason_type_code] UNIQUE NONCLUSTERED 
(
	[reason_type_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__760965CD51115919]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role]') AND name = N'UQ__custport__760965CD51115919')
ALTER TABLE [dbo].[custport_m_role] ADD UNIQUE NONCLUSTERED 
(
	[role_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__7101AE8BA1E4DB3B]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]') AND name = N'UQ__custport__7101AE8BA1E4DB3B')
ALTER TABLE [dbo].[custport_m_role_menu] ADD UNIQUE NONCLUSTERED 
(
	[role_menu_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UQ__custport__3683B5304EDE7025]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_status]') AND name = N'UQ__custport__3683B5304EDE7025')
ALTER TABLE [dbo].[custport_m_status] ADD  CONSTRAINT [UQ__custport__3683B5304EDE7025] UNIQUE NONCLUSTERED 
(
	[status_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__439ABFC09A999CFD]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_transaction_type]') AND name = N'UQ__custport__439ABFC09A999CFD')
ALTER TABLE [dbo].[custport_m_transaction_type] ADD  CONSTRAINT [UQ__custport__439ABFC09A999CFD] UNIQUE NONCLUSTERED 
(
	[transaction_type_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__B9BE370E7A9BCB7D]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user]') AND name = N'UQ__custport__B9BE370E7A9BCB7D')
ALTER TABLE [dbo].[custport_m_user] ADD  CONSTRAINT [UQ__custport__B9BE370E7A9BCB7D] UNIQUE NONCLUSTERED 
(
	[user_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UQ_custport_m_user_username]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user]') AND name = N'UQ_custport_m_user_username')
ALTER TABLE [dbo].[custport_m_user] ADD  CONSTRAINT [UQ_custport_m_user_username] UNIQUE NONCLUSTERED 
(
	[username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__BFBB645394842EFE]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]') AND name = N'UQ__custport__BFBB645394842EFE')
ALTER TABLE [dbo].[custport_m_user_company] ADD  CONSTRAINT [UQ__custport__BFBB645394842EFE] UNIQUE NONCLUSTERED 
(
	[user_company_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [UQ_custport_m_user_company_code]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]') AND name = N'UQ_custport_m_user_company_code')
ALTER TABLE [dbo].[custport_m_user_company] ADD  CONSTRAINT [UQ_custport_m_user_company_code] UNIQUE NONCLUSTERED 
(
	[user_company_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__B8D9ABA33275BF14]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_role]') AND name = N'UQ__custport__B8D9ABA33275BF14')
ALTER TABLE [dbo].[custport_m_user_role] ADD UNIQUE NONCLUSTERED 
(
	[user_role_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [UQ__custport__9424CFA7F3CCF690]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_m_user_type]') AND name = N'UQ__custport__9424CFA7F3CCF690')
ALTER TABLE [dbo].[custport_m_user_type] ADD  CONSTRAINT [UQ__custport__9424CFA7F3CCF690] UNIQUE NONCLUSTERED 
(
	[user_type_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON

GO
/****** Object:  Index [IX_custport_s_action_list_act_name]    Script Date: 13/09/2018 17:17:59 ******/
IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[custport_s_action_list]') AND name = N'IX_custport_s_action_list_act_name')
ALTER TABLE [dbo].[custport_s_action_list] ADD  CONSTRAINT [IX_custport_s_action_list_act_name] UNIQUE NONCLUSTERED 
(
	[action_name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DF_custport_s_log_date]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[custport_s_log] ADD  CONSTRAINT [DF_custport_s_log_date]  DEFAULT (getdate()) FOR [date]
END

GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___claim__32A230EB]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim]'))
ALTER TABLE [dbo].[custport_claim]  WITH CHECK ADD  CONSTRAINT [FK__custport___claim__32A230EB] FOREIGN KEY([claim_type_code])
REFERENCES [dbo].[custport_m_claim_type] ([claim_type_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___claim__32A230EB]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim]'))
ALTER TABLE [dbo].[custport_claim] CHECK CONSTRAINT [FK__custport___claim__32A230EB]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___curre__33965524]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim]'))
ALTER TABLE [dbo].[custport_claim]  WITH CHECK ADD  CONSTRAINT [FK__custport___curre__33965524] FOREIGN KEY([currency_code])
REFERENCES [dbo].[custport_m_currency] ([currency_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___curre__33965524]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim]'))
ALTER TABLE [dbo].[custport_claim] CHECK CONSTRAINT [FK__custport___curre__33965524]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__3A4352B3]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim_document]'))
ALTER TABLE [dbo].[custport_claim_document]  WITH CHECK ADD  CONSTRAINT [FK__custport___docum__3A4352B3] FOREIGN KEY([document_code])
REFERENCES [dbo].[custport_m_document] ([document_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__3A4352B3]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim_document]'))
ALTER TABLE [dbo].[custport_claim_document] CHECK CONSTRAINT [FK__custport___docum__3A4352B3]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__3F0807D0]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim_document_file]'))
ALTER TABLE [dbo].[custport_claim_document_file]  WITH CHECK ADD  CONSTRAINT [FK__custport___docum__3F0807D0] FOREIGN KEY([document_code])
REFERENCES [dbo].[custport_m_document] ([document_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__3F0807D0]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_claim_document_file]'))
ALTER TABLE [dbo].[custport_claim_document_file] CHECK CONSTRAINT [FK__custport___docum__3F0807D0]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___claim__254835CD]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]'))
ALTER TABLE [dbo].[custport_m_claim_document]  WITH CHECK ADD  CONSTRAINT [FK__custport___claim__254835CD] FOREIGN KEY([claim_type_code])
REFERENCES [dbo].[custport_m_claim_type] ([claim_type_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___claim__254835CD]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]'))
ALTER TABLE [dbo].[custport_m_claim_document] CHECK CONSTRAINT [FK__custport___claim__254835CD]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__263C5A06]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]'))
ALTER TABLE [dbo].[custport_m_claim_document]  WITH CHECK ADD  CONSTRAINT [FK__custport___docum__263C5A06] FOREIGN KEY([document_code])
REFERENCES [dbo].[custport_m_document] ([document_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___docum__263C5A06]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_claim_document]'))
ALTER TABLE [dbo].[custport_m_claim_document] CHECK CONSTRAINT [FK__custport___docum__263C5A06]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__69334BC6]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_company_policy]'))
ALTER TABLE [dbo].[custport_m_company_policy]  WITH CHECK ADD  CONSTRAINT [FK__custport___compa__69334BC6] FOREIGN KEY([company_code])
REFERENCES [dbo].[custport_m_company] ([company_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__69334BC6]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_company_policy]'))
ALTER TABLE [dbo].[custport_m_company_policy] CHECK CONSTRAINT [FK__custport___compa__69334BC6]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__6D03DCAA]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_company_region]'))
ALTER TABLE [dbo].[custport_m_company_region]  WITH CHECK ADD  CONSTRAINT [FK__custport___compa__6D03DCAA] FOREIGN KEY([company_code])
REFERENCES [dbo].[custport_m_company] ([company_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__6D03DCAA]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_company_region]'))
ALTER TABLE [dbo].[custport_m_company_region] CHECK CONSTRAINT [FK__custport___compa__6D03DCAA]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___trans__16FA1676]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_flow]'))
ALTER TABLE [dbo].[custport_m_flow]  WITH CHECK ADD  CONSTRAINT [FK__custport___trans__16FA1676] FOREIGN KEY([transaction_type_code])
REFERENCES [dbo].[custport_m_transaction_type] ([transaction_type_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___trans__16FA1676]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_flow]'))
ALTER TABLE [dbo].[custport_m_flow] CHECK CONSTRAINT [FK__custport___trans__16FA1676]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___menu___0016B11E]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]'))
ALTER TABLE [dbo].[custport_m_role_menu]  WITH CHECK ADD FOREIGN KEY([menu_code])
REFERENCES [dbo].[custport_m_menu] ([menu_code])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___role___7F228CE5]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_role_menu]'))
ALTER TABLE [dbo].[custport_m_role_menu]  WITH CHECK ADD FOREIGN KEY([role_code])
REFERENCES [dbo].[custport_m_role] ([role_code])
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___user___73B0DA39]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user]'))
ALTER TABLE [dbo].[custport_m_user]  WITH CHECK ADD  CONSTRAINT [FK__custport___user___73B0DA39] FOREIGN KEY([user_type_code])
REFERENCES [dbo].[custport_m_user_type] ([user_type_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___user___73B0DA39]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user]'))
ALTER TABLE [dbo].[custport_m_user] CHECK CONSTRAINT [FK__custport___user___73B0DA39]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__04DB663B]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]'))
ALTER TABLE [dbo].[custport_m_user_company]  WITH CHECK ADD  CONSTRAINT [FK__custport___compa__04DB663B] FOREIGN KEY([company_code])
REFERENCES [dbo].[custport_m_company] ([company_code])
GO
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___compa__04DB663B]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user_company]'))
ALTER TABLE [dbo].[custport_m_user_company] CHECK CONSTRAINT [FK__custport___compa__04DB663B]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__custport___role___0D70AC3C]') AND parent_object_id = OBJECT_ID(N'[dbo].[custport_m_user_role]'))
ALTER TABLE [dbo].[custport_m_user_role]  WITH CHECK ADD FOREIGN KEY([role_code])
REFERENCES [dbo].[custport_m_role] ([role_code])
GO
/****** Object:  StoredProcedure [dbo].[proc_custport_app_action_claim]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_app_action_claim]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_app_action_claim] AS' 
END
GO

-- last modified by Pribadi Pamungkas. 2018-07-20 => tambah dokumen core
-- by Pribadi Pamungkas. 2018-07-20
ALTER PROCEDURE [dbo].[proc_custport_app_action_claim]
	@pi_claim_no VARCHAR(20),
	@pi_action_code VARCHAR(50),
	@pi_reason_code VARCHAR(50) = NULL,
	@pi_notes VARCHAR(300),
	@pi_user_id VARCHAR(20),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.


	IF EXISTS(SELECT 1 FROM dbo.custport_claim WHERE claim_no = @pi_claim_no AND is_active = 1)
		BEGIN

			DECLARE 
				@p_curr_date DATETIME = GETDATE()

			BEGIN TRAN

				DECLARE
					@p_is_external_process BIT,
					@p_next_flow_stage VARCHAR(50),
					@p_next_status_code VARCHAR(50),
					@p_flow_action_description VARCHAR(150)

				SELECT
					@p_is_external_process = is_external_process,
					@p_next_flow_stage = next_flow_stage,
					@p_next_status_code = next_status_code,
					@p_flow_action_description = flow_action_description
				FROM
					dbo.view_custport_flow
				WHERE
					flow_action_code = @pi_action_code
				IF (@@ERROR <> 0) OR (@@RowCount < 1)	-- jika ada error atau tidak ada row
					BEGIN
						ROLLBACK TRAN
						SET @po_message = 'Action tidak dikenal'
						SELECT @po_message AS message
						RETURN -1
					END

				IF @p_is_external_process=1	-- proses ke core
					BEGIN
						DECLARE
							@p_no_polis varchar(13),
							@p_id_peserta varchar(12),
							@p_certificate_no varchar(20),
							@p_contract_no varchar(20),
							@p_customer_name varchar(100),
							@p_register_date date,
							@p_event_date date,
							@p_claim_type_code varchar(50),
							@p_claim_core_code varchar(1),
							@p_currency_code varchar(50),
							@p_claim_amount decimal(12,2),
							@p_reference_no varchar(20),
							@p_status_code varchar(50),
							@p_flow_stage_code varchar(50),
							@p_reason_code varchar(50),
							@p_notes varchar(600),
							@p_company_code varchar(10),
							@p_company_region_code varchar(10),
							@p_tmp_guid varchar(50),
							@p_complete_doc_date datetime,
							@p_created_by varchar(15),
							@p_created_date datetime,
							@p_modified_by varchar(15),
							@p_modified_date datetime

						SELECT
							@p_no_polis = cc.no_polis,
							@p_id_peserta = cc.id_peserta,
							@p_certificate_no = cc.certificate_no,
							@p_contract_no = cc.contract_no,
							@p_customer_name = cc.customer_name,
							@p_register_date = cc.register_date,
							@p_event_date = cc.event_date,
							@p_claim_type_code = cc.claim_type_code,
							@p_claim_core_code = cmct.claim_core_code,
							@p_currency_code = cc.currency_code,
							@p_claim_amount = cc.claim_amount,
							@p_reference_no = cc.reference_no,
							@p_status_code = cc.status_code,
							@p_flow_stage_code = cc.flow_stage_code,
							@p_reason_code = cc.reason_code,
							@p_notes = cc.notes,
							@p_company_code = cc.company_code,
							@p_company_region_code = cc.company_region_code,
							@p_tmp_guid = cc.tmp_guid,
							@p_complete_doc_date = complete_doc_date,
							@p_created_by = cc.created_by,
							@p_created_date = cc.created_date,
							@p_modified_by = cc.modified_by,
							@p_modified_date = cc.modified_date
						FROM 
							[dbo].[custport_claim] AS cc INNER JOIN
							[dbo].[custport_m_claim_type] AS cmct ON cc.claim_type_code = cmct.claim_type_code
						WHERE
							cc.claim_no = @pi_claim_no 
							AND cc.is_active = 1
							AND cmct.is_active = 1
						IF (@@ERROR = 0) AND (@@RowCount > 0)	-- jika tidak ada error dan ada row
							BEGIN
								DECLARE 
									@p_id_klaim varchar(12) = NULL
		
								-- GET id_peserta
								EXEC AJK.dbo.gproc_GetNo
									@Tgl = @p_curr_date,
									@sField = 'id_klaim',
									@CurrNo = @p_id_klaim OUTPUT
								IF (@@Error <> 0 OR COALESCE(@p_id_klaim,'')='')
									BEGIN
										ROLLBACK TRAN
										SET @po_message = 'Error generating id_klaim'
										RETURN -1
									END
								INSERT INTO [dbo].[klaim]
												([id_klaim]
												,[tgl_pengajuan]
												,[tgl_kejadian]
												,[id_peserta]
												,[id_diagnosa]
												,[jml_uang_pertanggungan]
												,[jml_bayar]
												,[jml_tolakan]
												,[jml_penyesuaian]
												,[total_dibayar]
												,[catatan]
												,[status]
												,[create_date]
												,[create_by]
												,[change_date]
												,[change_by]
												,[id_jenis_klaim]
												,[id_status_klaim]
												,[id_kelompok_kota]
												,[keterangan]
												,[tgl_dokumen_lengkap]
												,[jml_diajukan]
												,[no_polis]
												,[coverage_installment]
												,[id_rejected_klaim_hci])
											VALUES
												(@p_id_klaim
												,CAST(@p_register_date AS DATETIME)
												,CAST(@p_event_date AS DATETIME)
												,@p_id_peserta
												,'99'
												,0	-- jml_uang_pertanggungan
												,0	-- jml_bayar
												,0
												,0
												,0	-- total_dibayar
												,LEFT(@p_notes, 100)
												,'G'
												,@p_curr_date
												,@pi_user_id	-- create_by
												,@p_curr_date
												,@pi_user_id	-- change_by
												,@p_claim_core_code
												,'01'	-- Draft
												,'9'
												,LEFT(@p_notes, 100)
												,CAST(CAST(@p_complete_doc_date AS DATE) AS DATETIME)
												,CAST(@p_claim_amount AS FLOAT)
												,@p_no_polis
												,0
												,'00')
								IF (@@Error <> 0)
									BEGIN
										ROLLBACK TRAN
										SET @po_message = 'Failed inserting claim to core'
										RETURN -1
									END

								-- insert dokumen core
								INSERT INTO [dbo].[klaim_dokumen]
										   ([id_klaim]
										   ,[no_urut]
										   ,[id_item_dokumen]
										   ,[wajib_ya]
										   ,[ada_ya]
										   ,[keterangan]
										   ,[status]
										   ,[create_date]
										   ,[create_by]
										   ,[change_date]
										   ,[change_by]
										   ,[valid_ya])
								SELECT
									@p_id_klaim,
									ROW_NUMBER() OVER(ORDER BY idk.id_item_dokumen),
									idk.id_item_dokumen,
									0,	-- wajib_ya
									CASE
										WHEN portal.id_item_dokumen_core IS NULL THEN 0
										ELSE 1
									END,	-- ada_ya
									NULL,
									'I',
									GETDATE(),
									@pi_user_id,
									GETDATE(),
									@pi_user_id,
									0
								FROM
									item_dokumen_klaim AS idk LEFT JOIN
									(
										SELECT
											cmd.id_item_dokumen_core
										FROM
											custport_m_document AS cmd INNER JOIN
											custport_claim_document AS ccd ON cmd.document_code = ccd.document_code INNER JOIN
											custport_claim_document_file AS ccdf ON ccd.claim_no = ccdf.claim_no
																					AND ccd.document_code = ccdf.document_code
										WHERE
											ccd.claim_no = @pi_claim_no
											AND COALESCE(ccdf.file_name,'') <> ''
											AND cmd.is_active = 1
											AND ccd.is_active = 1
											AND ccdf.is_active = 1
									) AS portal ON idk.id_item_dokumen = portal.id_item_dokumen_core
								WHERE
									idk.status = 'I'

								-- update tabel claim
								UPDATE
									dbo.custport_claim
								SET
									status_code = @p_next_status_code,
									flow_stage_code = @p_next_flow_stage,
									reason_code = NULL,	--@pi_reason_code
									id_klaim_core = @p_id_klaim
								WHERE
									claim_no = @pi_claim_no
								IF (@@Error <> 0)
									BEGIN
										ROLLBACK TRAN
										SET @po_message = 'Error updating status'
										RETURN -1
									END

								--SET @po_message = 'Klaim berhasil diinput dengan Id Klaim: ' + @p_id_klaim
								SET @po_message = 'Claim submitted'
							END

						---
					END
				ELSE	-- proses bukan ke core (cukup di portal aja)
					BEGIN
						-- update tabel claim
						UPDATE
							dbo.custport_claim
						SET
							status_code = @p_next_status_code,
							flow_stage_code = @p_next_flow_stage,
							reason_code = @pi_reason_code
						WHERE
							claim_no = @pi_claim_no
						IF (@@Error <> 0)
							BEGIN
								ROLLBACK TRAN
								SET @po_message = 'Error updating status'
								SELECT @po_message AS message
								RETURN -1
							END

						-- hardcode untuk Tgl Dokumen Lengkap
						IF (@pi_action_code = 'ACT00004')	-- saat ELI mengubah status menjadi 'Pending Amount'
							BEGIN
								UPDATE
									dbo.custport_claim
								SET
									complete_doc_date = GETDATE()
								WHERE
									claim_no = @pi_claim_no
								IF (@@Error <> 0)
									BEGIN
										ROLLBACK TRAN
										SET @po_message = 'Error while updating data'
										SELECT @po_message AS message
										RETURN -1
									END
							END

						SET @po_message = 'Status berhasil diubah'
					END

				-- insert history
				INSERT INTO [dbo].[custport_claim_history]
							([claim_no]
							,[date]
							,[action_code]
							,[action_description]
							,[reason_code]
							,[notes]
							,[created_by]
							,[created_date]
							,[modified_by]
							,[modified_date]
							,[is_active])
						VALUES
							(@pi_claim_no
							,@p_curr_date
							,@pi_action_code
							,LEFT(@p_flow_action_description,60)
							,@pi_reason_code
							,@pi_notes
							,@pi_user_id
							,@p_curr_date
							,@pi_user_id
							,@p_curr_date
							,1)
				IF (@@Error <> 0)
					BEGIN
						ROLLBACK TRAN
						SET @po_message = 'Error inserting history'
						SELECT @po_message AS message
						RETURN -1
					END

			COMMIT TRAN
	
			SELECT @po_message AS message
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = @pi_claim_no + ' tidak ditemukan'
			SELECT @po_message AS message
			RETURN -1
		END

END

GO
/****** Object:  StoredProcedure [dbo].[proc_custport_claim_document]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_claim_document]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_claim_document] AS' 
END
GO


-- created by Pribadi Pamungkas. 2018-07-11.
ALTER PROCEDURE [dbo].[proc_custport_claim_document]
@pi_claim_type_code VARCHAR(50) --tambahan
AS
BEGIN

	SET NOCOUNT ON;-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	DECLARE @v_guid VARCHAR(50);

	SELECT @v_guid = REPLACE(NEWID(),'-','');

	SELECT
		md.document_code,
		md.description,
		mcd.is_mandatory,
		mcd.claim_type_code,
		mcd.claim_document_code,
		mcd.is_active,
		@v_guid + '_' + md.document_code AS guid,
		@v_guid AS tmp_guid
	FROM
		custport_m_claim_document AS mcd INNER JOIN
		custport_m_document AS md ON mcd.document_code = md.document_code
	WHERE
		mcd.is_active = 1
		AND md.is_active = 1
		AND claim_type_code = @pi_claim_type_code --tambahan
	ORDER BY
		mcd.is_mandatory DESC,
		md.description ASC

END


GO
/****** Object:  StoredProcedure [dbo].[proc_custport_claim_history]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_claim_history]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_claim_history] AS' 
END
GO


-- created by Pribadi Pamungkas. 2018-08-27.
ALTER PROCEDURE [dbo].[proc_custport_claim_history]
--DECLARE
	@pi_claim_no VARCHAR(50)-- = 'CL1808000014'
AS
BEGIN

	SET NOCOUNT ON;-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	DECLARE @approve_reject TABLE ( 
									[claim_history_id] INT,
									[claim_no] VARCHAR(50),
									[date] DATETIME,
									[action_code] VARCHAR(50),
									[action_description] VARCHAR(60),
									[reason_code] VARCHAR(50),
									[reason] VARCHAR(100),
									[notes] VARCHAR(300),
									[create_user] VARCHAR(100),
									[created_by] VARCHAR(15),
									[created_date] DATETIME,
									[is_active] BIT
								  )

	IF EXISTS(SELECT * FROM klaim WHERE id_klaim=@pi_claim_no AND status = 'I')
		BEGIN
			INSERT INTO @approve_reject ([claim_history_id],[claim_no],[date],[action_code],[action_description],[reason_code],[reason],[notes],[create_user],[created_by],[created_date],[is_active])
			SELECT
				999998,
				@pi_claim_no,
				CASE k.id_status_klaim
					WHEN '05' THEN k.approve_date
					WHEN '06' THEN k.rejected_date
					ELSE NULL
				END,
				'',
				CASE k.id_status_klaim
					WHEN '05' THEN 'Approve'
					WHEN '06' THEN 'Reject'
					ELSE NULL
				END,
				NULL,
				'',
				k.approve_note,
				'Equity Life Indonesia',
				'SYS',
				create_date,
				1
			FROM
				custport_claim AS cc INNER JOIN
				klaim AS k ON cc.id_klaim_core = k.id_klaim
			WHERE
				cc.claim_no = @pi_claim_no
				AND k.status = 'I'
		END

	SELECT
		x.*
	FROM
		(
			SELECT 
				cch.[claim_history_id],
				cch.[claim_no],
				cch.[date],
				cch.[action_code],
				cch.[action_description],
				cch.[reason_code],
				cmr.description AS reason,
				cch.[notes],
				cmu.fullname AS create_user,
				cch.[created_by],
				cch.[created_date],
				cch.[is_active]
			FROM 
				[dbo].[custport_claim_history] AS cch LEFT JOIN
				[dbo].[custport_m_user] AS cmu ON cch.created_by = cmu.username LEFT JOIN
				[dbo].[custport_m_reason] AS cmr ON cch.reason_code = cmr.reason_code
			WHERE
				cch.[is_active] = 1
				--AND cmu.is_active = 1
				AND cch.[claim_no] = @pi_claim_no
			--ORDER BY
			--	date

			UNION ALL

			-- approve
			--SELECT
			--	999998 AS [claim_history_id],
			--	cc.claim_no,
			--	nt.approve_date AS [date],
			--	'' AS [action_code],
			--	'Approve' AS [action_description],
			--	NULL [reason_code],
			--	'' AS reason,
			--	nt.approve_note AS [notes],
			--	'Equity Life Indonesia' AS create_user,
			--	'SYS' AS [created_by],
			--	nt.create_date AS [created_date],
			--	1 AS [is_active]
			--FROM
			--	custport_claim AS cc INNER JOIN
			--	klaim AS k ON cc.id_klaim_core = k.id_klaim INNER JOIN
			--	note_terbit_peserta AS ntp ON k.id_klaim = ntp.id_klaim INNER JOIN
			--	note_terbit AS nt ON ntp.id_note_terbit = nt.id_note_terbit 
			--WHERE
			--	cc.claim_no = @pi_claim_no
			--	AND k.status = 'I'
			--	AND nt.status = 'I'
			--	AND ntp.status = 'I'
			SELECT 
				[claim_history_id],[claim_no],[date],[action_code],[action_description],[reason_code],[reason],[notes],[create_user],[created_by],[created_date],[is_active] 
			FROM 
				@approve_reject

			UNION ALL

			-- pembayaran
			SELECT
				999999 AS [claim_history_id],
				cc.claim_no,
				nl.tgl_lunas AS [date],
				'' AS [action_code],
				'Payment' AS [action_description],
				NULL [reason_code],
				'' AS reason,
				'' AS [notes],
				'Equity Life Indonesia' AS create_user,
				'SYS' AS [created_by],
				nl.create_date AS [created_date],
				1 AS [is_active]
			FROM
				custport_claim AS cc INNER JOIN
				klaim AS k ON cc.id_klaim_core = k.id_klaim INNER JOIN
				note_terbit_peserta AS ntp ON k.id_klaim = ntp.id_klaim INNER JOIN
				note_terbit AS nt ON ntp.id_note_terbit = nt.id_note_terbit INNER JOIN
				note_lunas AS nl ON nt.id_note_terbit = nl.id_note_terbit
			WHERE
				cc.claim_no = @pi_claim_no
				AND k.status = 'I'
				AND nt.status = 'I'
				AND ntp.status = 'I'
				--AND nl.status = 'I' -- ?
		) AS x
	ORDER BY
		x.date

END


GO
/****** Object:  StoredProcedure [dbo].[proc_custport_del_group_menu]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_del_group_menu]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_del_group_menu] AS' 
END
GO


ALTER PROCEDURE [dbo].[proc_custport_del_group_menu]
	@pi_group_menu_id INT,
	@pi_username VARCHAR(100),
	@pi_created_by VARCHAR(50),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	SET NOCOUNT ON;	

	BEGIN
		IF (COALESCE(@pi_group_menu_id,'') = '')
		BEGIN
			SET @po_message = 'Data incomplete, Please check Data'
			SELECT @po_message AS message
			RETURN -1
		END
		ELSE
		BEGIN TRAN
		BEGIN
				

				UPDATE [dbo].[custport_m_user_group_menu]
						set is_active=0
						where group_menu_id=@pi_group_menu_id
						AND username=@pi_username

				IF (@@Error <> 0)
					BEGIN
						ROLLBACK TRAN
						SET @po_message = 'Save failed'
						SELECT @po_message AS message
						RETURN -1
					END

				
				COMMIT TRAN	
				SET @po_message = 'Delete Successfully'
				SELECT @po_message AS message
				RETURN 0
			END

	END

END










GO
/****** Object:  StoredProcedure [dbo].[proc_custport_delete_document]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_delete_document]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_delete_document] AS' 
END
GO



-- created by Pribadi Pamungkas. 2018-07-12
ALTER PROCEDURE [dbo].[proc_custport_delete_document]
	@pi_claim_no VARCHAR(20),
	@pi_document_code VARCHAR(20),
	@pi_user_id VARCHAR(20),
	@po_message VARCHAR(100)
AS
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	IF EXISTS(SELECT 1 FROM dbo.custport_claim_document_file WHERE claim_no = @pi_claim_no AND document_code = @pi_document_code AND is_active = 1)
		BEGIN
			BEGIN TRAN

			UPDATE 
				[dbo].[custport_claim_document_file]
			SET 
				[file_name] = NULL,
				[file_path] = NULL,
				[modified_by] = @pi_user_id,
				[modified_date] = GETDATE()
			WHERE
				claim_no = @pi_claim_no 
				AND document_code = @pi_document_code 
				AND is_active = 1

			IF (@@Error <> 0)
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_message = 'Error updating document'
					SELECT @po_message AS message
					RETURN -1
				END


			COMMIT TRAN
	
			SET @po_message = 'Document deleted successfully'
			SELECT @po_message AS message
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = 'Not found'
			SELECT @po_message AS message
			RETURN -1
		END

	

END



GO
/****** Object:  StoredProcedure [dbo].[proc_custport_get_group_menu]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_get_group_menu]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_get_group_menu] AS' 
END
GO
ALTER PROCEDURE [dbo].[proc_custport_get_group_menu]
	@pi_username VARCHAR(50),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN

	SET NOCOUNT ON;
	IF COALESCE(@pi_username, '') = ''
		SET @po_message = 'User not found. Please login first'
	ELSE
		BEGIN
			SELECT 
			gm.group_menu_id
		   ,gm.description
		   ,gm.group_menu_icon
			FROM custport_m_user_group_menu ugm
			INNER JOIN custport_m_group_menu gm ON gm.group_menu_id=ugm.group_menu_id
			where ugm.username=@pi_username and ugm.is_active=1
		END


END


GO
/****** Object:  StoredProcedure [dbo].[proc_custport_get_menu]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_get_menu]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_get_menu] AS' 
END
GO


ALTER PROCEDURE [dbo].[proc_custport_get_menu]
	@pi_group_menu_id INT,
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN

	SET NOCOUNT ON;
		BEGIN
			SELECT DISTINCT 
			mapp.menu_id,
			m.menu_code,
		    m.description,
		    m.menu_url,
			gm.group_menu_id,
			'GMENU'+ CONVERT(VARCHAR(20),gm.group_menu_id) as parent
			FROM custport_m_mapp_menu mapp
			inner join custport_m_menu m ON mapp.menu_id=m.menu_id
			inner join custport_m_group_menu gm ON mapp.group_menu_id=gm.group_menu_id
			where mapp.is_active=1 and mapp.group_menu_id=@pi_group_menu_id
		END

END




GO
/****** Object:  StoredProcedure [dbo].[proc_custport_lookup_customer]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_lookup_customer]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_lookup_customer] AS' 
END
GO

-- last modified by Pribadi Pamungkas. 2018-07-31. => tambah kolom no_hp & email
-- created by Pribadi Pamungkas. 2018-06-29.
ALTER PROCEDURE [dbo].[proc_custport_lookup_customer]
	@pi_no_polis VARCHAR(12),
	@pi_contract_no VARCHAR(16),
	@pi_customer_name VARCHAR(50),
	@pi_ktp_id VARCHAR(16),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN

	SET NOCOUNT ON;-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	IF COALESCE(@pi_no_polis, '') = ''
		SET @po_message = 'No Polis tidak boleh kosong'
	ELSE
		BEGIN
			IF COALESCE(@pi_contract_no, '') = ''
			   AND COALESCE(@pi_customer_name, '') = ''
			   AND COALESCE(@pi_ktp_id, '') = ''
				SET @po_message = 'Contract No atau Customer Name dan KTP tidak boleh kosong'
			ELSE

				BEGIN
	
					SELECT
						nama_peserta_1 AS nama_peserta,
						dbo.func_date_format('dd-mmm-YYYY',tgl_lahir_1) AS tgl_lahir,
						no_kontrak_external AS contract_no,
						no_identitas,
						no_peserta AS certificate_no,
						--tgl_mulai,
						--tgl_akhir,
						dbo.func_date_format('dd-mmm-YYYY',tgl_mulai) + ' - ' + dbo.func_date_format('dd-mmm-YYYY',tgl_akhir) AS insurance_periode,
						masa,
						uang_pertanggungan,
						CASE status
							WHEN 'I' THEN 'Active'
							WHEN 'C' THEN 'Cancel'
							WHEN 'D' THEN 'Death'
							WHEN 'E' THEN 'Verifikasi'
							WHEN 'G' THEN 'Draft'
							WHEN 'M' THEN 'Maturity'
							WHEN 'O' THEN 'Keluar'
							WHEN 'R' THEN 'Reject'
							WHEN 'L' THEN 'Terminate'	-- ?
							ELSE 'Unknown'
						END AS [status],
						'IDR' AS currency,
						id_peserta,
						no_polis,
						no_hp, 
						email
					FROM
						peserta
					WHERE
						no_polis = @pi_no_polis
						AND
							(
								((COALESCE(@pi_contract_no, '') <> '') AND (no_kontrak_external = @pi_contract_no)) OR
								(COALESCE(@pi_contract_no, '') = '') 
							)  
						AND
							(
								((COALESCE(@pi_customer_name, '') <> '') AND (nama_peserta_1 = @pi_customer_name)) OR
								(COALESCE(@pi_customer_name, '') = '') 
							)  
						AND
							(
								((COALESCE(@pi_ktp_id, '') <> '') AND (no_identitas = @pi_ktp_id)) OR
								(COALESCE(@pi_ktp_id, '') = '') 
							)
		
				END
		END


END

GO
/****** Object:  StoredProcedure [dbo].[proc_custport_process_claim]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_process_claim]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_process_claim] AS' 
END
GO



-- created by Pribadi Pamungkas. 2018-07-16
ALTER PROCEDURE [dbo].[proc_custport_process_claim]
	@pi_claim_no VARCHAR(20),
	@pi_user_id VARCHAR(20),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	DECLARE
		@p_no_polis varchar(13),
		@p_id_peserta varchar(12),
		@p_certificate_no varchar(20),
		@p_contract_no varchar(20),
		@p_customer_name varchar(100),
		@p_register_date date,
		@p_event_date date,
		@p_claim_type_code varchar(50),
		@p_claim_core_code varchar(1),
		@p_currency_code varchar(50),
		@p_claim_amount decimal(12,2),
		@p_reference_no varchar(20),
		@p_status_code varchar(50),
		@p_flow_stage_code varchar(50),
		@p_reason_code varchar(50),
		@p_notes varchar(600),
		@p_company_code varchar(10),
		@p_company_region_code varchar(10),
		@p_tmp_guid varchar(50),
		@p_created_by varchar(15),
		@p_created_date datetime,
		@p_modified_by varchar(15),
		@p_modified_date datetime

	SELECT
		@p_no_polis = cc.no_polis,
		@p_id_peserta = cc.id_peserta,
		@p_certificate_no = cc.certificate_no,
		@p_contract_no = cc.contract_no,
		@p_customer_name = cc.customer_name,
		@p_register_date = cc.register_date,
		@p_event_date = cc.event_date,
		@p_claim_type_code = cc.claim_type_code,
		@p_claim_core_code = cmct.claim_core_code,
		@p_currency_code = cc.currency_code,
		@p_claim_amount = cc.claim_amount,
		@p_reference_no = cc.reference_no,
		@p_status_code = cc.status_code,
		@p_flow_stage_code = cc.flow_stage_code,
		@p_reason_code = cc.reason_code,
		@p_notes = cc.notes,
		@p_company_code = cc.company_code,
		@p_company_region_code = cc.company_region_code,
		@p_tmp_guid = cc.tmp_guid,
		@p_created_by = cc.created_by,
		@p_created_date = cc.created_date,
		@p_modified_by = cc.modified_by,
		@p_modified_date = cc.modified_date
	FROM 
		[dbo].[custport_claim] AS cc INNER JOIN
		[dbo].[custport_m_claim_type] AS cmct ON cc.claim_type_code = cmct.claim_type_code
	WHERE
		cc.claim_no = @pi_claim_no 
		AND cc.is_active = 1
		AND cmct.is_active = 1
	IF (@@ERROR = 0) AND (@@RowCount > 0)	-- jika tidak ada error dan ada row
	--IF EXISTS(SELECT 1 FROM dbo.custport_claim WHERE claim_no = @pi_claim_no AND is_active = 1)
		BEGIN
			BEGIN TRAN

			DECLARE 
				@p_curr_date datetime,
				@p_id_klaim varchar(12),
				@p_user varchar(4)

			SET @p_curr_date      = GETDATE()
			SET @p_user           = 'SYS'
		
			-- GET id_peserta
			EXEC AJK.dbo.gproc_GetNo
				@Tgl = @p_curr_date,
				@sField = 'id_klaim',
				@CurrNo = @p_id_klaim OUTPUT
			IF (@@Error <> 0 OR COALESCE(@p_id_klaim,'')='')
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_message = 'Error generating id_klaim'
					RETURN -1
				END
			INSERT INTO [dbo].[klaim]
							([id_klaim]
							,[tgl_pengajuan]
							,[tgl_kejadian]
							,[id_peserta]
							,[id_diagnosa]
							,[jml_uang_pertanggungan]
							,[jml_bayar]
							,[jml_tolakan]
							,[jml_penyesuaian]
							,[total_dibayar]
							,[catatan]
							,[status]
							,[create_date]
							,[create_by]
							,[change_date]
							,[change_by]
							,[id_jenis_klaim]
							,[id_status_klaim]
							,[id_kelompok_kota]
							,[keterangan]
							,[jml_diajukan]
							,[no_polis]
							,[coverage_installment]
							,[id_rejected_klaim_hci])
						VALUES
							(@p_id_klaim
							,CAST(@p_register_date AS DATETIME)
							,CAST(@p_event_date AS DATETIME)
							,@p_id_peserta
							,'99'
							,0	-- jml_uang_pertanggungan
							,0	-- jml_bayar
							,0
							,0
							,0	-- total_dibayar
							,LEFT(@p_notes, 100)
							,'G'
							,@p_curr_date
							,@p_user	-- create_by
							,@p_curr_date
							,@p_user	-- change_by
							,@p_claim_core_code
							,'01'	-- Draft
							,'9'
							,LEFT(@p_notes, 100)
							,CAST(@p_claim_amount AS FLOAT)
							,@p_no_polis
							,0
							,'00')
			IF (@@Error <> 0)
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_message = 'Failed inserting claim'
					RETURN -1
				END

			-- ubah status
			UPDATE
				dbo.custport_claim
			SET
				status_code = 'PRC',
				flow_stage_code = 'STG1800004',
				reason_code = NULL,	--@pi_reason_code
				id_klaim_core = @p_id_klaim
			WHERE
				claim_no = @pi_claim_no
			IF (@@Error <> 0)
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_message = 'Error updating status'
					RETURN -1
				END

			-- simpan history (masih hardcode)
			INSERT INTO [dbo].[custport_claim_history]
						([claim_no]
						,[date]
						,[action_code]
						,[action_description]
						,[reason_code]
						,[notes]
						,[created_by]
						,[created_date]
						,[modified_by]
						,[modified_date]
						,[is_active])
					VALUES
						(@pi_claim_no
						,GETDATE()
						,'ACT00003'
						,'Process Claim'
						,NULL	-- @pi_reason_code
						,NULL	-- @pi_notes
						,@pi_user_id
						,GETDATE()
						,@pi_user_id
						,GETDATE()
						,1)
			IF (@@Error <> 0)
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_message = 'Error insert history'
					RETURN -1
				END



			COMMIT TRAN
	
			SET @po_message = 'Klaim berhasil diinput dengan Id Klaim: ' + @p_id_klaim
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = 'Not found'
			RETURN -1
		END

END



GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_branch]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_branch]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_save_branch] AS' 
END
GO




ALTER PROCEDURE [dbo].[proc_custport_save_branch]
	@pi_company_region_id INT,
	@pi_description VARCHAR(100),
	@pi_created_by VARCHAR(50),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	SET NOCOUNT ON;	

	IF (COALESCE(@pi_company_region_id,'') <> '')
		BEGIN
			BEGIN TRAN
				UPDATE [custport_m_company_region] SET					   
					   description=@pi_description					   				   
					   ,modified_by=@pi_created_by
					   ,modified_date=GETDATE()
					   WHERE company_region_id=@pi_company_region_id

				IF (@@Error <> 0)
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Udpdate Branch Failed'
					SELECT @po_message AS message
					RETURN -1
				END
				
				COMMIT TRAN	
				SET @po_message = 'Update Successfully'
				SELECT @po_message AS message
				RETURN 0

	END	
	ELSE
	BEGIN
		IF ((COALESCE(@pi_company_region_id,'') = '') AND (COALESCE(@pi_description,'') = ''))
		BEGIN
			SET @po_message = 'Data incomplete, Please check Data'
			SELECT @po_message AS message
			RETURN -1
		END
		IF EXISTS(SELECT * FROM [dbo].[custport_m_company_region] WHERE (description=@pi_description) and company_region_id not in (@pi_company_region_id))
		BEGIN
				SET @po_message = 'Data can not be saved. Duplicate branch name!'
						SELECT @po_message AS message
						RETURN -1
		END
		ELSE
		BEGIN TRAN
		BEGIN
				

				INSERT INTO [dbo].[custport_m_company_region]
					   ([company_region_code]
					   ,[company_code]
					   ,[description]
					   ,[created_by]
					   ,[created_date]
					   ,[modified_by]
					   ,[modified_date]
					   ,[is_active])
				 VALUES
					   (
						'hci'
						,'hci'
						,@pi_description
					    ,@pi_created_by
					    ,GETDATE()
					    ,@pi_created_by
					    ,GETDATE()
					    ,1)

				IF (@@Error <> 0)
					BEGIN
						ROLLBACK TRAN
						SET @po_message = 'Save failed'
						SELECT @po_message AS message
						RETURN -1
					END

				
				COMMIT TRAN	
				SET @po_message = 'Successfully'
				SELECT @po_message AS message
				RETURN 0
			END

	END

END






GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_claim]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_claim]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_save_claim] AS' 
END
GO

-- created by Pribadi Pamungkas. 2018-06-29
ALTER PROCEDURE [dbo].[proc_custport_save_claim]
	@pi_claim_no VARCHAR(20),
	@pi_certificate_no VARCHAR(20),
	@pi_contract_no VARCHAR(20),
	@pi_customer_name VARCHAR(100),
	@pi_register_date DATE,
	@pi_event_date DATE,
	@pi_claim_type_code VARCHAR(50),
	@pi_currency_code VARCHAR(50),
	@pi_claim_amount DECIMAL(12,2),
	@pi_reference_no VARCHAR(20),
	@pi_status_code VARCHAR(50),
	@pi_reason_code VARCHAR(50),
	@pi_user_id VARCHAR(15),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	-- disini (atau didalem IF dibawah) diisi validasi

	IF COALESCE(@pi_claim_no,'') = ''
		BEGIN
			INSERT INTO [dbo].[custport_claim]
					   ([certificate_no]
					   ,[contract_no]
					   ,[customer_name]
					   ,[register_date]
					   ,[event_date]
					   ,[claim_type_code]
					   ,[currency_code]
					   ,[claim_amount]
					   ,[reference_no]
					   ,[status_code]
					   ,[reason_code]
					   ,[created_by]
					   ,[created_date]
					   ,[modified_by]
					   ,[modified_date]
					   ,[is_active])
				 VALUES
					   (@pi_certificate_no
					   ,@pi_contract_no
					   ,@pi_customer_name
					   ,@pi_register_date
					   ,@pi_event_date
					   ,@pi_claim_type_code
					   ,@pi_currency_code
					   ,@pi_claim_amount
					   ,@pi_reference_no
					   ,@pi_status_code
					   ,@pi_reason_code
					   ,@pi_user_id
					   ,GETDATE()
					   ,@pi_user_id
					   ,GETDATE()
					   ,1)
		END
	ELSE
		BEGIN
			UPDATE [dbo].[custport_claim]
			   SET --[certificate_no] = <certificate_no, varchar(20),>
				  --,[contract_no] = <contract_no, varchar(20),>
				  --,[customer_name] = <customer_name, varchar(100),>
				   [register_date] = @pi_register_date
				  ,[event_date] = @pi_event_date
				  ,[claim_type_code] = @pi_claim_type_code
				  ,[currency_code] = @pi_currency_code
				  ,[claim_amount] = @pi_claim_amount
				  ,[reference_no] = @pi_reference_no
				  ,[status_code] = @pi_status_code
				  ,[reason_code] = @pi_reason_code
				  ,[modified_by] = @pi_user_id
				  ,[modified_date] = GETDATE()
			 WHERE 
				claim_no = @pi_claim_no
		END

END

GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_group_menu]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_group_menu]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_save_group_menu] AS' 
END
GO






ALTER PROCEDURE [dbo].[proc_custport_save_group_menu]
	@pi_group_menu_id INT,
	@pi_username VARCHAR(100),
	@pi_created_by VARCHAR(50),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	SET NOCOUNT ON;	

	BEGIN
		IF (COALESCE(@pi_group_menu_id,'') = '')
		BEGIN
			SET @po_message = 'Data incomplete, Please check Data'
			SELECT @po_message AS message
			RETURN -1
		END
		IF EXISTS(SELECT * FROM [dbo].[custport_m_user_group_menu] WHERE (group_menu_id=@pi_group_menu_id) and is_active=1 and username=@pi_username)
		BEGIN
				SET @po_message = 'Data can not be saved. Duplicate group menu!'
						SELECT @po_message AS message
						RETURN -1
		END
		ELSE
		BEGIN TRAN
		BEGIN
				

				INSERT INTO [dbo].[custport_m_user_group_menu]
					   ([group_menu_id]
					   ,[username]
					   ,[created_by]
					   ,[created_date]
					   ,[modified_by]
					   ,[modified_date]
					   ,[is_active])
				 VALUES
					   (
						@pi_group_menu_id
						,@pi_username
					    ,@pi_created_by
					    ,GETDATE()
					    ,@pi_created_by
					    ,GETDATE()
					    ,1)

				IF (@@Error <> 0)
					BEGIN
						ROLLBACK TRAN
						SET @po_message = 'Save failed'
						SELECT @po_message AS message
						RETURN -1
					END

				
				COMMIT TRAN	
				SET @po_message = 'Successfully'
				SELECT @po_message AS message
				RETURN 0
			END

	END

END








GO
/****** Object:  StoredProcedure [dbo].[proc_custport_save_user]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_save_user]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_save_user] AS' 
END
GO


ALTER PROCEDURE [dbo].[proc_custport_save_user]
	@pi_user_id INT,
	@pi_username VARCHAR(30),
	@pi_fullname VARCHAR(100),
	@pi_email VARCHAR(100),
	@pi_user_type_code VARCHAR(10),
	@pi_company_region_code VARCHAR(10),
	@pi_password VARCHAR(50),
	@pi_created_by VARCHAR(50),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	SET NOCOUNT ON;

	IF (COALESCE(@pi_user_id,'') <> '')
		BEGIN
			BEGIN TRAN

			UPDATE 
				[custport_m_user] 
			SET
				fullname = @pi_fullname,
				email = @pi_email,
				modified_by = @pi_created_by,
				modified_date = GETDATE()
			WHERE 
				user_id = @pi_user_id
			IF (@@Error <> 0)
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Update User Failed'
					SELECT @po_message AS message
					RETURN -1
				END

			UPDATE 
				[custport_m_user_company] 
			SET
				company_region_code = @pi_company_region_code,
				modified_by = @pi_created_by,
				modified_date = GETDATE()
			WHERE 
				username = @pi_username
			IF (@@Error <> 0)
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Update User Failed'
					SELECT @po_message AS message
					RETURN -1
				END

			COMMIT TRAN	
			SET @po_message = 'Update Successfully'
			SELECT @po_message AS message
			RETURN 0
		END	
	ELSE
		BEGIN
			BEGIN TRAN

			IF (
				(COALESCE(@pi_user_id,'') = '') 
				AND (
						(COALESCE(@pi_username,'') = '') 
						OR (COALESCE(@pi_fullname,'') = '') 
						OR (COALESCE(@pi_email,'') = '') 
						OR (COALESCE(@pi_password,'') = '')
					)
				)
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Data incomplete, Please check Data'
					SELECT @po_message AS message
					RETURN -1
				END
		
			IF EXISTS(SELECT * FROM [dbo].[custport_m_user] WHERE (username=@pi_username) and (user_id not in (@pi_user_id) OR ISNULL(@pi_user_id, '') = ''))
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Data can not be saved. Duplicate Username!'
					SELECT @po_message AS message
					RETURN -1
				END
			ELSE
				BEGIN
					INSERT INTO [dbo].[custport_m_user]
							([username]
							,[fullname]
							,[email]
							,[user_type_code]
							,[password]
							,[created_by]
							,[created_date]
							,[modified_by]
							,[modified_date]
							,[is_active])
					 VALUES
							(@pi_username
							,@pi_fullname
							,@pi_email
							,@pi_user_type_code
							,SUBSTRING(sys.fn_sqlvarbasetostr(HASHBYTES('MD5',@pi_password)),3,32)
							,@pi_created_by
							,GETDATE()
							,@pi_created_by
							,GETDATE()
							,1)
					IF (@@Error <> 0)
						BEGIN
							ROLLBACK TRAN
							SET @po_message = 'Save failed'
							SELECT @po_message AS message
							RETURN -1
						END
					
					INSERT INTO [dbo].[custport_m_user_company]
							([user_company_code]
							,[username]
							,[company_code]
							,[company_region_code]
							,[created_by]
							,[created_date]
							,[modified_by]
							,[modified_date]
							,[is_active])
					 VALUES
							(@pi_username
							,@pi_username
							,'hci'
							,@pi_company_region_code
							,@pi_created_by
							,GETDATE()
							,@pi_created_by
							,GETDATE()
							,1)
					IF (@@Error <> 0)
						BEGIN
							ROLLBACK TRAN
							SET @po_message = 'Save failed'
							SELECT @po_message AS message
							RETURN -1
						END

					COMMIT TRAN	
					SET @po_message = 'Successfully'
					SELECT @po_message AS message
					RETURN 0
				END
		END

END


GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_amount_claim]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_amount_claim]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_set_amount_claim] AS' 
END
GO


-- created by Pribadi Pamungkas. 2018-08-28
ALTER PROCEDURE [dbo].[proc_custport_set_amount_claim]
	@pi_claim_no VARCHAR(20),
	@pi_currency_code VARCHAR(50),
	@pi_claim_amount DECIMAL(12,2),
	@pi_user_id VARCHAR(15),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.
	DECLARE @po_error VARCHAR(1)

	-- disini (atau didalem IF dibawah) diisi validasi


	IF COALESCE(@pi_claim_no,'') <> ''
		BEGIN
			BEGIN TRAN

			--UPDATE [dbo].[custport_claim]
			--   SET [currency_code] = @pi_currency_code
			--	  ,[claim_amount] = @pi_claim_amount
			--	  ,[status_code] = 'STC'				-- hardcode
			--	  ,[flow_stage_code] = 'STG1800005'		-- hardcode
			--	  ,[modified_by] = @pi_user_id
			--	  ,[modified_date] = GETDATE()
			-- WHERE 
			--	claim_no = @pi_claim_no
			--IF (@@Error <> 0)
			--	BEGIN
			--		-- Gagal
			--		ROLLBACK TRAN
			--		SET @po_message = 'Error updating status'
			--		RETURN -1
			--	END

			---- simpan history (masih hardcode)
			--INSERT INTO [dbo].[custport_claim_history]
			--			([claim_no]
			--			,[date]
			--			,[action_code]
			--			,[action_description]
			--			,[reason_code]
			--			,[notes]
			--			,[created_by]
			--			,[created_date]
			--			,[modified_by]
			--			,[modified_date]
			--			,[is_active])
			--		VALUES
			--			(@pi_claim_no
			--			,GETDATE()
			--			,'ACT00006'
			--			,'Submitted to Claim'
			--			,NULL	-- @pi_reason_code
			--			,NULL	-- @pi_notes
			--			,@pi_user_id
			--			,GETDATE()
			--			,@pi_user_id
			--			,GETDATE()
			--			,1)
			--IF (@@Error <> 0)
			--	BEGIN
			--		-- Gagal
			--		ROLLBACK TRAN
			--		SET @po_message = 'Error insert history'
			--		RETURN -1
			--	END



			--COMMIT TRAN
	
			--SET @po_error = '0'
			--SET @po_message = 'Success submitting claim.'
			--SELECT @po_error, @po_message
			--RETURN 0

			--------------------------------------------------------------------------------------------------------------------
			UPDATE [dbo].[custport_claim]
			   SET [currency_code] = @pi_currency_code
				  ,[claim_amount] = @pi_claim_amount
				  ,[modified_by] = @pi_user_id
				  ,[modified_date] = GETDATE()
			 WHERE 
				claim_no = @pi_claim_no
			IF (@@Error <> 0)
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_error = '1'
					SET @po_message = 'Error updating status'
					SELECT @po_error AS error, @po_message AS [message]
					RETURN -1
				END

			-- simpan history (masih hardcode)
			--INSERT INTO [dbo].[custport_claim_history]
			--			([claim_no]
			--			,[date]
			--			,[action_code]
			--			,[action_description]
			--			,[reason_code]
			--			,[notes]
			--			,[created_by]
			--			,[created_date]
			--			,[modified_by]
			--			,[modified_date]
			--			,[is_active])
			--		VALUES
			--			(@pi_claim_no
			--			,GETDATE()
			--			,'ACT00006'
			--			,'Submitted to Claim'
			--			,NULL	-- @pi_reason_code
			--			,NULL	-- @pi_notes
			--			,@pi_user_id
			--			,GETDATE()
			--			,@pi_user_id
			--			,GETDATE()
			--			,1)
			--IF (@@Error <> 0)
			--	BEGIN
			--		-- Gagal
			--		ROLLBACK TRAN
			--		SET @po_error = '1'
			--		SET @po_message = 'Error insert history'
			--		SELECT @po_error AS error, @po_message AS [message]
			--		RETURN -1
			--	END


			-- proses ke core
			DECLARE @RC int

			DECLARE @pi_action_code varchar(50) = 'ACT00006'	-- hardcode untuk Submitted to Claim
			--DECLARE @pi_notes varchar(300)
			DECLARE @p_exec_message varchar(100)

			EXECUTE @RC = [dbo].[proc_custport_app_action_claim] 
			   @pi_claim_no
			  ,@pi_action_code
			  ,NULL	--@pi_reason_code
			  ,NULL	--@pi_notes
			  ,@pi_user_id
			  ,@p_exec_message OUTPUT
			IF (@@Error <> 0)
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_error = '1'
					SET @po_message = 'Failed submitting claim'
					SELECT @po_error AS error, @po_message AS [message]
					RETURN -1
				END
			ELSE
				BEGIN
					IF (@RC=0)	-- sukses
						BEGIN
							COMMIT TRAN
	
							SET @po_error = '0'
							SET @po_message = @p_exec_message
							SELECT @po_error AS error, @po_message AS [message]
							RETURN 0
						END
					ELSE	-- gagal
						BEGIN
							ROLLBACK TRAN
							SET @po_error = '1'
							SET @po_message = @p_exec_message
							SELECT @po_error AS error, @po_message AS [message]
							RETURN -1
						END
				END
			


		END
	ELSE
		BEGIN
			SET @po_error = '1'
			SET @po_message = 'Not found.'
			SELECT @po_error AS error, @po_message AS [message]
			RETURN -1
		END

END


GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_branch_status]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_branch_status]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_set_branch_status] AS' 
END
GO


ALTER PROCEDURE [dbo].[proc_custport_set_branch_status]
	@pi_company_region_id VARCHAR(20),
	@pi_status_id BIT,
	@pi_modified_by VARCHAR(20),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	
	IF EXISTS(SELECT 1 FROM dbo.custport_m_company_region WHERE company_region_id = @pi_company_region_id)
		BEGIN
			BEGIN TRAN
			UPDATE
				dbo.custport_m_company_region
			SET
				is_active = @pi_status_id,				
				modified_by=@pi_modified_by,
				modified_date=GETDATE()
			WHERE
				company_region_id = @pi_company_region_id
			IF (@@Error <> 0)
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Error updating status'
					SELECT @po_message AS message
					RETURN -1
				END

			COMMIT TRAN
	
			SET @po_message = 'Update Status Succesfully'
			SELECT @po_message AS message
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = 'Not found'
			SELECT @po_message AS message
			RETURN -1
		END

END




GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_cancel_claim]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_cancel_claim]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_set_cancel_claim] AS' 
END
GO


-- created by Pribadi Pamungkas. 2018-06-29
ALTER PROCEDURE [dbo].[proc_custport_set_cancel_claim]
	@pi_claim_no VARCHAR(20),
	@pi_user_id VARCHAR(20),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	IF EXISTS(SELECT 1 FROM dbo.custport_claim WHERE claim_no = @pi_claim_no AND is_active = 1)
		BEGIN
			BEGIN TRAN

			UPDATE
				dbo.custport_claim
			SET
				status_code = 'CNC',
				flow_stage_code = 'STG1800006'
			WHERE
				claim_no = @pi_claim_no
			IF (@@Error <> 0)
				BEGIN
					-- Gagal
					ROLLBACK TRAN
					SET @po_message = 'Error updating status'
					SELECT @po_message AS message
					RETURN -1
				END

			INSERT INTO [dbo].[custport_claim_history]
					   ([claim_no]
					   ,[date]
					   ,[action_code]
					   ,[action_description]
					   ,[created_by]
					   ,[created_date]
					   ,[modified_by]
					   ,[modified_date]
					   ,[is_active])
				 VALUES
					   (@pi_claim_no
					   ,GETDATE()
					   ,'ACT00007'
					   ,'Claim Canceled'
					   ,@pi_user_id
					   ,GETDATE()
					   ,@pi_user_id
					   ,GETDATE()
					   ,1)

			COMMIT TRAN
	
			SET @po_message = 'Claim Canceled'
			SELECT @po_message AS message
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = 'Not found'
			SELECT @po_message AS message
			RETURN -1
		END

END


GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_password]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_password]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_set_password] AS' 
END
GO





ALTER PROCEDURE [dbo].[proc_custport_set_password]
	@pi_username VARCHAR(20),
	@pi_password VARCHAR(50),
	@pi_modified_by VARCHAR(20),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	
	IF (COALESCE(@pi_password,'') = '')
		BEGIN
			SET @po_message = 'Password blank, Please try again'
			SELECT @po_message AS message
			RETURN -1
		END
	IF EXISTS(SELECT 1 FROM dbo.custport_m_user WHERE username = @pi_username)
		BEGIN
			BEGIN TRAN
			UPDATE
				dbo.custport_m_user
			SET
				password =SUBSTRING(sys.fn_sqlvarbasetostr(HASHBYTES('MD5',@pi_password)),3,32),				
				modified_by=@pi_modified_by,
				modified_date=GETDATE()
			WHERE
				username = @pi_username
			IF (@@Error <> 0)
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Error updating status'
					SELECT @po_message AS message
					RETURN -1
				END

			COMMIT TRAN
	
			SET @po_message = 'Reset Password has been succesfully'
			SELECT @po_message AS message
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = 'Not found'
			SELECT @po_message AS message
			RETURN -1
		END

END







GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_status_claim]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_status_claim]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_set_status_claim] AS' 
END
GO



-- created by Pribadi Pamungkas. 2018-07-16
ALTER PROCEDURE [dbo].[proc_custport_set_status_claim]
	@pi_claim_no VARCHAR(20),
	@pi_action VARCHAR(50),
	@pi_reason_code VARCHAR(50),
	@pi_notes VARCHAR(300),
	@pi_user_id VARCHAR(20),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	IF EXISTS(SELECT 1 FROM dbo.custport_claim WHERE claim_no = @pi_claim_no AND is_active = 1)
		BEGIN
			BEGIN TRAN

				IF LOWER(@pi_action)='hold'
					BEGIN
						UPDATE
							dbo.custport_claim
						SET
							status_code = 'PEN',
							flow_stage_code = 'STG1800003',
							reason_code = @pi_reason_code
						WHERE
							claim_no = @pi_claim_no
						IF (@@Error <> 0)
							BEGIN
								-- Gagal
								ROLLBACK TRAN
								SET @po_message = 'Error updating status'
								SELECT @po_message AS message
								RETURN -1
							END

						INSERT INTO [dbo].[custport_claim_history]
								   ([claim_no]
								   ,[date]
								   ,[action_code]
								   ,[action_description]
								   ,[reason_code]
								   ,[notes]
								   ,[created_by]
								   ,[created_date]
								   ,[modified_by]
								   ,[modified_date]
								   ,[is_active])
							 VALUES
								   (@pi_claim_no
								   ,GETDATE()
								   ,'ACT00004'
								   ,'Pending'
								   ,@pi_reason_code
								   ,@pi_notes
								   ,@pi_user_id
								   ,GETDATE()
								   ,@pi_user_id
								   ,GETDATE()
								   ,1)
					END

			COMMIT TRAN
	
			SET @po_message = 'Saved'
			SELECT @po_message AS message
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = 'Not found'
			SELECT @po_message AS message
			RETURN -1
		END

END



GO
/****** Object:  StoredProcedure [dbo].[proc_custport_set_user_status]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc_custport_set_user_status]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[proc_custport_set_user_status] AS' 
END
GO

ALTER PROCEDURE [dbo].[proc_custport_set_user_status]
	@pi_username VARCHAR(20),
	@pi_status_id BIT,
	@pi_modified_by VARCHAR(20),
	@po_message VARCHAR(100) OUTPUT
AS
BEGIN
	
	SET NOCOUNT ON;	
	IF EXISTS(SELECT 1 FROM dbo.custport_m_user WHERE username = @pi_username)
		BEGIN
			BEGIN TRAN
			UPDATE
				dbo.custport_m_user
			SET
				is_active = @pi_status_id,				
				modified_by=@pi_modified_by,
				modified_date=GETDATE()
			WHERE
				username = @pi_username
			IF (@@Error <> 0)
				BEGIN
					ROLLBACK TRAN
					SET @po_message = 'Error updating status'
					SELECT @po_message AS message
					RETURN -1
				END

			COMMIT TRAN
	
			SET @po_message = 'Update Status Succesfully'
			SELECT @po_message AS message
			RETURN 0

		END
	ELSE
		BEGIN
			SET @po_message = 'Not found'
			SELECT @po_message AS message
			RETURN -1
		END

END



GO
/****** Object:  Trigger [dbo].[trig_insert_claim]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[trig_insert_claim]'))
EXEC dbo.sp_executesql @statement = N'-- created by Pribadi Pamungkas. 2018-06-29
CREATE TRIGGER [dbo].[trig_insert_claim]
   ON  [dbo].[custport_claim]
   INSTEAD OF INSERT
   --AFTER INSERT
AS 
BEGIN
	
	SET NOCOUNT ON;	-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

	DECLARE
		@numrows INT,
		@claim_no VARCHAR(12)

	-- pake logic seperti ini dengan catatan tidak ada row yg di (hard) delete
	SELECT 
		@numrows = COUNT(claim_id)
	FROM 
		custport_claim
	WHERE 
		created_date >= DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)
		AND created_date < DATEADD(DAY, 0, DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0))

	SELECT @claim_no = ''CL'' + RIGHT(CONVERT(VARCHAR(8), GETDATE(), 1),2) + CONVERT(VARCHAR(2), GETDATE(), 101) + RIGHT(''00000'' + CAST(@numrows+1 AS VARCHAR(6)),6)

	INSERT INTO [dbo].[custport_claim]
			   ([claim_no]
			   ,[no_polis]
			   ,[id_peserta]
			   ,[certificate_no]
			   ,[contract_no]
			   ,[customer_name]
			   ,[register_date]
			   ,[event_date]
			   ,[claim_type_code]
			   ,[currency_code]
			   ,[claim_amount]
			   ,[reference_no]
			   ,[status_code]
			   ,[flow_stage_code]
			   ,[reason_code]
			   ,[notes]
			   ,[company_code]
			   ,[company_region_code]
			   ,[tmp_guid]
			   ,[id_klaim_core]
			   ,[created_by]
			   ,[created_date]
			   ,[modified_by]
			   ,[modified_date]
			   ,[is_active])
			SELECT @claim_no
				  ,[no_polis]
				  ,[id_peserta]
				  ,[certificate_no]
				  ,[contract_no]
				  ,[customer_name]
				  ,[register_date]
				  ,[event_date]
				  ,[claim_type_code]
				  ,[currency_code]
				  ,[claim_amount]
				  ,[reference_no]
				  ,[status_code]
				  ,[flow_stage_code]
				  ,[reason_code]
				  ,[notes]
				  ,[company_code]
				  ,[company_region_code]
				  ,[tmp_guid]
				  ,[id_klaim_core]
				  ,[created_by]
				  ,[created_date]
				  ,[modified_by]
				  ,[modified_date]
				  ,[is_active]
			  FROM INSERTED

END
' 
GO
/****** Object:  Trigger [dbo].[CreateCompanyRegionCode]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[CreateCompanyRegionCode]'))
EXEC dbo.sp_executesql @statement = N'

CREATE TRIGGER [dbo].[CreateCompanyRegionCode]
   ON [dbo].[custport_m_company_region]
   FOR INSERT
AS 
BEGIN
	SET NOCOUNT ON;
	DECLARE @rownums VARCHAR(11);
	DECLARE @ucompcode VARCHAR(10);

    SET @rownums = (SELECT CAST((COUNT(company_region_id)) AS VARCHAR) 
					FROM [dbo].[custport_m_company_region]);

	SET @ucompcode = (SELECT ''HCI'' + STUFF(''00000'', 5 - LEN(@rownums) + 1, LEN(@rownums), @rownums));

	UPDATE [dbo].[custport_m_company_region]
	SET company_region_code = @ucompcode
	WHERE company_region_id IN (
		SELECT company_region_id 
		FROM inserted
	);
	


END

' 
GO
/****** Object:  Trigger [dbo].[CreateUserCompanyCode]    Script Date: 13/09/2018 17:17:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[CreateUserCompanyCode]'))
EXEC dbo.sp_executesql @statement = N'
CREATE TRIGGER [dbo].[CreateUserCompanyCode]
   ON [dbo].[custport_m_user_company]
   FOR INSERT
AS 
BEGIN
	SET NOCOUNT ON;
	DECLARE @rownums VARCHAR(11);
	DECLARE @ucompcode VARCHAR(10);

    SET @rownums = (SELECT CAST((COUNT(user_company_id)) AS VARCHAR) 
					FROM [dbo].[custport_m_user_company]);

	SET @ucompcode = (SELECT ''REG'' + STUFF(''00000'', 5 - LEN(@rownums) + 1, LEN(@rownums), @rownums));

	UPDATE [dbo].[custport_m_user_company]
	SET user_company_code = @ucompcode
	WHERE user_company_id IN (
		SELECT user_company_id 
		FROM inserted
	);
	


END
' 
GO
