-- Create Table Statement for 'Payment Plan'
DROP TABLE IF EXISTS `PAYMENT_PLAN`;
CREATE TABLE `PAYMENT_PLAN` (
	ID bigint(20) NOT NULL,
	REF_CODE varchar,
	CREATE_DATE datetime,
	IMPORT_DATE datetime,
	LAST_INVOICING_DATE datetime,
	LAST_PROCESSING_DATE datetime,
	REF_CREATOR_CODE varchar,
	REF_SELLER_CODE varchar,
	STATUS varchar,
	PREVIOUS_STATUS varchar,
	FIRST_BILLING_INDEX int(11),
	NEXT_PROCESSING_INDEX int(11),
	LAST_PROCESSING_INDEX int(11),
	LENGTH int(11),
	VALUE int(11),
	DEFERRED_LENGTH int(11),
	DEFERRED_VALUE int(11),
	ORIGINAL_VALUE int(11),
	AMOUNT int(11),
	TAX_AMOUNT int(11),
	RENEWAL_AMOUNT int(11),
	RENEWAL_TAX_AMOUNT int(11),
	REF_GROUP_CODE1 varchar,
	REF_GROUP_CODE2 varchar,
	REF_GROUP_CODE3 varchar,
	REF_GROUP_CODE4 varchar,
	REF_GROUP_CODE5 varchar,
	REF_GROUP_CODE6 varchar,
	REF_GROUP_CODE7 varchar,
	REF_GROUP_CODE8 varchar,
	MERCHANT_ACCOUNT_CODE int(11) NOT NULL,
	COLLECTOR_ACCOUNT_CODE int(11),
	CLAIM_CL varchar,
	PAYMENT_PLAN_CL varchar,
	FIRST_BILLING_DATE datetime,
	LAST_UPDATE_DATE datetime,
	TERMINATOR_CODE varchar,
	CANCELLATION_DATE datetime,
	FIRST_INVOICE_DATE datetime,
	NOTE varchar,
	CUSTOM_FIELDS varchar,
	IS_VISIBLE_EXTERNALLY tinyint(1),
	RENEWED_DATE datetime,
	LEAD_SOURCE_CODE varchar,
	IS_VALUE_CHANGED tinyint(1),
	CUSTOMER_ACCOUNT_FK bigint(20),
	BILLING_CYCLE_FK bigint(20),
	PARENT_FK bigint(20),
	PAYMENT_OPTION_FK bigint(20),
	ITEM_FK bigint(20),
	TAX_FK bigint(20),
	CONTRACT_DOCUMENT_FK bigint(20),
	TERMINAL_REVENUE_TRANSACTION_FK bigint(20),
	LAST_INVOICE_FK bigint(20),
	ID_DOCUMENT_FK bigint(20),
	CONTRACT_FK bigint(20),
	CANCELLATION_ADJUSTMENT_FK bigint(20),
	FREEZE_ADJUSTMENT_FK bigint(20),
	LAST_PAYMENT_PLAN_STATISTICS_FK bigint(20),
	IS_WELCOME_LETTER_SENT tinyint(1),
	RECURRENCE_COUNT int(11),
	RECURRENCE_LIMIT int(11),
	PENDING_EXPIRATION_DATE datetime,
	COLLECTED_BILLINGS_COUNT int(11),
	ITEM_DESCRIPTION varchar,
	LINK_ACCOUNT int(11),
	IS_AGAINST_BALANCE tinyint(1),
	CHARGES bigint(20),
	CONTRACT_DOCUMENT_FK bigint(20),
	ID_DOCUMENT_FK bigint(20),
	ORIGINAL_ASSET_TRANSACTION bigint(20),
	ORIGINAL_ASSET_TRANSACTION bigint(20),
	ORIGINAL_ASSET_TRANSACTION bigint(20),
	LAST_SEQUENCE_COUNT int(11),
	LAST_SEQUENCE_NUMBER int(11),
	LAST_SEQUENCE_COUNT int(11),
	LAST_SEQUENCE_NUMBER int(11),
	LAST_SEQUENCE_COUNT int(11),
	LAST_SEQUENCE_NUMBER int(11),
	PENDING_ADJUSTMENT_CL varchar,
	PENDING_ADJUSTMENT_EFFECTIVE_DATE datetime,
	PENDING_ADJUSTMENT_NOTE varchar,
	PENDING_ADJUSTMENT_LENGTH int(11),
	PAUSE_ADJUSTMENT_FK bigint(20),
	PLAN_FK bigint(20),
	PENDING_ADJUSTMENT_CL varchar,
	PENDING_ADJUSTMENT_EFFECTIVE_DATE datetime,
	PENDING_ADJUSTMENT_NOTE varchar,
	PENDING_ADJUSTMENT_LENGTH int(11),
	PAUSE_ADJUSTMENT_FK bigint(20),
	PLAN_FK bigint(20),
	PENDING_ADJUSTMENT_CL varchar,
	PENDING_ADJUSTMENT_EFFECTIVE_DATE datetime,
	PENDING_ADJUSTMENT_NOTE varchar,
	PENDING_ADJUSTMENT_LENGTH int(11),
	PAUSE_ADJUSTMENT_FK bigint(20),
	PLAN_FK bigint(20),
	PRIMARY KEY (ID)
) ENGINE=InnoDB;