-- Table structure for table `trnclaimsdtlestimateattachment`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlestimateattachment` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_estimate_code` bigint(20) NOT NULL,
  `uploaded_file` longblob NOT NULL,
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `filetype` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `uploaded_user_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `claimsattachindex` (`claims_trn_code`,`claims_trn_estimate_code`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;

--
-- Dumping data for table `trnclaimsdtlestimateattachment`
--

INSERT INTO `trnclaimsdtlestimateattachment` (`code`, `claims_trn_code`, `claims_trn_estimate_code`, `uploaded_file`, `uploaded_file_name`, `filetype`, `uploaded_at`, `uploaded_user_mst_code`, `remarks`, `created_at`, `updated_at`, `created_user_mst_code`, `updated_user_mst_code`) VALUES
(1, 5, 1, '', 'Corp Comm Job Order.pdf', 'pdf', '2017-06-06 17:05:12', 203, '', '2017-06-06 17:05:12', '2017-06-06 17:05:12', 203, 203);

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlestimatedistribution`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlestimatedistribution` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_estimate_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_group_code` bigint(20) NOT NULL,
  `claims_trn_items_involved_code` bigint(20) NOT NULL,
  `item_no` int(3) NOT NULL,
  `claim_type_mst_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `estimate_amount` double NOT NULL,
  `approved_amount` double NOT NULL,
  `loss_reserve_amount` double NOT NULL,
  `expense_reserve_amount` double NOT NULL,
  `loss_paid_amount` double NOT NULL,
  `expense_paid_amount` double NOT NULL,
  `loss_actual_amount` double NOT NULL,
  `expense_actual_amount` double NOT NULL,
  `net_loss_paid_amount` double NOT NULL,
  `net_expense_paid_amount` double NOT NULL,
  `loss_recovery_amount` double NOT NULL,
  `expense_recovery_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_estimate_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlestimateentries`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlestimateentries` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_estimate_code` bigint(20) NOT NULL,
  `item_no` int(3) NOT NULL,
  `quantity` int(3) NOT NULL,
  `particulars` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `claims_particulars_indemnity_mst_code` bigint(20) NOT NULL,
  `is_reestimated` tinyint(1) NOT NULL,
  `is_surplus_obn` tinyint(1) NOT NULL COMMENT '0:Not Applicable|1:OBN|2:Surplus',
  `is_vatable` tinyint(1) NOT NULL,
  `is_part_or_labor` tinyint(1) NOT NULL COMMENT '0:Not Applicable|1:Parts| 2:Labor',
  `tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - Non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `estimate_amount` double NOT NULL,
  `reestimate_amount` double NOT NULL,
  `approved_amount` double NOT NULL,
  `depreciation_amount` double NOT NULL,
  `depreciation_percentage` double NOT NULL,
  `discount_amount` double NOT NULL,
  `discount_percentage` double NOT NULL,
  `other_discount_amount` double NOT NULL,
  `gross_amount` double NOT NULL,
  `total_amount` double NOT NULL,
  `last_update_reserve_estimate_amount` double NOT NULL COMMENT 'TO BE USED FOR LOGGING HISTORY',
  `last_update_reserve_date` date NOT NULL COMMENT 'TO BE USED FOR LOGGING HISTORY',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_estimate_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlestimateevaluation`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlestimateevaluation` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_estimate_code` bigint(20) NOT NULL,
  `sender_user_mst_code` bigint(20) NOT NULL,
  `message_title` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `message_text` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `send_datetime` datetime NOT NULL,
  `notification_trn_code` bigint(20) NOT NULL,
  `claims_trn_estimate_evaluation_code` bigint(20) NOT NULL COMMENT 'PARENT EVALUATION ENTRY CODE. FOR REPLYING',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  `claims_trn_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_estimate_code`,`send_datetime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlestimateremarks`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlestimateremarks` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_estimate_code` bigint(20) NOT NULL,
  `sender_user_mst_code` bigint(20) NOT NULL,
  `message_text` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `send_datetime` datetime NOT NULL,
  `notification_trn_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  `claims_trn_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_estimate_code`,`sender_user_mst_code`,`send_datetime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlfileattachments`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlfileattachments` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_submitted_docs_code` bigint(20) NOT NULL,
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `encrypted_uploaded_file_name` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `filetype` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `uploaded_user_mst_code` bigint(20) NOT NULL,
  `attachment_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `description` mediumtext COLLATE latin1_general_ci NOT NULL,
  `remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `claimsattachment` (`claims_trn_code`),
  KEY `claimsattachment2` (`claims_trn_code`,`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='FOR UPLOADING OF CRM TICKET ATTACHMENTS' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlitemsinvolved`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlitemsinvolved` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL COMMENT 'for Fire',
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_group_code` bigint(20) NOT NULL COMMENT 'for PA',
  `item_no` int(3) NOT NULL,
  `mc_plate_no` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'get on PolicyItemValue table use param',
  `mc_engine_no` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'get on PolicyItemValue table use param',
  `mc_chassis_no` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'get on PolicyItemValue table use paramget on PolicyItemValue table use param',
  `table_retention_limits_mst_code` bigint(20) NOT NULL COMMENT 'for Fire',
  `fire_location_no` int(3) NOT NULL COMMENT 'for Fire',
  `pa_position_mst_code` bigint(20) NOT NULL,
  `pa_position_mst_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `cargo_vessel_mst_code` bigint(20) NOT NULL COMMENT 'get on PolicyItemValue table use param',
  `cargo_vessel_mst_name` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'get on PolicyItemValue table use param',
  `cargo_origin` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'get on PolicyItemValue table use param',
  `cargo_destination` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'get on PolicyItemValue table use param',
  `tsi_amount` double NOT NULL,
  `deductible_amount` double NOT NULL,
  `location_no` int(3) NOT NULL,
  `description` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `recovery_at_fault_party` tinyint(1) NOT NULL,
  `recovery_status` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `loss_reserve_amount` double NOT NULL,
  `expense_reserve_amount` double NOT NULL,
  `loss_paid_amount` double NOT NULL,
  `expense_paid_amount` double NOT NULL,
  `loss_actual_amount` double NOT NULL,
  `expense_actual_amount` double NOT NULL,
  `loss_recovery_amount` double NOT NULL,
  `expense_recovery_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `claimsitemsinvolvedindex` (`claims_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlitemsinvolvedinfo`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlitemsinvolvedinfo` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_items_involved_code` bigint(20) NOT NULL,
  `mc_driver_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `mc_license_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `mc_license_expiry_date` date NOT NULL,
  `mc_gender` varchar(1) COLLATE latin1_general_cs NOT NULL COMMENT 'M/F',
  `mc_civil_status` tinyint(1) NOT NULL COMMENT '1 - Single ; 2 - Married ; 3 - Widow/Windower ; 4 - Legally Separated ; 5 - Divorced',
  `mc_age` int(3) NOT NULL,
  `mc_position_mst_code` bigint(20) NOT NULL,
  `fire_country_mst_code` bigint(20) NOT NULL,
  `fire_region_mst_code` bigint(20) NOT NULL,
  `fire_province_mst_code` bigint(20) NOT NULL,
  `fire_city_mst_code` bigint(20) NOT NULL,
  `fire_barangay_mst_code` bigint(20) NOT NULL,
  `fire_street_address` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `fire_complete_address` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `fire_district_no` varchar(50) COLLATE latin1_general_cs NOT NULL,
  `fire_block_number` varchar(50) COLLATE latin1_general_cs NOT NULL,
  `fire_block_mst_code` bigint(20) NOT NULL,
  `pa_gender` varchar(1) COLLATE latin1_general_cs NOT NULL COMMENT 'M/F',
  `pa_civil_status` tinyint(1) NOT NULL COMMENT '1 - Single ; 2 - Married ; 3 - Widow/Windower ; 4 - Legally Separated ; 5 - Divorced',
  `pa_age` int(3) NOT NULL,
  `pa_birthday` date NOT NULL,
  `pa_position_mst_code` bigint(20) NOT NULL,
  `pa_occupation` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `cargo_bl_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `cargo_lc_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `cargo_voyage_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `cargo_eta` datetime NOT NULL,
  `cargo_etd` datetime NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_items_involved_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtllosssched`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtllosssched` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_group_code` bigint(20) NOT NULL,
  `item_no` int(3) NOT NULL,
  `tsi_amount` double NOT NULL,
  `loss_reserve_amount` double NOT NULL,
  `expense_reserve_amount` double NOT NULL,
  `loss_paid_amount` double NOT NULL,
  `expense_paid_amount` double NOT NULL,
  `loss_actual_amount` double NOT NULL,
  `expense_actual_amount` double NOT NULL,
  `net_loss_paid_amount` double NOT NULL,
  `net_expense_paid_amount` double NOT NULL,
  `loss_recovery_amount` double NOT NULL,
  `expense_recovery_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtllossschedhistory`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtllossschedhistory` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_loss_sched_code` bigint(20) NOT NULL,
  `claims_trn_loss_sched_item_code` bigint(20) NOT NULL,
  `history_type` tinyint(1) NOT NULL COMMENT '1 - Reserve ; 2 - Actual ; 3 - Paid',
  `type` tinyint(1) NOT NULL COMMENT '1 - Loss ; 2 - Expense',
  `type_amount` double NOT NULL,
  `net_type_amount` double NOT NULL,
  `reserve_date` date NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_loss_sched_code`,`claims_trn_loss_sched_item_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtllossschedperils`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtllossschedperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_loss_sched_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `curr_policy_trn_item_peril_code` bigint(20) NOT NULL,
  `at_fault_mode` tinyint(1) NOT NULL COMMENT '0 - Not Applicable ; 1 - Salvage Recovery ; 2 - Assured Claimant ; 3 - Third Party Claimant',
  `loss_reserve_date` date NOT NULL,
  `loss_paid_date` date NOT NULL,
  `loss_actual_date` date NOT NULL,
  `expense_reserve_date` date NOT NULL,
  `expense_paid_date` date NOT NULL,
  `expense_actual_date` date NOT NULL,
  `tsi_amount` double NOT NULL,
  `loss_reserve_amount` double NOT NULL,
  `expense_reserve_amount` double NOT NULL,
  `loss_paid_amount` double NOT NULL,
  `expense_paid_amount` double NOT NULL,
  `loss_actual_amount` double NOT NULL,
  `expense_actual_amount` double NOT NULL,
  `net_loss_paid_amount` double NOT NULL,
  `net_expense_paid_amount` double NOT NULL,
  `loss_recovery_amount` double NOT NULL,
  `expense_recovery_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_loss_sched_code`,`peril_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtllossschedperilspaymentreqdtl`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtllossschedperilspaymentreqdtl` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_loss_sched_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `curr_policy_trn_item_peril_code` bigint(20) NOT NULL,
  `loss_reserve_date` date NOT NULL,
  `loss_paid_date` date NOT NULL,
  `expense_reserve_date` date NOT NULL,
  `expense_paid_date` date NOT NULL,
  `claims_trn_payment_req_dtl_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `loss_reserve_amount` double NOT NULL,
  `expense_reserve_amount` double NOT NULL,
  `loss_paid_amount` double NOT NULL,
  `expense_paid_amount` double NOT NULL,
  `loss_actual_amount` double NOT NULL,
  `expense_actual_amount` double NOT NULL,
  `net_loss_paid_amount` double NOT NULL,
  `net_expense_paid_amount` double NOT NULL,
  `loss_recovery_amount` double NOT NULL,
  `expense_recovery_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_loss_sched_code`,`curr_policy_trn_item_peril_code`,`claims_trn_payment_req_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlpaymentrequisition`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlpaymentrequisition` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `payment_req_ref_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `payment_req_ref_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `is_closed` tinyint(1) NOT NULL,
  `closed_user_mst_code` bigint(20) NOT NULL,
  `closed_datetime` datetime NOT NULL,
  `payment_req_status` int(2) NOT NULL,
  `payee_type` tinyint(1) NOT NULL,
  `payee_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `payee_mst_code` bigint(20) NOT NULL,
  `vat_type` tinyint(1) NOT NULL COMMENT '0 - Non-VAT ; 1 - Vat Inclusive ; 2 - Vat Exclusive',
  `amount` double NOT NULL,
  `deductible_amount` double NOT NULL,
  `vat_amount` double NOT NULL,
  `wtax_amount` double NOT NULL,
  `other_deduction_amount` double NOT NULL,
  `net_amount` double NOT NULL,
  `depreciation_amount` double NOT NULL,
  `discount_amount` double NOT NULL,
  `other_discount_amount` double NOT NULL,
  `ap_transaction_trn_code` bigint(20) NOT NULL,
  `order_of_payments_trn_code` bigint(20) NOT NULL,
  `cash_check_voucher_trn_code` bigint(20) NOT NULL,
  `approved_user_mst_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `approve_user_mst_code` bigint(20) NOT NULL,
  `approve_at` datetime NOT NULL,
  `routed_user_mst_code` bigint(20) NOT NULL,
  `routed_at` datetime NOT NULL,
  `cancelled_datetime` datetime NOT NULL,
  `cancelled_user_mst_code` bigint(20) NOT NULL,
  `cancelled_option` tinyint(4) NOT NULL COMMENT '1-cancel&create new| 2-cancel&edit',
  `cancelled_remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `is_advanced_cash_call` tinyint(1) NOT NULL COMMENT 'IF SET TO 1 = ISSUED ADVANCED CASH CALL. NO NEED TO REMAKE RECOVERABLE UPON PAYMENT',
  `is_partial_payment` tinyint(1) NOT NULL COMMENT '0 - Full Payment ; 1 - Partial Payment',
  `is_paid_outside_system` tinyint(1) NOT NULL,
  `paid_outside_datetime` datetime NOT NULL,
  `paid_outside_user_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `paymentreqindex` (`claims_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlpaymentrequisitiondtl`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlpaymentrequisitiondtl` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_payment_req_code` bigint(20) NOT NULL,
  `claims_trn_estimate_code` bigint(20) NOT NULL,
  `entry_no` int(3) NOT NULL,
  `payment_req_status` int(3) NOT NULL,
  `item_no` int(3) NOT NULL,
  `entry_user_mst_code` bigint(20) NOT NULL,
  `entry_datetime` datetime NOT NULL,
  `tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - Non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `vat_type` tinyint(1) NOT NULL COMMENT '0 - Non-VAT ; 1 - Vat Inclusive ; 2 - Vat Exclusive',
  `ap_item_chart_of_accounts_mst_code` bigint(20) NOT NULL,
  `ap_transaction_trn_code` bigint(20) NOT NULL,
  `approved_user_mst_code` bigint(20) NOT NULL,
  `approved_datetime` datetime NOT NULL,
  `vat_rate` double NOT NULL,
  `wtax_rate` double NOT NULL,
  `amount` double NOT NULL,
  `deductible_amount` double NOT NULL,
  `vat_amount` double NOT NULL,
  `wtax_amount` double NOT NULL,
  `other_deduction_amount` double NOT NULL,
  `net_amount` double NOT NULL,
  `depreciation_amount` double NOT NULL,
  `depreciation_percentage` double NOT NULL,
  `discount_amount` double NOT NULL,
  `discount_percentage` double NOT NULL,
  `other_discount_amount` double NOT NULL,
  `base_net_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_payment_req_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlpaymentrequisitiondtlotherded`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlpaymentrequisitiondtlotherded` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_payment_req_code` bigint(20) NOT NULL,
  `claims_trn_estimate_code` bigint(20) NOT NULL,
  `claims_trn_estimate_entries_code` bigint(20) NOT NULL,
  `claims_trn_payment_req_dtl_code` bigint(20) NOT NULL,
  `other_deductions_mst_code` bigint(20) NOT NULL,
  `other_deductions_mst_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `other_deduction_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_payment_req_code`,`claims_trn_payment_req_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlrecovery`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlrecovery` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_group_code` bigint(20) NOT NULL,
  `claims_trn_items_involved_code` bigint(20) NOT NULL,
  `claim_type_mst_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `recovery_status` int(3) NOT NULL,
  `recovery_ref_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `recovery_ref_number_type` tinyint(1) NOT NULL,
  `recovery_date` date NOT NULL,
  `approved_user_mst_codes` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `approving_datetimes` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `recovery_description` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `payee_type` tinyint(1) NOT NULL,
  `gross_amount` double NOT NULL,
  `quantity` int(4) NOT NULL,
  `total_amount` double NOT NULL,
  `vat_rate` double NOT NULL,
  `vat_amount` double NOT NULL,
  `wtax_rate` double NOT NULL,
  `wtax_amount` double NOT NULL,
  `vatable_amount` double NOT NULL,
  `recovery_amount` double NOT NULL,
  `payee_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `payee_contact_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `payee_contact_person` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `payee_mst_code` bigint(20) NOT NULL,
  `recovery_type` tinyint(1) NOT NULL COMMENT '1 - LOSS ; 2 - EXPENSE',
  `routed_user_mst_code` bigint(20) NOT NULL,
  `routed_at` datetime NOT NULL,
  `approve_user_mst_code` bigint(20) NOT NULL,
  `approve_at` datetime NOT NULL,
  `payment_term_mst_code` bigint(20) NOT NULL,
  `ar_transaction_trn_code` bigint(20) NOT NULL,
  `official_receipts_trn_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_items_involved_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlrecoverydistribution`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlrecoverydistribution` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_recovery_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_group_code` bigint(20) NOT NULL,
  `claims_trn_items_involved_code` bigint(20) NOT NULL,
  `claim_type_mst_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `recovery_amount` double NOT NULL,
  `loss_recovery_amount` double NOT NULL,
  `expense_recovery_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_recovery_code`,`claims_trn_items_involved_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlrecoveryremarks`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlrecoveryremarks` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_recovery_code` bigint(20) NOT NULL,
  `sender_user_mst_code` bigint(20) NOT NULL,
  `message_text` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `send_datetime` datetime NOT NULL,
  `notification_trn_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`claims_trn_recovery_code`,`send_datetime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlremarks`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlremarks` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `sender_user_mst_code` bigint(20) NOT NULL,
  `message_text` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `send_date` date NOT NULL,
  `send_datetime` datetime NOT NULL,
  `notification_trn_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`send_datetime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlsubmitteddocs`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlsubmitteddocs` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_trn_code` bigint(20) NOT NULL,
  `required_docs_mst_code` bigint(20) NOT NULL,
  `claims_trn_submitted_docs_image_code` bigint(20) NOT NULL,
  `file_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `uploaded_user_mst_code` bigint(20) NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`claims_trn_code`,`required_docs_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsdtlsubmitteddocsfiles`
--

CREATE TABLE IF NOT EXISTS `trnclaimsdtlsubmitteddocsfiles` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `uploaded_file` longblob NOT NULL COMMENT 'actual image',
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `claims_trn_code` bigint(20) NOT NULL,
  `claims_trn_submitted_docs_code` bigint(20) NOT NULL,
  `filetype` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `uploaded_user_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `claims_trn_code` (`claims_trn_code`),
  KEY `claims_trn_submitted_docs_code` (`claims_trn_submitted_docs_code`),
  KEY `trnclaimsdtlsubmitindex` (`claims_trn_code`,`claims_trn_submitted_docs_code`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='DEPRECATED - replaced with trnclaimsdtlfileattachments' AUTO_INCREMENT=2 ;

--
-- Dumping data for table `trnclaimsdtlsubmitteddocsfiles`
--

INSERT INTO `trnclaimsdtlsubmitteddocsfiles` (`code`, `uploaded_file`, `uploaded_file_name`, `claims_trn_code`, `claims_trn_submitted_docs_code`, `filetype`, `uploaded_at`, `uploaded_user_mst_code`, `remarks`, `created_at`, `updated_at`, `created_user_mst_code`, `updated_user_mst_code`) VALUES
(1, 0x[encoded data, 60214 characters], 'SSS_R1A_201711241521.pdf', 1252, 3, 'pdf', '2017-12-04 12:11:53', 71, '', '2017-12-04 12:11:53', '2017-12-04 12:11:53', 71, 71);

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimsreportmonitoring`
--

CREATE TABLE IF NOT EXISTS `trnclaimsreportmonitoring` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `report_source` int(2) NOT NULL COMMENT '0 - Report a Claim ; 1 - Thru phone call ; 2 - Thru Email ; 3 - Personal ; 4 - Others',
  `policy_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `assured_name` mediumtext COLLATE latin1_general_ci NOT NULL,
  `loss_datetime` datetime NOT NULL,
  `email_address` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `contact_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `accident_type` mediumtext COLLATE latin1_general_ci NOT NULL COMMENT 'comma separated',
  `client_remarks` mediumtext COLLATE latin1_general_ci NOT NULL COMMENT 'remarks (please state what happened or details)',
  `report_status` int(2) NOT NULL COMMENT '0 - New/Pending ; 10 - Approved ; 20 - Rejected',
  `approve_reject_at` datetime NOT NULL,
  `approve_reject_user_mst_code` bigint(20) NOT NULL,
  `claims_trn_code` bigint(20) NOT NULL,
  `support_ticket_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `approve_reject_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `access_monitoring_active` tinyint(1) NOT NULL COMMENT 'if the access in monitoring dashboard page still active',
  `access_username` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `access_password` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `monitoring_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `plate_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `engine_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `chassis_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `mv_file_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `instructions_to_client` mediumtext COLLATE latin1_general_ci NOT NULL,
  `assigned_to_user_mst_code` bigint(20) NOT NULL,
  `cc_email_address` mediumtext COLLATE latin1_general_ci NOT NULL,
  `source_ip_address` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `required_docs_mst_codes` mediumtext COLLATE latin1_general_ci NOT NULL COMMENT 'comma separated',
  `nature_of_loss_mst_code` bigint(20) NOT NULL COMMENT 'nature of loss (confirmed upon checking of accidents)',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimstracker`
--

CREATE TABLE IF NOT EXISTS `trnclaimstracker` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `policy_number` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `assured_mst_code` bigint(20) NOT NULL,
  `assured_name` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `claimant_description` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'MOTORCAR - N/A; PA - claimant name ; FIRE - address',
  `claims_trn_code` bigint(20) NOT NULL,
  `claim_no` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `nature_of_loss_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `claims_tracker_number` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `tracking_open_datetime` datetime NOT NULL,
  `tracking_open_user_mst_code` bigint(20) NOT NULL,
  `cancelled_datetime` datetime NOT NULL,
  `cancelled_user_mst_code` bigint(20) NOT NULL,
  `cancelled_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `tracking_close_datetime` datetime NOT NULL,
  `tracking_close_user_mst_code` bigint(20) NOT NULL,
  `tracking_close_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `tracking_status` tinyint(1) NOT NULL,
  `extra_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `service_level_agreement_days_total` int(3) NOT NULL,
  `has_loa_billing` tinyint(1) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `line_mst_code` (`line_mst_code`),
  KEY `tracking_open_user_mst_code` (`tracking_open_user_mst_code`),
  KEY `indextry2` (`created_at`,`line_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimstrackerdtltrail`
--

CREATE TABLE IF NOT EXISTS `trnclaimstrackerdtltrail` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_tracker_trn_code` bigint(20) NOT NULL,
  `claims_tracker_activity_mst_code` bigint(20) NOT NULL,
  `department_mst_code` bigint(20) NOT NULL,
  `datetime_in` datetime NOT NULL,
  `documents_received` mediumtext COLLATE latin1_general_ci NOT NULL COMMENT 'NEW LINE SEPARATED',
  `action_done` mediumtext COLLATE latin1_general_ci NOT NULL,
  `other_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `finish_processed_user_mst_code` bigint(20) NOT NULL COMMENT 'USER WHO PROCESSED FINISHED / TURNOVER(AUTO FINISH)',
  `datetime_out` datetime NOT NULL,
  `datetime_received` datetime NOT NULL,
  `turnover_processed_user_mst_code` bigint(20) NOT NULL COMMENT 'USER WHO PROCESSED THE TURNOVER ACTION',
  `turnover_reason` mediumtext COLLATE latin1_general_ci NOT NULL,
  `turnover_claims_tracker_dtl_trail_trn_code` bigint(20) NOT NULL,
  `turnover_receiver_user_mst_code` bigint(20) NOT NULL,
  `turnover_trail_department_mst_code` bigint(20) NOT NULL,
  `activity_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `service_level_agreement_days` int(3) NOT NULL,
  `receiver_user_mst_code` bigint(20) NOT NULL,
  `last_claims_tracker_dtl_trail_followup_trn_code` bigint(20) NOT NULL,
  `last_datetime_call` datetime NOT NULL,
  `last_followup_person_name` mediumtext COLLATE latin1_general_ci NOT NULL,
  `last_followup_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `last_followup_encoded_user_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `claims_tracker_trn_code` (`claims_tracker_trn_code`),
  KEY `claims_tracker_activity_mst_code` (`claims_tracker_activity_mst_code`),
  KEY `department_mst_code` (`department_mst_code`),
  KEY `datetime_in` (`datetime_in`),
  KEY `index2` (`claims_tracker_trn_code`,`datetime_in`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnclaimstrackerdtltrailfollowup`
--

CREATE TABLE IF NOT EXISTS `trnclaimstrackerdtltrailfollowup` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `claims_tracker_trn_code` bigint(20) NOT NULL,
  `claims_tracker_dtl_trail_trn_code` bigint(20) NOT NULL,
  `datetime_call` datetime NOT NULL,
  `followup_person_name` mediumtext COLLATE latin1_general_ci NOT NULL,
  `followup_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `index1` (`claims_tracker_trn_code`,`claims_tracker_dtl_trail_trn_code`),
  KEY `claims_tracker_trn_code` (`claims_tracker_trn_code`),
  KEY `claims_tracker_dtl_trail_trn_code` (`claims_tracker_dtl_trail_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncommissionchit`
--

CREATE TABLE IF NOT EXISTS `trncommissionchit` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `commission_chit_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `commission_chit_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `transaction_date` date NOT NULL,
  `booking_year` int(4) NOT NULL COMMENT 'YEAR OF O/R DATE',
  `booking_period` int(2) NOT NULL COMMENT 'MONTH OF O/R DATE',
  `reference_mst_code` bigint(20) NOT NULL,
  `reference_type` tinyint(2) NOT NULL,
  `is_source_of_business` tinyint(4) NOT NULL,
  `agent_mst_code` bigint(20) NOT NULL,
  `source_of_business_mst_code` tinyint(4) NOT NULL,
  `source_of_business_source_category` tinyint(4) NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `advanced_commission_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_agent_mst_code` bigint(20) NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `comm_status` int(3) NOT NULL,
  `is_paid` tinyint(1) NOT NULL,
  `paid_cash_check_voucher_trn_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL COMMENT 'might be many, comma-separated',
  `paid_datetime` datetime NOT NULL,
  `is_posted` tinyint(1) NOT NULL,
  `posted_user_mst_code` bigint(20) NOT NULL,
  `posting_datetime` datetime NOT NULL,
  `is_printed` tinyint(1) NOT NULL,
  `printed_user_mst_code` bigint(20) NOT NULL,
  `print_datetime` datetime NOT NULL,
  `is_void` tinyint(1) NOT NULL,
  `void_user_mst_code` bigint(20) NOT NULL,
  `void_datetime` datetime NOT NULL,
  `is_sysgen` tinyint(1) NOT NULL,
  `generated_ap_transaction_trn_code` bigint(20) NOT NULL,
  `recommended_user_mst_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `approved_user_mst_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `recommended_datetimes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `approving_datetimes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `particulars` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`company_mst_code`,`branch_mst_code`,`agent_mst_code`,`transaction_date`,`commission_chit_no`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncommissionchitdtlpolicy`
--

CREATE TABLE IF NOT EXISTS `trncommissionchitdtlpolicy` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `commission_chit_trn_code` bigint(20) NOT NULL,
  `official_receipts_trn_code` bigint(20) NOT NULL,
  `policy_trn_code` bigint(20) NOT NULL,
  `official_receipts_trn_ar_trans_code` bigint(20) NOT NULL,
  `ar_transaction_trn_code` bigint(20) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `advanced_commission_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `or_date` date NOT NULL,
  `agent_tax_type` tinyint(1) NOT NULL,
  `agent_vat_rate` double NOT NULL,
  `agent_wtax_rate` double NOT NULL,
  `agent_mst_code` bigint(20) NOT NULL,
  `parent_agent_mst_code` bigint(20) NOT NULL,
  `parent_agent_vat_rate` double NOT NULL,
  `parent_agent_wtax_rate` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`commission_chit_trn_code`,`official_receipts_trn_code`),
  KEY `trncommissionchitdtlpolicy_index001` (`policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncommissionchitdtlpolicyperils`
--

CREATE TABLE IF NOT EXISTS `trncommissionchitdtlpolicyperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `commission_chit_trn_code` bigint(20) NOT NULL,
  `commission_chit_policy_trn_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `commission_rate` double NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `advanced_commission_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_rate` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`commission_chit_trn_code`,`commission_chit_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncommissionreplenishment`
--

CREATE TABLE IF NOT EXISTS `trncommissionreplenishment` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `replenishment_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `replenishment_number_type` tinyint(1) NOT NULL COMMENT '1 - System Generated ; 2 - Manual',
  `replenishment_date` date NOT NULL,
  `replenishment_status` tinyint(1) NOT NULL,
  `replenishment_amount` double NOT NULL,
  `balance_forwarded` double NOT NULL,
  `current_balance` double NOT NULL,
  `is_posted` tinyint(1) NOT NULL,
  `posted_user_mst_code` bigint(20) NOT NULL,
  `posting_datetime` datetime NOT NULL,
  `is_sysgen` tinyint(1) NOT NULL,
  `or_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `advanced_commission_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `generated_ap_transaction_trn_code` bigint(20) NOT NULL,
  `generated_order_of_payments_trn_code` bigint(20) NOT NULL,
  `generated_cash_check_voucher_trn_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`company_mst_code`,`branch_mst_code`,`replenishment_date`,`replenishment_no`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncommissionreplenishmentbalance`
--

CREATE TABLE IF NOT EXISTS `trncommissionreplenishmentbalance` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `current_balance` double NOT NULL,
  `last_amount_applied` double NOT NULL,
  `last_applied_date` date NOT NULL,
  `last_applied_mode` tinyint(1) NOT NULL COMMENT '1 - add ; 2 - minus',
  `last_reference_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`company_mst_code`,`branch_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncommissionreplenishmentdtlor`
--

CREATE TABLE IF NOT EXISTS `trncommissionreplenishmentdtlor` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `commission_replenishment_trn_code` bigint(20) NOT NULL,
  `official_receipts_trn_code` bigint(20) NOT NULL,
  `policy_trn_code` bigint(20) NOT NULL,
  `official_receipts_trn_ar_trans_code` bigint(20) NOT NULL,
  `ar_transaction_trn_code` bigint(20) NOT NULL,
  `or_date` date NOT NULL,
  `agent_mst_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `advanced_commission_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`commission_replenishment_trn_code`,`official_receipts_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncovernotebreakdown`
--

CREATE TABLE IF NOT EXISTS `trncovernotebreakdown` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `order_no` int(3) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `net_prem_amount` double NOT NULL,
  `charges_amount` double NOT NULL,
  `amount_due` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`int_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncovernotebreakdowndtlitems`
--

CREATE TABLE IF NOT EXISTS `trncovernotebreakdowndtlitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `cover_note_breakdown_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_location_dtl_code` bigint(20) NOT NULL,
  `orig_policy_location_dtl_code` bigint(20) NOT NULL,
  `int_policy_item_dtl_code` bigint(20) NOT NULL,
  `orig_policy_item_dtl_code` bigint(20) NOT NULL,
  `interim_item_no` int(3) NOT NULL,
  `new_item_no` int(3) NOT NULL,
  `item_name` varchar(2000) COLLATE latin1_general_ci NOT NULL,
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `net_prem_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`cover_note_breakdown_trn_code`,`orig_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncovernoteuploading`
--

CREATE TABLE IF NOT EXISTS `trncovernoteuploading` (
  `code` bigint(20) NOT NULL,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `mortgagee_mst_code` bigint(20) NOT NULL,
  `cover_note_no` varchar(50) COLLATE latin1_general_ci NOT NULL,
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `net_prem_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='for cover note uploading of pbb';

-- --------------------------------------------------------

--
-- Table structure for table `trncreditmemo`
--

CREATE TABLE IF NOT EXISTS `trncreditmemo` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `reference_mst_code` bigint(20) NOT NULL,
  `reference_type` int(2) NOT NULL,
  `credit_memo_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `credit_memo_no` varchar(200) COLLATE latin1_general_cs NOT NULL,
  `reference_no` varchar(200) COLLATE latin1_general_cs NOT NULL,
  `credit_memo_date` date NOT NULL,
  `bank_mst_code` bigint(20) NOT NULL,
  `bank_account_mst_code` bigint(20) NOT NULL,
  `bank_account_chart_of_accounts_mst_code` bigint(20) NOT NULL,
  `credit_memo_amount` double NOT NULL,
  `credit_memo_amount_balance` double NOT NULL,
  `particulars` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `posted_user_mst_code` bigint(20) NOT NULL,
  `posting_datetime` datetime NOT NULL,
  `void_user_mst_code` bigint(20) NOT NULL,
  `void_datetime` datetime NOT NULL,
  `is_recorded` tinyint(1) NOT NULL,
  `is_sysgen` tinyint(1) NOT NULL,
  `cm_status` tinyint(1) NOT NULL COMMENT '2 - POSTED | 3 - VOIDED | 4 - FOR EDITING',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `credmemoindex` (`company_mst_code`,`branch_mst_code`,`credit_memo_no`,`reference_no`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicy`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicy` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `subline_mst_code` bigint(20) NOT NULL,
  `assured_mst_code` bigint(20) NOT NULL,
  `assured_name` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `assured_address_dtl_code` bigint(20) NOT NULL,
  `country_mst_code` bigint(20) NOT NULL,
  `region_mst_code` bigint(20) NOT NULL,
  `province_mst_code` bigint(20) NOT NULL,
  `city_mst_code` bigint(20) NOT NULL,
  `barangay_mst_code` bigint(20) NOT NULL,
  `street_address` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `complete_address` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `assigned_or_leased_to` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'for fire and motorcar',
  `curr_sequence` bigint(20) NOT NULL,
  `policy_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `policy_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `policy_source` tinyint(1) NOT NULL COMMENT '1 - DB ; 2 - RII ; 3 - RIO',
  `policy_type` tinyint(1) NOT NULL COMMENT '1 - Policy/Binder/Quotation/HoldCover ; 2 - Endorsement/Alteration ; 3 - Renewal',
  `booking_year` int(4) NOT NULL,
  `booking_period` int(2) NOT NULL,
  `interim_status` int(2) NOT NULL,
  `interim_no` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'always sysgen',
  `int_policy_trn_code` bigint(20) NOT NULL,
  `generated_policy_trn_code` bigint(20) NOT NULL,
  `generated_curr_policy_trn_code` bigint(20) NOT NULL,
  `endorsing_curr_policy_trn_code` bigint(20) NOT NULL COMMENT 'endorsing policy no',
  `quotation_curr_policy_trn_code` bigint(20) NOT NULL COMMENT 'if converted from quotation',
  `renewing_curr_policy_trn_code` bigint(20) NOT NULL COMMENT 'if processed from renewals',
  `renewed_curr_policy_trn_code` bigint(20) NOT NULL COMMENT 'TO MAP THE SAID POLICY TO ITS RENEWAL',
  `spoiling_policy_trn_code` bigint(20) NOT NULL COMMENT 'SPOIL RE-ISSUE POLICY DETAILS FROM (FOR S/P)',
  `new_int_policy_trn_code` bigint(20) NOT NULL COMMENT 'TO MAP THIS POLICY TO ITS NEW INTERIM POLICY IF SPOIL RE-ISSUE',
  `revision_counter` int(3) NOT NULL,
  `quotation_days_valid` int(3) NOT NULL,
  `quotation_printing_datetime` datetime NOT NULL,
  `reinstatement_type` tinyint(1) NOT NULL COMMENT '1 - From Current State ; 2 - From Original Policy',
  `document_series_no` int(9) NOT NULL,
  `renewal_no` int(3) NOT NULL COMMENT 'renewal counter',
  `renewal_status` tinyint(1) NOT NULL COMMENT '0 - Unprocessed ; 1 - Processed / Renewed ; 2 - Not Renewed',
  `temporary_int_policy_trn_code` bigint(20) NOT NULL,
  `renewal_print_count` int(4) NOT NULL,
  `is_dont_renew` tinyint(1) NOT NULL,
  `non_renewal_reason_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL COMMENT 'comma-separated',
  `non_renewal_reason_remarks` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `is_unrenewed` tinyint(1) NOT NULL,
  `new_policy_trn_code` bigint(20) NOT NULL,
  `can_allow_renew` tinyint(1) NOT NULL,
  `renewal_tag` tinyint(1) NOT NULL COMMENT '0 - no action ; 1 - to renew ; 2 - dont renew',
  `renewal_processed_user_mst_code` bigint(20) NOT NULL,
  `issue_date` date NOT NULL,
  `inception_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `effectivity_date` date NOT NULL,
  `is_inception_date_tba` tinyint(1) NOT NULL,
  `is_expiry_date_tba` tinyint(1) NOT NULL,
  `industry_mst_code` bigint(20) NOT NULL,
  `spoiling_datetime` datetime NOT NULL,
  `spoiling_user_mst_code` bigint(20) NOT NULL,
  `spoil_remarks` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `spoil_option` tinyint(1) NOT NULL,
  `cancelled_date` datetime NOT NULL,
  `cancelled_user_mst_code` bigint(20) NOT NULL,
  `distribution_status` tinyint(1) NOT NULL COMMENT '1 - Undistributed ; 2 - Distributed and Unposted ; 3 - Distributed and Posted',
  `endorsement_no` int(3) NOT NULL COMMENT 'endorsement counter',
  `endorsement_number` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'THE ACTUAL ENDORSEMENT NUMBER',
  `region_mst_code_2` bigint(20) NOT NULL,
  `policy_status` int(2) NOT NULL,
  `agent_mst_code` bigint(20) NOT NULL,
  `agent_commission_type_flag` tinyint(1) NOT NULL COMMENT '0 - N/A ; 1 - Single Rate ; 2 - All In Rate',
  `parent_agent_mst_code` bigint(20) NOT NULL,
  `source_of_business_mst_code` bigint(20) NOT NULL,
  `agent_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - Non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `agent_vat_rate` double NOT NULL,
  `agent_wtax_rate` double NOT NULL,
  `parent_agent_tax_type` tinyint(1) NOT NULL,
  `parent_agent_vat_rate` double NOT NULL,
  `parent_agent_wtax_rate` double NOT NULL,
  `assured_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - Non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `policy_no_of_days` int(3) NOT NULL,
  `is_one_year` tinyint(4) NOT NULL,
  `solicitor_mst_code` bigint(20) NOT NULL,
  `currency_mst_code` bigint(20) NOT NULL,
  `exchange_rate` double NOT NULL,
  `endorsement_mst_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL COMMENT 'comma-separated',
  `endorsement_text` varchar(15000) COLLATE latin1_general_cs NOT NULL,
  `recommended_user_mst_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `approved_user_mst_codes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `recommended_datetimes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `approving_datetimes` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `is_printed` tinyint(1) NOT NULL,
  `print_counter` int(3) NOT NULL,
  `print_datetime` datetime NOT NULL COMMENT 'latest',
  `printed_user_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `net_tsi_amount` double NOT NULL COMMENT 'for running totals after endorsements/alteration',
  `net_prem_amount` double NOT NULL COMMENT 'for running totals after endorsements/alteration',
  `pres_net_prem_amount` double NOT NULL COMMENT 'for running totals after endorsements/alteration',
  `charges_amount` double NOT NULL,
  `amount_due` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `commission_broker_fee_amount` double NOT NULL,
  `commission_broker_fee_vat_amount` double NOT NULL,
  `commission_net_amount` double NOT NULL,
  `surcharge_amount` double NOT NULL,
  `coc_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `coc_number_type` tinyint(1) NOT NULL,
  `authentication_code` varchar(1000) COLLATE latin1_general_cs NOT NULL,
  `prev_curr_tsi_amount` double NOT NULL,
  `prev_curr_prem_amount` double NOT NULL,
  `prev_curr_charges_amount` double NOT NULL,
  `terms_of_coverage` mediumtext COLLATE latin1_general_cs NOT NULL,
  `policy_remarks` mediumtext COLLATE latin1_general_cs NOT NULL,
  `searchable_field_1` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'DEPENDS PER LINE, COMMA SEPARATED PER ITEM',
  `searchable_field_2` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'DEPENDS PER LINE, COMMA SEPARATED PER ITEM',
  `searchable_field_3` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'DEPENDS PER LINE, COMMA SEPARATED PER ITEM',
  `is_from_quotation` tinyint(1) NOT NULL,
  `quotation_user_mst_code` bigint(20) NOT NULL,
  `quotation_created_at` datetime NOT NULL,
  `depreciation_rate` double NOT NULL COMMENT 'WHOLE PERCENTAGE NOT YET DIVIDED BY 100',
  `no_claim_bonus_amt` double NOT NULL,
  `depreciation_amt` double NOT NULL,
  `no_claim_bonus_rate` double NOT NULL COMMENT 'WHOLE PERCENTAGE NOT YET DIVIDED BY 100',
  `email_address` varchar(150) COLLATE latin1_general_cs NOT NULL COMMENT 'assured email address',
  `secondary_email_address` mediumtext COLLATE latin1_general_cs NOT NULL COMMENT 'agent/referror/account officer/representative email address',
  `other_email_address` mediumtext COLLATE latin1_general_cs NOT NULL COMMENT 'other email address for cc',
  `cellphone_number` varchar(250) COLLATE latin1_general_cs NOT NULL,
  `support_ticket_policy_trn_code` bigint(20) NOT NULL COMMENT 'FOR CRM TICKET CONNECTION',
  `renewal_type` int(2) NOT NULL,
  `renewal_remarks` mediumtext COLLATE latin1_general_cs NOT NULL,
  `renewal_auto_no_of_days` int(3) NOT NULL,
  `bypass_claim_validation` tinyint(1) NOT NULL,
  `bypass_claim_user_mst_code` bigint(20) NOT NULL,
  `bypass_claim_remarks` mediumtext COLLATE latin1_general_cs NOT NULL,
  `is_thank_you_letter_sent` tinyint(1) NOT NULL,
  `thank_you_letter_user_mst_code` bigint(20) NOT NULL COMMENT 'user who sent the thank you letter',
  `thank_you_letter_sent_datetime` datetime NOT NULL,
  `is_mortgage_account` tinyint(4) NOT NULL COMMENT '0-no|1-yes - cfg mortgage account',
  `is_mortgage_generate_or` tinyint(4) NOT NULL COMMENT '0-no|1-yes - automatically generate or',
  `loss_type` tinyint(1) NOT NULL COMMENT '0 - n/a ; 1 - total loss/wreck ; 2 - carnap',
  `loss_type_claim_no` varchar(200) COLLATE latin1_general_cs NOT NULL COMMENT 'claim number na total loss (baka kasi multiple claim)',
  `referring_branch` varchar(100) COLLATE latin1_general_cs NOT NULL,
  `referring_person` varchar(100) COLLATE latin1_general_cs NOT NULL,
  `referring_branch_code` varchar(100) COLLATE latin1_general_cs NOT NULL,
  `is_open_market_rate` tinyint(1) NOT NULL,
  `non_renewal_notice_reasons_mst_code` bigint(20) NOT NULL,
  `non_renewal_notice_reason` mediumtext COLLATE latin1_general_cs NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `currsearchindex` (`policy_number`),
  KEY `currcombinedindex` (`policy_source`,`policy_type`,`line_mst_code`,`subline_mst_code`,`branch_mst_code`,`policy_number`),
  KEY `interimindex` (`temporary_int_policy_trn_code`),
  KEY `RiskProfileIndex` (`booking_year`,`booking_period`,`line_mst_code`,`spoiling_datetime`,`policy_source`),
  KEY `FireStatIndex` (`booking_year`,`booking_period`,`policy_source`,`line_mst_code`,`spoiling_user_mst_code`,`spoiling_datetime`),
  KEY `generated_policy_trn_code_index` (`generated_policy_trn_code`,`code`),
  KEY `currindexrenew1` (`policy_source`,`source_of_business_mst_code`,`spoiling_datetime`,`cancelled_date`,`line_mst_code`,`expiry_date`),
  KEY `currpolicyindex01` (`is_expiry_date_tba`,`expiry_date`,`line_mst_code`,`policy_source`,`tsi_amount`) USING BTREE,
  KEY `currindex02` (`branch_mst_code`,`agent_mst_code`,`source_of_business_mst_code`,`line_mst_code`,`subline_mst_code`,`policy_source`,`policy_type`,`expiry_date`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlacceptanceinfo`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlacceptanceinfo` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `mother_policy_orig_policy_trn_code` bigint(20) NOT NULL COMMENT 'MOTHER POLICY OF THIS OUTGOING BINDER/ALTERATION (NOT APPLICABLE IN INWARD)',
  `mother_endorsement_orig_policy_trn_code` bigint(20) NOT NULL COMMENT 'MOTHER ENDORSEMENT OF THIS OUTGOING BINDER/ALTERATION (NOT APPLICABLE IN INWARD)',
  `mother_binder_orig_policy_trn_code` bigint(20) NOT NULL COMMENT 'MOTHER BINDER OF THIS REINSURANCE BINDER/ALTERATION (APPLICABLE TO BOTH INWARD OUTGOING)',
  `acceptance_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `acceptance_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `acceptance_date` date NOT NULL,
  `accepted_by` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `reinsurer_mst_code` bigint(20) NOT NULL,
  `reinsurer_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `reinsurer_vat_rate` double NOT NULL,
  `reinsurer_wtax_rate` double NOT NULL,
  `ceding_policy_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `ceding_endorse_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `ceding_binder_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `date_offered` date NOT NULL,
  `reassured_mst_code` bigint(20) NOT NULL,
  `reassured_name` varchar(1000) COLLATE latin1_general_cs NOT NULL,
  `alteration_advice_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `broker_reinsurer_mst_code` bigint(20) NOT NULL COMMENT 'same masterfile',
  `broker_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `broker_vat_rate` double NOT NULL,
  `broker_fee_rate` double NOT NULL,
  `reinsurance_tsi_amount` double NOT NULL,
  `reinsurance_prem_amount` double NOT NULL,
  `original_tsi_amount` double NOT NULL,
  `original_prem_amount` double NOT NULL,
  `gross_facul_amount` double NOT NULL,
  `facul_share_percentages` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `binder_warranty_payment_term_mst_code` bigint(20) NOT NULL,
  `binder_warranty_no_days` int(3) NOT NULL,
  `payment_premium_warranty_payment_term_mst_code` bigint(20) NOT NULL,
  `payment_premium_warranty_no_days` int(3) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `curracceptanceindex` (`curr_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlbondcollaterals`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlbondcollaterals` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `collateral_no` int(3) NOT NULL,
  `bond_collaterals_mst_code` bigint(20) NOT NULL,
  `collateral_description` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `collateral_amount` double NOT NULL,
  `issue_date` date NOT NULL,
  `received_date` date NOT NULL,
  `received_by` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `maturity_date` date NOT NULL,
  `release_date` date NOT NULL,
  `renewal` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlcomm`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlcomm` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `group_no` int(3) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `broker_fee_vat_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `is_no_commission` tinyint(1) NOT NULL,
  `no_comm_change_datetime` datetime NOT NULL,
  `no_comm_change_user_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommindex` (`curr_policy_trn_code`,`curr_policy_trn_group_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlcommbreakdowns`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlcommbreakdowns` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `curr_policy_trn_comm_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_breakdown_code` bigint(20) NOT NULL,
  `breakdown_ordinal` int(3) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommbreakdownsindex` (`curr_policy_trn_code`,`curr_policy_trn_group_code`,`curr_policy_trn_comm_code`,`curr_policy_trn_group_breakdown_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlcommbreakdownsperils`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlcommbreakdownsperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `curr_policy_trn_comm_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_breakdown_code` bigint(20) NOT NULL,
  `curr_policy_trn_comm_breakdown_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_breakdown_item_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `curr_policy_trn_item_peril_code` bigint(20) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_rate` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `broker_fee_vat_rate` double NOT NULL,
  `broker_fee_vat_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_rate` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommbreakdownsperilsindex` (`curr_policy_trn_code`,`curr_policy_trn_group_code`,`curr_policy_trn_comm_code`,`curr_policy_trn_group_breakdown_code`,`curr_policy_trn_comm_breakdown_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlcommperils`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlcommperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `curr_policy_trn_comm_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `curr_policy_trn_item_peril_code` bigint(20) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_rate` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `broker_fee_vat_rate` double NOT NULL,
  `broker_fee_vat_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_rate` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `is_override_commission` tinyint(1) NOT NULL,
  `override_comm_change_datetime` datetime NOT NULL,
  `parent_is_override_commission` tinyint(1) NOT NULL,
  `parent_override_comm_change_datetime` datetime NOT NULL,
  `parent_override_comm_change_user_mst_code` bigint(20) NOT NULL,
  `override_comm_change_user_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommperilsindex` (`curr_policy_trn_code`,`curr_policy_trn_group_code`,`curr_policy_trn_comm_code`,`peril_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlgroupings`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlgroupings` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `group_no` int(3) NOT NULL,
  `prem_amount` double NOT NULL,
  `charge_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `pres_charge_amount` double NOT NULL,
  `staggered_count` int(3) NOT NULL COMMENT 'no. of A/Rs',
  `particulars` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `payment_term_mst_code` bigint(20) NOT NULL,
  `term_no_days` int(3) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsindex` (`curr_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='Per group' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlgroupingsbreakdowns`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlgroupingsbreakdowns` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `payment_term_mst_code` bigint(20) NOT NULL,
  `term_no_days` int(3) NOT NULL,
  `due_date` date NOT NULL,
  `breakdown_ordinal` int(3) NOT NULL,
  `maturity_date` date NOT NULL COMMENT 'date of previous breakdown + 1 day',
  `prem_amount` double NOT NULL,
  `charge_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `pres_charge_amount` double NOT NULL,
  `breakdown_percentage` double NOT NULL,
  `particulars` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `invoice_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `invoice_number_type` tinyint(1) NOT NULL,
  `invoice_sequence` bigint(20) NOT NULL,
  `document_type` tinyint(1) NOT NULL COMMENT '1 - A/R ; 2 - A/P',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsbreakdownsindex` (`curr_policy_trn_code`,`curr_policy_trn_group_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlgroupingsbreakdownsitems`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlgroupingsbreakdownsitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_breakdown_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `type` tinyint(1) NOT NULL,
  `type_code` bigint(20) NOT NULL COMMENT 'Peril MST or Charges MST',
  `item_amount` double NOT NULL,
  `item_rate` double NOT NULL,
  `item_type` tinyint(1) NOT NULL COMMENT '0 - Peril ; 1 - Rated ; 2 - Fixed ; 3 - Tabled',
  `tax_charges_mst_code` bigint(20) NOT NULL,
  `pres_item_amount` double NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `breakdown_percentage` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsbreakdownsitemsindex` (`curr_policy_trn_code`,`curr_policy_trn_group_code`,`curr_policy_trn_group_breakdown_code`,`type`,`type_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='breakdown items' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlgroupingsitems`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlgroupingsitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `type` tinyint(1) NOT NULL COMMENT '1 - Peril ; 2 - Charges',
  `type_code` bigint(20) NOT NULL COMMENT 'PerilMST or Charges MST',
  `item_amount` double NOT NULL,
  `item_rate` double NOT NULL,
  `item_type` tinyint(1) NOT NULL COMMENT '0 - Peril ; 1 - Rated ; 2 - Fixed ; 3 - Tabled',
  `tax_charges_mst_code` bigint(20) NOT NULL,
  `pres_item_amount` double NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsitemsindex` (`curr_policy_trn_code`,`curr_policy_trn_group_code`,`type`,`type_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlinspection`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlinspection` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `inspection_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `purpose_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `business_type_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `operation_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `construction_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `occupancy_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `protection_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `exposure_external_fire_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `exposure_earthquake_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `assessment_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `block_exposure_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `overall_assessment_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlinspectionindex` (`curr_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 COMMENT='FOR FIRE INSPECTION REPORT' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitem`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitem` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL COMMENT 'IF FIRE ONLY MAGKAKALAMAN',
  `item_no` int(3) NOT NULL,
  `curr_policy_trn_group_code` bigint(20) NOT NULL,
  `item_name` mediumtext COLLATE latin1_general_cs NOT NULL,
  `item_description` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `group_risk_code` varchar(20) COLLATE latin1_general_cs NOT NULL COMMENT 'FOR BLOCK CARDS / LINE SHEET GROUPING (USER INPUT)',
  `is_each_person` tinyint(1) NOT NULL COMMENT 'For PA',
  `no_of_passengers` int(3) NOT NULL,
  `pa_type` tinyint(1) NOT NULL COMMENT 'For PA ; 1 - Individual ; 2 - Group ; 3 - Travel',
  `table_retention_limits_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `net_tsi_amount` double NOT NULL,
  `net_prem_amount` double NOT NULL,
  `prev_curr_tsi_amount` double NOT NULL,
  `prev_curr_prem_amount` double NOT NULL,
  `pres_net_prem_amount` double NOT NULL,
  `premium_basis` tinyint(1) NOT NULL COMMENT '1 - No of Days / 2 - Short Period Scale',
  `plan_type_mst_code` bigint(20) NOT NULL,
  `is_compre` tinyint(1) NOT NULL,
  `is_ctpl` tinyint(1) NOT NULL,
  `is_special_deductible` tinyint(1) NOT NULL COMMENT 'for deductible',
  `is_for_claims_purposes` tinyint(1) NOT NULL,
  `motorcar_vehicle_size` tinyint(1) NOT NULL,
  `surcharge_amount` double NOT NULL,
  `motorcar_towing_amount` double NOT NULL,
  `motorcar_repair_limit` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `tryindex2` (`curr_policy_trn_code`,`curr_policy_location_dtl_code`,`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitembondsignatories`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitembondsignatories` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `signatory_type` tinyint(1) NOT NULL COMMENT '1 - Principal ; 2 - Co-Signor',
  `cosignor_user_mst_code` bigint(20) NOT NULL,
  `signor_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `tin_no` varchar(50) COLLATE latin1_general_cs NOT NULL,
  `residence_certificate` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `designation` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `issue_date` date NOT NULL,
  `issue_place` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitembondsignatoriesindex` (`curr_policy_trn_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemdeductibles`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemdeductibles` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `deductible_mst_code` bigint(20) NOT NULL,
  `deductible_amount` double NOT NULL,
  `deductible_type` tinyint(1) NOT NULL COMMENT '1 - Rated ; 2 - Fixed Amout',
  `deductible_rate` double NOT NULL,
  `motorcar_towing_amount` double NOT NULL COMMENT 'for motor car only',
  `motorcar_repair_limit` double NOT NULL COMMENT 'for motor car only',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemdeductiblesindex` (`curr_policy_trn_code`,`curr_policy_location_dtl_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemfields`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemfields` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `short_name` varchar(50) COLLATE latin1_general_cs NOT NULL,
  `info_code_name` varchar(150) COLLATE latin1_general_cs NOT NULL,
  `description` varchar(200) COLLATE latin1_general_cs NOT NULL,
  `info_codes_mst_code` bigint(20) NOT NULL COMMENT 'for reference only',
  `data_type` int(2) NOT NULL,
  `max_length` int(4) NOT NULL,
  `data_source` tinyint(1) NOT NULL COMMENT '1 - Static ; 2 - Database',
  `data_source_database_name` varchar(200) COLLATE latin1_general_cs NOT NULL,
  `data_source_table_name` varchar(50) COLLATE latin1_general_cs NOT NULL,
  `data_source_value_pair` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `special_conditions` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `special_conditions2` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `info_codes_dtl_code` bigint(20) NOT NULL,
  `parent_info_codes_mst_code` bigint(20) NOT NULL,
  `is_required` tinyint(1) NOT NULL,
  `is_unique` tinyint(1) NOT NULL,
  `display_order` int(3) NOT NULL,
  `memo_field` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `dtl_special_condition1` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `dtl_special_condition2` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `info_codes_arrangement_dtl_code` bigint(20) NOT NULL,
  `row_order` int(4) NOT NULL COMMENT 'row order per line',
  `row_span` int(4) NOT NULL COMMENT 'via span',
  `col_order` int(4) NOT NULL COMMENT 'col order per row',
  `col_span` int(4) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemfieldsindex` (`curr_policy_trn_code`),
  KEY `dtlitemfields_index001` (`curr_policy_trn_code`,`info_codes_mst_code`) USING BTREE,
  KEY `dltfieldsindex002` (`display_order`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='kasama lahat para future-proof' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemfirecoinsurances`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemfirecoinsurances` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `coinsurance_reinsurer_mst_code` bigint(20) NOT NULL,
  `coinsurance_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemfirecoinsurances` (`curr_policy_trn_code`,`curr_policy_location_dtl_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemmortgagees`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemmortgagees` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `mortgagee_mst_code` bigint(20) NOT NULL,
  `mortgagee_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemmortgageesindex` (`curr_policy_trn_code`,`curr_policy_location_dtl_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemmotorcaraccessories`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemmotorcaraccessories` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `accessories_mst_code` bigint(20) NOT NULL,
  `accessories_amount` double NOT NULL,
  `accessory_amount_type` tinyint(1) NOT NULL COMMENT '1 - NIL 2 - Built-in 3 - Has Amount',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemmotorcaraccessoriesindex` (`curr_policy_trn_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitempabeneficiaries`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitempabeneficiaries` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_group_code` bigint(20) NOT NULL,
  `beneficiary_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `gender` varchar(1) COLLATE latin1_general_cs NOT NULL COMMENT 'M/F',
  `civil_status` tinyint(1) NOT NULL,
  `birthday` date NOT NULL,
  `age` int(3) NOT NULL,
  `relationship` varchar(200) COLLATE latin1_general_cs NOT NULL,
  `position_mst_code` bigint(20) NOT NULL,
  `position` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitempabeneficiaries` (`curr_policy_trn_code`,`curr_policy_item_dtl_code`),
  KEY `dtlpaitembeneficiaries2index` (`curr_policy_trn_code`,`curr_policy_item_group_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitempagroupmembers`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitempagroupmembers` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `group_member_no` int(3) NOT NULL,
  `group_member_name` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `gender` varchar(1) COLLATE latin1_general_cs NOT NULL COMMENT 'M/F',
  `civil_status` tinyint(1) NOT NULL COMMENT '1 - Single ; 2 - Married ; 3 - Widow/Widower ; 4 - Legally Separated ; 5 - Divorced',
  `birthday` date NOT NULL,
  `age` int(3) NOT NULL,
  `position_mst_code` bigint(20) NOT NULL,
  `amount_covered` double NOT NULL,
  `position` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitempagroupmembersindex` (`curr_policy_trn_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemperils`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `peril_no` int(3) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `peril_type` varchar(1) COLLATE latin1_general_cs NOT NULL COMMENT 'B - Basic ; A - Allied',
  `base_rate` double NOT NULL,
  `fire_tariffs_mst_code` bigint(20) NOT NULL COMMENT 'for Fire',
  `is_prescribed_rate_applied` tinyint(1) NOT NULL,
  `prescribed_rate` double NOT NULL,
  `plan_type_mst_code` bigint(20) NOT NULL,
  `foreign_amount` double NOT NULL COMMENT 'for marine cargo',
  `markup_rate` double NOT NULL COMMENT 'for marine cargo',
  `total_foreign_amount` double NOT NULL COMMENT 'for marine cargo',
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `net_tsi_amount` double NOT NULL,
  `net_prem_amount` double NOT NULL,
  `prev_curr_tsi_amount` double NOT NULL,
  `prev_curr_prem_amount` double NOT NULL,
  `pres_net_prem_amount` double NOT NULL,
  `is_surcharge_applicable` tinyint(1) NOT NULL,
  `surcharge_rate` double NOT NULL,
  `surcharge_amount` double NOT NULL,
  `additional_amount` double NOT NULL,
  `ctpl_premium_type_mst_code` bigint(20) NOT NULL,
  `is_each_person` tinyint(1) NOT NULL COMMENT 'FOR PA',
  `no_of_passengers` int(3) NOT NULL COMMENT 'FOR PA',
  `tsi_per_passenger` double NOT NULL COMMENT 'FOR PA',
  `prem_per_passenger` double NOT NULL,
  `net_prem_per_passenger` double NOT NULL COMMENT 'FOR PA',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemperilsindex` (`curr_policy_trn_code`,`curr_policy_location_dtl_code`,`curr_policy_item_dtl_code`),
  KEY `StatIndex` (`curr_policy_trn_code`,`curr_policy_location_dtl_code`,`curr_policy_item_dtl_code`,`peril_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemtax`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemtax` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_location_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `taxes_mst_code` bigint(20) NOT NULL,
  `tax_charges_mst_code` bigint(20) NOT NULL,
  `tax_amount` double NOT NULL,
  `tax_rate` double NOT NULL,
  `tax_type` tinyint(1) NOT NULL COMMENT '1 - Rated ; 2 - Fixed ; 3 - Tabled',
  `pres_tax_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemtaxindex` (`curr_policy_trn_code`,`curr_policy_location_dtl_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='Charges per ITEM ' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlitemvalues`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlitemvalues` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_fields_dtl_code` bigint(20) NOT NULL,
  `actual_value` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlitemvaluesindex` (`curr_policy_trn_code`,`curr_policy_item_dtl_code`,`curr_policy_item_fields_dtl_code`),
  KEY `curr_policy_item_fields_dtl_code` (`curr_policy_item_fields_dtl_code`,`curr_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='actual value of policy item per field' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtllocationofrisk`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtllocationofrisk` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `location_no` int(3) NOT NULL,
  `country_mst_code` bigint(20) NOT NULL,
  `region_mst_code` bigint(20) NOT NULL,
  `province_mst_code` bigint(20) NOT NULL,
  `city_mst_code` bigint(20) NOT NULL,
  `barangay_mst_code` bigint(20) NOT NULL,
  `district_mst_code` bigint(20) NOT NULL,
  `street_address` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `complete_address` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `district_no` varchar(50) COLLATE latin1_general_cs NOT NULL,
  `block_number` varchar(50) COLLATE latin1_general_cs NOT NULL,
  `block_mst_code` bigint(20) NOT NULL,
  `industry_mst_code` bigint(20) NOT NULL,
  `latitude` double NOT NULL,
  `longitude` double NOT NULL,
  `distance_from_fault_line` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `tryindex2` (`curr_policy_trn_code`) USING BTREE,
  KEY `blockcard05` (`country_mst_code`,`region_mst_code`,`province_mst_code`,`city_mst_code`,`block_number`,`block_mst_code`),
  KEY `blockcard04` (`country_mst_code`,`region_mst_code`,`province_mst_code`,`block_number`),
  KEY `blockcardindex01` (`country_mst_code`,`region_mst_code`,`province_mst_code`,`city_mst_code`,`barangay_mst_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='Location of Risk - For FIRE line only' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlperiltax`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlperiltax` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `taxes_mst_code` bigint(20) NOT NULL,
  `tax_charges_mst_code` bigint(20) NOT NULL,
  `tax_amount` double NOT NULL,
  `tax_rate` double NOT NULL,
  `tax_type` tinyint(1) NOT NULL COMMENT '1 - Rated; 2 - Fixed ; 3 - Tabled',
  `pres_tax_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlperiltaxindex` (`curr_policy_trn_code`,`line_mst_code`,`peril_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='taxes per PERIL' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlremarks`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlremarks` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `sender_user_mst_code` bigint(20) NOT NULL,
  `message_text` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `send_datetime` datetime NOT NULL,
  `notification_trn_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlremarksindex` (`curr_policy_trn_code`,`sender_user_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncurrpolicydtlwarranties`
--

CREATE TABLE IF NOT EXISTS `trncurrpolicydtlwarranties` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `warrant_clause_mst_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `warrant_title` varchar(150) COLLATE latin1_general_cs NOT NULL,
  `warrant_text` mediumtext COLLATE latin1_general_cs NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlwarrantiesindex` (`curr_policy_trn_code`,`warrant_clause_mst_code`),
  KEY `warrantiesindex1` (`warrant_title`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trncustomercall`
--

CREATE TABLE IF NOT EXISTS `trncustomercall` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `caller_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `caller_number` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `department_mst_code` bigint(20) NOT NULL,
  `customer_call_category_mst_code` bigint(20) NOT NULL,
  `caller_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndeliveryreceipt`
--

CREATE TABLE IF NOT EXISTS `trndeliveryreceipt` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `delivery_receipt_no` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `delivery_receipt_sequence` bigint(20) NOT NULL,
  `delivery_date` date NOT NULL,
  `delivery_time_from` varchar(25) COLLATE latin1_general_ci NOT NULL,
  `delivery_time_to` varchar(25) COLLATE latin1_general_ci NOT NULL,
  `delivery_date_time_remarks` varchar(2000) COLLATE latin1_general_ci NOT NULL,
  `messenger_schedule_date` date NOT NULL COMMENT 'date for when the actual delivery date is scheduled for the messenger day\r\n-set by CSD upon submission',
  `is_rush` tinyint(1) NOT NULL,
  `delivery_status` tinyint(1) NOT NULL COMMENT '0 - Pending , \r\n10 - Request Cancelled , \r\n20 - Request Submitted , \r\n30 - Delivery Returned , \r\n40 - Delivery Cancelled , \r\n50 - On-Delivery , \r\n60 - Delivered',
  `recipient_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `recipient_address` varchar(2000) COLLATE latin1_general_ci NOT NULL,
  `recipient_contact_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `qr_code_filepath` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `delivery_mode` tinyint(1) NOT NULL COMMENT '0 - Email / 1 - Messengerial',
  `delivery_type` tinyint(1) NOT NULL COMMENT '0 - Delivery / 1 - Pick-Up',
  `pickup_type` tinyint(1) NOT NULL COMMENT '0 - Delivery / 1 - Pick-Up',
  `delivery_courier_type_mst_code` bigint(20) NOT NULL,
  `delivery_courier_mst_code` bigint(20) NOT NULL,
  `delivery_employee_user_mst_code` bigint(20) NOT NULL COMMENT 'will only have value if delivery mode = 2 (abic employee). if 0 value = requestor',
  `returned_at` datetime NOT NULL,
  `returned_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `returned_user_mst_code` bigint(20) NOT NULL,
  `cancelled_at` datetime NOT NULL,
  `cancelled_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `cancelled_user_mst_code` bigint(20) NOT NULL,
  `on_delivery_at` datetime NOT NULL,
  `on_delivery_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `on_delivery_user_mst_code` bigint(20) NOT NULL,
  `received_by_datetime` datetime NOT NULL,
  `received_by` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `received_by_date` date NOT NULL,
  `received_by_user_mst_code` bigint(20) NOT NULL,
  `received_by_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `request_returned_at` datetime NOT NULL,
  `request_returned_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `request_returned_user_mst_code` bigint(20) NOT NULL,
  `request_cancelled_at` datetime NOT NULL,
  `request_cancelled_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `request_cancelled_user_mst_code` bigint(20) NOT NULL,
  `request_submitted_at` datetime NOT NULL,
  `request_submitted_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `request_submitted_user_mst_code` bigint(20) NOT NULL,
  `courier_tracking_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `other_remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `particulars` mediumtext COLLATE latin1_general_ci NOT NULL,
  `notify_list_cc_email_address` mediumtext COLLATE latin1_general_ci NOT NULL COMMENT 'COMMA-SEPARATED',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `delivery_status` (`delivery_status`),
  KEY `delivery_courier_type_mst_code` (`delivery_courier_type_mst_code`),
  KEY `delivery_courier_mst_code` (`delivery_courier_mst_code`),
  KEY `delivery_mode` (`delivery_mode`),
  KEY `delivery_type` (`delivery_type`),
  KEY `is_rush` (`is_rush`),
  KEY `delivery_employee_user_mst_code` (`delivery_employee_user_mst_code`),
  KEY `created_user_mst_code` (`created_user_mst_code`),
  KEY `updated_user_mst_code` (`updated_user_mst_code`),
  KEY `delivery_date` (`delivery_date`),
  KEY `messenger_schedule_date` (`messenger_schedule_date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndeliveryreceiptdtldeliverydetails`
--

CREATE TABLE IF NOT EXISTS `trndeliveryreceiptdtldeliverydetails` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `delivery_receipt_trn_code` bigint(20) NOT NULL,
  `delivery_detail_source` tinyint(1) NOT NULL COMMENT '0 - Policy Table ; 1 - User Input',
  `delivery_detail_description` mediumtext COLLATE latin1_general_ci NOT NULL,
  `policy_delivery_details_trn_code` bigint(20) NOT NULL,
  `delivery_status` tinyint(1) NOT NULL COMMENT 'copy header except if return',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dr` (`delivery_receipt_trn_code`,`delivery_detail_source`),
  KEY `dr2` (`policy_delivery_details_trn_code`),
  KEY `dr3` (`delivery_receipt_trn_code`,`policy_delivery_details_trn_code`),
  KEY `dr4` (`delivery_receipt_trn_code`,`delivery_detail_source`,`policy_delivery_details_trn_code`,`delivery_status`),
  KEY `delivery_receipt_trn_code` (`delivery_receipt_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndeliveryreceiptdtlfileattachments`
--

CREATE TABLE IF NOT EXISTS `trndeliveryreceiptdtlfileattachments` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `delivery_receipt_trn_code` bigint(20) NOT NULL,
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `encrypted_uploaded_file_name` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `filetype` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `uploaded_user_mst_code` bigint(20) NOT NULL,
  `attachment_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `description` mediumtext COLLATE latin1_general_ci NOT NULL,
  `remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`) USING BTREE,
  KEY `code_2` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='FOR UPLOADING OF DELIVERY RECEIPTS ATTACHMENTS' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistribution`
--

CREATE TABLE IF NOT EXISTS `trndistribution` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `line_mst_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `is_itemized` tinyint(1) NOT NULL,
  `distribution_counter` int(3) NOT NULL,
  `policy_source` tinyint(1) NOT NULL COMMENT '1 - DB ; 2 - RII',
  `gross_retention_tsi_amount` double NOT NULL,
  `gross_retention_prem_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`line_mst_code`,`orig_policy_trn_code`),
  KEY `index2` (`orig_policy_trn_code`),
  KEY `index3` (`curr_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributiondtlgross`
--

CREATE TABLE IF NOT EXISTS `trndistributiondtlgross` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `gross_tsi_amount` double NOT NULL,
  `gross_prem_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `treaty_working_paper_trn_code` bigint(20) NOT NULL COMMENT 'KAYA NANDITO KASI PARA PER DIST SHARE PWEDE MAG INCLUDE/EXCLUDE',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_trn_code`),
  KEY `tryindex` (`distribution_trn_code`,`distribution_share_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributiondtlitems`
--

CREATE TABLE IF NOT EXISTS `trndistributiondtlitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_trn_code` bigint(20) NOT NULL,
  `distribution_gross_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `int_policy_location_dtl_code` bigint(20) NOT NULL,
  `int_policy_item_dtl_code` bigint(20) NOT NULL,
  `orig_policy_location_dtl_code` bigint(20) NOT NULL,
  `orig_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_code` bigint(20) NOT NULL,
  `item_gross_tsi_amount` double NOT NULL,
  `item_gross_prem_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `is_itemized` tinyint(1) NOT NULL,
  `gross_retention_tsi_amount` double NOT NULL,
  `gross_retention_prem_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_trn_code`,`distribution_gross_trn_code`),
  KEY `StatIndex` (`distribution_trn_code`,`orig_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributiondtlitemsperils`
--

CREATE TABLE IF NOT EXISTS `trndistributiondtlitemsperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_trn_code` bigint(20) NOT NULL,
  `distribution_gross_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `distribution_item_trn_code` bigint(20) NOT NULL,
  `int_policy_location_dtl_code` bigint(20) NOT NULL,
  `int_policy_item_dtl_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `distribution_percentage` double NOT NULL,
  `peril_gross_tsi_amount` double NOT NULL,
  `peril_gross_prem_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_trn_code`,`distribution_gross_trn_code`,`distribution_item_trn_code`),
  KEY `StatIndex` (`distribution_trn_code`,`distribution_item_trn_code`,`peril_mst_code`),
  KEY `distribution_perilindex` (`distribution_item_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributiondtlperils`
--

CREATE TABLE IF NOT EXISTS `trndistributiondtlperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_trn_code` bigint(20) NOT NULL,
  `distribution_gross_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `distribution_percentage` double NOT NULL,
  `peril_gross_tsi_amount` double NOT NULL,
  `peril_gross_prem_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_trn_code`,`distribution_gross_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='per PERIL breakdown of distribution' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributionri`
--

CREATE TABLE IF NOT EXISTS `trndistributionri` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `line_mst_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `reinsurer_mst_code` bigint(20) NOT NULL,
  `treaty_structures_mst_code` bigint(20) NOT NULL,
  `policy_source` tinyint(1) NOT NULL COMMENT '1 - DB ; 2 - RII',
  `distribution_counter` int(3) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `distribution_comm_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`line_mst_code`,`orig_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributionridtlitems`
--

CREATE TABLE IF NOT EXISTS `trndistributionridtlitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_ri_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `int_policy_location_dtl_code` bigint(20) NOT NULL,
  `int_policy_item_dtl_code` bigint(20) NOT NULL,
  `orig_policy_location_dtl_code` bigint(20) NOT NULL,
  `orig_policy_item_dtl_code` bigint(20) NOT NULL,
  `curr_policy_item_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `distribution_comm_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `broker_reinsurer_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_ri_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='per ITEM per share of REINSURER' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributionridtlitemsperils`
--

CREATE TABLE IF NOT EXISTS `trndistributionridtlitemsperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_ri_trn_code` bigint(20) NOT NULL,
  `distribution_ri_item_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `distribution_comm_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `ri_commission_rate` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_ri_trn_code`,`distribution_ri_item_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributionridtlperils`
--

CREATE TABLE IF NOT EXISTS `trndistributionridtlperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_ri_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `distribution_comm_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `ri_commission_rate` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_ri_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='per PERIL breakdown per RI' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trndistributionridtlshare`
--

CREATE TABLE IF NOT EXISTS `trndistributionridtlshare` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `distribution_ri_trn_code` bigint(20) NOT NULL,
  `distribution_share_mst_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `distribution_tsi_amount` double NOT NULL,
  `distribution_prem_amount` double NOT NULL,
  `distribution_comm_amount` double NOT NULL,
  `curr_distribution_tsi_amount` double NOT NULL,
  `curr_distribution_prem_amount` double NOT NULL,
  `gross_facul_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`distribution_ri_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='per SHARE CODE of REINSURER' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnemailqueue`
--

CREATE TABLE IF NOT EXISTS `trnemailqueue` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `from_email` varchar(100) NOT NULL,
  `from_name` varchar(100) NOT NULL,
  `to_email` text NOT NULL,
  `subject` varchar(300) NOT NULL,
  `cc_emails` text NOT NULL,
  `bcc_emails` text NOT NULL,
  `message` mediumtext NOT NULL,
  `datetime_queued` datetime NOT NULL,
  `is_sent` tinyint(1) NOT NULL DEFAULT '0',
  `datetime_sent` datetime NOT NULL,
  `remarks` varchar(200) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `is_sent` (`is_sent`),
  FULLTEXT KEY `to_email` (`to_email`),
  FULLTEXT KEY `cc_emails` (`cc_emails`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnemailqueuedtlattachment`
--

CREATE TABLE IF NOT EXISTS `trnemailqueuedtlattachment` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `email_queue_trn_code` bigint(20) NOT NULL,
  `filename` varchar(100) NOT NULL,
  `file` text NOT NULL,
  `file_ext` varchar(5) NOT NULL,
  `remarks` varchar(200) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `email_queue_trn_code` (`email_queue_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnerrorsrevisions`
--

CREATE TABLE IF NOT EXISTS `trnerrorsrevisions` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `reference_no` varchar(50) COLLATE latin1_general_ci NOT NULL,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `department_mst_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `subline_mst_code` bigint(20) NOT NULL,
  `policy_source` tinyint(1) NOT NULL COMMENT '1 - DB ; 2 - RII ; 3 - RIO',
  `policy_type` tinyint(1) NOT NULL COMMENT '10 - Quotation ; 20 - Cover Notes ; 30 - Policy/Binder ; 40 - Endorsement/Alteration ; 50 - Renewal',
  `title` varchar(250) COLLATE latin1_general_ci NOT NULL,
  `description` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `date_created` datetime NOT NULL,
  `status` tinyint(1) NOT NULL COMMENT '1 - New ; 2 - On Going ; 3 - Hold ; 4 - For Checking ; 5 - Done',
  `reported_by` bigint(20) NOT NULL COMMENT 'user_mst_code',
  `started_by_user_mst_code` bigint(20) NOT NULL,
  `started_at` datetime NOT NULL,
  `held_by_user_mst_code` bigint(20) NOT NULL,
  `held_at` datetime NOT NULL,
  `for_checking_by_user_mst_code` bigint(20) NOT NULL,
  `for_checking_at` datetime NOT NULL,
  `checked_by_user_mst_code` bigint(20) NOT NULL,
  `checked_at` datetime NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `errorrevisionindex` (`policy_source`,`policy_type`,`company_mst_code`,`branch_mst_code`,`department_mst_code`,`line_mst_code`,`subline_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnexcessofloss`
--

CREATE TABLE IF NOT EXISTS `trnexcessofloss` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `treaty_year` int(4) NOT NULL,
  `claims_events_mst_code` bigint(20) NOT NULL,
  `description` varchar(2000) COLLATE latin1_general_ci NOT NULL,
  `xol_reference_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `excess_of_loss_status` tinyint(1) NOT NULL,
  `is_posted` tinyint(1) NOT NULL,
  `posted_user_mst_code` bigint(20) NOT NULL,
  `posted_datetime` datetime NOT NULL,
  `total_claim_count` int(4) NOT NULL,
  `losses_paid_amount` double NOT NULL,
  `total_retention_amount` double NOT NULL,
  `xol_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnfacultativeplacements`
--

CREATE TABLE IF NOT EXISTS `trnfacultativeplacements` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `facul_type` int(3) NOT NULL COMMENT '1 - Gross ; 2 - Per Item',
  `placement_slip_seq_no` bigint(20) NOT NULL,
  `placement_slip_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `policy_source` tinyint(1) NOT NULL COMMENT 'same as trnintpolicy counterparts',
  `policy_type` tinyint(1) NOT NULL COMMENT 'same as trnintpolicy counterparts',
  `line_mst_code` bigint(20) NOT NULL,
  `subline_mst_code` bigint(20) NOT NULL,
  `assured_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `company_mst_code` bigint(20) NOT NULL,
  `interim_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `policy_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `ceded_tsi_amount` double NOT NULL COMMENT 'TOTAL CEDED TSI AMOUNT',
  `accepted_tsi_amount` double NOT NULL COMMENT 'TOTAL ACCEPTED AMOUNT',
  `ceded_prem_amount` double NOT NULL,
  `accepted_prem_amount` double NOT NULL,
  `facul_status` int(3) NOT NULL COMMENT '0 - New ; 1 - Unposted ; 2 - Posted ; 3 - Generated',
  `routed_at` datetime NOT NULL,
  `routed_user_mst_code` bigint(20) NOT NULL,
  `posted_at` datetime NOT NULL,
  `posted_user_mst_code` bigint(20) NOT NULL,
  `unposted_at` datetime NOT NULL,
  `unposted_user_mst_code` bigint(20) NOT NULL,
  `generated_at` datetime NOT NULL,
  `generated_user_mst_code` bigint(20) NOT NULL,
  `spoiling_datetime` datetime NOT NULL,
  `spoiling_user_mst_code` bigint(20) NOT NULL,
  `spoil_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `selected_int_policy_item_dtl_codes` varchar(1000) COLLATE latin1_general_ci NOT NULL COMMENT 'ALL IF GROSS',
  `selected_orig_policy_item_dtl_codes` varchar(1000) COLLATE latin1_general_ci NOT NULL COMMENT 'ALL IF GROSS',
  `selected_items_ceded_amounts` varchar(5000) COLLATE latin1_general_ci NOT NULL COMMENT 'totals per items',
  `selected_items_distribution_percentage` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `selected_items_ceded_prem_amounts` mediumtext COLLATE latin1_general_ci NOT NULL,
  `frps_state_percentage` double NOT NULL,
  `generated_int_policy_trn_code` bigint(20) NOT NULL,
  `generated_orig_policy_trn_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `orig_policy_trn_code` (`orig_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnfacultativeplacementsdtlpanels`
--

CREATE TABLE IF NOT EXISTS `trnfacultativeplacementsdtlpanels` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `facultative_placements_trn_code` bigint(20) NOT NULL,
  `int_policy_item_dtl_code` bigint(20) NOT NULL COMMENT '0 value if gross',
  `orig_policy_item_dtl_code` bigint(20) NOT NULL COMMENT '0 value if gross',
  `item_no` int(3) NOT NULL COMMENT '0 value if gross',
  `reinsurer_mst_code` bigint(20) NOT NULL,
  `reinsurer_type_mst_code` bigint(20) NOT NULL,
  `ceded_tsi_amount` double NOT NULL,
  `ceded_prem_amount` double NOT NULL,
  `share_tsi_amount` double NOT NULL,
  `share_prem_amount` double NOT NULL,
  `share_percent` double NOT NULL,
  `acceptance_number` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `acceptance_date` date NOT NULL,
  `accepted_by` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `offer_date` date NOT NULL,
  `generated_int_policy_trn_code` bigint(20) NOT NULL,
  `generated_orig_policy_trn_code` bigint(20) NOT NULL,
  `distribution_percentage` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`facultative_placements_trn_code`,`orig_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='PER PANEL BREAKDOWN (AND ITEM IF PER ITEM)' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnfacultativeplacementsdtlpanelsitems`
--

CREATE TABLE IF NOT EXISTS `trnfacultativeplacementsdtlpanelsitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `facultative_placements_trn_code` bigint(20) NOT NULL,
  `facultative_placements_panels_trn_code` bigint(20) NOT NULL,
  `int_policy_item_dtl_code` bigint(20) NOT NULL COMMENT 'MAY LAMAN NA TALAGA',
  `orig_policy_item_dtl_code` bigint(20) NOT NULL COMMENT 'MAY LAMAN NA TALAGA',
  `item_no` int(3) NOT NULL COMMENT 'MAY LAMAN NA TALAGA',
  `ceded_tsi_amount` double NOT NULL,
  `ceded_prem_amount` double NOT NULL,
  `share_tsi_amount` double NOT NULL,
  `share_prem_amount` double NOT NULL,
  `distribution_percentage` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `compoundindex` (`facultative_placements_trn_code`,`facultative_placements_panels_trn_code`,`orig_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='BREAKDOWN PER ITEM (IF GROSS); IDENTICAL RECORD TO PANEL TABLE IF PER ITEM' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneralledger`
--

CREATE TABLE IF NOT EXISTS `trngeneralledger` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `branch_mst_code` bigint(20) NOT NULL,
  `booking_year` int(4) NOT NULL,
  `booking_period` int(2) NOT NULL,
  `general_ledger_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `general_ledger_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `debit_amount` double NOT NULL,
  `credit_amount` double NOT NULL,
  `date_from` date NOT NULL COMMENT 'lowest date of included book',
  `date_to` date NOT NULL COMMENT 'highest date of included book',
  `production_register_total_amount` double NOT NULL,
  `jv_debit_amount` double NOT NULL,
  `jv_credit_amount` double NOT NULL,
  `cdb_debit_amount` double NOT NULL,
  `cdb_credit_amount` double NOT NULL,
  `crr_debit_amount` double NOT NULL,
  `crr_credit_amount` double NOT NULL,
  `gl_status` tinyint(1) NOT NULL COMMENT '0 - Posted Transaction only ; 1 - Closed month',
  `posted_transaction_user_mst_code` bigint(20) NOT NULL,
  `posted_transaction_datetime` datetime NOT NULL,
  `close_month_user_mst_code` bigint(20) NOT NULL,
  `close_month_datetime` datetime NOT NULL,
  `generated_24th_method_trn_code` bigint(20) NOT NULL COMMENT 'JOURNAL VOUCHER CODE',
  `generated_24th_method_trn_datetime` datetime NOT NULL,
  `generated_24th_method_trn_user_mst_code` bigint(20) NOT NULL,
  `generated_outstanding_losses_trn_code` bigint(20) NOT NULL COMMENT 'JOURNAL VOUCHER CODE',
  `generated_outstanding_losses_trn_datetime` datetime NOT NULL,
  `generated_outstanding_losses_trn_user_mst_code` bigint(20) NOT NULL,
  `generated_reversing_outstanding_losses_trn_code` bigint(20) NOT NULL COMMENT 'JOURNAL VOUCHER CODE',
  `generated_reversing_outstanding_losses_trn_datetime` datetime NOT NULL,
  `generated_reversing_outstanding_losses_trn_user_mst_code` bigint(20) NOT NULL,
  `generated_bank_recon_trn_code` bigint(20) NOT NULL COMMENT 'JOURNAL VOUCHER CODE',
  `generated_bank_recon_trn_datetime` datetime NOT NULL,
  `generated_bank_recon_trn_user_mst_code` bigint(20) NOT NULL,
  `is_outstanding_processed` tinyint(1) NOT NULL COMMENT 'NEED NG STATUS KASI PWEDENG WALANG LAMAN YUNG CODE (MEANS PROCESSED BUT NO J/V)',
  `is_24th_method_processed` tinyint(1) NOT NULL COMMENT 'NEED NG STATUS KASI PWEDENG WALANG LAMAN YUNG CODE (MEANS PROCESSED BUT NO J/V)',
  `is_bank_recon_processed` tinyint(1) NOT NULL COMMENT 'NEED NG STATUS KASI PWEDENG WALANG LAMAN YUNG CODE (MEANS PROCESSED BUT NO J/V)',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `glindex` (`branch_mst_code`,`booking_year`,`booking_period`,`gl_status`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='BREAKDOWN OF G/L ENTRY PER MONTH' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneralledgerdtl`
--

CREATE TABLE IF NOT EXISTS `trngeneralledgerdtl` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `general_ledger_trn_code` bigint(20) NOT NULL,
  `book_type` tinyint(1) NOT NULL COMMENT '1 - J/V ; 2 - CDB ; 3 - CRR',
  `normal_balance` tinyint(1) NOT NULL COMMENT '1 -DEBIT ; 2 - CREDIT',
  `debit_amount` double NOT NULL,
  `credit_amount` double NOT NULL,
  `reference_book_trn_code` bigint(20) NOT NULL COMMENT 'INTERNAL CODE OF THE TRANSACTION TABLE OF THE BOOK',
  `item_chart_of_accounts_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `general_ledger_trn_code` (`general_ledger_trn_code`,`book_type`,`item_chart_of_accounts_mst_code`,`normal_balance`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='BREAKDOWN OF G/L BY DEBIT&CREDIT AMOUNTS PER TRANSACTION' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneralledgerdtlaccountbal`
--

CREATE TABLE IF NOT EXISTS `trngeneralledgerdtlaccountbal` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `general_ledger_trn_code` bigint(20) NOT NULL,
  `book_type` tinyint(1) NOT NULL COMMENT '1 - J/V ; 2 - CDB ; 3 - CRR',
  `item_chart_of_accounts_mst_code` bigint(20) NOT NULL,
  `debit_amount` double NOT NULL COMMENT 'Period balance in trial balance',
  `credit_amount` double NOT NULL COMMENT 'Period balance in trial balance',
  `beginning_debit_amount` double NOT NULL COMMENT 'From Previous Month current_debit_amount or 0.00 if new',
  `beginning_credit_amount` double NOT NULL COMMENT 'From Previous Month current_credit_amount or 0.00 if new',
  `current_debit_amount` double NOT NULL COMMENT 'Beginning Balance + Period Balance',
  `current_credit_amount` double NOT NULL COMMENT 'Beginning Balance + Period Balance',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `glacctbalindex` (`general_ledger_trn_code`,`book_type`,`item_chart_of_accounts_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='BREAKDOWN OF G/L BY CHART OF ACCOUNT PER BOOK PER MONTH' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneraluploading`
--

CREATE TABLE IF NOT EXISTS `trngeneraluploading` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `uploaded_file_type_mst_code` tinyint(4) NOT NULL,
  `transaction_type_int_trn_code` bigint(20) NOT NULL COMMENT 'internal code of interim',
  `transaction_type_trn_code` bigint(20) NOT NULL COMMENT 'internal code of the final uploaded record',
  `transaction_type_item_trn_code` bigint(20) NOT NULL COMMENT 'reference item code for ABIC888 GPA',
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_0` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_1` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_2` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_3` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_4` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_5` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_6` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_7` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_8` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_9` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_10` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_11` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_12` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_13` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_14` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_15` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_16` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_17` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_18` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_19` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_20` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_21` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_22` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_23` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_24` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_25` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_26` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_27` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_28` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_29` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_30` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_31` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_32` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_33` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_34` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_35` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_36` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_37` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_38` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_39` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_40` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_41` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_42` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_43` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_44` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_45` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_46` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_47` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_48` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_49` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_50` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_51` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_52` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_53` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_54` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_55` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_56` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_57` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_58` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_59` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_60` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_61` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_62` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_63` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_64` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_65` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_66` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_67` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_68` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_69` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_70` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_71` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_72` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_73` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_74` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_75` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_76` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-abic portal user id',
  `field_77` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-inception',
  `field_78` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-assured surname',
  `field_79` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-assured firstname',
  `field_80` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-assured middlename',
  `field_81` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-referror emp id',
  `field_82` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-area code',
  `field_83` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-area name',
  `field_84` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-region code',
  `field_85` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-region name',
  `field_86` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-bbg code',
  `field_87` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'abic888-bbg name',
  `bills_unpaid_trn_code` bigint(20) NOT NULL COMMENT 'internal code of selected unpaid bills, for back tagging',
  `is_uploaded` tinyint(4) NOT NULL COMMENT '0-not uploaded|1-uploaded',
  `temp_code` bigint(20) NOT NULL COMMENT 'act as primary code for batch insert',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `trngeneraluploading_index001` (`temp_code`),
  KEY `trngeneraluploading` (`field_0`),
  KEY `trngeneraluploading_index002` (`transaction_type_trn_code`),
  KEY `trngeneraluploading_index003` (`uploaded_file_type_mst_code`,`is_uploaded`),
  KEY `trngeneraluploading_index004` (`transaction_type_int_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneraluploadingamendmenttrail`
--

CREATE TABLE IF NOT EXISTS `trngeneraluploadingamendmenttrail` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `reference_type` tinyint(4) NOT NULL COMMENT '0-abic888|1-codexl|2-bills',
  `general_uploading_trn_code` bigint(20) NOT NULL COMMENT 'primary code of record from generaluploading table',
  `transaction_type_trn_code` bigint(20) NOT NULL,
  `trail_source` tinyint(4) NOT NULL COMMENT '0-amendment|1-posting|',
  `reference_field` varchar(100) COLLATE latin1_general_ci NOT NULL COMMENT 'field name of modified record',
  `from_value` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `to_value` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `particulars` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(4) NOT NULL,
  `updated_user_mst_code` bigint(4) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `audit_index_1` (`reference_type`,`general_uploading_trn_code`),
  KEY `audit_index_2` (`transaction_type_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneraluploadingbillsunpaid`
--

CREATE TABLE IF NOT EXISTS `trngeneraluploadingbillsunpaid` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `uploaded_file_type_mst_code` tinyint(4) NOT NULL,
  `general_codexl_unpaid_trn_code` bigint(20) NOT NULL,
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_0` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_1` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_2` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_3` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_4` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_5` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_6` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_7` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_8` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_9` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_10` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `is_uploaded` tinyint(4) NOT NULL COMMENT '0-not uploaded|1-uploaded',
  `is_tagged` tinyint(4) NOT NULL COMMENT '0-no|1-tagged for extraction',
  `temp_code` bigint(20) NOT NULL COMMENT 'act as primary code for batch insert',
  `is_paired` tinyint(4) NOT NULL COMMENT '0-no|1-paired with codexl unpaid',
  `is_duplicate` tinyint(4) NOT NULL COMMENT '1:duplicate in bills payment',
  `percentage_match` double NOT NULL COMMENT 'matching accuracy vs bills unpaid',
  `previous_bill_account_no` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `for_report` tinyint(4) NOT NULL COMMENT '0-abic888 processing|1-for report extraction',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` date NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `trngeneraluploadingbillsunpaid_index001` (`created_user_mst_code`,`field_6`,`field_9`,`is_uploaded`,`is_duplicate`),
  KEY `trngeneraluploadingbillsunpaid_index002` (`for_report`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneraluploadingcodexlunpaid`
--

CREATE TABLE IF NOT EXISTS `trngeneraluploadingcodexlunpaid` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `uploaded_file_type_mst_code` tinyint(4) NOT NULL,
  `transaction_type_trn_code` bigint(20) NOT NULL COMMENT 'internal code of the final uploaded record',
  `transaction_type_item_trn_code` bigint(20) NOT NULL COMMENT 'reference item code for ABIC888 GPA',
  `bills_unpaid_trn_code` bigint(20) NOT NULL,
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_0` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_1` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_2` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_3` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_4` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_5` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_6` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_7` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_8` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_9` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_10` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_11` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_12` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_13` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_14` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_15` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_16` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_17` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_18` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_19` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_20` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_21` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_22` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_23` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_24` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_25` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_26` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_27` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_28` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_29` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_30` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_31` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_32` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_33` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_34` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_35` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_36` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_37` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_38` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_39` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_40` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_41` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_42` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_43` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_44` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_45` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_46` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_47` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_48` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_49` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_50` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_51` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_52` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_53` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_54` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_55` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_56` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_57` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_58` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_59` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_60` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_61` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_62` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_63` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_64` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_65` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_66` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_67` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_68` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_69` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_70` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_71` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_72` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_73` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_74` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_75` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `field_76` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `is_uploaded` tinyint(4) NOT NULL COMMENT '0-not uploaded|1-uploaded',
  `is_tagged` tinyint(4) NOT NULL COMMENT '0-no|1-tagged for extraction',
  `temp_code` bigint(20) NOT NULL COMMENT 'act as primary code for batch insert',
  `is_paired` tinyint(4) NOT NULL COMMENT '0-no|1-paired with bills unpaid',
  `percentage_match` double NOT NULL COMMENT 'matching accuracy vs bills unpaid',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `trngeneraluploadingcodexlunpaid_index001` (`is_uploaded`,`is_paired`),
  KEY `trngeneraluploadingcodexlunpaid_index002` (`is_uploaded`,`is_tagged`,`is_paired`),
  KEY `trngeneraluploadingcodexlunpaid_index003` (`bills_unpaid_trn_code`),
  KEY `trngeneraluploadingcodexlunpaid_index004` (`field_0`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trngeneraluploadingpercentagematch`
--

CREATE TABLE IF NOT EXISTS `trngeneraluploadingpercentagematch` (
  `code` bigint(20) NOT NULL,
  `percent` float NOT NULL,
  `transaction_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `branch_code` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `branch_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `referror` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `client_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `amount` float NOT NULL,
  KEY `trnpercent_index001` (`percent`),
  KEY `trnpercent_index002` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `trnglbudget`
--

CREATE TABLE IF NOT EXISTS `trnglbudget` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `booking_year` int(4) NOT NULL,
  `chart_of_accounts_mst_code` bigint(20) NOT NULL,
  `subsidiary_ledger_mst_code` bigint(20) NOT NULL,
  `sl_branch_mst_code` bigint(20) NOT NULL,
  `division_mst_code` bigint(20) NOT NULL,
  `department_mst_code` bigint(20) NOT NULL,
  `employee_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `glbudindex` (`company_mst_code`,`branch_mst_code`,`booking_year`,`chart_of_accounts_mst_code`,`subsidiary_ledger_mst_code`,`sl_branch_mst_code`,`division_mst_code`,`department_mst_code`,`employee_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnglbudgetdtlperiods`
--

CREATE TABLE IF NOT EXISTS `trnglbudgetdtlperiods` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `gl_budget_trn_code` bigint(20) NOT NULL,
  `booking_period` int(4) NOT NULL,
  `budget_amount` double NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `gl_budget_trn_code` (`gl_budget_trn_code`),
  KEY `glbuddtlperiodindex` (`gl_budget_trn_code`,`booking_period`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicy`
--

CREATE TABLE IF NOT EXISTS `trnintpolicy` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `subline_mst_code` bigint(20) NOT NULL,
  `assured_mst_code` bigint(20) NOT NULL,
  `assured_name` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `assured_address_dtl_code` bigint(20) NOT NULL,
  `country_mst_code` bigint(20) NOT NULL,
  `region_mst_code` bigint(20) NOT NULL,
  `province_mst_code` bigint(20) NOT NULL,
  `city_mst_code` bigint(20) NOT NULL,
  `barangay_mst_code` bigint(20) NOT NULL,
  `street_address` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `complete_address` varchar(2000) COLLATE latin1_general_cs NOT NULL,
  `assigned_or_leased_to` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'for fire and motorcar',
  `int_sequence` bigint(20) NOT NULL,
  `policy_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `policy_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `policy_source` tinyint(1) NOT NULL COMMENT '1 - DB ; 2 - RII ; 3 - RIO',
  `policy_type` tinyint(1) NOT NULL COMMENT '10 - Quotation ; 20 - Cover Notes ; 30 - Policy/Binder ; 40 - Endorsement/Alteration ; 50 - Renewal',
  `booking_year` int(4) NOT NULL,
  `booking_period` int(2) NOT NULL,
  `interim_status` int(2) NOT NULL,
  `interim_no` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'always sysgen',
  `generated_policy_trn_code` bigint(20) NOT NULL,
  `generated_curr_policy_trn_code` bigint(20) NOT NULL,
  `reference_curr_policy_trn_code` bigint(20) NOT NULL COMMENT 'endorsing policy no',
  `quotation_int_policy_trn_code` bigint(20) NOT NULL COMMENT 'if converted from quotation',
  `renewing_curr_policy_trn_code` bigint(20) NOT NULL COMMENT 'if processed from renewals',
  `spoiling_policy_trn_code` bigint(20) NOT NULL COMMENT 'SPOIL RE-ISSUE POLICY DETAILS FROM (FOR S/P)',
  `revision_counter` int(3) NOT NULL,
  `quotation_days_valid` int(3) NOT NULL,
  `quotation_printing_datetime` datetime NOT NULL,
  `reinstatement_type` tinyint(1) NOT NULL COMMENT '1 - From Current State ; 2 - From Original Policy',
  `document_series_no` int(9) NOT NULL,
  `renewal_no` int(3) NOT NULL COMMENT 'renewal counter',
  `issue_date` date NOT NULL,
  `inception_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `effectivity_date` date NOT NULL,
  `is_inception_date_tba` tinyint(1) NOT NULL,
  `is_expiry_date_tba` tinyint(1) NOT NULL,
  `industry_mst_code` bigint(20) NOT NULL,
  `spoiling_datetime` datetime NOT NULL,
  `spoiling_user_mst_code` bigint(20) NOT NULL,
  `cancelled_date` datetime NOT NULL,
  `cancelled_user_mst_code` bigint(20) NOT NULL,
  `distribution_status` tinyint(1) NOT NULL COMMENT '1 - Undistributed ; 2 - Distributed and Unposted ; 3 - Distributed and Posted',
  `endorsement_no` int(3) NOT NULL COMMENT 'endorsement counter',
  `region_mst_code_2` bigint(20) NOT NULL,
  `policy_status` int(2) NOT NULL,
  `agent_mst_code` bigint(20) NOT NULL,
  `agent_commission_type_flag` tinyint(1) NOT NULL COMMENT '0 - N/A ; 1 - Single Rate ; 2 - All In Rate',
  `parent_agent_mst_code` bigint(20) NOT NULL,
  `source_of_business_mst_code` bigint(20) NOT NULL,
  `agent_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - Non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `agent_vat_rate` double NOT NULL,
  `agent_wtax_rate` double NOT NULL,
  `parent_agent_tax_type` tinyint(1) NOT NULL,
  `parent_agent_vat_rate` double NOT NULL,
  `parent_agent_wtax_rate` double NOT NULL,
  `assured_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - Non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `policy_no_of_days` int(3) NOT NULL,
  `is_one_year` tinyint(4) NOT NULL,
  `solicitor_mst_code` bigint(20) NOT NULL,
  `currency_mst_code` bigint(20) NOT NULL,
  `exchange_rate` double NOT NULL,
  `endorsement_mst_codes` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'comma-separated',
  `endorsement_text` mediumtext COLLATE latin1_general_cs NOT NULL,
  `recommended_user_mst_codes` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `approved_user_mst_codes` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `recommended_datetimes` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `approving_datetimes` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `is_printed` tinyint(1) NOT NULL,
  `print_counter` int(3) NOT NULL,
  `print_datetime` datetime NOT NULL COMMENT 'latest',
  `printed_user_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `net_tsi_amount` double NOT NULL COMMENT 'for running totals after endorsements/alteration',
  `net_prem_amount` double NOT NULL COMMENT 'for running totals after endorsements/alteration',
  `pres_net_prem_amount` double NOT NULL COMMENT 'for running totals after endorsements/alteration',
  `charges_amount` double NOT NULL,
  `amount_due` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `commission_broker_fee_amount` double NOT NULL,
  `commission_broker_fee_vat_amount` double NOT NULL,
  `commission_net_amount` double NOT NULL,
  `surcharge_amount` double NOT NULL,
  `interim_state_percentage` double NOT NULL COMMENT 'FOR INTERIM ONLY',
  `interim_state_done_parts` varchar(500) COLLATE latin1_general_cs NOT NULL COMMENT 'comma-separated ; 1 - Basic Info ; 2 - Item Details ; 3 - Item Perils ; 4 - Bill Premium ; 5 - Commissions ; 6 - Warranties',
  `coc_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `coc_number_type` tinyint(1) NOT NULL,
  `authentication_code` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `endorsement_effectivity_date` date NOT NULL,
  `endorsement_no_of_days` int(3) NOT NULL,
  `reference_policy_booking_year` int(4) NOT NULL,
  `reference_policy_booking_period` int(2) NOT NULL,
  `facultative_placements_trn_codes` varchar(1000) COLLATE latin1_general_cs NOT NULL COMMENT 'MARAMI PAG PER ITEM',
  `facul_types` varchar(1000) COLLATE latin1_general_cs NOT NULL COMMENT 'MARAMI PAG PER ITEM',
  `prev_curr_tsi_amount` double NOT NULL,
  `prev_curr_prem_amount` double NOT NULL,
  `prev_curr_charges_amount` double NOT NULL,
  `discount_rate` double NOT NULL COMMENT 'USED FOR QUOTATION AND MAYBE FOR MARKETING EXPENSE CASE ABIC',
  `discount_amount` double NOT NULL COMMENT 'USED FOR QUOTATION AND MAYBE FOR MARKETING EXPENSE CASE ABIC',
  `quotation_referring_branch` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `quotation_referring_person` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `quotation_contact_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `terms_of_coverage` mediumtext COLLATE latin1_general_cs NOT NULL,
  `policy_remarks` mediumtext COLLATE latin1_general_cs NOT NULL,
  `searchable_field_1` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'DEPENDS PER LINE, COMMA SEPARATED PER ITEM',
  `searchable_field_2` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'DEPENDS PER LINE, COMMA SEPARATED PER ITEM',
  `searchable_field_3` mediumtext CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'DEPENDS PER LINE, COMMA SEPARATED PER ITEM',
  `is_from_quotation` tinyint(1) NOT NULL,
  `quotation_user_mst_code` bigint(20) NOT NULL,
  `quotation_created_at` datetime NOT NULL,
  `depreciation_rate` double NOT NULL COMMENT 'WHOLE PERCENTAGE NOT YET DIVIDED BY 100',
  `no_claim_bonus_amt` double NOT NULL,
  `depreciation_amt` double NOT NULL,
  `no_claim_bonus_rate` double NOT NULL COMMENT 'WHOLE PERCENTAGE NOT YET DIVIDED BY 100',
  `email_address` varchar(150) COLLATE latin1_general_cs NOT NULL COMMENT 'assured email address',
  `secondary_email_address` mediumtext COLLATE latin1_general_cs NOT NULL COMMENT 'agent/referror/account officer/representative email address',
  `other_email_address` mediumtext COLLATE latin1_general_cs NOT NULL COMMENT 'other email address for cc',
  `cellphone_number` varchar(250) COLLATE latin1_general_cs NOT NULL,
  `support_ticket_policy_trn_code` bigint(20) NOT NULL COMMENT 'FOR CRM TICKET CONNECTION',
  `renewal_type` int(2) NOT NULL,
  `renewal_remarks` mediumtext COLLATE latin1_general_cs NOT NULL,
  `renewal_auto_no_of_days` int(3) NOT NULL,
  `is_mortgage_account` tinyint(4) NOT NULL COMMENT '0-no|1-yes - cfg mortgage account',
  `is_mortgage_generate_or` tinyint(4) NOT NULL COMMENT '0-no|1-yes - automatically generate or',
  `did_not_materialized` tinyint(1) NOT NULL,
  `dnm_reason_mst_code` bigint(20) NOT NULL,
  `dnm_processed_user_mst_code` bigint(20) NOT NULL,
  `dnm_reason` mediumtext COLLATE latin1_general_cs NOT NULL,
  `dnm_processed_at` datetime NOT NULL,
  `is_from_cfg_module` tinyint(1) NOT NULL,
  `is_open_market_rate` tinyint(1) NOT NULL,
  `auto_email_upon_posting` tinyint(1) NOT NULL,
  `printout_attachment_mst_codes` varchar(2000) COLLATE latin1_general_cs NOT NULL COMMENT 'FOR AUTO EMAIL',
  `merge_pdfs_upon_sending` tinyint(1) NOT NULL,
  `remarks` varchar(15000) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `interimsearchindex` (`assured_name`(767),`interim_no`),
  KEY `interimfilterindex` (`policy_source`,`policy_type`,`line_mst_code`,`subline_mst_code`,`updated_user_mst_code`,`assured_mst_code`,`branch_mst_code`,`agent_mst_code`),
  KEY `interimcombinedindex` (`policy_source`,`policy_type`,`line_mst_code`,`subline_mst_code`,`updated_user_mst_code`,`assured_mst_code`,`branch_mst_code`,`agent_mst_code`,`assured_name`(767),`interim_no`),
  KEY `weeklyinterimindex` (`created_at`,`policy_type`),
  KEY `weeklyinterimindex3` (`line_mst_code`,`subline_mst_code`,`created_user_mst_code`,`support_ticket_policy_trn_code`,`agent_mst_code`,`parent_agent_mst_code`,`source_of_business_mst_code`,`created_at`,`policy_type`) USING BTREE,
  KEY `interimindex01` (`policy_source`,`line_mst_code`,`branch_mst_code`,`generated_policy_trn_code`,`updated_user_mst_code`,`did_not_materialized`),
  KEY `analyticsindex01` (`created_user_mst_code`,`policy_type`,`interim_state_percentage`,`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlacceptanceinfo`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlacceptanceinfo` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `mother_policy_orig_policy_trn_code` bigint(20) NOT NULL COMMENT 'MOTHER POLICY OF THIS OUTGOING BINDER/ALTERATION (NOT APPLICABLE IN INWARD)',
  `mother_endorsement_orig_policy_trn_code` bigint(20) NOT NULL COMMENT 'MOTHER ENDORSEMENT OF THIS OUTGOING BINDER/ALTERATION (NOT APPLICABLE IN INWARD)',
  `mother_binder_orig_policy_trn_code` bigint(20) NOT NULL COMMENT 'MOTHER BINDER OF THIS REINSURANCE BINDER/ALTERATION (APPLICABLE TO BOTH INWARD OUTGOING)',
  `acceptance_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `acceptance_number_type` tinyint(1) NOT NULL COMMENT '1 - Sysgen ; 2 - Manual',
  `acceptance_date` date NOT NULL,
  `accepted_by` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `reinsurer_mst_code` bigint(20) NOT NULL,
  `reinsurer_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `reinsurer_vat_rate` double NOT NULL,
  `reinsurer_wtax_rate` double NOT NULL,
  `ceding_policy_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `ceding_endorse_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `ceding_binder_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `date_offered` date NOT NULL,
  `reassured_mst_code` bigint(20) NOT NULL,
  `reassured_name` varchar(1000) COLLATE latin1_general_cs NOT NULL,
  `alteration_advice_no` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `broker_reinsurer_mst_code` bigint(20) NOT NULL COMMENT 'same masterfile',
  `broker_tax_type` tinyint(1) NOT NULL COMMENT '1 - Vatable ; 2 - non-VAT ; 3 - Zero Rated ; 4 - Tax Exempt',
  `broker_vat_rate` double NOT NULL,
  `broker_fee_rate` double NOT NULL,
  `reinsurance_tsi_amount` double NOT NULL,
  `reinsurance_prem_amount` double NOT NULL,
  `original_tsi_amount` double NOT NULL,
  `original_prem_amount` double NOT NULL,
  `curr_policy_trn_acceptance_code` bigint(20) NOT NULL,
  `gross_facul_amount` double NOT NULL,
  `facul_share_percentages` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `binder_warranty_payment_term_mst_code` bigint(20) NOT NULL,
  `binder_warranty_no_days` int(3) NOT NULL,
  `payment_premium_warranty_payment_term_mst_code` bigint(20) NOT NULL,
  `payment_premium_warranty_no_days` int(3) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `intacceptanceindex` (`int_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlbondcollaterals`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlbondcollaterals` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `collateral_no` int(3) NOT NULL,
  `bond_collaterals_mst_code` bigint(20) NOT NULL,
  `collateral_description` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `collateral_amount` double NOT NULL,
  `issue_date` date NOT NULL,
  `received_date` date NOT NULL,
  `received_by` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `maturity_date` date NOT NULL,
  `release_date` date NOT NULL,
  `renewal` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `curr_policy_bond_collaterals_code` bigint(20) NOT NULL,
  `is_for_deletion` tinyint(1) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlcfgdetails`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlcfgdetails` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `pnb_grouping_mst_code` bigint(20) NOT NULL,
  `pnb_region_mst_code` bigint(20) NOT NULL,
  `pnb_area_unit_mst_code` bigint(20) NOT NULL,
  `pnb_branch_mst_code` bigint(20) NOT NULL,
  `pnb_referror_mst_code` bigint(20) NOT NULL,
  `pnb_account_officer_mst_code` bigint(20) NOT NULL,
  `is_backlog` tinyint(1) NOT NULL,
  `backlog_user_mst_code` bigint(20) NOT NULL,
  `backlog_at` datetime NOT NULL,
  `assured_tin_sss_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `coverage_name` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `coc_expiry_date` date NOT NULL,
  `loan_term_years` int(3) NOT NULL,
  `loan_start_date` date NOT NULL,
  `mortgage_type` tinyint(1) NOT NULL,
  `cfg_banking_type` tinyint(1) NOT NULL,
  `coc_request_date` date NOT NULL,
  `coc_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `wholesale_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `marketing_assistant_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `amount_insured` double NOT NULL,
  `service_fee` double NOT NULL,
  `monthly_amortization_amount` double NOT NULL,
  `amount_due_insurance` double NOT NULL,
  `is_reviewed` tinyint(1) NOT NULL,
  `reviewed_user_mst_code` bigint(20) NOT NULL,
  `reviewed_datetime` datetime NOT NULL,
  `is_matched` tinyint(1) NOT NULL,
  `matched_user_mst_code` bigint(20) NOT NULL,
  `matched_datetime` datetime NOT NULL,
  `matched_filename` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `matched_remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `matched_general_uploading_trn_code` bigint(20) NOT NULL,
  `is_payment_confirmed` tinyint(1) NOT NULL,
  `payment_confirmed_user_mst_code` bigint(20) NOT NULL,
  `payment_confirmed_datetime` datetime NOT NULL,
  `payment_general_uploading_trn_code` bigint(20) NOT NULL,
  `is_booked` tinyint(1) NOT NULL,
  `booked_user_mst_code` bigint(20) NOT NULL,
  `booked_datetime` datetime NOT NULL,
  `is_details_completed` tinyint(1) NOT NULL,
  `details_completed_user_mst_code` bigint(20) NOT NULL,
  `details_completed_at` datetime NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlcomm`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlcomm` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `group_no` int(3) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `broker_fee_vat_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `is_no_commission` tinyint(1) NOT NULL,
  `no_comm_change_datetime` datetime NOT NULL,
  `no_comm_change_user_mst_code` bigint(20) NOT NULL,
  `curr_policy_comm_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommindex` (`int_policy_trn_code`,`int_policy_trn_group_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlcommbreakdowns`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlcommbreakdowns` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `int_policy_trn_comm_code` bigint(20) NOT NULL,
  `int_policy_trn_group_breakdown_code` bigint(20) NOT NULL,
  `breakdown_ordinal` int(3) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `curr_policy_comm_breakdown_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommbreakdownsindex` (`int_policy_trn_code`,`int_policy_trn_group_code`,`int_policy_trn_comm_code`,`int_policy_trn_group_breakdown_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlcommbreakdownsperils`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlcommbreakdownsperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `int_policy_trn_comm_code` bigint(20) NOT NULL,
  `int_policy_trn_group_breakdown_code` bigint(20) NOT NULL,
  `int_policy_trn_comm_breakdown_code` bigint(20) NOT NULL,
  `int_policy_trn_group_breakdown_item_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `int_policy_trn_item_peril_code` bigint(20) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_rate` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `broker_fee_vat_rate` double NOT NULL,
  `broker_fee_vat_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_rate` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `curr_policy_comm_breakdown_peril_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommbreakdownsperilsindex` (`int_policy_trn_code`,`int_policy_trn_group_code`,`int_policy_trn_comm_code`,`int_policy_trn_group_breakdown_code`,`int_policy_trn_comm_breakdown_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlcommperils`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlcommperils` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `int_policy_trn_comm_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `peril_mst_code` bigint(20) NOT NULL,
  `int_policy_trn_item_peril_code` bigint(20) NOT NULL,
  `prem_amount` double NOT NULL,
  `commission_rate` double NOT NULL,
  `commission_amount` double NOT NULL,
  `commission_vat_amount` double NOT NULL,
  `commission_wtax_amount` double NOT NULL,
  `broker_fee_amount` double NOT NULL,
  `broker_fee_vat_rate` double NOT NULL,
  `broker_fee_vat_amount` double NOT NULL,
  `net_commission_amount` double NOT NULL,
  `parent_commission_rate` double NOT NULL,
  `parent_commission_amount` double NOT NULL,
  `parent_commission_vat_amount` double NOT NULL,
  `parent_commission_wtax_amount` double NOT NULL,
  `parent_net_commission_amount` double NOT NULL,
  `is_override_commission` tinyint(1) NOT NULL,
  `override_comm_change_datetime` datetime NOT NULL,
  `parent_is_override_commission` tinyint(1) NOT NULL,
  `parent_override_comm_change_datetime` datetime NOT NULL,
  `parent_override_comm_change_user_mst_code` bigint(20) NOT NULL,
  `override_comm_change_user_mst_code` bigint(20) NOT NULL,
  `curr_policy_comm_item_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlcommperilsindex` (`int_policy_trn_code`,`int_policy_trn_group_code`,`int_policy_trn_comm_code`,`peril_mst_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtldeliverydetails`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtldeliverydetails` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `delivery_recipient_type_mst_code` bigint(20) NOT NULL,
  `recipient_name` varchar(200) COLLATE latin1_general_ci NOT NULL,
  `recipient_address` varchar(2000) COLLATE latin1_general_ci NOT NULL,
  `email_address` varchar(1000) COLLATE latin1_general_ci NOT NULL,
  `printout_attachment_mst_codes` varchar(2000) COLLATE latin1_general_ci NOT NULL,
  `delivery_status` int(2) NOT NULL COMMENT '0 - Pending ; 1 - Returned ; 2 - On Delivery ; 3 - Delivered',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `drint` (`int_policy_trn_code`),
  KEY `drorig` (`orig_policy_trn_code`),
  KEY `drint2` (`int_policy_trn_code`,`delivery_recipient_type_mst_code`,`delivery_status`),
  KEY `drorig2` (`orig_policy_trn_code`,`delivery_recipient_type_mst_code`,`delivery_status`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlfaculpanels`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlfaculpanels` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `reinsurer_mst_code` bigint(20) NOT NULL,
  `int_policy_item_dtl_code` bigint(20) NOT NULL,
  `acceptance_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `acceptance_date` date NOT NULL,
  `accepted_by` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `is_itemized` tinyint(1) NOT NULL,
  `placement_slip_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `share_amount` double NOT NULL,
  `facul_amount` double NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `share_percentage` double NOT NULL,
  `date_offered` date NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_item_dtl_code` bigint(20) NOT NULL,
  `gross_facul_amount` double NOT NULL,
  `gross_share_amount` double NOT NULL,
  `gross_share_percentage` double NOT NULL,
  `is_cancelled` tinyint(1) NOT NULL,
  `cancelled_user_mst_code` bigint(20) NOT NULL,
  `cancel_datetime` datetime NOT NULL,
  `broker_reinsurer_mst_code` bigint(20) NOT NULL,
  `reinsurer_type_mst_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlfaculpanelsindex` (`int_policy_trn_code`,`reinsurer_mst_code`,`int_policy_item_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='DEPRECATED TABLE. DO NOT USE' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlfileattachments`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlfileattachments` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `encrypted_uploaded_file_name` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `filetype` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `uploaded_user_mst_code` bigint(20) NOT NULL,
  `attachment_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `description` mediumtext COLLATE latin1_general_ci NOT NULL,
  `remarks` mediumtext COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `intattachment` (`int_policy_trn_code`),
  KEY `origattachment` (`orig_policy_trn_code`),
  KEY `currattachment` (`curr_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='FOR UPLOADING OF INTERIM/ARCHIVE ATTACHMENTS' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlgroupings`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlgroupings` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `company_mst_code` bigint(20) NOT NULL,
  `branch_mst_code` bigint(20) NOT NULL,
  `group_no` int(3) NOT NULL,
  `prem_amount` double NOT NULL,
  `charge_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `pres_charge_amount` double NOT NULL,
  `curr_policy_group_code` bigint(20) NOT NULL,
  `staggered_count` int(3) NOT NULL COMMENT 'no. of A/Rs',
  `particulars` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `payment_term_mst_code` bigint(20) NOT NULL,
  `term_no_days` int(3) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsindex` (`int_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='Per group' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlgroupingsbreakdowns`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlgroupingsbreakdowns` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `payment_term_mst_code` bigint(20) NOT NULL,
  `term_no_days` int(3) NOT NULL,
  `due_date` date NOT NULL,
  `breakdown_ordinal` int(3) NOT NULL,
  `maturity_date` date NOT NULL COMMENT 'date of previous breakdown + 1 day',
  `prem_amount` double NOT NULL,
  `charge_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `pres_charge_amount` double NOT NULL,
  `breakdown_percentage` double NOT NULL,
  `curr_policy_group_breakdown_code` bigint(20) NOT NULL,
  `particulars` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `invoice_number` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `invoice_number_type` tinyint(1) NOT NULL,
  `invoice_sequence` bigint(20) NOT NULL,
  `document_type` tinyint(1) NOT NULL COMMENT '1 - A/R ; 2 - A/P',
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsbreakdownsindex` (`int_policy_trn_code`,`int_policy_trn_group_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlgroupingsbreakdownsitems`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlgroupingsbreakdownsitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `int_policy_trn_group_breakdown_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `type` tinyint(1) NOT NULL,
  `type_code` bigint(20) NOT NULL COMMENT 'Peril MST or Charges MST',
  `item_amount` double NOT NULL,
  `item_rate` double NOT NULL,
  `item_type` tinyint(1) NOT NULL COMMENT '0 - Peril ; 1 - Rated ; 2 - Fixed ; 3 - Tabled',
  `tax_charges_mst_code` bigint(20) NOT NULL,
  `pres_item_amount` double NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `breakdown_percentage` double NOT NULL,
  `curr_policy_breakdown_item_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsbreakdownsitemsindex` (`int_policy_trn_code`,`int_policy_trn_group_code`,`int_policy_trn_group_breakdown_code`,`type`,`type_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs COMMENT='breakdown items' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlgroupingsitems`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlgroupingsitems` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `print_order` int(3) NOT NULL,
  `type` tinyint(1) NOT NULL COMMENT '1 - Peril ; 2 - Charges',
  `type_code` bigint(20) NOT NULL COMMENT 'PerilMST or Charges MST',
  `item_amount` double NOT NULL,
  `item_rate` double NOT NULL,
  `item_type` tinyint(1) NOT NULL COMMENT '0 - Peril ; 1 - Rated ; 2 - Fixed ; 3 - Tabled',
  `tax_charges_mst_code` bigint(20) NOT NULL,
  `pres_item_amount` double NOT NULL,
  `line_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `curr_policy_group_item_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlgroupingsitemsindex` (`int_policy_trn_code`,`int_policy_trn_group_code`,`type`,`type_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlinitialfaculpanels`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlinitialfaculpanels` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `reinsurer_mst_code` bigint(20) NOT NULL,
  `share_percent` double NOT NULL,
  `share_tsi_amount` double NOT NULL,
  `share_prem_amount` double NOT NULL,
  `binder_warranty_payment_term_mst_code` bigint(20) NOT NULL,
  `binder_warranty_no_days` int(3) NOT NULL,
  `payment_premium_warranty_payment_term_mst_code` bigint(20) NOT NULL,
  `payment_premium_warranty_no_days` int(3) NOT NULL,
  `acceptance_no` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `acceptance_date` date NOT NULL,
  `date_offered` date NOT NULL,
  `accepted_by` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlinspection`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlinspection` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `inspection_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `purpose_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `business_type_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `operation_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `construction_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `occupancy_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `protection_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `exposure_external_fire_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `exposure_earthquake_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `assessment_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `block_exposure_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `overall_assessment_remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `remarks` varchar(5000) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `dtlinspectionindex` (`int_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 COMMENT='FOR FIRE INSPECTION REPORT' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlinspectionattachments`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlinspectionattachments` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `orig_policy_trn_code` bigint(20) NOT NULL,
  `curr_policy_trn_code` bigint(20) NOT NULL,
  `uploaded_file` longblob NOT NULL,
  `uploaded_file_name` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `filetype` varchar(100) COLLATE latin1_general_ci NOT NULL,
  `uploaded_at` datetime NOT NULL,
  `uploaded_user_mst_code` bigint(20) NOT NULL,
  `attachment_name` varchar(500) COLLATE latin1_general_ci NOT NULL COMMENT 'USER INPUT',
  `remarks` varchar(500) COLLATE latin1_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `trnintpolicyattachintindex` (`int_policy_trn_code`),
  KEY `trnorigpolicyattachintindex` (`orig_policy_trn_code`),
  KEY `trncurrpolicyattachintindex` (`curr_policy_trn_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='FOR FIRE INSPECTION. ITO NA DIN GAGAMITIN FOR ORIG AND CURRENT STATE DAHIL MAGASTOS SA SPACE' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlitem`
--

CREATE TABLE IF NOT EXISTS `trnintpolicydtlitem` (
  `code` bigint(20) NOT NULL AUTO_INCREMENT,
  `int_policy_trn_code` bigint(20) NOT NULL,
  `int_policy_location_dtl_code` bigint(20) NOT NULL COMMENT 'IF FIRE ONLY MAGKAKALAMAN',
  `item_no` int(3) NOT NULL,
  `int_policy_trn_group_code` bigint(20) NOT NULL,
  `item_name` mediumtext COLLATE latin1_general_cs NOT NULL,
  `item_description` varchar(5000) COLLATE latin1_general_cs NOT NULL,
  `group_risk_code` varchar(20) COLLATE latin1_general_cs NOT NULL,
  `is_each_person` tinyint(1) NOT NULL COMMENT 'For PA',
  `no_of_passengers` int(3) NOT NULL,
  `pa_type` tinyint(1) NOT NULL COMMENT 'For PA ; 1 - Individual ; 2 - Group ; 3 - Travel',
  `table_retention_limits_mst_code` bigint(20) NOT NULL,
  `tsi_amount` double NOT NULL,
  `prem_amount` double NOT NULL,
  `pres_prem_amount` double NOT NULL,
  `net_tsi_amount` double NOT NULL,
  `net_prem_amount` double NOT NULL,
  `prev_curr_tsi_amount` double NOT NULL,
  `prev_curr_prem_amount` double NOT NULL,
  `pres_net_prem_amount` double NOT NULL,
  `curr_policy_item_code` bigint(20) NOT NULL COMMENT 'for endorsement',
  `premium_basis` tinyint(1) NOT NULL COMMENT '1 - No of Days / 2 - Short Period Scale',
  `plan_type_mst_code` bigint(20) NOT NULL,
  `is_compre` tinyint(1) NOT NULL,
  `is_ctpl` tinyint(1) NOT NULL,
  `is_special_deductible` tinyint(1) NOT NULL COMMENT 'for deductible',
  `is_for_claims_purposes` tinyint(1) NOT NULL,
  `motorcar_vehicle_size` tinyint(1) NOT NULL,
  `surcharge_amount` double NOT NULL,
  `motorcar_towing_amount` double NOT NULL,
  `motorcar_repair_limit` double NOT NULL,
  `is_for_deletion` tinyint(1) NOT NULL,
  `facultative_placements_trn_code` bigint(20) NOT NULL,
  `remarks` varchar(500) COLLATE latin1_general_cs NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_user_mst_code` bigint(20) NOT NULL,
  `updated_user_mst_code` bigint(20) NOT NULL,
  PRIMARY KEY (`code`),
  KEY `int_policy_trn_code` (`int_policy_trn_code`),
  KEY `int_policy_trn_code_2` (`int_policy_trn_code`),
  KEY `dtlitemindex` (`int_policy_trn_code`,`int_policy_location_dtl_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `trnintpolicydtlitembondsignatories`
--

