--
-- Host: localhost    Database: spserp_master
-- ------------------------------------------------------


--
-- Table structure for table `_log__customer`
--

CREATE TABLE `_log__customer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `ip_address` varchar(128) NOT NULL,
  `login_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `logout_ts` timestamp NULL DEFAULT NULL,
  `url_last` varchar(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `_log__email`
--

CREATE TABLE `_log__email` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `userID` int(11) NOT NULL,
  `from` varchar(64) NOT NULL,
  `to` text NOT NULL,
  `text` text NOT NULL,
  `result` varchar(64) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=875 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_log__module_session`
--

CREATE TABLE `_log__module_session` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_session_id` int(11) NOT NULL,
  `module_id` int(11) DEFAULT NULL,
  `login_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `logout_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_session_id` (`user_session_id`),
  KEY `login_ts` (`login_ts`),
  KEY `logout_ts` (`logout_ts`)
) ENGINE=InnoDB AUTO_INCREMENT=116050 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_log__query`
--

CREATE TABLE `_log__query` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `module_id` int(11) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `query` text,
  `url` varchar(128) DEFAULT NULL,
  `execution_time` double DEFAULT NULL,
  `ip_address` varchar(128) NOT NULL,
  `created_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `execution_time` (`execution_time`),
  KEY `user_id` (`user_id`),
  KEY `created_ts` (`created_ts`)
) ENGINE=InnoDB AUTO_INCREMENT=46992865 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_log__query_2019`
--

CREATE TABLE `_log__query_2019` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `module_id` int(11) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `query` text,
  `url` varchar(128) DEFAULT NULL,
  `execution_time` varchar(255) DEFAULT NULL,
  `ip_address` varchar(128) NOT NULL,
  `created_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `execution_time` (`execution_time`),
  KEY `user_id` (`user_id`),
  KEY `created_ts` (`created_ts`)
) ENGINE=InnoDB AUTO_INCREMENT=40562413 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_log__user_session`
--

CREATE TABLE `_log__user_session` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `ip_address` varchar(128) NOT NULL,
  `login_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `logout_ts` timestamp NULL DEFAULT NULL,
  `url_last` varchar(128) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `userid` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=88683 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__academic`
--

CREATE TABLE `_ref__academic` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `level` varchar(144) NOT NULL,
  `seq` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__accomodation_entitlement`
--

CREATE TABLE `_ref__accomodation_entitlement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `position_category_id` int(11) NOT NULL,
  `zone_type_id` int(11) NOT NULL,
  `with_receipt` int(11) NOT NULL,
  `without_receipt` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__action_type`
--

CREATE TABLE `_ref__action_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `icon` varchar(68) NOT NULL,
  `color` varchar(68) NOT NULL,
  `type` varchar(68) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__alphabet`
--

CREATE TABLE `_ref__alphabet` (
  `id` int(11) NOT NULL,
  `alphabet` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__bank`
--

CREATE TABLE `_ref__bank` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(144) NOT NULL,
  `shortcode` varchar(144) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__claim_type`
--

CREATE TABLE `_ref__claim_type` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `parent` int(11) NOT NULL,
  `code` varchar(64) NOT NULL,
  `name` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `form_location` varchar(144) NOT NULL,
  `sequence` int(11) NOT NULL,
  `is_display` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__claim_type_detail`
--

CREATE TABLE `_ref__claim_type_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_type_id` int(11) NOT NULL,
  `parent_detail_id` int(11) NOT NULL,
  `description` varchar(128) NOT NULL,
  `icon` varchar(128) DEFAULT NULL,
  `rank_id` int(11) NOT NULL,
  `amount` decimal(10,0) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__company_type`
--

CREATE TABLE `_ref__company_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__contract_confirmation`
--

CREATE TABLE `_ref__contract_confirmation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__contract_type`
--

CREATE TABLE `_ref__contract_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__country`
--

CREATE TABLE `_ref__country` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `country` varchar(45) DEFAULT NULL,
  `fldcontinent` varchar(45) DEFAULT NULL,
  `phone_code` varchar(64) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=895 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Table structure for table `_ref__dashboard_type`
--

CREATE TABLE `_ref__dashboard_type` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(32) NOT NULL,
  `seq` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__designation`
--

CREATE TABLE `_ref__designation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `position_id` int(11) NOT NULL,
  `designation` varchar(64) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=225 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__employee_contract_type`
--

CREATE TABLE `_ref__employee_contract_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__employee_group`
--

CREATE TABLE `_ref__employee_group` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__gender`
--

CREATE TABLE `_ref__gender` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `gender` varchar(16) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__hiring_reason`
--

CREATE TABLE `_ref__hiring_reason` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(144) NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__job`
--

CREATE TABLE `_ref__job` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `service_id` int(11) NOT NULL,
  `job` varchar(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=143 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__month`
--

CREATE TABLE `_ref__month` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `month` varchar(32) NOT NULL,
  `is_delete` smallint(6) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__race`
--

CREATE TABLE `_ref__race` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `race` varchar(144) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__region`
--

CREATE TABLE `_ref__region` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `region` varchar(32) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__relationship`
--

CREATE TABLE `_ref__relationship` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `relations` varchar(144) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__religion`
--

CREATE TABLE `_ref__religion` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(144) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__residence_type`
--

CREATE TABLE `_ref__residence_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__salary_scale`
--

CREATE TABLE `_ref__salary_scale` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `level` varchar(144) NOT NULL,
  `grade` int(11) NOT NULL,
  `indicator` varchar(144) NOT NULL,
  `designation` varchar(144) NOT NULL,
  `seq` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__services`
--

CREATE TABLE `_ref__services` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `service` varchar(128) NOT NULL,
  `shortName` varchar(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__staff_action_type`
--

CREATE TABLE `_ref__staff_action_type` (
  `id` int(11) NOT NULL,
  `page_view` varchar(144) NOT NULL,
  `code` varchar(144) NOT NULL,
  `type` varchar(144) NOT NULL,
  `modal_id` varchar(128) NOT NULL,
  `component_type` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__state`
--

CREATE TABLE `_ref__state` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `country_id` int(10) unsigned DEFAULT NULL,
  `state` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `subregion_region_id` (`country_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3880 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

--
-- Table structure for table `_ref__tax_type`
--

CREATE TABLE `_ref__tax_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__taxable_period`
--

CREATE TABLE `_ref__taxable_period` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `period` varchar(255) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `_ref__title`
--

CREATE TABLE `_ref__title` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(144) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Table structure for table `action_type_workflow`
--

CREATE TABLE `action_type_workflow` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(144) NOT NULL,
  `workflow` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=latin1;

--
-- Table structure for table `announcement`
--

CREATE TABLE `announcement` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `description` text NOT NULL,
  `publish` int(1) NOT NULL,
  `dateFrom` date NOT NULL,
  `dateTo` date NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Table structure for table `application`
--

CREATE TABLE `application` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `app_id` varchar(255) NOT NULL,
  `app_key` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Table structure for table `application__cron_log`
--

CREATE TABLE `application__cron_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `task` varchar(125) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=254 DEFAULT CHARSET=latin1;

--
-- Table structure for table `application__cron_schedule`
--

CREATE TABLE `application__cron_schedule` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `time` time NOT NULL,
  `command` text NOT NULL,
  `repeat` varchar(255) NOT NULL COMMENT 'DAILY,WEEKLY,MONTHLY,ANNUALLY,',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `execute_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `application__notification`
--

CREATE TABLE `application__notification` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `icon` varchar(128) NOT NULL,
  `type` varchar(144) NOT NULL,
  `heading` varchar(144) NOT NULL,
  `message` text NOT NULL,
  `image` varchar(144) NOT NULL,
  `status` int(1) NOT NULL,
  `is_read` int(1) NOT NULL,
  `link` varchar(144) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `read_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7408 DEFAULT CHARSET=latin1;

--
-- Table structure for table `company`
--

CREATE TABLE `company` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `branch_hq` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `profile` text NOT NULL,
  `main_logo_id` int(11) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `phone_others` varchar(255) NOT NULL,
  `website` varchar(255) NOT NULL,
  `status` tinyint(1) DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Table structure for table `company__branch`
--

CREATE TABLE `company__branch` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `company_id` int(11) NOT NULL DEFAULT '1',
  `name` varchar(255) DEFAULT NULL,
  `address` text NOT NULL,
  `postcode` varchar(255) NOT NULL,
  `city` varchar(128) NOT NULL,
  `state_id` int(11) NOT NULL,
  `country_id` int(11) NOT NULL,
  `latitude` varchar(20) DEFAULT NULL,
  `longitude` varchar(20) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `fax` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Table structure for table `company__business_entity`
--

CREATE TABLE `company__business_entity` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `company_id` int(11) NOT NULL DEFAULT '1',
  `name` varchar(128) NOT NULL,
  `short_name` varchar(11) NOT NULL,
  `description` text NOT NULL,
  `roc_no` varchar(255) NOT NULL,
  `logo` varchar(255) NOT NULL,
  `website` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `status` tinyint(1) DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;

--
-- Table structure for table `company__department`
--

CREATE TABLE `company__department` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `branch_id` int(11) NOT NULL,
  `division_id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `shortName` varchar(11) NOT NULL,
  `description` text NOT NULL,
  `hod_id` int(11) NOT NULL,
  `status` tinyint(1) DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `peopleID` (`hod_id`),
  KEY `status` (`status`),
  KEY `branch` (`branch_id`),
  KEY `division` (`division_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;

--
-- Table structure for table `company__division`
--

CREATE TABLE `company__division` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `department_id` int(11) NOT NULL,
  `code` varchar(16) DEFAULT NULL,
  `name` varchar(128) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0',
  `deleted_by` int(1) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;

--
-- Table structure for table `company__logo`
--

CREATE TABLE `company__logo` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `company_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_location` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Table structure for table `company__position`
--

CREATE TABLE `company__position` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) NOT NULL,
  `position` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `status` tinyint(1) DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `parentid` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=latin1;

--
-- Table structure for table `crm__enggagement`
--

CREATE TABLE `crm__enggagement` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `deptID` int(11) NOT NULL,
  `customerID` int(11) NOT NULL,
  `movementID` int(11) NOT NULL DEFAULT '0',
  `crm_processID` int(11) NOT NULL,
  `date` date NOT NULL,
  `timefrom` time NOT NULL,
  `timeto` time NOT NULL,
  `activity` varchar(128) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  KEY `customerID` (`customerID`),
  KEY `movementID` (`movementID`),
  KEY `crm_processID` (`crm_processID`),
  KEY `is_delete` (`is_delete`),
  KEY `deptID` (`deptID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `crm__enggagement_attachment`
--

CREATE TABLE `crm__enggagement_attachment` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `enggagementID` int(11) NOT NULL,
  `attachment` varchar(128) NOT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_location` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `confidential` int(11) NOT NULL DEFAULT '0',
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `crm__enggagement_contact`
--

CREATE TABLE `crm__enggagement_contact` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `enggagementid` int(11) NOT NULL,
  `contactid` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `group` (`enggagementid`),
  KEY `staff` (`contactid`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Table structure for table `crm__enggagement_detail`
--

CREATE TABLE `crm__enggagement_detail` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `enggagementID` int(11) NOT NULL,
  `type` varchar(16) NOT NULL,
  `description` text NOT NULL,
  `confidential` int(11) NOT NULL DEFAULT '0',
  `amount` decimal(9,2) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  KEY `enggagementID` (`enggagementID`),
  KEY `type` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

--
-- Table structure for table `crm__enggagement_report`
--

CREATE TABLE `crm__enggagement_report` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `enggagementID` int(11) NOT NULL,
  `type` varchar(16) NOT NULL,
  `description` text NOT NULL,
  `created_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `crm__enggagement_staff`
--

CREATE TABLE `crm__enggagement_staff` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `enggagementid` int(11) NOT NULL,
  `staffid` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `group` (`enggagementid`),
  KEY `staff` (`staffid`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `crm__process`
--

CREATE TABLE `crm__process` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `parentID` int(11) NOT NULL DEFAULT '0',
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '0=form, 1=report',
  `name` varchar(32) NOT NULL,
  `link` varchar(64) NOT NULL,
  `icon` varchar(32) NOT NULL,
  `color_code` varchar(16) NOT NULL,
  `description` varchar(128) NOT NULL,
  `sequenceNo` int(11) NOT NULL DEFAULT '10',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer`
--

CREATE TABLE `customer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type_id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `profile` text NOT NULL,
  `picture` varchar(255) NOT NULL,
  `roc_no` varchar(128) NOT NULL,
  `address1` varchar(128) NOT NULL,
  `address2` varchar(128) NOT NULL,
  `postcode` varchar(128) NOT NULL,
  `city` varchar(128) NOT NULL,
  `state_id` int(11) NOT NULL,
  `country_id` int(11) NOT NULL,
  `phone` varchar(128) NOT NULL,
  `phone_other` varchar(128) NOT NULL,
  `fax` varchar(128) NOT NULL,
  `email` varchar(128) NOT NULL,
  `website` varchar(128) NOT NULL,
  `master` int(11) NOT NULL COMMENT 'Yes = 1, No = 0',
  `master_id` int(11) NOT NULL,
  `grade_id` int(11) NOT NULL,
  `year_end_id` int(11) NOT NULL,
  `status_id` tinyint(1) NOT NULL DEFAULT '0',
  `incorporate_date` date NOT NULL,
  `appoint_date` date NOT NULL,
  `description` text NOT NULL,
  `ty_letter` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `master_id` (`master_id`),
  KEY `name` (`name`),
  KEY `type_id` (`type_id`),
  KEY `grade_id` (`grade_id`),
  KEY `is_delete` (`is_delete`),
  KEY `status_id` (`status_id`),
  KEY `state_id` (`state_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2104 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__accountant`
--

CREATE TABLE `customer__accountant` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `accountant_name` varchar(128) NOT NULL,
  `accountant_address1` varchar(128) NOT NULL,
  `accountant_address2` varchar(128) NOT NULL,
  `accountant_postcode` varchar(128) NOT NULL,
  `accountant_city` varchar(128) NOT NULL,
  `accountant_state_id` int(11) NOT NULL,
  `accountant_country_id` int(11) NOT NULL,
  `accountant_phone_no` varchar(128) NOT NULL,
  `accountant_fax` varchar(128) NOT NULL,
  `accountant_note` text NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=134 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__attachment`
--

CREATE TABLE `customer__attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_upload` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `customer_id` int(11) NOT NULL,
  `type_id` int(11) NOT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_location` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `updated_ts` int(11) DEFAULT NULL,
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=613 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__attachment_type`
--

CREATE TABLE `customer__attachment_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__auditor`
--

CREATE TABLE `customer__auditor` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `auditor_name` varchar(128) NOT NULL,
  `auditor_address1` varchar(128) NOT NULL,
  `auditor_address2` varchar(128) NOT NULL,
  `auditor_postcode` varchar(128) NOT NULL,
  `auditor_city` varchar(128) NOT NULL,
  `auditor_state_id` int(11) NOT NULL,
  `auditor_country_id` int(11) NOT NULL,
  `auditor_phone_no` varchar(128) NOT NULL,
  `auditor_fax` varchar(128) NOT NULL,
  `auditor_note` text NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__bank`
--

CREATE TABLE `customer__bank` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `bank_branch` varchar(255) NOT NULL,
  `account_no` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1 = inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__contact`
--

CREATE TABLE `customer__contact` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `ic_no` varchar(128) NOT NULL,
  `birthdate` date NOT NULL,
  `position` varchar(128) NOT NULL,
  `phone_work` varchar(16) NOT NULL,
  `phone_mobile` varchar(16) NOT NULL,
  `phone_home` varchar(16) NOT NULL,
  `fax` varchar(16) NOT NULL,
  `email` varchar(128) NOT NULL,
  `address1` varchar(128) NOT NULL,
  `address2` varchar(128) NOT NULL,
  `postcode` varchar(128) NOT NULL,
  `city` varchar(128) NOT NULL,
  `state_id` int(11) NOT NULL,
  `country_id` int(11) NOT NULL,
  `home_address1` varchar(128) NOT NULL,
  `home_address2` varchar(128) NOT NULL,
  `home_postcode` varchar(128) NOT NULL,
  `home_city` varchar(128) NOT NULL,
  `home_state_id` int(11) NOT NULL,
  `home_country_id` int(11) NOT NULL,
  `director` int(11) NOT NULL COMMENT 'Yes = 1, No = 0',
  `director_date` date NOT NULL,
  `shareholder` int(11) NOT NULL COMMENT 'Yes = 1, No = 0',
  `shareholder_date` date NOT NULL,
  `share` varchar(128) NOT NULL,
  `pic` int(11) NOT NULL COMMENT 'Yes = 1, No = 0',
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=3179 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__cosec`
--

CREATE TABLE `customer__cosec` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `cosec_name` varchar(128) NOT NULL,
  `cosec_no` varchar(128) NOT NULL,
  `cosec_year` year(4) NOT NULL,
  `cosec_email` varchar(128) NOT NULL,
  `cosec_phone` varchar(16) NOT NULL,
  `cosec_fax` varchar(16) NOT NULL,
  `cosec_address1` varchar(128) NOT NULL,
  `cosec_address2` varchar(128) NOT NULL,
  `cosec_postcode` varchar(128) NOT NULL,
  `cosec_city` varchar(128) NOT NULL,
  `cosec_state_id` int(11) NOT NULL,
  `cosec_country_id` int(11) NOT NULL,
  `cosec_pic` varchar(128) NOT NULL,
  `sec1_name` varchar(128) NOT NULL,
  `sec1_ic` varchar(128) NOT NULL,
  `sec1_license` varchar(128) NOT NULL,
  `sec1_address1` varchar(128) NOT NULL,
  `sec1_address2` varchar(128) NOT NULL,
  `sec1_postcode` varchar(128) NOT NULL,
  `sec1_city` varchar(128) NOT NULL,
  `sec1_state_id` int(11) NOT NULL,
  `sec1_country_id` int(11) NOT NULL,
  `sec2_name` varchar(128) NOT NULL,
  `sec2_ic` varchar(128) NOT NULL,
  `sec2_license` varchar(128) NOT NULL,
  `sec2_address1` varchar(128) NOT NULL,
  `sec2_address2` varchar(128) NOT NULL,
  `sec2_postcode` varchar(128) NOT NULL,
  `sec2_city` varchar(128) NOT NULL,
  `sec2_state_id` int(11) NOT NULL,
  `sec2_country_id` int(11) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1 = inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=309 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__detail`
--

CREATE TABLE `customer__detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `date_incorporation` date NOT NULL,
  `tax_no` varchar(255) NOT NULL,
  `lhdn_branch` varchar(255) NOT NULL,
  `date_submission` date NOT NULL,
  `gst_reg_no` varchar(255) NOT NULL,
  `custom_branch` varchar(255) NOT NULL,
  `tax_period_id` int(11) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__grade`
--

CREATE TABLE `customer__grade` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `grade` varchar(11) NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__gst`
--

CREATE TABLE `customer__gst` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `gst_no` varchar(128) NOT NULL,
  `custom_branch` varchar(128) NOT NULL,
  `taxable_period_id` int(11) NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__login`
--

CREATE TABLE `customer__login` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `username` varchar(255) NOT NULL,
  `pwd_salt` varchar(255) NOT NULL,
  `pwd_hash` varchar(255) NOT NULL,
  `id_token` varchar(255) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `added_by` int(11) NOT NULL,
  `added_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__other_address`
--

CREATE TABLE `customer__other_address` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `description` varchar(128) NOT NULL,
  `address1` varchar(128) NOT NULL,
  `address2` varchar(128) NOT NULL,
  `postcode` varchar(128) NOT NULL,
  `city` varchar(128) NOT NULL,
  `state_id` int(11) NOT NULL,
  `country_id` int(11) NOT NULL,
  `phone` varchar(128) NOT NULL,
  `fax` varchar(128) NOT NULL,
  `note` text NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__othersinfo`
--

CREATE TABLE `customer__othersinfo` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `year` int(11) NOT NULL,
  `companyType_id` int(11) NOT NULL,
  `region_id` int(11) NOT NULL,
  `annual_revenue` float NOT NULL,
  `cash_in_bank` float NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `region_id` (`region_id`),
  KEY `companyType_id` (`companyType_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1628 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__service`
--

CREATE TABLE `customer__service` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `service_id` int(11) NOT NULL,
  `job_id` int(11) NOT NULL,
  `description` text NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `current` int(11) NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=1253 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__status`
--

CREATE TABLE `customer__status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(32) NOT NULL,
  `is_delete` tinyint(6) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__tax_agent`
--

CREATE TABLE `customer__tax_agent` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `tax_agent_name` varchar(128) NOT NULL,
  `tax_agent_address1` varchar(128) NOT NULL,
  `tax_agent_address2` varchar(128) NOT NULL,
  `tax_agent_postcode` varchar(128) NOT NULL,
  `tax_agent_city` varchar(128) NOT NULL,
  `tax_agent_state_id` int(11) NOT NULL,
  `tax_agent_country_id` int(11) NOT NULL,
  `tax_agent_phone_no` varchar(128) NOT NULL,
  `tax_agent_fax` varchar(128) NOT NULL,
  `tax_agent_note` text NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `id` (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=360 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__taxation`
--

CREATE TABLE `customer__taxation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) NOT NULL,
  `tax_type` int(11) NOT NULL,
  `tax_no` varchar(128) NOT NULL,
  `lhdn_branch` varchar(128) NOT NULL,
  `submission_month` int(11) NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=476 DEFAULT CHARSET=latin1;

--
-- Table structure for table `customer__type`
--

CREATE TABLE `customer__type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

--
-- Table structure for table `dashboard`
--

CREATE TABLE `dashboard` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(64) NOT NULL,
  `description` text NOT NULL,
  `publish` int(11) NOT NULL,
  `dashboardTypeID` int(11) NOT NULL,
  `displayOption` int(11) NOT NULL DEFAULT '0' COMMENT '0 for all, 1 for personal',
  `script` text NOT NULL,
  `icon` varchar(32) NOT NULL,
  `httplink` varchar(64) NOT NULL,
  `bg_color` varchar(16) NOT NULL,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `dashboard__people`
--

CREATE TABLE `dashboard__people` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `dashboardID` int(11) NOT NULL,
  `peopleID` int(11) NOT NULL,
  `published` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `email__reminder`
--

CREATE TABLE `email__reminder` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `moduleID` int(11) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim`
--

CREATE TABLE `hr__claim` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `year` int(11) NOT NULL,
  `month` int(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '0 = draft, 1 = complete',
  `is_submit` int(1) NOT NULL DEFAULT '0',
  `is_delete` int(11) NOT NULL,
  `paid_amount` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `submitted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `status` (`status`),
  KEY `is_submit` (`is_submit`),
  KEY `is_delete` (`is_delete`),
  KEY `year` (`year`),
  KEY `month` (`month`)
) ENGINE=InnoDB AUTO_INCREMENT=1601 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_accommodation`
--

CREATE TABLE `hr__claim_accommodation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date_from` date NOT NULL,
  `date_to` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `location` int(11) NOT NULL,
  `type` int(11) NOT NULL COMMENT '0 = local, 1 = international',
  `description` text,
  `is_admin_approve` int(1) NOT NULL,
  `is_hod_approve` int(1) NOT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=149 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_accommodation_receipts`
--

CREATE TABLE `hr__claim_accommodation_receipts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `accommodation_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(128) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `type` (`type`),
  KEY `accommodation_id` (`accommodation_id`),
  KEY `type_2` (`type`),
  KEY `accommodation_id_2` (`accommodation_id`)
) ENGINE=InnoDB AUTO_INCREMENT=141 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_accomodation_movement`
--

CREATE TABLE `hr__claim_accomodation_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `accommodation_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `accommodation_id` (`accommodation_id`),
  KEY `movement_id` (`movement_id`),
  KEY `accommodation_id_2` (`accommodation_id`),
  KEY `movement_id_2` (`movement_id`)
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_airport_taxes`
--

CREATE TABLE `hr__claim_airport_taxes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `is_admin_approve` int(1) NOT NULL DEFAULT '0',
  `is_hod_approve` int(1) NOT NULL DEFAULT '0',
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_airport_taxes_attachment`
--

CREATE TABLE `hr__claim_airport_taxes_attachment` (
  `id` int(11) NOT NULL,
  `claim_airport_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_airport_taxes_movement`
--

CREATE TABLE `hr__claim_airport_taxes_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_airport_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_allocation`
--

CREATE TABLE `hr__claim_allocation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `year` int(11) NOT NULL,
  `year_joined` int(11) NOT NULL,
  `year_experienced` int(11) NOT NULL,
  `hospitalization` double NOT NULL,
  `room_package` double NOT NULL,
  `outpatient` double NOT NULL,
  `dental_optical` double NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_delete` int(1) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=1729 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_allocation_20210304`
--

CREATE TABLE `hr__claim_allocation_20210304` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `year` int(11) NOT NULL,
  `year_joined` int(11) NOT NULL,
  `year_experienced` int(11) NOT NULL,
  `hospitalization` double NOT NULL,
  `room_package` double NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_delete` int(1) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=907 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_allocation_prorate`
--

CREATE TABLE `hr__claim_allocation_prorate` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_allocation_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `year` int(11) NOT NULL,
  `month` int(11) NOT NULL,
  `outpatient` double NOT NULL,
  `dental_optical` double NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `allocation_id` (`claim_allocation_id`),
  KEY `user_id` (`user_id`),
  KEY `year_month` (`year`,`month`)
) ENGINE=InnoDB AUTO_INCREMENT=8737 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_allocation_prorate_20210304`
--

CREATE TABLE `hr__claim_allocation_prorate_20210304` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_allocation_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `year` int(11) NOT NULL,
  `month` int(11) NOT NULL,
  `outpatient` double NOT NULL,
  `dental_optical` double NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `allocation_id` (`claim_allocation_id`),
  KEY `user_id` (`user_id`),
  KEY `year_month` (`year`,`month`)
) ENGINE=InnoDB AUTO_INCREMENT=13441 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_call`
--

CREATE TABLE `hr__claim_call` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `amount` float NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_call_attachment`
--

CREATE TABLE `hr__claim_call_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_call_detail_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_call_detail`
--

CREATE TABLE `hr__claim_call_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_call_id` int(11) NOT NULL,
  `client_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `duration` float NOT NULL,
  `client_contact_no` varchar(11) NOT NULL,
  `type_of_call` int(11) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_dental`
--

CREATE TABLE `hr__claim_dental` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `journal_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `prorate_month` int(11) NOT NULL,
  `invoice_chit` varchar(64) NOT NULL,
  `clinic_name` varchar(64) NOT NULL,
  `amount_charge` float NOT NULL,
  `amount_claim` float NOT NULL,
  `is_approve` int(1) NOT NULL COMMENT '0 = pending , 1 = approve, 2 = rejected',
  `amount_approved` float NOT NULL,
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0' COMMENT '0 = no, 1= yes',
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `approved_hod_by` int(11) DEFAULT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `journal_id` (`journal_id`),
  KEY `is_delete` (`is_delete`),
  KEY `is_approve` (`is_approve`),
  KEY `prorate_month` (`prorate_month`),
  KEY `claim_id` (`claim_id`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=230 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_dental_attachment`
--

CREATE TABLE `hr__claim_dental_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `journal_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(128) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `journal_id` (`journal_id`),
  KEY `is_delete` (`is_delete`),
  KEY `type` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_dental_journal`
--

CREATE TABLE `hr__claim_dental_journal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `year` int(11) NOT NULL,
  `month` int(11) NOT NULL,
  `invoice_chit` varchar(64) NOT NULL,
  `clinic_name` varchar(64) NOT NULL,
  `amount_charge` float NOT NULL,
  `amount_claim` float NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `is_hod_approved` int(1) NOT NULL,
  `is_approved` int(1) NOT NULL DEFAULT '0',
  `approved_hod_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `claim_id` (`claim_id`),
  KEY `year_month` (`year`,`month`)
) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_entertainment`
--

CREATE TABLE `hr__claim_entertainment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `description` text NOT NULL,
  `year` int(11) NOT NULL,
  `month` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '0 = client, 1 = staff',
  `is_approve` int(1) NOT NULL,
  `is_hod_approve` int(1) NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=231 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_entertainment_attachment`
--

CREATE TABLE `hr__claim_entertainment_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_entertainment_id` int(11) NOT NULL,
  `attachment_name` varchar(255) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(255) NOT NULL,
  `location` varchar(255) NOT NULL,
  `unique_id` varchar(255) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=259 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_excess_baggage`
--

CREATE TABLE `hr__claim_excess_baggage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `is_admin_approve` int(1) NOT NULL,
  `is_hod_approve` int(1) NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_excess_baggage_attachment`
--

CREATE TABLE `hr__claim_excess_baggage_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_excess_baggage_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_excess_baggage_movement`
--

CREATE TABLE `hr__claim_excess_baggage_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `movement_id` int(11) NOT NULL,
  `claim_excess_baggage_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_firm_event`
--

CREATE TABLE `hr__claim_firm_event` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `date_event` date NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_firm_event_attachment`
--

CREATE TABLE `hr__claim_firm_event_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `firm_event_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_forex_attachment`
--

CREATE TABLE `hr__claim_forex_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_forex_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_forex_loss`
--

CREATE TABLE `hr__claim_forex_loss` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `is_admin_approve` int(1) NOT NULL,
  `is_hod_approve` int(1) NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_forex_movement`
--

CREATE TABLE `hr__claim_forex_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_forex_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_hospitalization`
--

CREATE TABLE `hr__claim_hospitalization` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `invoice_chit` varchar(64) NOT NULL,
  `clinic_name` varchar(144) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `treatment` varchar(64) NOT NULL,
  `day_warded` int(11) NOT NULL,
  `payment_method` int(1) NOT NULL,
  `room_package_id` int(11) NOT NULL,
  `room_amount` double NOT NULL,
  `amount_charge` float NOT NULL,
  `amount_claim` float NOT NULL,
  `is_approve` int(1) NOT NULL DEFAULT '0' COMMENT ' 0 = pending, 1= approve, 2 = rejected',
  `amount_approved` float NOT NULL,
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `approved_hod_by` int(11) DEFAULT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_hospitalization_attachment`
--

CREATE TABLE `hr__claim_hospitalization_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `hospitalization_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(128) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_laundry`
--

CREATE TABLE `hr__claim_laundry` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date_from` date NOT NULL,
  `date_to` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `is_admin_approve` int(1) NOT NULL DEFAULT '0',
  `is_hod_approve` int(1) NOT NULL DEFAULT '0',
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_laundry_attachment`
--

CREATE TABLE `hr__claim_laundry_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_laundry_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_laundry_movement`
--

CREATE TABLE `hr__claim_laundry_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_laundry_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_meal_attachment`
--

CREATE TABLE `hr__claim_meal_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `meal_claim_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_meals`
--

CREATE TABLE `hr__claim_meals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `restaurant_name` varchar(128) NOT NULL,
  `amount_charge` float NOT NULL,
  `amount_claim` float NOT NULL,
  `is_approve` int(1) NOT NULL,
  `amount_approved` float NOT NULL,
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0',
  `approved_hod_by` int(11) DEFAULT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4193 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_meals_movement`
--

CREATE TABLE `hr__claim_meals_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `meals_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3629 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_medical_screening`
--

CREATE TABLE `hr__claim_medical_screening` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `invoice_chit` varchar(64) NOT NULL,
  `clinic_name` varchar(64) NOT NULL,
  `amount_charge` float NOT NULL,
  `amount_claim` float NOT NULL,
  `is_approve` int(1) NOT NULL COMMENT '0 = pending , 1 = approve, 2 = rejected',
  `amount_approved` float NOT NULL,
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0',
  `approved_hod_by` int(11) DEFAULT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_medical_screening_attachment`
--

CREATE TABLE `hr__claim_medical_screening_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `medical_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(128) NOT NULL,
  `type` varchar(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_mileage`
--

CREATE TABLE `hr__claim_mileage` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `transport` int(1) NOT NULL,
  `distance` float NOT NULL,
  `description` text NOT NULL,
  `is_approve` int(1) NOT NULL,
  `amount_claim` float NOT NULL,
  `amount_approve` float NOT NULL DEFAULT '0',
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0',
  `approved_hod_by` int(11) DEFAULT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_mileage_attachment`
--

CREATE TABLE `hr__claim_mileage_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mileage_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` varchar(128) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `mileage_id` (`mileage_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_others`
--

CREATE TABLE `hr__claim_others` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `client_id` int(11) NOT NULL,
  `description` text NOT NULL,
  `amount_charge` float NOT NULL,
  `amount_claim` float NOT NULL,
  `is_approve` int(1) NOT NULL,
  `amount_approved` float NOT NULL,
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0',
  `approved_hod_by` int(11) DEFAULT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=355 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_others_attachment`
--

CREATE TABLE `hr__claim_others_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `other_claim_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=588 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_outpatient`
--

CREATE TABLE `hr__claim_outpatient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `journal_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `prorate_month` int(11) NOT NULL,
  `invoice_chit` varchar(64) NOT NULL,
  `clinic_id` varchar(64) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `patient_name` varchar(144) NOT NULL COMMENT '1 = self , 2 = child, 3 = spouse',
  `relation` int(1) NOT NULL,
  `treatment` varchar(64) NOT NULL,
  `amount_charge` float NOT NULL,
  `amount_claim` float NOT NULL,
  `is_medical` int(1) NOT NULL DEFAULT '0' COMMENT '0 = false, 1 = true',
  `is_approve` int(1) NOT NULL DEFAULT '0' COMMENT '0 = pending , 1 = approve, 2 = rejected',
  `amount_approved` float NOT NULL,
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0',
  `approved_hod_by` int(11) DEFAULT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `delete_by` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `claim_id` (`claim_id`),
  KEY `journal_id` (`journal_id`),
  KEY `prorate_month` (`prorate_month`),
  KEY `patient_id` (`patient_id`),
  KEY `is_delete` (`is_delete`),
  KEY `date_d` (`date`)
) ENGINE=InnoDB AUTO_INCREMENT=279 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_outpatient_attachment`
--

CREATE TABLE `hr__claim_outpatient_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `journal_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(128) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_outpatient_journal`
--

CREATE TABLE `hr__claim_outpatient_journal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `year` int(11) NOT NULL,
  `month` int(11) NOT NULL,
  `claim_id` int(11) NOT NULL,
  `invoice_chit` varchar(164) NOT NULL,
  `clinic_name` varchar(164) NOT NULL,
  `treatment` varchar(164) NOT NULL,
  `patient_name` varchar(164) NOT NULL,
  `relation` varchar(164) NOT NULL,
  `amount_claim` float NOT NULL,
  `amount_charge` float NOT NULL,
  `is_delete` int(1) NOT NULL,
  `is_approve` int(1) NOT NULL DEFAULT '0',
  `is_hod_approved` int(1) NOT NULL DEFAULT '0',
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `approved_hod_by` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=170 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_panel_attachment`
--

CREATE TABLE `hr__claim_panel_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_panel_id` int(11) NOT NULL,
  `attachment_name` varchar(128) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(128) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_panel_clinic`
--

CREATE TABLE `hr__claim_panel_clinic` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `panel_id` int(11) NOT NULL,
  `invoice_chit` varchar(144) NOT NULL,
  `invoice_month` int(11) NOT NULL,
  `invoice_year` int(11) NOT NULL,
  `status` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `deleted_by` int(11) NOT NULL,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `panel_id` (`panel_id`),
  KEY `year_month` (`invoice_month`,`invoice_year`),
  KEY `is_delete` (`is_delete`),
  KEY `is_delete_2` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_panel_clinic_detail`
--

CREATE TABLE `hr__claim_panel_clinic_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `panel_claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `claim_type_id` int(11) NOT NULL,
  `staff_id` int(11) NOT NULL,
  `employee_name` varchar(144) NOT NULL,
  `patient_name` varchar(144) NOT NULL,
  `relation` int(1) DEFAULT NULL,
  `employee_ic_no` varchar(144) NOT NULL,
  `patient_ic_no` varchar(144) NOT NULL,
  `treatment` varchar(144) NOT NULL,
  `amount` float NOT NULL,
  `is_delete` int(1) NOT NULL,
  `deleted_by` int(11) NOT NULL,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `panel_claim_id` (`panel_claim_id`),
  KEY `claim_type_id` (`claim_type_id`),
  KEY `staff_id` (`staff_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=280 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_parking`
--

CREATE TABLE `hr__claim_parking` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `user_id` int(11) NOT NULL,
  `is_admin_approve` int(1) NOT NULL DEFAULT '0',
  `is_hod_approve` int(1) NOT NULL DEFAULT '0',
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=986 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_parking_attachment`
--

CREATE TABLE `hr__claim_parking_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_parking_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1038 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_parking_movement`
--

CREATE TABLE `hr__claim_parking_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_parking_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `movement_id` (`movement_id`),
  KEY `claim_parking_id` (`claim_parking_id`),
  KEY `movement_id_2` (`movement_id`),
  KEY `claim_parking_id_2` (`claim_parking_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1180 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_petrol`
--

CREATE TABLE `hr__claim_petrol` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date_from` date NOT NULL,
  `date_to` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `is_admin_approve` int(1) NOT NULL,
  `is_hod_approve` int(1) NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_petrol_attachment`
--

CREATE TABLE `hr__claim_petrol_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_petrol_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_petrol_movement`
--

CREATE TABLE `hr__claim_petrol_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_petrol_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `movement_id` (`movement_id`),
  KEY `claim_petrol_id` (`claim_petrol_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `movement_id_2` (`movement_id`),
  KEY `claim_petrol_id_2` (`claim_petrol_id`)
) ENGINE=InnoDB AUTO_INCREMENT=315 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_subsistence`
--

CREATE TABLE `hr__claim_subsistence` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date_from` date NOT NULL,
  `date_to` date NOT NULL,
  `location` varchar(144) NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `is_admin_approved` int(1) NOT NULL,
  `is_hod_approved` int(1) NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `type` int(11) NOT NULL,
  `allowance` varchar(144) NOT NULL,
  `is_delete` int(11) NOT NULL,
  `delete_by` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=898 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_subsistence_movement`
--

CREATE TABLE `hr__claim_subsistence_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_subsistence_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `movement_id` (`movement_id`),
  KEY `claim_subsistence_id` (`claim_subsistence_id`),
  KEY `movement_id_2` (`movement_id`),
  KEY `claim_subsistence_id_2` (`claim_subsistence_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3389 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_toll`
--

CREATE TABLE `hr__claim_toll` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `user_id` int(11) NOT NULL,
  `is_admin_approve` int(1) NOT NULL,
  `is_hod_approve` int(1) NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1689 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_toll_attachment`
--

CREATE TABLE `hr__claim_toll_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_toll_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1928 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_toll_movement`
--

CREATE TABLE `hr__claim_toll_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_toll_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `movement_id` (`movement_id`),
  KEY `claim_toll_id` (`claim_toll_id`),
  KEY `movement_id_2` (`movement_id`),
  KEY `claim_toll_id_2` (`claim_toll_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2032 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_trainer`
--

CREATE TABLE `hr__claim_trainer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `start_at` time NOT NULL,
  `end_at` time NOT NULL,
  `title` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `movements` text,
  `amount` float NOT NULL,
  `amount_approved` float NOT NULL,
  `is_admin_approve` int(11) NOT NULL,
  `is_hod_approve` int(11) NOT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_trainer_attachment`
--

CREATE TABLE `hr__claim_trainer_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_trainer_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_transportation`
--

CREATE TABLE `hr__claim_transportation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `transportation_id` int(11) NOT NULL,
  `amount` double NOT NULL,
  `amount_approved` float NOT NULL,
  `description` varchar(144) NOT NULL,
  `is_hod_approved` int(11) NOT NULL,
  `is_admin_approved` int(11) NOT NULL,
  `hod_remarks` text NOT NULL,
  `admin_remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL,
  `delete_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=291 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_transportation_attachment`
--

CREATE TABLE `hr__claim_transportation_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_transportation_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=326 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_transportation_movement`
--

CREATE TABLE `hr__claim_transportation_movement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_transportation_id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=413 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_travelling`
--

CREATE TABLE `hr__claim_travelling` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_id` int(11) NOT NULL,
  `travelling_date` date NOT NULL,
  `client` int(11) DEFAULT NULL,
  `task` text NOT NULL,
  `mileage_amount` float NOT NULL DEFAULT '0',
  `zone` int(11) NOT NULL DEFAULT '0' COMMENT '0=within office teritory,1=within office zone,2=west/east malaysia, 3=over sea',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '0=draft,1=approve,2=rejected',
  `mileage_amount_approved` float NOT NULL DEFAULT '0',
  `amount_approve` float NOT NULL,
  `approved_date` date NOT NULL,
  `approved_by` int(11) NOT NULL,
  `remarks` text NOT NULL,
  `hod_remarks` varchar(144) NOT NULL,
  `admin_remarks` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `is_hod_approved` int(11) NOT NULL DEFAULT '0',
  `approved_hod_by` int(11) DEFAULT NULL,
  `update_by` int(11) NOT NULL,
  `update_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `claim_id` (`claim_id`),
  KEY `is_delete_2` (`is_delete`),
  KEY `claim_id_2` (`claim_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4446 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_travelling_attachment`
--

CREATE TABLE `hr__claim_travelling_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `travelling_id` int(11) NOT NULL,
  `attachment_name` varchar(255) NOT NULL,
  `file_type` varchar(128) NOT NULL,
  `file_ext` varchar(128) NOT NULL,
  `description` varchar(255) NOT NULL,
  `location` varchar(255) NOT NULL,
  `unique_id` varchar(255) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=159 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_travelling_detail`
--

CREATE TABLE `hr__claim_travelling_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `claim_travelling_id` int(11) NOT NULL,
  `claim_type_detail_id` int(11) NOT NULL,
  `item_name` varchar(64) NOT NULL,
  `measurement` decimal(8,2) NOT NULL,
  `unit` varchar(16) NOT NULL,
  `amount` decimal(8,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `claim_travelling_id` (`claim_travelling_id`),
  KEY `claim_travelling_id_2` (`claim_travelling_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_travelling_rate`
--

CREATE TABLE `hr__claim_travelling_rate` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type_id` int(11) NOT NULL,
  `type` varchar(64) NOT NULL,
  `rate_amount` float NOT NULL,
  `rate_km` int(11) NOT NULL,
  `sequence` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__claim_travelling_route`
--

CREATE TABLE `hr__claim_travelling_route` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `travel_id` int(11) NOT NULL,
  `from` text NOT NULL,
  `to` text NOT NULL,
  `distance` float NOT NULL,
  `vehicle_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8823 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd`
--

CREATE TABLE `hr__cpd` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `year` int(11) NOT NULL,
  `staff_id` int(11) NOT NULL,
  `st_target` decimal(10,0) NOT NULL,
  `sn_target` decimal(10,0) NOT NULL,
  `ut_target` decimal(10,0) NOT NULL,
  `un_target` decimal(10,0) NOT NULL,
  `total_target` decimal(6,2) NOT NULL,
  `total_earn` decimal(6,2) NOT NULL,
  `comply_level` int(11) NOT NULL DEFAULT '1' COMMENT '0 = comply , 1 = not comply , 2 = exempted',
  `obligation_level` int(11) NOT NULL,
  `comply_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_by` int(11) NOT NULL,
  `is_declare` int(11) NOT NULL DEFAULT '0',
  `is_delete` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1224 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_attachment`
--

CREATE TABLE `hr__cpd_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `earn_id` int(11) NOT NULL,
  `attachment` varchar(128) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `description` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `unique_id` varchar(144) NOT NULL,
  `type` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=868 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_category`
--

CREATE TABLE `hr__cpd_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(164) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_earn_category`
--

CREATE TABLE `hr__cpd_earn_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cpd_earn_detail_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_earn_detail`
--

CREATE TABLE `hr__cpd_earn_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cpd_id` int(11) NOT NULL,
  `cpd_type_id` varchar(11) NOT NULL,
  `earn_cpd_hour` decimal(6,2) NOT NULL,
  `title` varchar(128) NOT NULL,
  `topic` varchar(128) NOT NULL,
  `organizer_id` int(11) NOT NULL,
  `date_from` date NOT NULL,
  `date_end` date NOT NULL,
  `cost` decimal(10,0) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11349 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_earn_detail_category`
--

CREATE TABLE `hr__cpd_earn_detail_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cpd_earn_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7562 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_event_participant`
--

CREATE TABLE `hr__cpd_event_participant` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cpd_event_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6435 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_events`
--

CREATE TABLE `hr__cpd_events` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cpd_type_id` varchar(164) NOT NULL,
  `event_title` varchar(144) NOT NULL,
  `date_from` date NOT NULL,
  `date_to` date NOT NULL,
  `category_ids` varchar(144) NOT NULL,
  `topic` varchar(144) NOT NULL,
  `organiser` int(11) NOT NULL,
  `duration` double NOT NULL,
  `cost` double NOT NULL,
  `is_qr_valid` int(11) NOT NULL DEFAULT '0',
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=240 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_organizer`
--

CREATE TABLE `hr__cpd_organizer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `organizer` varchar(128) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_submission`
--

CREATE TABLE `hr__cpd_submission` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cpd_id` int(11) NOT NULL,
  `month_submission` int(11) NOT NULL,
  `year_submission` int(11) NOT NULL,
  `is_submit` int(1) NOT NULL DEFAULT '0',
  `submit_at` timestamp NULL DEFAULT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `delete_at` timestamp NULL DEFAULT NULL,
  `delete_by` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=466 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__cpd_target_detail`
--

CREATE TABLE `hr__cpd_target_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cpd_parent_id` int(11) NOT NULL,
  `target_type_id` int(11) NOT NULL,
  `target_cpd` decimal(6,2) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__form`
--

CREATE TABLE `hr__form` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `department_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `code` varchar(8) NOT NULL,
  `title` varchar(128) NOT NULL,
  `description` varchar(128) NOT NULL,
  `file_location` varchar(128) NOT NULL,
  `file_name` varchar(128) NOT NULL,
  `file_format` varchar(128) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  `table_name` varchar(32) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_allocation`
--

CREATE TABLE `hr__leave_allocation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `entitlement_id` int(11) NOT NULL,
  `year` year(4) NOT NULL,
  `date_from` date DEFAULT NULL,
  `date_to` date DEFAULT NULL,
  `type_id` int(11) NOT NULL,
  `leave_taken` decimal(6,1) NOT NULL,
  `balance_entitled` decimal(6,1) NOT NULL,
  `leave_balance` decimal(6,1) NOT NULL COMMENT 'brought from last  year',
  `bring_forward_entitled` decimal(6,1) NOT NULL COMMENT 'if brought forward > last year entt/2',
  `bring_forward` decimal(6,1) NOT NULL COMMENT 'brought from balance last  year',
  `leave_entitled` decimal(6,1) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` int(2) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `year` (`year`),
  KEY `type_id` (`type_id`),
  KEY `is_delete` (`is_delete`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4768 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_allocation_20181228`
--

CREATE TABLE `hr__leave_allocation_20181228` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `peopleID` int(11) NOT NULL,
  `entitlementID` int(11) NOT NULL,
  `allocationType` varchar(32) NOT NULL,
  `year` year(4) NOT NULL,
  `leaveTypeID` int(11) NOT NULL,
  `leaveTaken` decimal(6,1) NOT NULL,
  `balanceEntitled` decimal(6,1) NOT NULL,
  `leaveBalance` decimal(6,1) NOT NULL,
  `bringForwardEntitled` decimal(6,1) NOT NULL,
  `bringForward` decimal(6,1) NOT NULL,
  `leaveEntitled` decimal(6,1) NOT NULL,
  `is_delete` int(2) NOT NULL DEFAULT '0',
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=689 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_allocation_20190107`
--

CREATE TABLE `hr__leave_allocation_20190107` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `entitlement_id` int(11) NOT NULL,
  `year` year(4) NOT NULL,
  `date_from` date DEFAULT NULL,
  `date_to` date DEFAULT NULL,
  `type_id` int(11) NOT NULL,
  `leave_taken` decimal(6,1) NOT NULL,
  `balance_entitled` decimal(6,1) NOT NULL,
  `leave_balance` decimal(6,1) NOT NULL,
  `bring_forward_entitled` decimal(6,1) NOT NULL,
  `bring_forward` decimal(6,1) NOT NULL,
  `leave_entitled` decimal(6,1) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` int(2) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2310 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_allocation_20210108`
--

CREATE TABLE `hr__leave_allocation_20210108` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `entitlement_id` int(11) NOT NULL,
  `year` year(4) NOT NULL,
  `date_from` date DEFAULT NULL,
  `date_to` date DEFAULT NULL,
  `type_id` int(11) NOT NULL,
  `leave_taken` decimal(6,1) NOT NULL,
  `balance_entitled` decimal(6,1) NOT NULL,
  `leave_balance` decimal(6,1) NOT NULL,
  `bring_forward_entitled` decimal(6,1) NOT NULL,
  `bring_forward` decimal(6,1) NOT NULL,
  `leave_entitled` decimal(6,1) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` int(2) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `year` (`year`),
  KEY `type_id` (`type_id`),
  KEY `is_delete` (`is_delete`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4709 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_allocation_request`
--

CREATE TABLE `hr__leave_allocation_request` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `type_id` int(11) NOT NULL,
  `year` year(4) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '0 = pending, 1 = approved',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_application`
--

CREATE TABLE `hr__leave_application` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `department_id` int(11) NOT NULL,
  `type_id` int(11) NOT NULL,
  `date_from` date NOT NULL,
  `date_to` date NOT NULL,
  `days_applied` decimal(8,1) NOT NULL,
  `period_from_id` int(11) NOT NULL,
  `period_to_id` int(11) NOT NULL DEFAULT '1',
  `reason` text NOT NULL,
  `remarks` text NOT NULL,
  `absent_contact` varchar(32) NOT NULL,
  `absent_address` text NOT NULL,
  `absent_relief_id` int(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '1' COMMENT '1=pending,2=approved,3=rejected,4=cancel,5=change',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `approved_by` int(11) NOT NULL,
  `approved_ts` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `period_from_to` (`period_from_id`,`period_to_id`),
  KEY `status` (`status`),
  KEY `department` (`department_id`),
  KEY `date_from` (`date_from`),
  KEY `absent_reliefe_id` (`absent_relief_id`),
  KEY `user_id` (`user_id`),
  KEY `date_to` (`date_to`)
) ENGINE=InnoDB AUTO_INCREMENT=6119 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_application_20181228`
--

CREATE TABLE `hr__leave_application_20181228` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `peopleID` int(11) NOT NULL,
  `departmentID` int(11) NOT NULL,
  `dateFrom` date NOT NULL,
  `dateTo` date NOT NULL,
  `noOfDay` decimal(8,1) NOT NULL,
  `leavePeriod` int(11) NOT NULL,
  `leavePeriodValue` decimal(8,1) NOT NULL,
  `dateApply` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `leaveTypeID` int(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '1' COMMENT '1=pending,2=approved,3=rejected,4=cancel,5=change',
  `approvedBy` int(11) NOT NULL,
  `approvedDate` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `reason` text NOT NULL,
  `remarks` text NOT NULL,
  `absentContact` varchar(32) NOT NULL,
  `absentAddress` text NOT NULL,
  `absentReliefID` int(11) NOT NULL,
  `leaveApplied` decimal(6,1) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=466 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_application_20190107`
--

CREATE TABLE `hr__leave_application_20190107` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `department_id` int(11) NOT NULL,
  `type_id` int(11) NOT NULL,
  `date_from` date NOT NULL,
  `date_to` date NOT NULL,
  `days_applied` decimal(8,1) NOT NULL,
  `period_from_id` int(11) NOT NULL,
  `period_to_id` int(11) NOT NULL,
  `reason` text NOT NULL,
  `remarks` text NOT NULL,
  `absent_contact` varchar(32) NOT NULL,
  `absent_address` text NOT NULL,
  `absent_relief_id` int(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '1' COMMENT '1=pending,2=approved,3=rejected,4=cancel,5=change',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `approved_by` int(11) NOT NULL,
  `approved_ts` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2107 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_attachment`
--

CREATE TABLE `hr__leave_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `application_id` int(11) NOT NULL,
  `file_name` varchar(128) NOT NULL,
  `file_location` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` int(2) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `applicationid` (`application_id`)
) ENGINE=InnoDB AUTO_INCREMENT=861 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_attachment_20181228`
--

CREATE TABLE `hr__leave_attachment_20181228` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `peopleID` int(11) NOT NULL,
  `leaveApplicationID` int(11) NOT NULL,
  `attachment` varchar(128) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` int(2) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_entitlement`
--

CREATE TABLE `hr__leave_entitlement` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `year` year(4) NOT NULL,
  `type_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `min_month_of_service` decimal(6,1) NOT NULL,
  `month_of_service_add_leave` decimal(6,1) NOT NULL,
  `additional_leave` decimal(6,1) NOT NULL,
  `max_entitlement` decimal(6,1) NOT NULL,
  `bring_forward_percentage` decimal(6,1) NOT NULL,
  `entitled_leave` decimal(6,1) NOT NULL,
  `remarks` text NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_entitlement_20181228`
--

CREATE TABLE `hr__leave_entitlement_20181228` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `year` year(4) NOT NULL,
  `leaveTypeID` int(11) NOT NULL,
  `minMonthOfService` decimal(6,1) NOT NULL,
  `monthOfServiceAddLeave` decimal(6,1) NOT NULL,
  `additionalLeave` decimal(6,1) NOT NULL,
  `maxEntitlementPerYear` decimal(6,1) NOT NULL,
  `bringForwardByPercent` decimal(6,1) NOT NULL,
  `bringForwardByYear` decimal(6,1) NOT NULL,
  `entitledLeave` decimal(6,1) NOT NULL,
  `remarks` text NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `categoryID` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_transaction`
--

CREATE TABLE `hr__leave_transaction` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `allocation_id` int(11) NOT NULL,
  `application_id` int(11) NOT NULL,
  `leave_applied` decimal(6,1) NOT NULL,
  `bring_forward_applied` decimal(6,1) NOT NULL DEFAULT '0.0',
  `function` varchar(128) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4803 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_type`
--

CREATE TABLE `hr__leave_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(2) NOT NULL,
  `name` varchar(32) NOT NULL,
  `description` text NOT NULL,
  `colour` varchar(16) NOT NULL,
  `include_holiday` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = not included, 1 = included',
  `is_fixed` tinyint(1) NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '1',
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__leave_type_20181228`
--

CREATE TABLE `hr__leave_type_20181228` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(2) NOT NULL,
  `name` varchar(32) NOT NULL,
  `description` text NOT NULL,
  `colour` varchar(16) NOT NULL,
  `is_fixed` tinyint(1) NOT NULL COMMENT '0 = no, 1 = yes',
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__movement_group`
--

CREATE TABLE `hr__movement_group` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customerid` int(11) NOT NULL,
  `date` date NOT NULL,
  `description` text NOT NULL,
  `destination` text NOT NULL,
  `department_id` int(11) NOT NULL,
  `movementType` int(11) NOT NULL,
  `parentCopyid` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `status` smallint(6) NOT NULL DEFAULT '0',
  `update_status_by` int(11) DEFAULT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  `delete_by` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `customerid` (`customerid`),
  KEY `createdby` (`created_by`),
  KEY `movement_type` (`movementType`),
  KEY `department_id` (`department_id`),
  KEY `is_delete` (`is_delete`),
  KEY `date` (`date`)
) ENGINE=InnoDB AUTO_INCREMENT=11443 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__movement_group_detail`
--

CREATE TABLE `hr__movement_group_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `groupid` int(11) NOT NULL,
  `staffid` int(11) NOT NULL,
  `timeOut` time NOT NULL,
  `timeIn` time NOT NULL,
  PRIMARY KEY (`id`),
  KEY `groupid` (`groupid`),
  KEY `staffid` (`staffid`)
) ENGINE=InnoDB AUTO_INCREMENT=23386 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__movement_group_replacement_detail`
--

CREATE TABLE `hr__movement_group_replacement_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `time_out` time NOT NULL,
  `time_in` time NOT NULL,
  PRIMARY KEY (`id`),
  KEY `group_id` (`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11413 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__movement_type`
--

CREATE TABLE `hr__movement_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `movementType` varchar(32) NOT NULL,
  `color_code` varchar(7) NOT NULL,
  `seq` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ot`
--

CREATE TABLE `hr__ot` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `peopleID` int(11) NOT NULL,
  `year` int(11) NOT NULL,
  `month` int(11) NOT NULL,
  `totalHoursApplied` decimal(8,1) NOT NULL,
  `totalHoursApproved` decimal(8,1) NOT NULL,
  `totalClaim` decimal(10,2) NOT NULL COMMENT 'RM',
  `totalConvertToLeave` decimal(6,1) NOT NULL,
  `balanceCarryForward` decimal(6,1) NOT NULL,
  `claim_status` int(11) NOT NULL COMMENT 'pending = 0, submitted = 1, verified = 2',
  `paid_status` int(11) NOT NULL COMMENT 'unpaid = 0, paid = 1',
  `remarks` text NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `submitTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=1171 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ot__detail`
--

CREATE TABLE `hr__ot__detail` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `otID` int(11) NOT NULL,
  `peopleID` int(11) NOT NULL,
  `otDate` date NOT NULL,
  `dayType` int(11) NOT NULL,
  `clientID` int(11) NOT NULL,
  `crossDept` int(11) NOT NULL COMMENT 'Yes = 1, No = 0',
  `svID` int(11) NOT NULL,
  `svDeptID` int(11) NOT NULL,
  `task` varchar(128) NOT NULL,
  `mealAllowance` int(11) NOT NULL,
  `startTime` time NOT NULL,
  `endTime` time NOT NULL,
  `refreshment` int(11) NOT NULL COMMENT 'in minutes',
  `totalHoursApplied` decimal(8,1) NOT NULL,
  `status` int(11) NOT NULL COMMENT 'pending = 0, approved = 1, rejected = 2',
  `status_by` int(11) NOT NULL,
  `remarks` text NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `createdBy` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `updatedBy` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `ot_id` (`otID`),
  KEY `status` (`status`),
  KEY `is_delete` (`is_delete`),
  KEY `day_type` (`dayType`)
) ENGINE=InnoDB AUTO_INCREMENT=8034 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__payslip`
--

CREATE TABLE `hr__payslip` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uploadID` int(11) NOT NULL,
  `year` int(4) NOT NULL,
  `month` int(2) NOT NULL,
  `companyID` int(11) NOT NULL,
  `company_name` varchar(144) NOT NULL,
  `company_address` varchar(144) NOT NULL,
  `company_postcode` varchar(144) NOT NULL,
  `company_city` varchar(144) NOT NULL,
  `company_state` varchar(144) NOT NULL,
  `company_country` varchar(144) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `employeeID` varchar(16) NOT NULL,
  `employeeIC` varchar(16) NOT NULL,
  `employeeName` varchar(128) NOT NULL,
  `position` varchar(32) NOT NULL,
  `department` varchar(32) NOT NULL,
  `grossPay` decimal(8,2) NOT NULL,
  `totalDeduction` decimal(8,2) NOT NULL,
  `netPay` decimal(8,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7662 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__payslip_deduction`
--

CREATE TABLE `hr__payslip_deduction` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `paySlipID` int(11) NOT NULL,
  `deductionID` int(11) NOT NULL,
  `description` varchar(64) NOT NULL,
  `amount` decimal(8,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26113 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__payslip_employer_contribution`
--

CREATE TABLE `hr__payslip_employer_contribution` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `paySlipID` int(11) NOT NULL,
  `contributionID` int(11) NOT NULL,
  `description` varchar(64) NOT NULL,
  `amount` decimal(8,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17052 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__payslip_pay`
--

CREATE TABLE `hr__payslip_pay` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `paySlipID` int(11) NOT NULL,
  `payID` int(11) NOT NULL,
  `description` varchar(64) NOT NULL,
  `amount` decimal(8,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21207 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__payslip_upload`
--

CREATE TABLE `hr__payslip_upload` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `companyID` int(11) NOT NULL,
  `total_record` int(11) NOT NULL,
  `total_netpay` decimal(9,2) NOT NULL,
  `year` int(4) NOT NULL,
  `month` int(2) NOT NULL,
  `uploadedBy` int(11) NOT NULL,
  `uploadedTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=405 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__policy`
--

CREATE TABLE `hr__policy` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category_id` int(11) NOT NULL,
  `code` varchar(8) NOT NULL,
  `title` varchar(128) NOT NULL,
  `description` varchar(128) NOT NULL,
  `file_location` varchar(128) NOT NULL,
  `file_name` varchar(128) NOT NULL,
  `file_format` varchar(128) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__policyprocedure_category`
--

CREATE TABLE `hr__policyprocedure_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) NOT NULL DEFAULT '0',
  `category` varchar(64) NOT NULL,
  `description` varchar(128) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref`
--

CREATE TABLE `hr__ref` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(8) NOT NULL,
  `description` varchar(128) NOT NULL,
  `colName` varchar(32) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref_claim_call_type`
--

CREATE TABLE `hr__ref_claim_call_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(144) NOT NULL,
  `duration_per_minutes` int(11) NOT NULL,
  `limit_per_day` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref_claim_traveling_zone_claim_type`
--

CREATE TABLE `hr__ref_claim_traveling_zone_claim_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `zone_id` int(11) NOT NULL,
  `type_id` int(11) NOT NULL,
  `seq` int(11) NOT NULL,
  `param` text NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref_claim_travelling_vehicle`
--

CREATE TABLE `hr__ref_claim_travelling_vehicle` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(64) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref_claim_travelling_zone`
--

CREATE TABLE `hr__ref_claim_travelling_zone` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `zone` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref_leave_period`
--

CREATE TABLE `hr__ref_leave_period` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL,
  `value` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref_leave_status`
--

CREATE TABLE `hr__ref_leave_status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__ref_policyprocedure_type`
--

CREATE TABLE `hr__ref_policyprocedure_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(64) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Table structure for table `hr__tnc`
--

CREATE TABLE `hr__tnc` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category_id` int(11) NOT NULL,
  `title` varchar(128) NOT NULL,
  `description` varchar(128) NOT NULL,
  `file_location` varchar(128) NOT NULL,
  `file_name` varchar(128) NOT NULL,
  `file_format` varchar(128) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__attachment`
--

CREATE TABLE `kbs__attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `document_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `file_type` varchar(64) NOT NULL,
  `format` varchar(255) NOT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_location` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__box`
--

CREATE TABLE `kbs__box` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `rack_id` int(11) NOT NULL,
  `box_no` varchar(32) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `purchased_date` date DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `rack` (`rack_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=4429 DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__company`
--

CREATE TABLE `kbs__company` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL,
  `profile` text NOT NULL,
  `roc_no` varchar(32) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  `crm_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `crm_id` (`crm_id`),
  KEY `is_delete_2` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=869 DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__document`
--

CREATE TABLE `kbs__document` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `box_id` int(11) NOT NULL,
  `company_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `document_date` date NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '0 = available, 1 = on loan, 2 = archived',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `box` (`box_id`),
  KEY `is_delete` (`is_delete`),
  KEY `company` (`company_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=3362 DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__document_backup`
--

CREATE TABLE `kbs__document_backup` (
  `id` int(11) NOT NULL DEFAULT '0',
  `box_id` int(11) NOT NULL,
  `company_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `document_date` date NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '0 = available, 1 = on loan, 2 = archived',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__rack`
--

CREATE TABLE `kbs__rack` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `room_id` int(11) NOT NULL,
  `dept_id` int(11) NOT NULL,
  `code` varchar(255) NOT NULL,
  `allocated_box_count` int(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `room` (`room_id`),
  KEY `department` (`dept_id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__room`
--

CREATE TABLE `kbs__room` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type_id` int(11) NOT NULL,
  `location_branch_id` int(11) NOT NULL,
  `dept_id` int(11) DEFAULT NULL,
  `code` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;

--
-- Table structure for table `kbs__room_type`
--

CREATE TABLE `kbs__room_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(255) NOT NULL,
  `status` tinyint(1) DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Table structure for table `mobile__login`
--

CREATE TABLE `mobile__login` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `token` varchar(255) NOT NULL,
  `login_ts` timestamp NULL DEFAULT NULL,
  `logout_ts` timestamp NULL DEFAULT NULL,
  `logout_by` varchar(255) DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `device_os` varchar(255) NOT NULL,
  `device_info` varchar(255) DEFAULT NULL,
  `update_ts` timestamp NULL DEFAULT NULL,
  `apps_ver` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `verify` (`token`,`user_id`,`is_delete`),
  KEY `checking` (`user_id`,`is_delete`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `module`
--

CREATE TABLE `module` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `name` varchar(64) NOT NULL,
  `module_location` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `icon` varchar(64) NOT NULL,
  `background_color` varchar(64) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `status` (`status`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

--
-- Table structure for table `module__link`
--

CREATE TABLE `module__link` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) NOT NULL,
  `module_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `link` varchar(255) NOT NULL,
  `description` text,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `project`
--

CREATE TABLE `project` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `projectManager` varchar(128) NOT NULL,
  `startDate` date NOT NULL,
  `endDate` date NOT NULL,
  `status` varchar(32) NOT NULL,
  `totalBudget` decimal(9,2) NOT NULL,
  `estimateValue` decimal(9,2) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `report__center`
--

CREATE TABLE `report__center` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) NOT NULL,
  `report_name` varchar(128) NOT NULL,
  `view_name` varchar(128) NOT NULL,
  `link` varchar(128) NOT NULL,
  `is_close` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL,
  `createdBY` int(11) NOT NULL,
  `createdTS` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedBY` int(11) NOT NULL,
  `updatedTS` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1;

--
-- Temporary table structure for view `report__employee_profiling_by_action`
--

/*!50001 DROP VIEW IF EXISTS `report__employee_profiling_by_action`*/;
/*!50001 CREATE TABLE `report__employee_profiling_by_action` (
  `id` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `department_name` tinyint NOT NULL,
  `department_branch` tinyint NOT NULL,
  `business_entity` tinyint NOT NULL,
  `action_type` tinyint NOT NULL,
  `address_type` tinyint NOT NULL,
  `address` tinyint NOT NULL,
  `address_postcode` tinyint NOT NULL,
  `address_country` tinyint NOT NULL,
  `address_state` tinyint NOT NULL,
  `family_relation` tinyint NOT NULL,
  `family_member` tinyint NOT NULL,
  `family_member_contact_no` tinyint NOT NULL,
  `membership_no` tinyint NOT NULL,
  `membership` tinyint NOT NULL,
  `membership_professional_body` tinyint NOT NULL,
  `membership_certificate` tinyint NOT NULL,
  `license_no` tinyint NOT NULL,
  `license_profession` tinyint NOT NULL,
  `license_register_date` tinyint NOT NULL,
  `license_renewal_date` tinyint NOT NULL,
  `epf_no` tinyint NOT NULL,
  `socso_no` tinyint NOT NULL,
  `income_tax_no` tinyint NOT NULL,
  `pcb_deduction_percentage` tinyint NOT NULL,
  `zakat_deduction_percentage` tinyint NOT NULL,
  `ee_rate_percentage` tinyint NOT NULL,
  `statutory_status` tinyint NOT NULL,
  `statutory_year` tinyint NOT NULL,
  `third_party_payment_start_date` tinyint NOT NULL,
  `third_party_payment_end_date` tinyint NOT NULL,
  `third_party_institution_organisation` tinyint NOT NULL,
  `third_party_payment_status` tinyint NOT NULL,
  `third_party_payment_amount` tinyint NOT NULL,
  `employee_pcb_consideration` tinyint NOT NULL,
  `spouse_pcb_consideration` tinyint NOT NULL,
  `created_at` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `report__employee_update_profiling`
--

/*!50001 DROP VIEW IF EXISTS `report__employee_update_profiling`*/;
/*!50001 CREATE TABLE `report__employee_update_profiling` (
  `ids` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `department_name` tinyint NOT NULL,
  `department_branch` tinyint NOT NULL,
  `business_entity` tinyint NOT NULL,
  `action_type` tinyint NOT NULL,
  `created_at` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `report__employment_detail`
--

/*!50001 DROP VIEW IF EXISTS `report__employment_detail`*/;
/*!50001 CREATE TABLE `report__employment_detail` (
  `id` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `business_entity_ids` tinyint NOT NULL,
  `business_entity` tinyint NOT NULL,
  `department_ids` tinyint NOT NULL,
  `branch_ids` tinyint NOT NULL,
  `department_name` tinyint NOT NULL,
  `department_branch` tinyint NOT NULL,
  `division` tinyint NOT NULL,
  `position` tinyint NOT NULL,
  `employee_grade` tinyint NOT NULL,
  `contract_type` tinyint NOT NULL,
  `employee_group` tinyint NOT NULL,
  `employee_subgroup` tinyint NOT NULL,
  `title` tinyint NOT NULL,
  `date_joined` tinyint NOT NULL,
  `basic_pay` tinyint NOT NULL,
  `effective_date` tinyint NOT NULL,
  `date_termination` tinyint NOT NULL,
  `employmee_status` tinyint NOT NULL,
  `employmee_account_status` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `report__leave_application`
--

/*!50001 DROP VIEW IF EXISTS `report__leave_application`*/;
/*!50001 CREATE TABLE `report__leave_application` (
  `id` tinyint NOT NULL,
  `staffids` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `staff_name` tinyint NOT NULL,
  `department_ids` tinyint NOT NULL,
  `branch_ids` tinyint NOT NULL,
  `department_name` tinyint NOT NULL,
  `branch_name` tinyint NOT NULL,
  `leave_type` tinyint NOT NULL,
  `date_from` tinyint NOT NULL,
  `date_to` tinyint NOT NULL,
  `period_from` tinyint NOT NULL,
  `period_to` tinyint NOT NULL,
  `status` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `report__staff_movement`
--

/*!50001 DROP VIEW IF EXISTS `report__staff_movement`*/;
/*!50001 CREATE TABLE `report__staff_movement` (
  `id` tinyint NOT NULL,
  `staffids` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `staff_name` tinyint NOT NULL,
  `department_ids` tinyint NOT NULL,
  `branch_ids` tinyint NOT NULL,
  `department_name` tinyint NOT NULL,
  `branch_name` tinyint NOT NULL,
  `movement_type` tinyint NOT NULL,
  `customer_ids` tinyint NOT NULL,
  `customer` tinyint NOT NULL,
  `movement_date` tinyint NOT NULL,
  `time_out` tinyint NOT NULL,
  `time_in` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Table structure for table `survey`
--

CREATE TABLE `survey` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(144) NOT NULL,
  `objective` text NOT NULL,
  `startDate` date NOT NULL,
  `endDate` date NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Table structure for table `survey__answers`
--

CREATE TABLE `survey__answers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `survey_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `survey__answers_general`
--

CREATE TABLE `survey__answers_general` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `answer_id` int(11) NOT NULL,
  `question_id` int(11) NOT NULL,
  `type` varchar(144) NOT NULL,
  `answers` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `survey__answers_module`
--

CREATE TABLE `survey__answers_module` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `answer_id` int(11) NOT NULL,
  `module_id` int(11) NOT NULL,
  `question_id` int(11) NOT NULL,
  `type` varchar(144) NOT NULL,
  `answers` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `survey__general_questionnaire`
--

CREATE TABLE `survey__general_questionnaire` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `surveyID` int(11) NOT NULL,
  `question` varchar(144) NOT NULL,
  `instruction` varchar(144) NOT NULL,
  `type` varchar(144) NOT NULL,
  `metadata` text NOT NULL,
  `order` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1;

--
-- Table structure for table `survey__module_questionnaire`
--

CREATE TABLE `survey__module_questionnaire` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `surveyID` int(11) NOT NULL,
  `question` varchar(144) NOT NULL,
  `instruction` varchar(144) NOT NULL,
  `type` varchar(144) NOT NULL,
  `metadata` text NOT NULL,
  `order` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

--
-- Table structure for table `usd_to_myr`
--

CREATE TABLE `usd_to_myr` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `usd` float NOT NULL DEFAULT '1',
  `myr` float NOT NULL,
  `request_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1383 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `staff_id` varchar(5) NOT NULL,
  `ic_no` varchar(16) NOT NULL,
  `name` varchar(128) NOT NULL,
  `title_id` int(11) NOT NULL DEFAULT '0',
  `gender_id` int(11) NOT NULL,
  `email` varchar(128) NOT NULL,
  `email_secondary` varchar(144) NOT NULL,
  `profile` text NOT NULL,
  `marital_status` int(11) NOT NULL COMMENT '0 = single, 1 = married',
  `married_date` date NOT NULL,
  `profile_picture_id` int(11) NOT NULL,
  `phone` varchar(64) NOT NULL,
  `address` text NOT NULL,
  `postcode` varchar(8) NOT NULL,
  `city` varchar(32) NOT NULL,
  `state_id` int(11) NOT NULL,
  `country_id` int(11) NOT NULL,
  `citizen_id` int(11) NOT NULL,
  `race_id` int(11) NOT NULL,
  `religion_id` int(11) NOT NULL,
  `birth_date` date NOT NULL,
  `birth_place` text NOT NULL,
  `residential_id` int(11) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `hobby` varchar(144) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  `religion` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `delete` (`is_delete`),
  KEY `status` (`status`),
  KEY `gender` (`gender_id`),
  KEY `country` (`country_id`),
  KEY `state` (`state_id`),
  KEY `citizen` (`citizen_id`),
  KEY `race` (`race_id`),
  KEY `relegion` (`religion`),
  KEY `name` (`name`),
  KEY `profilepicture` (`profile_picture_id`),
  KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=487 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__academic_qualification`
--

CREATE TABLE `user__academic_qualification` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `level_id` int(11) NOT NULL,
  `program` varchar(144) NOT NULL,
  `institution` varchar(144) NOT NULL,
  `year` year(4) NOT NULL,
  `cgpa` varchar(144) DEFAULT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  `deleted_by` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=589 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__academic_qualification_attachment`
--

CREATE TABLE `user__academic_qualification_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `academic_qualification_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `mask_id` varchar(144) NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=155 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__address`
--

CREATE TABLE `user__address` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '0 = permanent, 1 = temporary,2 = correspondence',
  `address` text NOT NULL,
  `postcode` varchar(8) NOT NULL,
  `city` varchar(32) NOT NULL,
  `state_id` int(11) NOT NULL,
  `country_id` int(11) NOT NULL,
  `contact_no` varchar(11) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  `deleted_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=559 DEFAULT CHARSET=latin1;

--
-- Temporary table structure for view `user__background_detail_incomplete_list`
--

/*!50001 DROP VIEW IF EXISTS `user__background_detail_incomplete_list`*/;
/*!50001 CREATE TABLE `user__background_detail_incomplete_list` (
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `family_info` tinyint NOT NULL,
  `academic_qualification` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Table structure for table `user__bank_detail`
--

CREATE TABLE `user__bank_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `bank_id` int(11) NOT NULL,
  `branch` varchar(144) NOT NULL,
  `acc_no` varchar(144) NOT NULL,
  `status` varchar(144) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=296 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__bank_detail_attachment`
--

CREATE TABLE `user__bank_detail_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `bank_detail_id` int(11) NOT NULL,
  `attachment_name` int(11) NOT NULL,
  `location` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `mask_id` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__basic_pay`
--

CREATE TABLE `user__basic_pay` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `profiling_id` int(11) NOT NULL,
  `scale_group` int(11) NOT NULL,
  `amount` float NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `reason` text NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `deleted_by` int(11) NOT NULL,
  `status` int(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `profilling` (`profiling_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1130 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__case_of_emergency`
--

CREATE TABLE `user__case_of_emergency` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `relation` varchar(32) NOT NULL,
  `phone_no` varchar(64) NOT NULL,
  `email` varchar(128) NOT NULL,
  `address` varchar(128) NOT NULL,
  `is_delete` int(144) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  `deleted_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `profiling_id` (`profiling_id`),
  KEY `user_id` (`user_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=226 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__contract_element`
--

CREATE TABLE `user__contract_element` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) NOT NULL,
  `contract_hiring_type_id` int(1) NOT NULL,
  `duration` int(11) NOT NULL,
  `confirmation` int(11) NOT NULL,
  `confirmation_date` date DEFAULT NULL,
  `probation` int(11) NOT NULL,
  `probation_duration` int(11) NOT NULL COMMENT '0 = days, 1 = week, 2 = months, 3 = years',
  `er_notice` int(11) NOT NULL,
  `er_notice_duration` int(11) NOT NULL COMMENT '0 = days, 1= weeks , 2 = months, 3= year',
  `ee_notice` int(11) NOT NULL,
  `ee_notice_duration` int(11) NOT NULL COMMENT '0 = days, 1= weeks , 2 = months, 3= year',
  `user_id` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `profiling` (`profiling_id`)
) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1;

--
-- Temporary table structure for view `user__employment_detail`
--

/*!50001 DROP VIEW IF EXISTS `user__employment_detail`*/;
/*!50001 CREATE TABLE `user__employment_detail` (
  `id` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `profiling_id` tinyint NOT NULL,
  `company_id` tinyint NOT NULL,
  `reporting_to` tinyint NOT NULL,
  `business_entity_id` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `division_id` tinyint NOT NULL,
  `position_id` tinyint NOT NULL,
  `employee_grade` tinyint NOT NULL,
  `employee_group_id` tinyint NOT NULL,
  `employee_subgroup_id` tinyint NOT NULL,
  `title` tinyint NOT NULL,
  `contract_id` tinyint NOT NULL,
  `date_joined` tinyint NOT NULL,
  `basic_pay` tinyint NOT NULL,
  `basic_pay_start_date` tinyint NOT NULL,
  `date_commencement` tinyint NOT NULL,
  `date_termination` tinyint NOT NULL,
  `status` tinyint NOT NULL,
  `created_ts` tinyint NOT NULL,
  `is_delete` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `user__employment_detail_new`
--

/*!50001 DROP VIEW IF EXISTS `user__employment_detail_new`*/;
/*!50001 CREATE TABLE `user__employment_detail_new` (
  `id` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `profiling_id` tinyint NOT NULL,
  `company_id` tinyint NOT NULL,
  `reporting_to` tinyint NOT NULL,
  `business_entity_id` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `division_id` tinyint NOT NULL,
  `position_id` tinyint NOT NULL,
  `employee_grade` tinyint NOT NULL,
  `title` tinyint NOT NULL,
  `contract_id` tinyint NOT NULL,
  `date_joined` tinyint NOT NULL,
  `employee_group_id` tinyint NOT NULL,
  `basic_pay` tinyint NOT NULL,
  `basic_pay_start_date` tinyint NOT NULL,
  `date_commencement` tinyint NOT NULL,
  `date_termination` tinyint NOT NULL,
  `status` tinyint NOT NULL,
  `created_ts` tinyint NOT NULL,
  `is_delete` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Table structure for table `user__employment_detal_asal`
--

CREATE TABLE `user__employment_detal_asal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `company_id` int(11) NOT NULL,
  `business_entity_id` int(11) NOT NULL,
  `department_id` int(11) DEFAULT NULL,
  `position_id` int(11) NOT NULL,
  `position_id_joined` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `date_joined` date NOT NULL,
  `date_promoted` date NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__employment_history`
--

CREATE TABLE `user__employment_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `employer_name` varchar(144) NOT NULL,
  `employer_address` text NOT NULL,
  `position` varchar(144) NOT NULL,
  `date_enter` date DEFAULT NULL,
  `date_exit` date DEFAULT NULL,
  `length_of_service` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=258 DEFAULT CHARSET=latin1;

--
-- Temporary table structure for view `user__employment_incomplete_list`
--

/*!50001 DROP VIEW IF EXISTS `user__employment_incomplete_list`*/;
/*!50001 CREATE TABLE `user__employment_incomplete_list` (
  `user_id` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `profiling_id` tinyint NOT NULL,
  `title_id` tinyint NOT NULL,
  `gender_id` tinyint NOT NULL,
  `ic_no` tinyint NOT NULL,
  `birth_date` tinyint NOT NULL,
  `birth_place` tinyint NOT NULL,
  `citizen_id` tinyint NOT NULL,
  `religion_id` tinyint NOT NULL,
  `race_id` tinyint NOT NULL,
  `residential_id` tinyint NOT NULL,
  `marital_status` tinyint NOT NULL,
  `primary_email` tinyint NOT NULL,
  `company_id` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `division_id` tinyint NOT NULL,
  `position_id` tinyint NOT NULL,
  `employee_grade` tinyint NOT NULL,
  `title` tinyint NOT NULL,
  `reason_id` tinyint NOT NULL,
  `employee_group_id` tinyint NOT NULL,
  `contract_element_id` tinyint NOT NULL,
  `employee_subgroup_id` tinyint NOT NULL,
  `address_type` tinyint NOT NULL,
  `address` tinyint NOT NULL,
  `postcode` tinyint NOT NULL,
  `city` tinyint NOT NULL,
  `state_id` tinyint NOT NULL,
  `country_id` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Table structure for table `user__family_member`
--

CREATE TABLE `user__family_member` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `name` varchar(144) NOT NULL,
  `ic_no` varchar(144) NOT NULL,
  `relation` int(11) NOT NULL,
  `birthdate` date DEFAULT NULL,
  `phone_no` varchar(144) NOT NULL,
  `email` varchar(144) NOT NULL,
  `address` varchar(144) NOT NULL,
  `oku_status` int(1) NOT NULL,
  `study_status` int(1) NOT NULL,
  `academic_lavel` int(1) NOT NULL,
  `academic_institution` varchar(144) NOT NULL,
  `occupation` varchar(144) NOT NULL,
  `is_delete` int(144) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  `deleted_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=733 DEFAULT CHARSET=latin1;

--
-- Temporary table structure for view `user__financial_detail_incomplete_list`
--

/*!50001 DROP VIEW IF EXISTS `user__financial_detail_incomplete_list`*/;
/*!50001 CREATE TABLE `user__financial_detail_incomplete_list` (
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `basic_pay` tinyint NOT NULL,
  `bank_detail` tinyint NOT NULL,
  `statutory_detail` tinyint NOT NULL,
  `recurring` tinyint NOT NULL,
  `third_party_payment` tinyint NOT NULL,
  `user_pcb` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Table structure for table `user__joining_group`
--

CREATE TABLE `user__joining_group` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) NOT NULL,
  `date_join` date DEFAULT NULL,
  `date_to` date DEFAULT NULL,
  `reason_id` int(11) DEFAULT NULL,
  `position_id` int(11) DEFAULT NULL,
  `position_information` varchar(144) NOT NULL,
  `employee_grade` int(11) NOT NULL,
  `user_reporting_id` int(11) DEFAULT NULL,
  `company_id` int(11) NOT NULL DEFAULT '1',
  `business_entity_id` int(11) NOT NULL,
  `branch_id` int(11) DEFAULT NULL,
  `personnel_area_id` int(11) DEFAULT NULL,
  `personal_subarea_id` int(11) DEFAULT NULL,
  `employee_group_id` int(11) DEFAULT NULL,
  `contract_element_id` int(11) DEFAULT NULL,
  `employee_subgroup_id` int(11) DEFAULT NULL,
  `is_active` int(1) NOT NULL DEFAULT '1' COMMENT '1 = active , 2 = inactive',
  `is_delete` int(1) NOT NULL COMMENT '0 = exist, 1 = delete',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `profilling` (`profiling_id`),
  KEY `date_join` (`date_join`),
  KEY `position` (`position_information`),
  KEY `personnel_area_id` (`personnel_area_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1265 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__license`
--

CREATE TABLE `user__license` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `profession` varchar(144) NOT NULL,
  `license_no` varchar(144) NOT NULL,
  `register_date` date DEFAULT NULL,
  `renewal_date` date DEFAULT NULL,
  `is_delete` int(11) NOT NULL COMMENT '0 = exist, 1 = delete',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__license_attachment`
--

CREATE TABLE `user__license_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `license_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `mask_id` varchar(144) NOT NULL,
  `is_delete` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__login`
--

CREATE TABLE `user__login` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `username` varchar(255) NOT NULL,
  `pwd_hash` varchar(255) NOT NULL,
  `id_token` varchar(255) NOT NULL DEFAULT '26b8111d89db2d62faa22b2c360887de',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=423 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__module_access`
--

CREATE TABLE `user__module_access` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `module_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `access_lvl` varchar(16) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = active, 1= inactive',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = no, 1 = yes',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `is_delete` (`is_delete`),
  KEY `module_id` (`module_id`),
  KEY `user_id` (`user_id`),
  KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=1958 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__passport`
--

CREATE TABLE `user__passport` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `staff_id` int(11) NOT NULL,
  `expired_date` date NOT NULL,
  `working_expired_date` date NOT NULL,
  `issue` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  PRIMARY KEY (`id`),
  KEY `staffid` (`staff_id`),
  KEY `issueCountry` (`issue`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__pcb`
--

CREATE TABLE `user__pcb` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `profiling_id` int(11) NOT NULL,
  `family_id` int(11) NOT NULL,
  `responsible_id` int(11) NOT NULL,
  `status` int(11) NOT NULL,
  `is_delete` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=161 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__personal_attachment`
--

CREATE TABLE `user__personal_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `detail` varchar(144) NOT NULL,
  `description` text NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(64) NOT NULL,
  `mask_id` varchar(144) NOT NULL,
  `is_delete` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__picture`
--

CREATE TABLE `user__picture` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_location` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_ts` timestamp NULL DEFAULT NULL,
  `is_delete` tinyint(1) DEFAULT '0',
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_ts` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=124 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__previous_employment_history`
--

CREATE TABLE `user__previous_employment_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `employer_name` varchar(144) NOT NULL,
  `employer_address` varchar(144) NOT NULL,
  `position` varchar(144) NOT NULL,
  `duration` varchar(144) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__profesional_membership`
--

CREATE TABLE `user__profesional_membership` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `professional_body` varchar(144) NOT NULL,
  `certificate` varchar(144) NOT NULL,
  `membership` varchar(144) NOT NULL,
  `membership_no` varchar(144) NOT NULL,
  `year` year(4) NOT NULL,
  `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  `deleted_by` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__profesional_membership_attachment`
--

CREATE TABLE `user__profesional_membership_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `professional_membership_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `mask_id` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1;

--
-- Temporary table structure for view `user__professional_detail_incomplete_list`
--

/*!50001 DROP VIEW IF EXISTS `user__professional_detail_incomplete_list`*/;
/*!50001 CREATE TABLE `user__professional_detail_incomplete_list` (
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `previous_employment` tinyint NOT NULL,
  `contract_element` tinyint NOT NULL,
  `recognition` tinyint NOT NULL,
  `membership` tinyint NOT NULL,
  `license` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Table structure for table `user__profiling`
--

CREATE TABLE `user__profiling` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `staff_id` varchar(128) NOT NULL,
  `title_id` int(11) DEFAULT NULL,
  `gender_id` int(11) DEFAULT NULL,
  `ic_no` varchar(16) DEFAULT NULL,
  `passport_expired_date` date DEFAULT NULL,
  `working_expired_date` date DEFAULT NULL,
  `place_issue` varchar(11) DEFAULT NULL,
  `birth_date` date DEFAULT NULL,
  `birth_place` varchar(144) DEFAULT NULL,
  `hobby` varchar(144) DEFAULT NULL,
  `citizen_id` int(11) DEFAULT NULL,
  `religion_id` int(11) DEFAULT NULL,
  `race_id` int(11) DEFAULT NULL,
  `residential_id` int(11) DEFAULT NULL,
  `marital_status` tinyint(1) DEFAULT NULL,
  `married_date` date DEFAULT NULL,
  `primary_email` varchar(128) DEFAULT NULL,
  `secondary_email` varchar(128) DEFAULT NULL,
  `action_type_id` int(11) NOT NULL,
  `action_efective_date` date NOT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0' COMMENT '0 = exist, 1 = delete',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `userID` (`user_id`),
  KEY `actiondate` (`action_efective_date`),
  KEY `is_delete` (`is_delete`),
  KEY `action_type_id` (`action_type_id`),
  KEY `action_efective_date` (`action_efective_date`),
  KEY `created_by` (`created_by`,`updated_by`)
) ENGINE=InnoDB AUTO_INCREMENT=2394 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__profiling_status`
--

CREATE TABLE `user__profiling_status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `status` int(1) NOT NULL COMMENT '0=incomplete, 1-complete',
  `is_delete` int(1) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `deleted_by` int(11) NOT NULL,
  `deleted_ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__pursuing_study`
--

CREATE TABLE `user__pursuing_study` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `date_start` date DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `institution` varchar(128) NOT NULL,
  `program` varchar(128) NOT NULL,
  `status` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `deleted_by` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `profiling_id` (`profiling_id`),
  KEY `user_id` (`user_id`),
  KEY `is_delete` (`is_delete`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__recognition`
--

CREATE TABLE `user__recognition` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `achievement` varchar(144) NOT NULL,
  `award` varchar(144) NOT NULL,
  `year` year(4) NOT NULL,
  `is_delete` int(11) NOT NULL COMMENT '0 = exist, 1 = delete',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__recognition_attachment`
--

CREATE TABLE `user__recognition_attachment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `recognition_id` int(11) NOT NULL,
  `attachment_name` varchar(144) NOT NULL,
  `location` varchar(144) NOT NULL,
  `file_type` varchar(144) NOT NULL,
  `file_ext` varchar(144) NOT NULL,
  `mask_id` varchar(144) NOT NULL,
  `is_delete` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__recurring`
--

CREATE TABLE `user__recurring` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `recurring_type` int(1) NOT NULL,
  `type` varchar(144) NOT NULL,
  `amount` float NOT NULL,
  `date_start` date DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `status` int(1) DEFAULT NULL,
  `is_delete` int(1) NOT NULL,
  `deleted_by` int(1) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2881 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__statutory_detail`
--

CREATE TABLE `user__statutory_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `ee_epf_no` varchar(144) NOT NULL,
  `er_rate` int(1) NOT NULL,
  `er_percent` float NOT NULL,
  `ee_rate` int(1) NOT NULL,
  `ee_percent` float NOT NULL,
  `ee_socso` varchar(144) NOT NULL,
  `ee_income_tax` varchar(144) NOT NULL,
  `ee_pcb_deduction` float NOT NULL,
  `ee_zakat_deduction` float NOT NULL,
  `ee_pcb_deduction_percent` float NOT NULL,
  `ee_zakat_deduction_percent` float NOT NULL,
  `year` varchar(64) NOT NULL,
  `is_deleted` int(1) NOT NULL,
  `deleted_by` int(11) NOT NULL,
  `status` int(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=942 DEFAULT CHARSET=latin1;

--
-- Table structure for table `user__third_party_payment`
--

CREATE TABLE `user__third_party_payment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `profiling_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `date_start` date DEFAULT NULL,
  `date_end` date DEFAULT NULL,
  `type` varchar(128) NOT NULL,
  `account_no` varchar(32) NOT NULL,
  `amount` float NOT NULL,
  `status` int(1) NOT NULL,
  `is_delete` int(1) NOT NULL,
  `deleted_by` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1;

--
-- Temporary table structure for view `user__update_profile`
--

/*!50001 DROP VIEW IF EXISTS `user__update_profile`*/;
/*!50001 CREATE TABLE `user__update_profile` (
  `user_id` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `ic_no` tinyint NOT NULL,
  `marital_status` tinyint NOT NULL,
  `address` tinyint NOT NULL,
  `family_info` tinyint NOT NULL,
  `next_kin` tinyint NOT NULL,
  `user_rate` tinyint NOT NULL,
  `user_gross_pay` tinyint NOT NULL,
  `user_epf_deduction` tinyint NOT NULL,
  `user_pcb_rate` tinyint NOT NULL,
  `user_zakat_rate` tinyint NOT NULL,
  `user_statutory_year` tinyint NOT NULL,
  `child_info` tinyint NOT NULL,
  `pcb_consideration` tinyint NOT NULL,
  `case_emergency` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view__claim_allocation_prorate`
--

/*!50001 DROP VIEW IF EXISTS `view__claim_allocation_prorate`*/;
/*!50001 CREATE TABLE `view__claim_allocation_prorate` (
  `id` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `year_joined` tinyint NOT NULL,
  `year_experienced` tinyint NOT NULL,
  `hospitalization` tinyint NOT NULL,
  `room_package` tinyint NOT NULL,
  `created_by` tinyint NOT NULL,
  `created_ts` tinyint NOT NULL,
  `outpatient_january_prorate` tinyint NOT NULL,
  `outpatient_february_prorate` tinyint NOT NULL,
  `outpatient_march_prorate` tinyint NOT NULL,
  `outpatient_april_prorate` tinyint NOT NULL,
  `outpatient_may_prorate` tinyint NOT NULL,
  `outpatient_june_prorate` tinyint NOT NULL,
  `outpatient_july_prorate` tinyint NOT NULL,
  `outpatient_august_prorate` tinyint NOT NULL,
  `outpatient_september_prorate` tinyint NOT NULL,
  `outpatient_october_prorate` tinyint NOT NULL,
  `outpatient_november_prorate` tinyint NOT NULL,
  `outpatient_december_prorate` tinyint NOT NULL,
  `dental_january_prorate` tinyint NOT NULL,
  `dental_february_prorate` tinyint NOT NULL,
  `dental_march_prorate` tinyint NOT NULL,
  `dental_april_prorate` tinyint NOT NULL,
  `dental_may_prorate` tinyint NOT NULL,
  `dental_june_prorate` tinyint NOT NULL,
  `dental_july_prorate` tinyint NOT NULL,
  `dental_august_prorate` tinyint NOT NULL,
  `dental_september_prorate` tinyint NOT NULL,
  `dental_october_prorate` tinyint NOT NULL,
  `dental_november_prorate` tinyint NOT NULL,
  `dental_december_prorate` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view__current_month_unsubmitted_dental_or_optical_claim`
--

/*!50001 DROP VIEW IF EXISTS `view__current_month_unsubmitted_dental_or_optical_claim`*/;
/*!50001 CREATE TABLE `view__current_month_unsubmitted_dental_or_optical_claim` (
  `id` tinyint NOT NULL,
  `submission_month_claim_id` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `is_submission_submitted` tinyint NOT NULL,
  `first_entry_submission_month_claim_id` tinyint NOT NULL,
  `first_entry_submission_is_submitted` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view__current_month_unsubmitted_outpatient_claim`
--

/*!50001 DROP VIEW IF EXISTS `view__current_month_unsubmitted_outpatient_claim`*/;
/*!50001 CREATE TABLE `view__current_month_unsubmitted_outpatient_claim` (
  `id` tinyint NOT NULL,
  `submission_month_claim_id` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `is_submission_submitted` tinyint NOT NULL,
  `first_entry_submission_month_claim_id` tinyint NOT NULL,
  `first_entry_submission_is_submitted` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view__gross_pay_by_staff`
--

/*!50001 DROP VIEW IF EXISTS `view__gross_pay_by_staff`*/;
/*!50001 CREATE TABLE `view__gross_pay_by_staff` (
  `user_id` tinyint NOT NULL,
  `staff_id` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `employeeid` tinyint NOT NULL,
  `employeeName` tinyint NOT NULL,
  `grossPay` tinyint NOT NULL,
  `employer_contribution` tinyint NOT NULL,
  `claim` tinyint NOT NULL,
  `ot` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view__kbs`
--

/*!50001 DROP VIEW IF EXISTS `view__kbs`*/;
/*!50001 CREATE TABLE `view__kbs` (
  `department_name` tinyint NOT NULL,
  `department_desc` tinyint NOT NULL,
  `branch` tinyint NOT NULL,
  `room_code` tinyint NOT NULL,
  `rack_code` tinyint NOT NULL,
  `box_no` tinyint NOT NULL,
  `box_title` tinyint NOT NULL,
  `box_description` tinyint NOT NULL,
  `document_title` tinyint NOT NULL,
  `document_desccription` tinyint NOT NULL,
  `document_date` tinyint NOT NULL,
  `created_by` tinyint NOT NULL,
  `updated_by` tinyint NOT NULL,
  `attachment_title` tinyint NOT NULL,
  `attachment_description` tinyint NOT NULL,
  `file_name` tinyint NOT NULL,
  `file_location` tinyint NOT NULL,
  `crm_customer_name` tinyint NOT NULL,
  `roc_no` tinyint NOT NULL,
  `kbs_old_customer_name` tinyint NOT NULL,
  `kbs_old_roc_no` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view__report_department_claim`
--

/*!50001 DROP VIEW IF EXISTS `view__report_department_claim`*/;
/*!50001 CREATE TABLE `view__report_department_claim` (
  `department_id` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `overtime` tinyint NOT NULL,
  `dental_approved` tinyint NOT NULL,
  `hospitalization_approved` tinyint NOT NULL,
  `outpatient_approved` tinyint NOT NULL,
  `medical_screening_approved` tinyint NOT NULL,
  `meals_approved` tinyint NOT NULL,
  `others_tng` tinyint NOT NULL,
  `others_purchase` tinyint NOT NULL,
  `others_call` tinyint NOT NULL,
  `others_airport_taxes` tinyint NOT NULL,
  `others_service_taxes` tinyint NOT NULL,
  `others_tips_and_portage` tinyint NOT NULL,
  `others_laundry` tinyint NOT NULL,
  `others_excess_baggage` tinyint NOT NULL,
  `others_loss_in_foreign_exchange` tinyint NOT NULL,
  `others_firm_event` tinyint NOT NULL,
  `others_motor_expenses` tinyint NOT NULL,
  `others_ssm_search` tinyint NOT NULL,
  `others_book` tinyint NOT NULL,
  `others_stationary` tinyint NOT NULL,
  `others_membership` tinyint NOT NULL,
  `others_printing` tinyint NOT NULL,
  `others_stamping` tinyint NOT NULL,
  `others_license` tinyint NOT NULL,
  `mileage_approved` tinyint NOT NULL,
  `accomodation_claim_approved` tinyint NOT NULL,
  `subsistence_outstation` tinyint NOT NULL,
  `subsistence_meals` tinyint NOT NULL,
  `transportation_car_rental_approved` tinyint NOT NULL,
  `transportation_flight_approved` tinyint NOT NULL,
  `transportation_public_transport_approved` tinyint NOT NULL,
  `transportation_e_hailing_approved` tinyint NOT NULL,
  `transportation_trains_approved` tinyint NOT NULL,
  `parking_claim_approved` tinyint NOT NULL,
  `toll_claim_approved` tinyint NOT NULL,
  `trainer_claim_approved` tinyint NOT NULL,
  `panel_claim` tinyint NOT NULL,
  `petrol_claim_approved` tinyint NOT NULL,
  `entertainment_claim_approved` tinyint NOT NULL,
  `entertainment_claim_client` tinyint NOT NULL,
  `entertainment_claim_staff` tinyint NOT NULL,
  `other_courier` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_claim`
--

/*!50001 DROP VIEW IF EXISTS `view_claim`*/;
/*!50001 CREATE TABLE `view_claim` (
  `id` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `status` tinyint NOT NULL,
  `is_submit` tinyint NOT NULL,
  `is_delete` tinyint NOT NULL,
  `dental_claim` tinyint NOT NULL,
  `dental_approved` tinyint NOT NULL,
  `hospitalization_claim` tinyint NOT NULL,
  `hospitalization_approved` tinyint NOT NULL,
  `meals_claim` tinyint NOT NULL,
  `meals_approved` tinyint NOT NULL,
  `medical_screening_claim` tinyint NOT NULL,
  `medical_screening_approved` tinyint NOT NULL,
  `mileage_claim` tinyint NOT NULL,
  `mileage_approved` tinyint NOT NULL,
  `others_claim` tinyint NOT NULL,
  `others_approved` tinyint NOT NULL,
  `outpatient_claim` tinyint NOT NULL,
  `outpatient_approved` tinyint NOT NULL,
  `travelling_mileage_claim` tinyint NOT NULL,
  `travelling_mileage_approved` tinyint NOT NULL,
  `travelling_mileage_claim_item` tinyint NOT NULL,
  `travelling_item_approved` tinyint NOT NULL,
  `accomodation_claim` tinyint NOT NULL,
  `accomodation_claim_approved` tinyint NOT NULL,
  `subsistence_claim` tinyint NOT NULL,
  `subsistence_claim_approved` tinyint NOT NULL,
  `transportation_claim` tinyint NOT NULL,
  `transportation_claim_approved` tinyint NOT NULL,
  `parking_claim` tinyint NOT NULL,
  `parking_claim_approved` tinyint NOT NULL,
  `toll_claim` tinyint NOT NULL,
  `toll_claim_approved` tinyint NOT NULL,
  `trainer_claim` tinyint NOT NULL,
  `trainer_claim_approved` tinyint NOT NULL,
  `panel_claim` tinyint NOT NULL,
  `petrol_claim` tinyint NOT NULL,
  `petrol_claim_approved` tinyint NOT NULL,
  `entertainment_claim_amount` tinyint NOT NULL,
  `entertainment_claim_amount_approved` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_claim_dental_optical`
--

/*!50001 DROP VIEW IF EXISTS `view_claim_dental_optical`*/;
/*!50001 CREATE TABLE `view_claim_dental_optical` (
  `user_id` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `prorate` tinyint NOT NULL,
  `pending` tinyint NOT NULL,
  `approved` tinyint NOT NULL,
  `panel_claim` tinyint NOT NULL,
  `balanced_prorate` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_claim_outpatient`
--

/*!50001 DROP VIEW IF EXISTS `view_claim_outpatient`*/;
/*!50001 CREATE TABLE `view_claim_outpatient` (
  `user_id` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `prorate` tinyint NOT NULL,
  `pending` tinyint NOT NULL,
  `approved` tinyint NOT NULL,
  `panel_claim` tinyint NOT NULL,
  `balanced_prorate` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_crm_duplicate`
--

/*!50001 DROP VIEW IF EXISTS `view_crm_duplicate`*/;
/*!50001 CREATE TABLE `view_crm_duplicate` (
  `id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `roc_no` tinyint NOT NULL,
  `c` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_crm_enggagement`
--

/*!50001 DROP VIEW IF EXISTS `view_crm_enggagement`*/;
/*!50001 CREATE TABLE `view_crm_enggagement` (
  `crmID` tinyint NOT NULL,
  `deptID` tinyint NOT NULL,
  `department` tinyint NOT NULL,
  `movementID` tinyint NOT NULL,
  `customerID` tinyint NOT NULL,
  `activity` tinyint NOT NULL,
  `enggagementType` tinyint NOT NULL,
  `date` tinyint NOT NULL,
  `color_code` tinyint NOT NULL,
  `staff` tinyint NOT NULL,
  `staffID` tinyint NOT NULL,
  `contact` tinyint NOT NULL,
  `contactID` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_crm_incomplete`
--

/*!50001 DROP VIEW IF EXISTS `view_crm_incomplete`*/;
/*!50001 CREATE TABLE `view_crm_incomplete` (
  `id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `type_id` tinyint NOT NULL,
  `type_f` tinyint NOT NULL,
  `profile_f` tinyint NOT NULL,
  `address1_f` tinyint NOT NULL,
  `postcode_f` tinyint NOT NULL,
  `city_f` tinyint NOT NULL,
  `state_id_f` tinyint NOT NULL,
  `country_id_f` tinyint NOT NULL,
  `phone_f` tinyint NOT NULL,
  `email_f` tinyint NOT NULL,
  `grade_id_f` tinyint NOT NULL,
  `year_end_id_f` tinyint NOT NULL,
  `status_id_f` tinyint NOT NULL,
  `director_f` tinyint NOT NULL,
  `count1` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_customer_summary`
--

/*!50001 DROP VIEW IF EXISTS `view_customer_summary`*/;
/*!50001 CREATE TABLE `view_customer_summary` (
  `customer_id` tinyint NOT NULL,
  `customer_name` tinyint NOT NULL,
  `sum_contact` tinyint NOT NULL,
  `sum_director` tinyint NOT NULL,
  `sum_other_address` tinyint NOT NULL,
  `sum_service` tinyint NOT NULL,
  `sum_accountant` tinyint NOT NULL,
  `sum_auditor` tinyint NOT NULL,
  `sum_taxation` tinyint NOT NULL,
  `sum_cosec` tinyint NOT NULL,
  `sum_cf` tinyint NOT NULL,
  `sum_gst` tinyint NOT NULL,
  `sum_IT` tinyint NOT NULL,
  `sum_shariah` tinyint NOT NULL,
  `sum_others` tinyint NOT NULL,
  `sum_attachment` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_hiring_by_month_by_dept`
--

/*!50001 DROP VIEW IF EXISTS `view_hiring_by_month_by_dept`*/;
/*!50001 CREATE TABLE `view_hiring_by_month_by_dept` (
  `year` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `new_1` tinyint NOT NULL,
  `new_2` tinyint NOT NULL,
  `new_3` tinyint NOT NULL,
  `new_4` tinyint NOT NULL,
  `new_5` tinyint NOT NULL,
  `new_6` tinyint NOT NULL,
  `new_7` tinyint NOT NULL,
  `new_8` tinyint NOT NULL,
  `new_9` tinyint NOT NULL,
  `new_10` tinyint NOT NULL,
  `new_11` tinyint NOT NULL,
  `new_12` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_leave__summary_all_type`
--

/*!50001 DROP VIEW IF EXISTS `view_leave__summary_all_type`*/;
/*!50001 CREATE TABLE `view_leave__summary_all_type` (
  `year` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `staff` tinyint NOT NULL,
  `date_joined` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `type_code` tinyint NOT NULL,
  `leave_type` tinyint NOT NULL,
  `type_id` tinyint NOT NULL,
  `last_year_entitled` tinyint NOT NULL,
  `last_year_taken_b4_april` tinyint NOT NULL,
  `last_year_taken_after_april` tinyint NOT NULL,
  `last_year_balance` tinyint NOT NULL,
  `last_year_brought_forward` tinyint NOT NULL,
  `bring_forward_entitled` tinyint NOT NULL,
  `leave_entitled` tinyint NOT NULL,
  `leave_applied_before_april` tinyint NOT NULL,
  `leave_applied_after_april` tinyint NOT NULL,
  `current_balance` tinyint NOT NULL,
  `last_year_taken_b4_april_from_table` tinyint NOT NULL,
  `last_year_taken_after_april_from_table` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_leave_balance`
--

/*!50001 DROP VIEW IF EXISTS `view_leave_balance`*/;
/*!50001 CREATE TABLE `view_leave_balance` (
  `year` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `type_id` tinyint NOT NULL,
  `leave_entitled` tinyint NOT NULL,
  `leave_balance` tinyint NOT NULL,
  `total_applied` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_leave_summary`
--

/*!50001 DROP VIEW IF EXISTS `view_leave_summary`*/;
/*!50001 CREATE TABLE `view_leave_summary` (
  `year` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `staff` tinyint NOT NULL,
  `date_joined` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `leave_type` tinyint NOT NULL,
  `type_id` tinyint NOT NULL,
  `last_year_entitled` tinyint NOT NULL,
  `last_year_taken_b4_april` tinyint NOT NULL,
  `last_year_taken_after_april` tinyint NOT NULL,
  `last_year_balance` tinyint NOT NULL,
  `last_year_brought_forward` tinyint NOT NULL,
  `bring_forward_entitled` tinyint NOT NULL,
  `leave_entitled` tinyint NOT NULL,
  `leave_applied_before_april` tinyint NOT NULL,
  `leave_applied_after_april` tinyint NOT NULL,
  `current_balance` tinyint NOT NULL,
  `last_year_taken_b4_april_from_table` tinyint NOT NULL,
  `last_year_taken_after_april_from_table` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_ot`
--

/*!50001 DROP VIEW IF EXISTS `view_ot`*/;
/*!50001 CREATE TABLE `view_ot` (
  `otID` tinyint NOT NULL,
  `peopleid` tinyint NOT NULL,
  `deptID` tinyint NOT NULL,
  `department` tinyint NOT NULL,
  `branchID` tinyint NOT NULL,
  `branch` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `Pending` tinyint NOT NULL,
  `Approved` tinyint NOT NULL,
  `Rejected` tinyint NOT NULL,
  `noOfClaim` tinyint NOT NULL,
  `totalHoursApplied` tinyint NOT NULL,
  `totalHoursApproved` tinyint NOT NULL,
  `Normal` tinyint NOT NULL,
  `Rest` tinyint NOT NULL,
  `Public` tinyint NOT NULL,
  `Weekend` tinyint NOT NULL,
  `Weekdays` tinyint NOT NULL,
  `NormalMeal` tinyint NOT NULL,
  `RestMeal` tinyint NOT NULL,
  `PublicMeal` tinyint NOT NULL,
  `WeekendMeal` tinyint NOT NULL,
  `WeekdaysMeal` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_ot1`
--

/*!50001 DROP VIEW IF EXISTS `view_ot1`*/;
/*!50001 CREATE TABLE `view_ot1` (
  `otID` tinyint NOT NULL,
  `peopleid` tinyint NOT NULL,
  `deptID` tinyint NOT NULL,
  `department` tinyint NOT NULL,
  `branchID` tinyint NOT NULL,
  `branch` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `Pending` tinyint NOT NULL,
  `Approved` tinyint NOT NULL,
  `Rejected` tinyint NOT NULL,
  `noOfClaim` tinyint NOT NULL,
  `totalHoursApplied` tinyint NOT NULL,
  `totalHoursApproved` tinyint NOT NULL,
  `Normal` tinyint NOT NULL,
  `Rest` tinyint NOT NULL,
  `Public` tinyint NOT NULL,
  `NormalMeal` tinyint NOT NULL,
  `RestMeal` tinyint NOT NULL,
  `PublicMeal` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_report_claim`
--

/*!50001 DROP VIEW IF EXISTS `view_report_claim`*/;
/*!50001 CREATE TABLE `view_report_claim` (
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `business_entity_id` tinyint NOT NULL,
  `business_entity_name` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `overtime` tinyint NOT NULL,
  `dental_approved` tinyint NOT NULL,
  `hospitalization_approved` tinyint NOT NULL,
  `meals_approved` tinyint NOT NULL,
  `medical_screening_approved` tinyint NOT NULL,
  `others_tng` tinyint NOT NULL,
  `others_purchase` tinyint NOT NULL,
  `others_call` tinyint NOT NULL,
  `others_airport_taxes` tinyint NOT NULL,
  `others_service_taxes` tinyint NOT NULL,
  `others_tips_and_portage` tinyint NOT NULL,
  `others_laundry` tinyint NOT NULL,
  `others_excess_baggage` tinyint NOT NULL,
  `others_loss_in_foreign_exchange` tinyint NOT NULL,
  `others_firm_Event` tinyint NOT NULL,
  `others_motor_expenses` tinyint NOT NULL,
  `others_ssm_search` tinyint NOT NULL,
  `other_book` tinyint NOT NULL,
  `other_stationary` tinyint NOT NULL,
  `other_membership` tinyint NOT NULL,
  `other_printing` tinyint NOT NULL,
  `other_stamping` tinyint NOT NULL,
  `other_license` tinyint NOT NULL,
  `other_courier` tinyint NOT NULL,
  `total_others_approved` tinyint NOT NULL,
  `outpatient_approved` tinyint NOT NULL,
  `mileage_approved` tinyint NOT NULL,
  `accomodation_claim_approved` tinyint NOT NULL,
  `subsistence_outstation` tinyint NOT NULL,
  `subsistence_meals` tinyint NOT NULL,
  `transportation_car_rental_approved` tinyint NOT NULL,
  `transportation_flight_approved` tinyint NOT NULL,
  `transportation_public_transport_approved` tinyint NOT NULL,
  `transportation_e_hailing_approved` tinyint NOT NULL,
  `transportation_trains_approved` tinyint NOT NULL,
  `parking_claim_approved` tinyint NOT NULL,
  `toll_claim_approved` tinyint NOT NULL,
  `trainer_claim_approved` tinyint NOT NULL,
  `panel_claim` tinyint NOT NULL,
  `petrol_claim_approved` tinyint NOT NULL,
  `entertainment_claim_approved` tinyint NOT NULL,
  `entertainment_claim_client` tinyint NOT NULL,
  `entertainment_claim_staff` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_report_claim_20210111`
--

/*!50001 DROP VIEW IF EXISTS `view_report_claim_20210111`*/;
/*!50001 CREATE TABLE `view_report_claim_20210111` (
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `business_entity_id` tinyint NOT NULL,
  `business_entity_name` tinyint NOT NULL,
  `year` tinyint NOT NULL,
  `month` tinyint NOT NULL,
  `overtime` tinyint NOT NULL,
  `dental_approved` tinyint NOT NULL,
  `hospitalization_approved` tinyint NOT NULL,
  `meals_approved` tinyint NOT NULL,
  `medical_screening_approved` tinyint NOT NULL,
  `others_tng` tinyint NOT NULL,
  `others_purchase` tinyint NOT NULL,
  `others_call` tinyint NOT NULL,
  `others_airport_taxes` tinyint NOT NULL,
  `others_service_taxes` tinyint NOT NULL,
  `others_tips_and_portage` tinyint NOT NULL,
  `others_laundry` tinyint NOT NULL,
  `others_excess_baggage` tinyint NOT NULL,
  `others_loss_in_foreign_exchange` tinyint NOT NULL,
  `others_firm_Event` tinyint NOT NULL,
  `others_motor_expenses` tinyint NOT NULL,
  `others_ssm_search` tinyint NOT NULL,
  `other_book` tinyint NOT NULL,
  `other_stationary` tinyint NOT NULL,
  `other_membership` tinyint NOT NULL,
  `other_printing` tinyint NOT NULL,
  `other_stamping` tinyint NOT NULL,
  `other_license` tinyint NOT NULL,
  `other_courier` tinyint NOT NULL,
  `total_others_approved` tinyint NOT NULL,
  `outpatient_approved` tinyint NOT NULL,
  `mileage_approved` tinyint NOT NULL,
  `accomodation_claim_approved` tinyint NOT NULL,
  `subsistence_outstation` tinyint NOT NULL,
  `subsistence_meals` tinyint NOT NULL,
  `transportation_car_rental_approved` tinyint NOT NULL,
  `transportation_flight_approved` tinyint NOT NULL,
  `transportation_public_transport_approved` tinyint NOT NULL,
  `transportation_e_hailing_approved` tinyint NOT NULL,
  `transportation_trains_approved` tinyint NOT NULL,
  `parking_claim_approved` tinyint NOT NULL,
  `toll_claim_approved` tinyint NOT NULL,
  `trainer_claim_approved` tinyint NOT NULL,
  `panel_claim` tinyint NOT NULL,
  `petrol_claim_approved` tinyint NOT NULL,
  `entertainment_claim_approved` tinyint NOT NULL,
  `entertainment_claim_client` tinyint NOT NULL,
  `entertainment_claim_staff` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_terminate_by_month_by_dept`
--

/*!50001 DROP VIEW IF EXISTS `view_terminate_by_month_by_dept`*/;
/*!50001 CREATE TABLE `view_terminate_by_month_by_dept` (
  `year` tinyint NOT NULL,
  `department_id` tinyint NOT NULL,
  `res_1` tinyint NOT NULL,
  `res_2` tinyint NOT NULL,
  `res_3` tinyint NOT NULL,
  `res_4` tinyint NOT NULL,
  `res_5` tinyint NOT NULL,
  `res_6` tinyint NOT NULL,
  `res_7` tinyint NOT NULL,
  `res_8` tinyint NOT NULL,
  `res_9` tinyint NOT NULL,
  `res_10` tinyint NOT NULL,
  `res_11` tinyint NOT NULL,
  `res_12` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_user_accomodation_entitlement`
--

/*!50001 DROP VIEW IF EXISTS `view_user_accomodation_entitlement`*/;
/*!50001 CREATE TABLE `view_user_accomodation_entitlement` (
  `user_id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `position_id` tinyint NOT NULL,
  `parent_id` tinyint NOT NULL,
  `position` tinyint NOT NULL,
  `zone_type_id` tinyint NOT NULL,
  `with_receipt` tinyint NOT NULL,
  `without_receipt` tinyint NOT NULL,
  `zone_id` tinyint NOT NULL,
  `zone` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Temporary table structure for view `view_user_latest_profiling`
--

/*!50001 DROP VIEW IF EXISTS `view_user_latest_profiling`*/;
/*!50001 CREATE TABLE `view_user_latest_profiling` (
  `id` tinyint NOT NULL,
  `user_id` tinyint NOT NULL,
  `date_commencement` tinyint NOT NULL
) ENGINE=MyISAM */;

--
-- Final view structure for view `report__employee_profiling_by_action`
--

/*!50001 DROP TABLE IF EXISTS `report__employee_profiling_by_action`*/;
/*!50001 DROP VIEW IF EXISTS `report__employee_profiling_by_action`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `report__employee_profiling_by_action` AS select distinct `up`.`user_id` AS `id`,`ued`.`staff_id` AS `staff_id`,`ued`.`name` AS `name`,`cd`.`name` AS `department_name`,`cb`.`name` AS `department_branch`,`cbe`.`name` AS `business_entity`,`rac`.`type` AS `action_type`,`rrt`.`type` AS `address_type`,`ua`.`address` AS `address`,`ua`.`postcode` AS `address_postcode`,`rc`.`country` AS `address_country`,`rs`.`state` AS `address_state`,`rr`.`relations` AS `family_relation`,`ufm`.`name` AS `family_member`,`ufm`.`phone_no` AS `family_member_contact_no`,`upm`.`membership_no` AS `membership_no`,`upm`.`membership` AS `membership`,`upm`.`professional_body` AS `membership_professional_body`,`upm`.`certificate` AS `membership_certificate`,`ul`.`license_no` AS `license_no`,`ul`.`profession` AS `license_profession`,`ul`.`register_date` AS `license_register_date`,`ul`.`renewal_date` AS `license_renewal_date`,`usd`.`ee_epf_no` AS `epf_no`,`usd`.`ee_socso` AS `socso_no`,`usd`.`ee_income_tax` AS `income_tax_no`,`usd`.`ee_pcb_deduction_percent` AS `pcb_deduction_percentage`,`usd`.`ee_zakat_deduction_percent` AS `zakat_deduction_percentage`,`usd`.`ee_percent` AS `ee_rate_percentage`,if((`usd`.`status` = 1),'ACTIVE','INACTIVE') AS `statutory_status`,`usd`.`year` AS `statutory_year`,`utp`.`date_start` AS `third_party_payment_start_date`,`utp`.`date_end` AS `third_party_payment_end_date`,`utp`.`type` AS `third_party_institution_organisation`,if((`utp`.`status` = 0),'ONGOING','END') AS `third_party_payment_status`,`utp`.`amount` AS `third_party_payment_amount`,if((`pcb`.`responsible_id` = 0),`ufm_pcb`.`name`,'null') AS `employee_pcb_consideration`,if((`pcb`.`responsible_id` = 1),`ufm_pcb`.`name`,'null') AS `spouse_pcb_consideration`,`up`.`created_at` AS `created_at` from (((((((((((((((((`user__profiling` `up` left join `user__employment_detail` `ued` on((`ued`.`id` = `up`.`user_id`))) left join `company__department` `cd` on((`ued`.`department_id` = `cd`.`id`))) left join `company__branch` `cb` on((`cd`.`branch_id` = `cb`.`id`))) left join `company__business_entity` `cbe` on((`ued`.`business_entity_id` = `cbe`.`id`))) left join `_ref__action_type` `rac` on(((`up`.`action_type_id` = `rac`.`id`) and (`rac`.`is_delete` = 0)))) left join `user__address` `ua` on(((`ua`.`profiling_id` = `up`.`id`) and (`ua`.`is_delete` = 0)))) left join `user__family_member` `ufm` on(((`ufm`.`profiling_id` = `up`.`id`) and (`ufm`.`is_delete` = 0)))) left join `user__profesional_membership` `upm` on(((`upm`.`profiling_id` = `up`.`id`) and (`upm`.`is_delete` = 0)))) left join `user__license` `ul` on(((`ul`.`profiling_id` = `up`.`id`) and (`ul`.`is_delete` = 0)))) left join `user__statutory_detail` `usd` on(((`usd`.`profiling_id` = `up`.`id`) and (`usd`.`is_deleted` = 0)))) left join `user__third_party_payment` `utp` on(((`utp`.`profiling_id` = `up`.`id`) and (`utp`.`is_delete` = 0)))) left join `user__pcb` `pcb` on(((`pcb`.`profiling_id` = `up`.`id`) and (`pcb`.`is_delete` = 0)))) left join `user__family_member` `ufm_pcb` on(((`pcb`.`family_id` = `ufm_pcb`.`id`) and (`ufm_pcb`.`is_delete` = 0)))) left join `_ref__relationship` `rr` on((`ufm`.`relation` = `rr`.`id`))) left join `_ref__residence_type` `rrt` on((`ua`.`type` = `rrt`.`id`))) left join `_ref__country` `rc` on((`ua`.`country_id` = `rc`.`id`))) left join `_ref__state` `rs` on((`ua`.`state_id` = `rs`.`id`))) where ((`up`.`is_delete` = 0) and (`ued`.`is_delete` = 0)) order by `up`.`user_id` */;

--
-- Final view structure for view `report__employee_update_profiling`
--

/*!50001 DROP TABLE IF EXISTS `report__employee_update_profiling`*/;
/*!50001 DROP VIEW IF EXISTS `report__employee_update_profiling`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `report__employee_update_profiling` AS select distinct `a`.`user_id` AS `ids`,`b`.`staff_id` AS `staff_id`,`b`.`name` AS `name`,`c`.`name` AS `department_name`,`e`.`name` AS `department_branch`,`f`.`name` AS `business_entity`,`d`.`type` AS `action_type`,`a`.`created_at` AS `created_at` from (((((`user__profiling` `a` join `user__employment_detail` `b`) join `company__department` `c`) join `_ref__action_type` `d`) join `company__branch` `e`) join `company__business_entity` `f`) where ((`a`.`action_type_id` = 10000) and (`b`.`id` = `a`.`user_id`) and (`b`.`department_id` = `c`.`id`) and (`c`.`branch_id` = `e`.`id`) and (`b`.`business_entity_id` = `f`.`id`) and (`a`.`action_type_id` = `d`.`id`)) order by `a`.`user_id` */;

--
-- Final view structure for view `report__employment_detail`
--

/*!50001 DROP TABLE IF EXISTS `report__employment_detail`*/;
/*!50001 DROP VIEW IF EXISTS `report__employment_detail`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `report__employment_detail` AS select `ued`.`id` AS `id`,`ued`.`staff_id` AS `staff_id`,`ued`.`name` AS `name`,`ued`.`business_entity_id` AS `business_entity_ids`,`cbe`.`name` AS `business_entity`,`ued`.`department_id` AS `department_ids`,`cb`.`id` AS `branch_ids`,`cd`.`name` AS `department_name`,`cb`.`name` AS `department_branch`,`cdv`.`name` AS `division`,`cp`.`position` AS `position`,`ued`.`employee_grade` AS `employee_grade`,`rct`.`type` AS `contract_type`,`reg`.`type` AS `employee_group`,`rsc`.`level` AS `employee_subgroup`,`ued`.`title` AS `title`,`ued`.`date_joined` AS `date_joined`,`ued`.`basic_pay` AS `basic_pay`,`ued`.`date_commencement` AS `effective_date`,`ued`.`date_termination` AS `date_termination`,if((`ued`.`is_delete` = 0),'Active','Resigned') AS `employmee_status`,if((`ued`.`is_delete` = 0),'Active','Deleted') AS `employmee_account_status` from ((((((((`user__employment_detail` `ued` left join `company__business_entity` `cbe` on((`cbe`.`id` = `ued`.`business_entity_id`))) left join `company__department` `cd` on((`cd`.`id` = `ued`.`department_id`))) left join `company__branch` `cb` on((`cb`.`id` = `cd`.`branch_id`))) left join `company__division` `cdv` on((`cdv`.`id` = `ued`.`division_id`))) left join `company__position` `cp` on((`cp`.`id` = `ued`.`position_id`))) left join `_ref__contract_type` `rct` on((`rct`.`id` = `ued`.`contract_id`))) left join `_ref__employee_group` `reg` on((`reg`.`id` = `ued`.`employee_group_id`))) left join `_ref__salary_scale` `rsc` on((`rsc`.`id` = `ued`.`employee_subgroup_id`))) group by `ued`.`id` order by `ued`.`id` */;

--
-- Final view structure for view `report__leave_application`
--

/*!50001 DROP TABLE IF EXISTS `report__leave_application`*/;
/*!50001 DROP VIEW IF EXISTS `report__leave_application`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `report__leave_application` AS select `a`.`id` AS `id`,`a`.`user_id` AS `staffids`,`b`.`staff_id` AS `staff_id`,`b`.`name` AS `staff_name`,`a`.`department_id` AS `department_ids`,`d`.`id` AS `branch_ids`,`c`.`name` AS `department_name`,`d`.`name` AS `branch_name`,`e`.`name` AS `leave_type`,`a`.`date_from` AS `date_from`,`a`.`date_to` AS `date_to`,`f`.`name` AS `period_from`,`g`.`name` AS `period_to`,`h`.`status` AS `status` from (((((((`hr__leave_application` `a` left join `user` `b` on((`b`.`id` = `a`.`user_id`))) left join `company__department` `c` on((`c`.`id` = `a`.`department_id`))) left join `company__branch` `d` on((`d`.`id` = `c`.`branch_id`))) left join `hr__leave_type` `e` on((`e`.`id` = `a`.`type_id`))) left join `hr__ref_leave_period` `f` on((`f`.`id` = `a`.`period_to_id`))) left join `hr__ref_leave_period` `g` on((`g`.`id` = `a`.`period_to_id`))) left join `hr__ref_leave_status` `h` on((`h`.`id` = `a`.`status`))) where ((`a`.`is_delete` = 0) and (`b`.`is_delete` = 0) and (`b`.`status` = 0)) */;

--
-- Final view structure for view `report__staff_movement`
--

/*!50001 DROP TABLE IF EXISTS `report__staff_movement`*/;
/*!50001 DROP VIEW IF EXISTS `report__staff_movement`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `report__staff_movement` AS select `a`.`id` AS `id`,`b`.`staffid` AS `staffids`,`c`.`staff_id` AS `staff_id`,`c`.`name` AS `staff_name`,`a`.`department_id` AS `department_ids`,`e`.`id` AS `branch_ids`,`d`.`name` AS `department_name`,`e`.`name` AS `branch_name`,`g`.`movementType` AS `movement_type`,`f`.`id` AS `customer_ids`,`f`.`name` AS `customer`,`a`.`date` AS `movement_date`,`b`.`timeOut` AS `time_out`,`b`.`timeIn` AS `time_in` from ((((((`hr__movement_group` `a` left join `hr__movement_group_detail` `b` on((`b`.`groupid` = `a`.`id`))) left join `user` `c` on((`c`.`id` = `b`.`staffid`))) left join `company__department` `d` on((`d`.`id` = `a`.`department_id`))) left join `company__branch` `e` on((`e`.`id` = `d`.`branch_id`))) left join `customer` `f` on(((`f`.`id` = `a`.`customerid`) and (`f`.`is_delete` = 0)))) left join `hr__movement_type` `g` on((`g`.`id` = `a`.`movementType`))) where ((`a`.`is_delete` = 0) and (`c`.`is_delete` = 0) and (`c`.`status` = 0)) */;

--
-- Final view structure for view `user__background_detail_incomplete_list`
--

/*!50001 DROP TABLE IF EXISTS `user__background_detail_incomplete_list`*/;
/*!50001 DROP VIEW IF EXISTS `user__background_detail_incomplete_list`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user__background_detail_incomplete_list` AS select `a`.`user_id` AS `user_id`,`a`.`name` AS `name`,count(`b`.`id`) AS `family_info`,count(`c`.`id`) AS `academic_qualification` from ((`user__employment_detail` `a` left join `user__family_member` `b` on(((`b`.`user_id` = `a`.`id`) and (`b`.`is_delete` = 0)))) left join `user__academic_qualification` `c` on(((`c`.`user_id` = `a`.`id`) and (`c`.`is_delete` = 0)))) where (`a`.`is_delete` = 0) group by `a`.`id` order by `a`.`id` */;

--
-- Final view structure for view `user__employment_detail`
--

/*!50001 DROP TABLE IF EXISTS `user__employment_detail`*/;
/*!50001 DROP VIEW IF EXISTS `user__employment_detail`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user__employment_detail` AS select distinct `a`.`id` AS `id`,`a`.`id` AS `user_id`,`a`.`staff_id` AS `staff_id`,`a`.`name` AS `name`,(select `up`.`id` from `user__profiling` `up` where ((`up`.`user_id` = `a`.`id`) and (`up`.`action_efective_date` <= curdate()) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `profiling_id`,(select `ujg`.`company_id` from (`user__joining_group` `ujg` join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) where (`up`.`action_efective_date` <= curdate()) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `company_id`,(select `ujg1`.`user_reporting_id` from (`user__joining_group` `ujg1` join `user__profiling` `up1` on((`up1`.`id` = `ujg1`.`profiling_id`))) where (`up1`.`action_efective_date` <= curdate()) order by `up1`.`action_efective_date` desc,`up1`.`id` desc limit 1) AS `reporting_to`,(select `ujg`.`business_entity_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `business_entity_id`,(select `ujg`.`personnel_area_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `department_id`,(select `ujg`.`personal_subarea_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `division_id`,(select `ujg`.`position_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `position_id`,(select `ujg`.`employee_grade` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `employee_grade`,(select `ujg`.`employee_group_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `employee_group_id`,(select `ujg`.`employee_subgroup_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `employee_subgroup_id`,(select `des`.`designation` from (((`_ref__designation` `des` left join `user__joining_group` `ujg` on((`ujg`.`position_information` = `des`.`id`))) left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `title`,`g`.`id` AS `contract_id`,(select min(`ujg`.`date_join`) from (`user__joining_group` `ujg` join `user__profiling` `up` on((`ujg`.`profiling_id` = `up`.`id`))) where ((`ujg`.`profiling_id` = `up`.`id`) and (`up`.`user_id` = `a`.`id`))) AS `date_joined`,(select `ubp`.`amount` from (`user__basic_pay` `ubp` join `user__profiling` `up` on((`ubp`.`profiling_id` = `up`.`id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0) and (`ubp`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `basic_pay`,(select `ubp`.`start_date` from (`user__basic_pay` `ubp` join `user__profiling` `up` on((`ubp`.`profiling_id` = `up`.`id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `basic_pay_start_date`,(select `up`.`action_efective_date` from `user__profiling` `up` where ((`up`.`user_id` = `a`.`id`) and (`up`.`action_efective_date` <= curdate())) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `date_commencement`,(select `up`.`action_efective_date` from `user__profiling` `up` where ((`up`.`user_id` = `a`.`id`) and (`up`.`action_type_id` in (12,13,14))) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `date_termination`,`a`.`status` AS `status`,`a`.`created_ts` AS `created_ts`,`a`.`is_delete` AS `is_delete` from ((((((`user` `a` left join `user__profiling` `b` on((`b`.`user_id` = `a`.`id`))) left join `user__joining_group` `c` on((`c`.`profiling_id` = `b`.`id`))) left join `company__department` `d` on((`d`.`id` = `c`.`personal_subarea_id`))) left join `user__basic_pay` `e` on((`e`.`user_id` = `a`.`id`))) left join `company__branch` `f` on((`f`.`id` = `c`.`branch_id`))) left join `user__contract_element` `g` on((`g`.`profiling_id` = `b`.`id`))) group by `a`.`id` order by `a`.`id` */;

--
-- Final view structure for view `user__employment_detail_new`
--

/*!50001 DROP TABLE IF EXISTS `user__employment_detail_new`*/;
/*!50001 DROP VIEW IF EXISTS `user__employment_detail_new`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user__employment_detail_new` AS select distinct `a`.`id` AS `id`,`a`.`id` AS `user_id`,`a`.`staff_id` AS `staff_id`,`a`.`name` AS `name`,(select `up`.`id` from `user__profiling` `up` where ((`up`.`user_id` = `a`.`id`) and (`up`.`action_efective_date` <= curdate()) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `profiling_id`,(select `ujg`.`company_id` from (`user__joining_group` `ujg` join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) where (`up`.`action_efective_date` <= curdate()) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `company_id`,(select `ujg1`.`user_reporting_id` from (`user__joining_group` `ujg1` join `user__profiling` `up1` on((`up1`.`id` = `ujg1`.`profiling_id`))) where (`up1`.`action_efective_date` <= curdate()) order by `up1`.`action_efective_date` desc,`up1`.`id` desc limit 1) AS `reporting_to`,(select `ujg`.`business_entity_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `business_entity_id`,(select `ujg`.`personnel_area_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `department_id`,(select `ujg`.`personal_subarea_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `division_id`,(select `ujg`.`position_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `position_id`,(select `ujg`.`employee_grade` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `employee_grade`,(select `des`.`designation` from (((`_ref__designation` `des` left join `user__joining_group` `ujg` on((`ujg`.`position_information` = `des`.`id`))) left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `title`,`g`.`id` AS `contract_id`,(select min(`ujg`.`date_join`) from (`user__joining_group` `ujg` join `user__profiling` `up` on((`ujg`.`profiling_id` = `up`.`id`))) where ((`ujg`.`profiling_id` = `up`.`id`) and (`up`.`user_id` = `a`.`id`))) AS `date_joined`,(select `ujg`.`employee_group_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `employee_group_id`,(select `ubp`.`amount` from (`user__basic_pay` `ubp` join `user__profiling` `up` on((`ubp`.`profiling_id` = `up`.`id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0) and (`ubp`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `basic_pay`,(select `ubp`.`start_date` from (`user__basic_pay` `ubp` join `user__profiling` `up` on((`ubp`.`profiling_id` = `up`.`id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `basic_pay_start_date`,(select `up`.`action_efective_date` from `user__profiling` `up` where ((`up`.`user_id` = `a`.`id`) and (`up`.`action_efective_date` <= curdate())) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `date_commencement`,(select `up`.`action_efective_date` from `user__profiling` `up` where ((`up`.`user_id` = `a`.`id`) and (`up`.`action_type_id` in (12,13,14))) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `date_termination`,`a`.`status` AS `status`,`a`.`created_ts` AS `created_ts`,`a`.`is_delete` AS `is_delete` from ((((((`user` `a` left join `user__profiling` `b` on((`b`.`user_id` = `a`.`id`))) left join `user__joining_group` `c` on((`c`.`profiling_id` = `b`.`id`))) left join `company__department` `d` on((`d`.`id` = `c`.`personal_subarea_id`))) left join `user__basic_pay` `e` on((`e`.`user_id` = `a`.`id`))) left join `company__branch` `f` on((`f`.`id` = `c`.`branch_id`))) left join `user__contract_element` `g` on((`g`.`profiling_id` = `b`.`id`))) group by `a`.`id` order by `a`.`id` */;

--
-- Final view structure for view `user__employment_incomplete_list`
--

/*!50001 DROP TABLE IF EXISTS `user__employment_incomplete_list`*/;
/*!50001 DROP VIEW IF EXISTS `user__employment_incomplete_list`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user__employment_incomplete_list` AS select `a`.`user_id` AS `user_id`,`a`.`staff_id` AS `staff_id`,`a`.`name` AS `name`,`a`.`profiling_id` AS `profiling_id`,`b`.`title_id` AS `title_id`,`b`.`gender_id` AS `gender_id`,`b`.`ic_no` AS `ic_no`,`b`.`birth_date` AS `birth_date`,`b`.`birth_place` AS `birth_place`,`b`.`citizen_id` AS `citizen_id`,`b`.`religion_id` AS `religion_id`,`b`.`race_id` AS `race_id`,`b`.`residential_id` AS `residential_id`,`b`.`marital_status` AS `marital_status`,`b`.`primary_email` AS `primary_email`,`a`.`company_id` AS `company_id`,`a`.`department_id` AS `department_id`,`a`.`division_id` AS `division_id`,`a`.`position_id` AS `position_id`,`a`.`employee_grade` AS `employee_grade`,`a`.`title` AS `title`,(select `ujg`.`reason_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `reason_id`,(select `ujg`.`employee_group_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `employee_group_id`,(select `ujg`.`contract_element_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `contract_element_id`,(select `ujg`.`employee_subgroup_id` from ((`user__joining_group` `ujg` left join `user__profiling` `up` on((`up`.`id` = `ujg`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `employee_subgroup_id`,`c`.`type` AS `address_type`,`c`.`address` AS `address`,`c`.`postcode` AS `postcode`,`c`.`city` AS `city`,`c`.`state_id` AS `state_id`,`c`.`country_id` AS `country_id` from ((`user__employment_detail` `a` left join `user__profiling` `b` on(((`b`.`id` = `a`.`profiling_id`) and (`b`.`is_delete` = 0)))) left join `user__address` `c` on(((`c`.`user_id` = `a`.`user_id`) and (`c`.`id` = (select max(`user__address`.`id`) from `user__address` where ((`user__address`.`user_id` = `a`.`user_id`) and (`user__address`.`is_delete` = 0))))))) where (`a`.`is_delete` = 0) order by `a`.`user_id` */;

--
-- Final view structure for view `user__financial_detail_incomplete_list`
--

/*!50001 DROP TABLE IF EXISTS `user__financial_detail_incomplete_list`*/;
/*!50001 DROP VIEW IF EXISTS `user__financial_detail_incomplete_list`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user__financial_detail_incomplete_list` AS select `a`.`user_id` AS `user_id`,`a`.`name` AS `name`,(select `b`.`id` from ((`user__basic_pay` `b` left join `user__profiling` `up` on((`up`.`id` = `b`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `basic_pay`,(select `c`.`id` from ((`user__bank_detail` `c` left join `user__profiling` `up` on((`up`.`id` = `c`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `bank_detail`,(select `d`.`id` from ((`user__statutory_detail` `d` left join `user__profiling` `up` on((`up`.`id` = `d`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `statutory_detail`,(select `e`.`id` from ((`user__recurring` `e` left join `user__profiling` `up` on((`up`.`id` = `e`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `recurring`,(select `f`.`id` from ((`user__third_party_payment` `f` left join `user__profiling` `up` on((`up`.`id` = `f`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `third_party_payment`,(select `g`.`id` from ((`user__pcb` `g` left join `user__profiling` `up` on((`up`.`id` = `g`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `user_pcb` from `user__employment_detail` `a` where (`a`.`is_delete` = 0) order by `a`.`id` */;

--
-- Final view structure for view `user__professional_detail_incomplete_list`
--

/*!50001 DROP TABLE IF EXISTS `user__professional_detail_incomplete_list`*/;
/*!50001 DROP VIEW IF EXISTS `user__professional_detail_incomplete_list`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user__professional_detail_incomplete_list` AS select `a`.`user_id` AS `user_id`,`a`.`name` AS `name`,count(`b`.`id`) AS `previous_employment`,(select count(`uce`.`id`) from ((`user__contract_element` `uce` left join `user__profiling` `up` on((`up`.`id` = `uce`.`profiling_id`))) left join `user` `u` on((`u`.`id` = `up`.`user_id`))) where ((`up`.`action_efective_date` <= curdate()) and (`up`.`user_id` = `a`.`id`) and (`up`.`is_delete` = 0)) order by `up`.`action_efective_date` desc,`up`.`id` desc limit 1) AS `contract_element`,count(`c`.`id`) AS `recognition`,count(`d`.`id`) AS `membership`,count(`e`.`id`) AS `license` from ((((`user__employment_detail` `a` left join `user__employment_history` `b` on(((`b`.`user_id` = `a`.`id`) and (`b`.`is_delete` = 0)))) left join `user__recognition` `c` on(((`c`.`user_id` = `a`.`id`) and (`c`.`is_delete` = 0)))) left join `user__profesional_membership` `d` on(((`d`.`user_id` = `a`.`id`) and (`d`.`is_delete` = 0)))) left join `user__license` `e` on(((`e`.`user_id` = `a`.`id`) and (`e`.`is_delete` = 0)))) where (`a`.`is_delete` = 0) group by `a`.`id` order by `a`.`id` */;

--
-- Final view structure for view `user__update_profile`
--

/*!50001 DROP TABLE IF EXISTS `user__update_profile`*/;
/*!50001 DROP VIEW IF EXISTS `user__update_profile`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `user__update_profile` AS select `a`.`id` AS `user_id`,`b`.`staff_id` AS `staff_id`,`a`.`name` AS `name`,`b`.`ic_no` AS `ic_no`,`b`.`marital_status` AS `marital_status`,(select count(`user__address`.`id`) from `user__address` where ((`user__address`.`user_id` = `a`.`id`) and (`user__address`.`is_delete` = 0))) AS `address`,(select count(`user__family_member`.`id`) from `user__family_member` where ((`user__family_member`.`user_id` = `a`.`id`) and (`user__family_member`.`relation` > 0) and (`user__family_member`.`is_delete` = 0))) AS `family_info`,(select count(`user__family_member`.`id`) from `user__family_member` where ((`user__family_member`.`user_id` = `a`.`id`) and (`user__family_member`.`relation` = 6) and (`user__family_member`.`is_delete` = 0))) AS `next_kin`,`e`.`ee_percent` AS `user_rate`,`c`.`grossPay` AS `user_gross_pay`,`d`.`amount` AS `user_epf_deduction`,`e`.`ee_pcb_deduction_percent` AS `user_pcb_rate`,`e`.`ee_zakat_deduction_percent` AS `user_zakat_rate`,`e`.`year` AS `user_statutory_year`,(select count(`user__family_member`.`id`) from `user__family_member` where ((`user__family_member`.`user_id` = `a`.`id`) and (`user__family_member`.`relation` = 2) and (`user__family_member`.`is_delete` = 0))) AS `child_info`,(select count(`user__pcb`.`id`) from `user__pcb` where ((`user__pcb`.`user_id` = `a`.`id`) and (`user__pcb`.`is_delete` = 0))) AS `pcb_consideration`,(select count(`user__case_of_emergency`.`id`) from `user__case_of_emergency` where ((`user__case_of_emergency`.`user_id` = `a`.`id`) and (`user__case_of_emergency`.`is_delete` = 0))) AS `case_emergency` from ((((`user` `a` left join `user__profiling` `b` on(((`b`.`user_id` = `a`.`id`) and (`b`.`action_efective_date` <= curdate()) and (`b`.`id` = (select max(`user__profiling`.`id`) from `user__profiling` where ((`user__profiling`.`user_id` = `a`.`id`) and (`user__profiling`.`is_delete` = 0))))))) left join `hr__payslip` `c` on(((`c`.`employeeIC` = replace(`b`.`ic_no`,'-','')) and (`c`.`id` = (select max(`hr__payslip`.`id`) from `hr__payslip` where (`hr__payslip`.`employeeIC` = replace(`b`.`ic_no`,'-',''))))))) left join `hr__payslip_deduction` `d` on(((`d`.`paySlipID` = `c`.`id`) and (`d`.`deductionID` = 15)))) left join `user__statutory_detail` `e` on(((`e`.`user_id` = `a`.`id`) and (`e`.`is_deleted` = 0) and (`e`.`id` = (select max(`user__statutory_detail`.`id`) from `user__statutory_detail` where ((`user__statutory_detail`.`user_id` = `a`.`id`) and (`user__statutory_detail`.`is_deleted` = 0))))))) where (`a`.`is_delete` = 0) order by `a`.`id` */;

--
-- Final view structure for view `view__claim_allocation_prorate`
--

/*!50001 DROP TABLE IF EXISTS `view__claim_allocation_prorate`*/;
/*!50001 DROP VIEW IF EXISTS `view__claim_allocation_prorate`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view__claim_allocation_prorate` AS select `a`.`id` AS `id`,`a`.`user_id` AS `user_id`,`a`.`year` AS `year`,`a`.`year_joined` AS `year_joined`,`a`.`year_experienced` AS `year_experienced`,`a`.`hospitalization` AS `hospitalization`,`a`.`room_package` AS `room_package`,`a`.`created_by` AS `created_by`,`a`.`created_ts` AS `created_ts`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 1) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_january_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 2) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_february_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 3) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_march_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 4) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_april_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 5) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_may_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 6) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_june_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 7) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_july_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 8) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_august_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 9) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_september_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 10) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_october_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 11) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_november_prorate`,(select `b`.`outpatient` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 12) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `outpatient_december_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 1) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_january_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 2) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_february_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 3) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_march_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 4) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_april_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 5) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_may_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 6) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_june_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 7) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_july_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 8) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_august_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 9) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_september_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 10) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_october_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 11) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_november_prorate`,(select `b`.`dental_optical` from `hr__claim_allocation_prorate` `b` where ((`b`.`month` = 12) and (`b`.`claim_allocation_id` = `a`.`id`))) AS `dental_december_prorate` from `hr__claim_allocation` `a` where (`a`.`is_delete` = 0) */;

--
-- Final view structure for view `view__current_month_unsubmitted_dental_or_optical_claim`
--

/*!50001 DROP TABLE IF EXISTS `view__current_month_unsubmitted_dental_or_optical_claim`*/;
/*!50001 DROP VIEW IF EXISTS `view__current_month_unsubmitted_dental_or_optical_claim`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view__current_month_unsubmitted_dental_or_optical_claim` AS select `op`.`id` AS `id`,`op`.`claim_id` AS `submission_month_claim_id`,`claim_submission`.`year` AS `year`,`claim_submission`.`month` AS `month`,`claim_submission`.`user_id` AS `user_id`,`user`.`name` AS `name`,`claim_submission`.`is_submit` AS `is_submission_submitted`,`op_journal`.`claim_id` AS `first_entry_submission_month_claim_id`,`claim_submission_journal`.`is_submit` AS `first_entry_submission_is_submitted` from ((((`hr__claim_dental` `op` left join `hr__claim` `claim_submission` on((`op`.`claim_id` = `claim_submission`.`id`))) left join `hr__claim_dental_journal` `op_journal` on((`op`.`journal_id` = `op_journal`.`id`))) left join `hr__claim` `claim_submission_journal` on((`op_journal`.`claim_id` = `claim_submission_journal`.`id`))) left join `user` on((`user`.`id` = `claim_submission`.`user_id`))) where ((`op`.`prorate_month` = (month(curdate()) - 1)) and (`op`.`is_delete` = 0) and (`claim_submission`.`is_submit` = 0) and (`claim_submission_journal`.`is_submit` = 1)) */;

--
-- Final view structure for view `view__current_month_unsubmitted_outpatient_claim`
--

/*!50001 DROP TABLE IF EXISTS `view__current_month_unsubmitted_outpatient_claim`*/;
/*!50001 DROP VIEW IF EXISTS `view__current_month_unsubmitted_outpatient_claim`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view__current_month_unsubmitted_outpatient_claim` AS select `op`.`id` AS `id`,`op`.`claim_id` AS `submission_month_claim_id`,`claim_submission`.`year` AS `year`,`claim_submission`.`month` AS `month`,`claim_submission`.`user_id` AS `user_id`,`user`.`name` AS `name`,`claim_submission`.`is_submit` AS `is_submission_submitted`,`op_journal`.`claim_id` AS `first_entry_submission_month_claim_id`,`claim_submission_journal`.`is_submit` AS `first_entry_submission_is_submitted` from ((((`hr__claim_outpatient` `op` left join `hr__claim` `claim_submission` on((`op`.`claim_id` = `claim_submission`.`id`))) left join `hr__claim_outpatient_journal` `op_journal` on((`op`.`journal_id` = `op_journal`.`id`))) left join `hr__claim` `claim_submission_journal` on((`op_journal`.`claim_id` = `claim_submission_journal`.`id`))) left join `user` on((`user`.`id` = `claim_submission`.`user_id`))) where ((`op`.`prorate_month` = (month(curdate()) - 1)) and (`op`.`is_delete` = 0) and (`claim_submission`.`is_submit` = 0) and (`claim_submission_journal`.`is_submit` = 1)) */;

--
-- Final view structure for view `view__gross_pay_by_staff`
--

/*!50001 DROP TABLE IF EXISTS `view__gross_pay_by_staff`*/;
/*!50001 DROP VIEW IF EXISTS `view__gross_pay_by_staff`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view__gross_pay_by_staff` AS select `a`.`id` AS `user_id`,`a`.`staff_id` AS `staff_id`,`g`.`department_id` AS `department_id`,`b`.`year` AS `year`,`b`.`month` AS `month`,`b`.`employeeID` AS `employeeid`,`b`.`employeeName` AS `employeeName`,ifnull(round(sum(`b`.`grossPay`),2),0.00) AS `grossPay`,ifnull(round(sum(`c`.`amount`),2),0.00) AS `employer_contribution`,ifnull(round(sum(`e`.`paid_amount`),2),0.00) AS `claim`,ifnull(round(sum(`f`.`totalClaim`),2),0.00) AS `ot` from (((((`user` `a` left join `hr__payslip` `b` on(((`a`.`staff_id` = `b`.`employeeID`) or (`a`.`ic_no` = `b`.`employeeIC`)))) left join `hr__payslip_employer_contribution` `c` on((`c`.`paySlipID` = `b`.`id`))) left join `hr__claim` `e` on(((`e`.`user_id` = `a`.`id`) and (`e`.`year` = `b`.`year`) and (`e`.`month` = `b`.`month`) and (`e`.`is_delete` = 0)))) left join `hr__ot` `f` on(((`f`.`peopleID` = `a`.`id`) and (`f`.`year` = `b`.`year`) and (`f`.`month` = `b`.`month`) and (`f`.`is_delete` = 0)))) left join `user__employment_detail` `g` on((`g`.`user_id` = `a`.`id`))) group by `a`.`id`,`b`.`year`,`b`.`month` */;

--
-- Final view structure for view `view__kbs`
--

/*!50001 DROP TABLE IF EXISTS `view__kbs`*/;
/*!50001 DROP VIEW IF EXISTS `view__kbs`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view__kbs` AS select `a`.`name` AS `department_name`,`a`.`description` AS `department_desc`,`b`.`name` AS `branch`,`c`.`code` AS `room_code`,`d`.`code` AS `rack_code`,`e`.`box_no` AS `box_no`,`e`.`title` AS `box_title`,`e`.`description` AS `box_description`,`f`.`title` AS `document_title`,`f`.`description` AS `document_desccription`,`f`.`document_date` AS `document_date`,`h`.`name` AS `created_by`,`i`.`name` AS `updated_by`,`g`.`title` AS `attachment_title`,`g`.`description` AS `attachment_description`,`g`.`file_name` AS `file_name`,`g`.`file_location` AS `file_location`,`customer`.`name` AS `crm_customer_name`,`customer`.`roc_no` AS `roc_no`,`j`.`name` AS `kbs_old_customer_name`,`j`.`roc_no` AS `kbs_old_roc_no` from ((((((((((`company__department` `a` left join `company__branch` `b` on(((`b`.`id` = `a`.`branch_id`) and (`b`.`is_delete` = 0)))) left join `kbs__room` `c` on(((`c`.`dept_id` = `a`.`id`) and (`c`.`is_delete` = 0)))) left join `kbs__rack` `d` on(((`d`.`room_id` = `c`.`id`) and (`d`.`is_delete` = 0)))) left join `kbs__box` `e` on(((`d`.`id` = `e`.`rack_id`) and (`e`.`is_delete` = 0)))) left join `kbs__document` `f` on(((`e`.`id` = `f`.`box_id`) and (`f`.`is_delete` = 0)))) left join `kbs__attachment` `g` on(((`g`.`document_id` = `f`.`id`) and (`g`.`is_delete` = 0)))) left join `user` `h` on((`h`.`id` = `f`.`created_by`))) left join `user` `i` on((`i`.`id` = `f`.`updated_by`))) left join `kbs__company` `j` on((`j`.`id` = `f`.`company_id`))) left join `customer` on((`customer`.`id` = `j`.`crm_id`))) */;

--
-- Final view structure for view `view__report_department_claim`
--

/*!50001 DROP TABLE IF EXISTS `view__report_department_claim`*/;
/*!50001 DROP VIEW IF EXISTS `view__report_department_claim`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view__report_department_claim` AS select `rc`.`department_id` AS `department_id`,`rc`.`year` AS `year`,`rc`.`month` AS `month`,sum(`rc`.`overtime`) AS `overtime`,sum(`rc`.`dental_approved`) AS `dental_approved`,sum(`rc`.`hospitalization_approved`) AS `hospitalization_approved`,sum(`rc`.`outpatient_approved`) AS `outpatient_approved`,sum(`rc`.`medical_screening_approved`) AS `medical_screening_approved`,sum(`rc`.`meals_approved`) AS `meals_approved`,sum(`rc`.`others_tng`) AS `others_tng`,sum(`rc`.`others_purchase`) AS `others_purchase`,sum(`rc`.`others_call`) AS `others_call`,sum(`rc`.`others_airport_taxes`) AS `others_airport_taxes`,sum(`rc`.`others_service_taxes`) AS `others_service_taxes`,sum(`rc`.`others_tips_and_portage`) AS `others_tips_and_portage`,sum(`rc`.`others_laundry`) AS `others_laundry`,sum(`rc`.`others_excess_baggage`) AS `others_excess_baggage`,sum(`rc`.`others_loss_in_foreign_exchange`) AS `others_loss_in_foreign_exchange`,sum(`rc`.`others_firm_Event`) AS `others_firm_event`,sum(`rc`.`others_motor_expenses`) AS `others_motor_expenses`,sum(`rc`.`others_ssm_search`) AS `others_ssm_search`,sum(`rc`.`other_book`) AS `others_book`,sum(`rc`.`other_stationary`) AS `others_stationary`,sum(`rc`.`other_membership`) AS `others_membership`,sum(`rc`.`other_printing`) AS `others_printing`,sum(`rc`.`other_stamping`) AS `others_stamping`,sum(`rc`.`other_license`) AS `others_license`,sum(`rc`.`mileage_approved`) AS `mileage_approved`,sum(`rc`.`accomodation_claim_approved`) AS `accomodation_claim_approved`,sum(`rc`.`subsistence_outstation`) AS `subsistence_outstation`,sum(`rc`.`subsistence_meals`) AS `subsistence_meals`,sum(`rc`.`transportation_car_rental_approved`) AS `transportation_car_rental_approved`,sum(`rc`.`transportation_flight_approved`) AS `transportation_flight_approved`,sum(`rc`.`transportation_public_transport_approved`) AS `transportation_public_transport_approved`,sum(`rc`.`transportation_e_hailing_approved`) AS `transportation_e_hailing_approved`,sum(`rc`.`transportation_trains_approved`) AS `transportation_trains_approved`,sum(`rc`.`parking_claim_approved`) AS `parking_claim_approved`,sum(`rc`.`toll_claim_approved`) AS `toll_claim_approved`,sum(`rc`.`trainer_claim_approved`) AS `trainer_claim_approved`,sum(`rc`.`panel_claim`) AS `panel_claim`,sum(`rc`.`petrol_claim_approved`) AS `petrol_claim_approved`,sum(`rc`.`entertainment_claim_approved`) AS `entertainment_claim_approved`,sum(`rc`.`entertainment_claim_client`) AS `entertainment_claim_client`,sum(`rc`.`entertainment_claim_staff`) AS `entertainment_claim_staff`,sum(`rc`.`other_courier`) AS `other_courier` from `view_report_claim` `rc` group by `rc`.`year`,`rc`.`month`,`rc`.`department_id` */;

--
-- Final view structure for view `view_claim`
--

/*!50001 DROP TABLE IF EXISTS `view_claim`*/;
/*!50001 DROP VIEW IF EXISTS `view_claim`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_claim` AS select `a`.`id` AS `id`,`a`.`user_id` AS `user_id`,`a`.`year` AS `year`,`a`.`month` AS `month`,`a`.`status` AS `status`,`a`.`is_submit` AS `is_submit`,`a`.`is_delete` AS `is_delete`,(select ifnull(round(sum(`dt`.`amount_claim`),2),0.00) from `hr__claim_dental` `dt` where ((`dt`.`claim_id` = `a`.`id`) and (`dt`.`is_delete` = 0))) AS `dental_claim`,(select ifnull(round(sum(`dt`.`amount_approved`),2),0.00) from `hr__claim_dental` `dt` where ((`dt`.`claim_id` = `a`.`id`) and (`dt`.`is_delete` = 0))) AS `dental_approved`,(select ifnull(round(sum(`hosp`.`amount_claim`),2),0.00) from `hr__claim_hospitalization` `hosp` where ((`hosp`.`claim_id` = `a`.`id`) and (`hosp`.`is_delete` = 0))) AS `hospitalization_claim`,(select ifnull(round(sum(`hosp`.`amount_approved`),2),0.00) from `hr__claim_hospitalization` `hosp` where ((`hosp`.`claim_id` = `a`.`id`) and (`hosp`.`is_delete` = 0))) AS `hospitalization_approved`,(select ifnull(round(sum(`meals`.`amount_claim`),2),0.00) from `hr__claim_meals` `meals` where ((`meals`.`claim_id` = `a`.`id`) and (`meals`.`is_delete` = 0))) AS `meals_claim`,(select ifnull(round(sum(`meals`.`amount_approved`),2),0.00) from `hr__claim_meals` `meals` where ((`meals`.`claim_id` = `a`.`id`) and (`meals`.`is_delete` = 0))) AS `meals_approved`,(select ifnull(round(sum(`medical`.`amount_claim`),2),0.00) from `hr__claim_medical_screening` `medical` where ((`medical`.`claim_id` = `a`.`id`) and (`medical`.`is_delete` = 0))) AS `medical_screening_claim`,(select ifnull(round(sum(`medical`.`amount_approved`),2),0.00) from `hr__claim_medical_screening` `medical` where ((`medical`.`claim_id` = `a`.`id`) and (`medical`.`is_delete` = 0))) AS `medical_screening_approved`,(select ifnull(round(sum(`mileage`.`amount_claim`),2),0.00) from `hr__claim_mileage` `mileage` where ((`mileage`.`claim_id` = `a`.`id`) and (`mileage`.`is_delete` = 0))) AS `mileage_claim`,(select ifnull(round(sum(`mileage`.`amount_approve`),2),0.00) from `hr__claim_mileage` `mileage` where ((`mileage`.`claim_id` = `a`.`id`) and (`mileage`.`is_delete` = 0))) AS `mileage_approved`,(select ifnull(round(sum(`others`.`amount_claim`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0))) AS `others_claim`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0))) AS `others_approved`,(select ifnull(round(sum(`outpatient`.`amount_claim`),2),0.00) from `hr__claim_outpatient` `outpatient` where ((`outpatient`.`claim_id` = `a`.`id`) and (`outpatient`.`is_delete` = 0))) AS `outpatient_claim`,(select ifnull(round(sum(`outpatient`.`amount_approved`),2),0.00) from `hr__claim_outpatient` `outpatient` where ((`outpatient`.`claim_id` = `a`.`id`) and (`outpatient`.`is_delete` = 0))) AS `outpatient_approved`,(select ifnull(round(sum(`travelling`.`mileage_amount`),2),0.00) from `hr__claim_travelling` `travelling` where ((`travelling`.`claim_id` = `a`.`id`) and (`travelling`.`is_delete` = 0))) AS `travelling_mileage_claim`,(select ifnull(round(sum(`travelling`.`mileage_amount_approved`),2),0.00) from `hr__claim_travelling` `travelling` where ((`travelling`.`claim_id` = `a`.`id`) and (`travelling`.`is_delete` = 0))) AS `travelling_mileage_approved`,(select ifnull(round(sum(`travelling_detail`.`amount`),2),0.00) from (`hr__claim_travelling_detail` `travelling_detail` left join `hr__claim_travelling` `travelling` on((`travelling_detail`.`claim_travelling_id` = `travelling`.`id`))) where ((`travelling`.`claim_id` = `a`.`id`) and (`travelling`.`is_delete` = 0))) AS `travelling_mileage_claim_item`,(select ifnull(round(sum(`travelling`.`amount_approve`),2),0.00) from `hr__claim_travelling` `travelling` where ((`travelling`.`claim_id` = `a`.`id`) and (`travelling`.`is_delete` = 0))) AS `travelling_item_approved`,(select ifnull(round(sum(`accomodation`.`amount`),2),0.00) from `hr__claim_accommodation` `accomodation` where ((`accomodation`.`claim_id` = `a`.`id`) and (`accomodation`.`is_delete` = 0))) AS `accomodation_claim`,(select ifnull(round(sum(`accomodation`.`amount_approved`),2),0.00) from `hr__claim_accommodation` `accomodation` where ((`accomodation`.`claim_id` = `a`.`id`) and (`accomodation`.`is_delete` = 0))) AS `accomodation_claim_approved`,(select ifnull(round(sum(`subsistence`.`amount`),2),0.00) from `hr__claim_subsistence` `subsistence` where ((`subsistence`.`claim_id` = `a`.`id`) and (`subsistence`.`is_delete` = 0))) AS `subsistence_claim`,(select ifnull(round(sum(`subsistence`.`amount_approved`),2),0.00) from `hr__claim_subsistence` `subsistence` where ((`subsistence`.`claim_id` = `a`.`id`) and (`subsistence`.`is_delete` = 0))) AS `subsistence_claim_approved`,(select ifnull(round(sum(`transportation`.`amount`),2),0.00) from `hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`is_delete` = 0))) AS `transportation_claim`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`is_delete` = 0))) AS `transportation_claim_approved`,(select ifnull(round(sum(`parking`.`amount`),2),0.00) from `hr__claim_parking` `parking` where ((`parking`.`claim_id` = `a`.`id`) and (`parking`.`is_delete` = 0))) AS `parking_claim`,(select ifnull(round(sum(`parking`.`amount_approved`),2),0.00) from `hr__claim_parking` `parking` where ((`parking`.`claim_id` = `a`.`id`) and (`parking`.`is_delete` = 0))) AS `parking_claim_approved`,(select ifnull(round(sum(`toll`.`amount`),2),0.00) from `hr__claim_toll` `toll` where ((`toll`.`claim_id` = `a`.`id`) and (`toll`.`is_delete` = 0))) AS `toll_claim`,(select ifnull(round(sum(`toll`.`amount_approved`),2),0.00) from `hr__claim_toll` `toll` where ((`toll`.`claim_id` = `a`.`id`) and (`toll`.`is_delete` = 0))) AS `toll_claim_approved`,(select ifnull(round(sum(`trainer`.`amount`),2),0.00) from `hr__claim_trainer` `trainer` where ((`trainer`.`claim_id` = `a`.`id`) and (`trainer`.`is_delete` = 0))) AS `trainer_claim`,(select ifnull(round(sum(`trainer`.`amount_approved`),2),0.00) from `hr__claim_trainer` `trainer` where ((`trainer`.`claim_id` = `a`.`id`) and (`trainer`.`is_delete` = 0))) AS `trainer_claim_approved`,(select ifnull(round(sum(`clinic`.`amount`),2),0.00) from (`hr__claim_panel_clinic` `panel` left join `hr__claim_panel_clinic_detail` `clinic` on(((`panel`.`id` = `clinic`.`panel_claim_id`) and (`clinic`.`is_delete` = 0)))) where ((`panel`.`is_delete` = 0) and (`panel`.`invoice_month` = (`a`.`month` - 1)) and (`panel`.`invoice_year` = `a`.`year`) and (`clinic`.`staff_id` = `a`.`user_id`))) AS `panel_claim`,(select ifnull(round(sum(`petrol`.`amount`),2),0.00) from `hr__claim_petrol` `petrol` where ((`petrol`.`claim_id` = `a`.`id`) and (`petrol`.`is_delete` = 0))) AS `petrol_claim`,(select ifnull(round(sum(`petrol`.`amount_approved`),2),0.00) from `hr__claim_petrol` `petrol` where ((`petrol`.`claim_id` = `a`.`id`) and (`petrol`.`is_delete` = 0))) AS `petrol_claim_approved`,(select ifnull(round(sum(`entertainment`.`amount`),2),0.00) from `hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0))) AS `entertainment_claim_amount`,(select ifnull(round(sum(`entertainment`.`amount_approved`),2),0.00) from `hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0))) AS `entertainment_claim_amount_approved` from `hr__claim` `a` where (`a`.`is_delete` = 0) group by `a`.`id` */;

--
-- Final view structure for view `view_claim_dental_optical`
--

/*!50001 DROP TABLE IF EXISTS `view_claim_dental_optical`*/;
/*!50001 DROP VIEW IF EXISTS `view_claim_dental_optical`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_claim_dental_optical` AS select `a`.`user_id` AS `user_id`,`a`.`month` AS `month`,`a`.`year` AS `year`,`a`.`dental_optical` AS `prorate`,ifnull((select sum(`b`.`amount_claim`) from (`hr__claim_dental` `b` left join `hr__claim_dental_journal` `c` on((`c`.`id` = `b`.`journal_id`))) where ((`b`.`is_delete` = 0) and (`b`.`is_approve` = 0) and (`b`.`prorate_month` <= `a`.`month`) and (year(`b`.`date`) = `a`.`year`) and (`c`.`user_id` = `a`.`user_id`))),0) AS `pending`,ifnull((select sum(`b`.`amount_approved`) from (`hr__claim_dental` `b` left join `hr__claim_dental_journal` `c` on((`c`.`id` = `b`.`journal_id`))) where ((`b`.`is_delete` = 0) and (`b`.`is_approve` = 1) and (`b`.`prorate_month` <= `a`.`month`) and (year(`b`.`date`) = `a`.`year`) and (`c`.`user_id` = `a`.`user_id`))),0) AS `approved`,ifnull((select sum(`d`.`amount`) from (`hr__claim_panel_clinic_detail` `d` left join `hr__claim_panel_clinic` `e` on(((`e`.`id` = `d`.`panel_claim_id`) and (`e`.`is_delete` = 0) and (`d`.`is_delete` = 0) and (`d`.`claim_type_id` = 4)))) where ((`e`.`invoice_month` <= `a`.`month`) and (`e`.`invoice_year` = `a`.`year`) and (`d`.`staff_id` = `a`.`user_id`))),0) AS `panel_claim`,(select (((`prorate` - `pending`) - `approved`) - `panel_claim`) AS `balanced_prorate`) AS `balanced_prorate` from (`hr__claim_allocation_prorate` `a` left join `hr__claim_allocation` `h` on((`h`.`id` = `a`.`claim_allocation_id`))) where (`h`.`is_delete` = 0) */;

--
-- Final view structure for view `view_claim_outpatient`
--

/*!50001 DROP TABLE IF EXISTS `view_claim_outpatient`*/;
/*!50001 DROP VIEW IF EXISTS `view_claim_outpatient`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_claim_outpatient` AS select `c`.`user_id` AS `user_id`,`c`.`month` AS `month`,`c`.`year` AS `year`,`c`.`outpatient` AS `prorate`,ifnull((select sum(`d`.`amount_claim`) from (`hr__claim_outpatient` `d` left join `hr__claim` `e` on(((`e`.`id` = `d`.`claim_id`) and (`e`.`is_delete` = 0)))) where ((`d`.`prorate_month` <= `c`.`month`) and (`d`.`is_approve` = 0) and (`d`.`is_delete` = 0) and (`e`.`user_id` = `c`.`user_id`) and (year(`d`.`date`) = `c`.`year`))),0) AS `pending`,ifnull((select sum(`f`.`amount_claim`) from (`hr__claim_outpatient` `f` left join `hr__claim` `g` on(((`g`.`id` = `f`.`claim_id`) and (`g`.`is_delete` = 0)))) where ((`f`.`prorate_month` <= `c`.`month`) and (`f`.`is_approve` = 1) and (`f`.`is_delete` = 0) and (`g`.`user_id` = `c`.`user_id`) and (year(`f`.`date`) = `c`.`year`))),0) AS `approved`,ifnull((select sum(`a`.`amount`) from (`hr__claim_panel_clinic_detail` `a` left join `hr__claim_panel_clinic` `b` on(((`b`.`id` = `a`.`panel_claim_id`) and (`b`.`is_delete` = 0) and (`a`.`is_delete` = 0) and (`a`.`claim_type_id` = 1)))) where ((`b`.`invoice_month` <= `c`.`month`) and (`b`.`invoice_year` = `c`.`year`) and (`a`.`staff_id` = `c`.`user_id`))),0) AS `panel_claim`,(select (((`prorate` - `pending`) - `approved`) - `panel_claim`) AS `balanced_prorate`) AS `balanced_prorate` from (`hr__claim_allocation_prorate` `c` left join `hr__claim_allocation` `h` on((`h`.`id` = `c`.`claim_allocation_id`))) where (`h`.`is_delete` = 0) */;

--
-- Final view structure for view `view_crm_duplicate`
--

/*!50001 DROP TABLE IF EXISTS `view_crm_duplicate`*/;
/*!50001 DROP VIEW IF EXISTS `view_crm_duplicate`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_crm_duplicate` AS select `customer`.`id` AS `id`,`customer`.`name` AS `name`,`customer`.`roc_no` AS `roc_no`,count(0) AS `c` from `customer` where (`customer`.`is_delete` = 0) group by `customer`.`name` having (`c` > 1) */;

--
-- Final view structure for view `view_crm_enggagement`
--

/*!50001 DROP TABLE IF EXISTS `view_crm_enggagement`*/;
/*!50001 DROP VIEW IF EXISTS `view_crm_enggagement`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_crm_enggagement` AS select `crm`.`ID` AS `crmID`,`crm`.`deptID` AS `deptID`,`c`.`name` AS `department`,`a`.`id` AS `movementID`,`a`.`customerid` AS `customerID`,concat(`a`.`description`,'<br>Location ',`a`.`destination`) AS `activity`,`b`.`movementType` AS `enggagementType`,`a`.`date` AS `date`,`b`.`color_code` AS `color_code`,(select group_concat(`bb`.`name` separator ',') from (`hr__movement_group_detail` `aa` left join `user` `bb` on((`aa`.`staffid` = `bb`.`id`))) where (`aa`.`groupid` = `a`.`id`)) AS `staff`,(select group_concat(`bb`.`id` separator ',') from (`hr__movement_group_detail` `aa` left join `user` `bb` on((`aa`.`staffid` = `bb`.`id`))) where (`aa`.`groupid` = `a`.`id`)) AS `staffID`,(select group_concat(concat(`bb`.`name`,'(',`bb`.`position`,')') separator ',') from (`crm__enggagement_contact` `aa` left join `customer__contact` `bb` on((`aa`.`contactid` = `bb`.`id`))) where ((`aa`.`enggagementid` = `crm`.`ID`) and (`aa`.`is_delete` = 0))) AS `contact`,(select group_concat(`bb`.`id` separator ',') from (`crm__enggagement_contact` `aa` left join `customer__contact` `bb` on((`aa`.`contactid` = `bb`.`id`))) where ((`aa`.`enggagementid` = `crm`.`ID`) and (`aa`.`is_delete` = 0))) AS `contactID` from (((`hr__movement_group` `a` left join `hr__movement_type` `b` on((`a`.`movementType` = `b`.`id`))) left join `crm__enggagement` `crm` on(((`crm`.`movementID` = `a`.`id`) and (`crm`.`is_delete` = 0)))) left join `company__department` `c` on((`c`.`id` = `crm`.`deptID`))) union select `a`.`ID` AS `ID`,`a`.`deptID` AS `deptID`,`c`.`name` AS `department`,0 AS `movementID`,`a`.`customerID` AS `customerID`,`a`.`activity` AS `activity`,`b`.`name` AS `name`,`a`.`date` AS `date`,`b`.`color_code` AS `color_code`,(select group_concat(`bb`.`name` separator ',') from (`crm__enggagement_staff` `aa` left join `user` `bb` on((`aa`.`staffid` = `bb`.`id`))) where ((`aa`.`enggagementid` = `a`.`ID`) and (`aa`.`is_delete` = 0))) AS `staff`,(select group_concat(`bb`.`id` separator ',') from (`crm__enggagement_staff` `aa` left join `user` `bb` on((`aa`.`staffid` = `bb`.`id`))) where ((`aa`.`enggagementid` = `a`.`ID`) and (`aa`.`is_delete` = 0))) AS `staffID`,(select group_concat(concat(`bb`.`name`,'(',`bb`.`position`,')') separator ',') from (`crm__enggagement_contact` `aa` left join `customer__contact` `bb` on((`aa`.`contactid` = `bb`.`id`))) where ((`aa`.`enggagementid` = `a`.`ID`) and (`aa`.`is_delete` = 0))) AS `contact`,(select group_concat(`bb`.`id` separator ',') from (`crm__enggagement_contact` `aa` left join `customer__contact` `bb` on((`aa`.`contactid` = `bb`.`id`))) where ((`aa`.`enggagementid` = `a`.`ID`) and (`aa`.`is_delete` = 0))) AS `contactID` from (((`crm__enggagement` `a` left join `crm__process` `b` on((`b`.`ID` = `a`.`crm_processID`))) left join `company__department` `c` on((`c`.`id` = `a`.`deptID`))) left join `hr__movement_group` `d` on((`a`.`movementID` = `d`.`id`))) where (`a`.`is_delete` = 0) */;

--
-- Final view structure for view `view_crm_incomplete`
--

/*!50001 DROP TABLE IF EXISTS `view_crm_incomplete`*/;
/*!50001 DROP VIEW IF EXISTS `view_crm_incomplete`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_crm_incomplete` AS select `customer`.`id` AS `id`,`customer`.`name` AS `name`,`customer`.`type_id` AS `type_id`,if((`customer`.`type_id` = 0),0,1) AS `type_f`,if((`customer`.`profile` = ''),0,1) AS `profile_f`,if((`customer`.`address1` = ''),0,1) AS `address1_f`,if((`customer`.`postcode` = ''),0,1) AS `postcode_f`,if((`customer`.`city` = ''),0,1) AS `city_f`,if((`customer`.`state_id` = 0),0,1) AS `state_id_f`,if((`customer`.`country_id` = 0),0,1) AS `country_id_f`,if((`customer`.`phone` = ''),0,1) AS `phone_f`,if((`customer`.`email` = ''),0,1) AS `email_f`,if((`customer`.`grade_id` = 0),0,1) AS `grade_id_f`,if((`customer`.`year_end_id` = 0),0,1) AS `year_end_id_f`,if((`customer`.`status_id` = 0),0,1) AS `status_id_f`,(select if(((select count(`customer__contact`.`id`) AS `count_director` from `customer__contact` where ((`customer__contact`.`customer_id` = `customer`.`id`) and (`customer__contact`.`is_delete` = 0) and ((`customer__contact`.`director` = 1) or (`customer__contact`.`shareholder` = 1)))) = 0),0,1)) AS `director_f`,(select ((((((((((((`type_f` + `profile_f`) + `address1_f`) + `postcode_f`) + `city_f`) + `state_id_f`) + `country_id_f`) + `phone_f`) + `email_f`) + `grade_id_f`) + `year_end_id_f`) + `status_id_f`) + `director_f`)) AS `count1` from `customer` where (`customer`.`is_delete` = 0) */;

--
-- Final view structure for view `view_customer_summary`
--

/*!50001 DROP TABLE IF EXISTS `view_customer_summary`*/;
/*!50001 DROP VIEW IF EXISTS `view_customer_summary`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_customer_summary` AS select `customer`.`id` AS `customer_id`,`customer`.`name` AS `customer_name`,(select count(`customer__contact`.`id`) AS `sum_contact` from `customer__contact` where ((`customer__contact`.`customer_id` = `customer`.`id`) and (`customer__contact`.`is_delete` = 0))) AS `sum_contact`,(select count(`customer__contact`.`id`) AS `sum_director` from `customer__contact` where ((`customer__contact`.`customer_id` = `customer`.`id`) and ((`customer__contact`.`director` = 1) or (`customer__contact`.`shareholder` = 1)) and (`customer__contact`.`is_delete` = 0))) AS `sum_director`,(select count(`customer__other_address`.`id`) AS `sum_other_address` from `customer__other_address` where ((`customer__other_address`.`customer_id` = `customer`.`id`) and (`customer__other_address`.`is_delete` = 0))) AS `sum_other_address`,(select count(`customer__service`.`id`) AS `sum_service` from `customer__service` where ((`customer__service`.`customer_id` = `customer`.`id`) and (`customer__service`.`is_delete` = 0))) AS `sum_service`,(select count(`customer__accountant`.`id`) AS `sum_accountant` from `customer__accountant` where ((`customer__accountant`.`customer_id` = `customer`.`id`) and (`customer__accountant`.`is_delete` = 0))) AS `sum_accountant`,(select count(`customer__auditor`.`id`) AS `sum_auditor` from `customer__auditor` where ((`customer__auditor`.`customer_id` = `customer`.`id`) and (`customer__auditor`.`is_delete` = 0))) AS `sum_auditor`,(select count(`customer__tax_agent`.`id`) AS `sum_taxation` from `customer__tax_agent` where ((`customer__tax_agent`.`customer_id` = `customer`.`id`) and (`customer__tax_agent`.`is_delete` = 0))) AS `sum_taxation`,(select count(`customer__cosec`.`id`) AS `sum_cosec` from `customer__cosec` where ((`customer__cosec`.`customer_id` = `customer`.`id`) and (`customer__cosec`.`is_delete` = 0))) AS `sum_cosec`,0 AS `sum_cf`,(select count(`customer__gst`.`id`) AS `sum_gst` from `customer__gst` where ((`customer__gst`.`customer_id` = `customer`.`id`) and (`customer__gst`.`is_delete` = 0))) AS `sum_gst`,0 AS `sum_IT`,0 AS `sum_shariah`,(select count(`customer__othersinfo`.`id`) AS `sum_others` from `customer__othersinfo` where ((`customer__othersinfo`.`customer_id` = `customer`.`id`) and (`customer__othersinfo`.`is_delete` = 0))) AS `sum_others`,(select count(`customer__attachment`.`id`) AS `sum_attachment` from `customer__attachment` where ((`customer__attachment`.`customer_id` = `customer`.`id`) and (`customer__attachment`.`is_delete` = 0))) AS `sum_attachment` from `customer` where ((`customer`.`is_delete` = 0) and (`customer`.`status_id` in (1,2)) and (`customer`.`type_id` = 1)) order by `customer`.`name` */;

--
-- Final view structure for view `view_hiring_by_month_by_dept`
--

/*!50001 DROP TABLE IF EXISTS `view_hiring_by_month_by_dept`*/;
/*!50001 DROP VIEW IF EXISTS `view_hiring_by_month_by_dept`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_hiring_by_month_by_dept` AS select distinct year(`a`.`date_joined`) AS `year`,`a`.`department_id` AS `department_id`,sum(if((month(`a`.`date_joined`) = 1),1,0)) AS `new_1`,sum(if((month(`a`.`date_joined`) = 2),1,0)) AS `new_2`,sum(if((month(`a`.`date_joined`) = 3),1,0)) AS `new_3`,sum(if((month(`a`.`date_joined`) = 4),1,0)) AS `new_4`,sum(if((month(`a`.`date_joined`) = 5),1,0)) AS `new_5`,sum(if((month(`a`.`date_joined`) = 6),1,0)) AS `new_6`,sum(if((month(`a`.`date_joined`) = 7),1,0)) AS `new_7`,sum(if((month(`a`.`date_joined`) = 8),1,0)) AS `new_8`,sum(if((month(`a`.`date_joined`) = 9),1,0)) AS `new_9`,sum(if((month(`a`.`date_joined`) = 10),1,0)) AS `new_10`,sum(if((month(`a`.`date_joined`) = 11),1,0)) AS `new_11`,sum(if((month(`a`.`date_joined`) = 12),1,0)) AS `new_12` from `user__employment_detail` `a` group by year(`a`.`date_joined`),`a`.`department_id` */;

--
-- Final view structure for view `view_leave__summary_all_type`
--

/*!50001 DROP TABLE IF EXISTS `view_leave__summary_all_type`*/;
/*!50001 DROP VIEW IF EXISTS `view_leave__summary_all_type`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_leave__summary_all_type` AS select `a`.`year` AS `year`,`a`.`user_id` AS `user_id`,`c`.`name` AS `staff`,`ued`.`date_joined` AS `date_joined`,concat(`c`.`name`,'[',`a`.`user_id`,']',`ued`.`date_joined`) AS `name`,`t`.`code` AS `type_code`,`t`.`name` AS `leave_type`,`a`.`type_id` AS `type_id`,`aa`.`leave_entitled` AS `last_year_entitled`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_b4_april`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_after_april`,`aa`.`leave_balance` AS `last_year_balance`,`aa`.`bring_forward_entitled` AS `last_year_brought_forward`,`a`.`bring_forward_entitled` AS `bring_forward_entitled`,`a`.`leave_entitled` AS `leave_entitled`,sum(if(((month(`b`.`date_from`) < 4) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_before_april`,sum(if(((month(`b`.`date_from`) > 3) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_after_april`,`a`.`leave_balance` AS `current_balance`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_b4_april_from_table`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_after_april_from_table` from (((((`hr__leave_allocation` `a` left join `hr__leave_allocation` `aa` on(((`a`.`user_id` = `aa`.`user_id`) and (`a`.`type_id` = `aa`.`type_id`) and (`aa`.`year` = (`a`.`year` - 1)) and (`aa`.`is_delete` = 0) and (`aa`.`type_id` in (1,2))))) left join `hr__leave_application` `b` on(((`a`.`user_id` = `b`.`user_id`) and (`a`.`type_id` = `b`.`type_id`) and (`b`.`is_delete` = 0) and (`b`.`status` < 3)))) left join `user__employment_detail` `ued` on((`a`.`user_id` = `ued`.`user_id`))) join `hr__leave_type` `t`) join `user` `c`) where ((`c`.`id` = `a`.`user_id`) and (`a`.`type_id` in (1,2)) and (`t`.`id` = `a`.`type_id`) and (`a`.`is_delete` = 0)) group by `a`.`user_id`,`a`.`type_id`,`a`.`year` union select `a`.`year` AS `year`,`a`.`user_id` AS `user_id`,`c`.`name` AS `staff`,`ued`.`date_joined` AS `date_joined`,concat(`c`.`name`,'[',`a`.`user_id`,']',`ued`.`date_joined`) AS `name`,`t`.`code` AS `type_code`,`t`.`name` AS `leave_type`,`a`.`type_id` AS `type_id`,`aa`.`leave_entitled` AS `last_year_entitled`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` = 3))) AS `last_year_taken_b4_april`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` = 3))) AS `last_year_taken_after_april`,`aa`.`leave_balance` AS `last_year_balance`,`aa`.`bring_forward_entitled` AS `last_year_brought_forward`,`a`.`bring_forward_entitled` AS `bring_forward_entitled`,`a`.`leave_entitled` AS `leave_entitled`,sum(if(((month(`b`.`date_from`) < 4) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_before_april`,sum(if(((month(`b`.`date_from`) > 3) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_after_april`,`a`.`leave_balance` AS `current_balance`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` = 3))) AS `last_year_taken_b4_april_from_table`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` = 3))) AS `last_year_taken_after_april_from_table` from (((((`hr__leave_allocation` `a` left join `hr__leave_allocation` `aa` on(((`a`.`user_id` = `aa`.`user_id`) and (`a`.`type_id` = `aa`.`type_id`) and (`aa`.`year` = (`a`.`year` - 1)) and (`aa`.`is_delete` = 0) and (`aa`.`type_id` = 3)))) left join `hr__leave_application` `b` on(((`a`.`user_id` = `b`.`user_id`) and (`a`.`type_id` = `b`.`type_id`) and (`b`.`is_delete` = 0) and (`b`.`status` < 3)))) left join `user__employment_detail` `ued` on((`a`.`user_id` = `ued`.`user_id`))) join `hr__leave_type` `t`) join `user` `c`) where ((`c`.`id` = `a`.`user_id`) and (`a`.`type_id` >= 3) and (`t`.`id` = `a`.`type_id`) and (`a`.`is_delete` = 0)) group by `a`.`user_id`,`a`.`type_id`,`a`.`year` */;

--
-- Final view structure for view `view_leave_balance`
--

/*!50001 DROP TABLE IF EXISTS `view_leave_balance`*/;
/*!50001 DROP VIEW IF EXISTS `view_leave_balance`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_leave_balance` AS select `a`.`year` AS `year`,`a`.`user_id` AS `user_id`,`b`.`name` AS `name`,`a`.`type_id` AS `type_id`,`a`.`leave_entitled` AS `leave_entitled`,`a`.`leave_balance` AS `leave_balance`,ifnull(sum(`c`.`days_applied`),0) AS `total_applied` from ((`hr__leave_allocation` `a` left join `user` `b` on((`a`.`user_id` = `b`.`id`))) left join `hr__leave_application` `c` on(((`a`.`user_id` = `c`.`user_id`) and (`a`.`year` = year(`c`.`date_from`)) and (`a`.`type_id` = `c`.`type_id`) and (`c`.`is_delete` = 0) and (`c`.`status` = 2)))) where ((`a`.`is_delete` = 0) and (`a`.`type_id` > 2)) group by `a`.`year`,`a`.`user_id`,`a`.`type_id` */;

--
-- Final view structure for view `view_leave_summary`
--

/*!50001 DROP TABLE IF EXISTS `view_leave_summary`*/;
/*!50001 DROP VIEW IF EXISTS `view_leave_summary`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_leave_summary` AS select `a`.`year` AS `year`,`a`.`user_id` AS `user_id`,`c`.`name` AS `staff`,`ued`.`date_joined` AS `date_joined`,concat(`c`.`name`,'[',`a`.`user_id`,']',`ued`.`date_joined`) AS `name`,`t`.`name` AS `leave_type`,`a`.`type_id` AS `type_id`,`aa`.`leave_entitled` AS `last_year_entitled`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_b4_april`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_after_april`,`aa`.`leave_balance` AS `last_year_balance`,`aa`.`bring_forward_entitled` AS `last_year_brought_forward`,`a`.`bring_forward_entitled` AS `bring_forward_entitled`,`a`.`leave_entitled` AS `leave_entitled`,sum(if(((month(`b`.`date_from`) < 4) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_before_april`,sum(if(((month(`b`.`date_from`) > 3) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_after_april`,`a`.`leave_balance` AS `current_balance`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_b4_april_from_table`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_after_april_from_table` from (((((`hr__leave_allocation` `a` left join `hr__leave_allocation` `aa` on(((`a`.`user_id` = `aa`.`user_id`) and (`a`.`type_id` = `aa`.`type_id`) and (`aa`.`year` = (`a`.`year` - 1)) and (`aa`.`is_delete` = 0) and (`aa`.`type_id` in (1,2))))) left join `hr__leave_application` `b` on(((`a`.`user_id` = `b`.`user_id`) and (`a`.`type_id` = `b`.`type_id`) and (`b`.`is_delete` = 0) and (`b`.`status` < 3)))) left join `user__employment_detail` `ued` on((`a`.`user_id` = `ued`.`user_id`))) join `hr__leave_type` `t`) join `user` `c`) where ((`c`.`id` = `a`.`user_id`) and (`a`.`type_id` in (1,2)) and (`t`.`id` = `a`.`type_id`) and (`a`.`is_delete` = 0)) group by `a`.`user_id`,`a`.`type_id`,`a`.`year` union select `a`.`year` AS `year`,`a`.`user_id` AS `user_id`,`c`.`name` AS `staff`,`ued`.`date_joined` AS `date_joined`,concat(`c`.`name`,'[',`a`.`user_id`,']',`ued`.`date_joined`) AS `name`,`t`.`name` AS `leave_type`,`a`.`type_id` AS `type_id`,`aa`.`leave_entitled` AS `last_year_entitled`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_b4_april`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = (`a`.`year` - 1)) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_after_april`,`aa`.`leave_balance` AS `last_year_balance`,`aa`.`bring_forward_entitled` AS `last_year_brought_forward`,`a`.`bring_forward_entitled` AS `bring_forward_entitled`,`a`.`leave_entitled` AS `leave_entitled`,sum(if(((month(`b`.`date_from`) < 4) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_before_april`,sum(if(((month(`b`.`date_from`) > 3) and (year(`b`.`date_from`) = `a`.`year`)),`b`.`days_applied`,0)) AS `leave_applied_after_april`,`a`.`leave_balance` AS `current_balance`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) < 4) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_b4_april_from_table`,(select sum(`hr__leave_application`.`days_applied`) from `hr__leave_application` where ((`hr__leave_application`.`user_id` = `a`.`user_id`) and (year(`hr__leave_application`.`date_from`) = `a`.`year`) and (month(`hr__leave_application`.`date_from`) > 3) and (`hr__leave_application`.`is_delete` = 0) and (`hr__leave_application`.`type_id` = `a`.`type_id`) and (`hr__leave_application`.`status` in (1,2)))) AS `last_year_taken_after_april_from_table` from (((((`hr__leave_allocation` `a` left join `hr__leave_allocation` `aa` on(((`a`.`user_id` = `aa`.`user_id`) and (`a`.`type_id` = `aa`.`type_id`) and (`aa`.`year` = (`a`.`year` - 1)) and (`aa`.`is_delete` = 0) and (`aa`.`type_id` = 3)))) left join `hr__leave_application` `b` on(((`a`.`user_id` = `b`.`user_id`) and (`a`.`type_id` = `b`.`type_id`) and (`b`.`is_delete` = 0) and (`b`.`status` in (1,2))))) left join `user__employment_detail` `ued` on((`a`.`user_id` = `ued`.`user_id`))) join `hr__leave_type` `t`) join `user` `c`) where ((`c`.`id` = `a`.`user_id`) and (`a`.`type_id` = 3) and (`t`.`id` = `a`.`type_id`) and (`a`.`is_delete` = 0)) group by `a`.`user_id`,`a`.`type_id`,`a`.`year` */;

--
-- Final view structure for view `view_ot`
--

/*!50001 DROP TABLE IF EXISTS `view_ot`*/;
/*!50001 DROP VIEW IF EXISTS `view_ot`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_ot` AS select `a`.`ID` AS `otID`,`a`.`peopleID` AS `peopleid`,`c`.`department_id` AS `deptID`,`d`.`name` AS `department`,(select `company__department`.`branch_id` from `company__department` where (`company__department`.`id` = `c`.`department_id`)) AS `branchID`,(select `company__branch`.`name` from `company__branch` where (`company__branch`.`id` = `branchID`)) AS `branch`,`a`.`year` AS `year`,`a`.`month` AS `month`,sum(if((`b`.`status` = 0),1,0)) AS `Pending`,sum(if((`b`.`status` = 1),1,0)) AS `Approved`,sum(if((`b`.`status` = 2),1,0)) AS `Rejected`,count(`b`.`ID`) AS `noOfClaim`,sum(`b`.`totalHoursApplied`) AS `totalHoursApplied`,sum(if((`b`.`status` = 1),`b`.`totalHoursApplied`,0)) AS `totalHoursApproved`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 1)),`b`.`totalHoursApplied`,0)) AS `Normal`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 2)),`b`.`totalHoursApplied`,0)) AS `Rest`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 3)),`b`.`totalHoursApplied`,0)) AS `Public`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 4)),`b`.`totalHoursApplied`,0)) AS `Weekend`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 5)),`b`.`totalHoursApplied`,0)) AS `Weekdays`,sum(if(((`b`.`dayType` = 1) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `NormalMeal`,sum(if(((`b`.`dayType` = 2) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `RestMeal`,sum(if(((`b`.`dayType` = 3) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `PublicMeal`,sum(if(((`b`.`dayType` = 4) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `WeekendMeal`,sum(if(((`b`.`dayType` = 5) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `WeekdaysMeal` from (((`hr__ot` `a` left join `hr__ot__detail` `b` on((`a`.`ID` = `b`.`otID`))) left join `user__employment_detail` `c` on((`a`.`peopleID` = `c`.`user_id`))) left join `company__department` `d` on((`d`.`id` = `c`.`department_id`))) where ((`a`.`is_delete` = 0) and (`b`.`is_delete` = 0)) group by `a`.`ID` */;

--
-- Final view structure for view `view_ot1`
--

/*!50001 DROP TABLE IF EXISTS `view_ot1`*/;
/*!50001 DROP VIEW IF EXISTS `view_ot1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_ot1` AS select `a`.`ID` AS `otID`,`a`.`peopleID` AS `peopleid`,(select `user__joining_group`.`personnel_area_id` from (`user__profiling` left join `user__joining_group` on((`user__profiling`.`id` = `user__joining_group`.`profiling_id`))) where ((`user__profiling`.`user_id` = `a`.`peopleID`) and (concat(`a`.`year`,'-',`a`.`month`,'-31') >= `user__profiling`.`action_efective_date`)) order by `user__joining_group`.`profiling_id` desc limit 1) AS `deptID`,(select `company__department`.`name` from ((`user__profiling` left join `user__joining_group` on((`user__profiling`.`id` = `user__joining_group`.`profiling_id`))) left join `company__department` on((`company__department`.`id` = `user__joining_group`.`personnel_area_id`))) where ((`user__profiling`.`user_id` = `a`.`peopleID`) and (concat(`a`.`year`,'-',`a`.`month`,'-31') >= `user__profiling`.`action_efective_date`)) order by `user__joining_group`.`profiling_id` desc limit 1) AS `department`,(select `company__department`.`branch_id` from `company__department` where (`company__department`.`id` = `deptID`)) AS `branchID`,(select `company__branch`.`name` from `company__branch` where (`company__branch`.`id` = `branchID`)) AS `branch`,`a`.`year` AS `year`,`a`.`month` AS `month`,sum(if((`b`.`status` = 0),1,0)) AS `Pending`,sum(if((`b`.`status` = 1),1,0)) AS `Approved`,sum(if((`b`.`status` = 2),1,0)) AS `Rejected`,count(`b`.`ID`) AS `noOfClaim`,sum(`b`.`totalHoursApplied`) AS `totalHoursApplied`,sum(if((`b`.`status` = 1),`b`.`totalHoursApplied`,0)) AS `totalHoursApproved`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 1)),`b`.`totalHoursApplied`,0)) AS `Normal`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 2)),`b`.`totalHoursApplied`,0)) AS `Rest`,sum(if(((`b`.`status` = 1) and (`b`.`dayType` = 3)),`b`.`totalHoursApplied`,0)) AS `Public`,sum(if(((`b`.`dayType` = 1) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `NormalMeal`,sum(if(((`b`.`dayType` = 2) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `RestMeal`,sum(if(((`b`.`dayType` = 3) and (`b`.`mealAllowance` = 2) and (`b`.`status` = 1)),1,0)) AS `PublicMeal` from (`hr__ot` `a` left join `hr__ot__detail` `b` on((`a`.`ID` = `b`.`otID`))) where ((`a`.`is_delete` = 0) and (`b`.`is_delete` = 0)) group by `a`.`ID` */;

--
-- Final view structure for view `view_report_claim`
--

/*!50001 DROP TABLE IF EXISTS `view_report_claim`*/;
/*!50001 DROP VIEW IF EXISTS `view_report_claim`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_report_claim` AS select `a`.`user_id` AS `user_id`,`b`.`name` AS `name`,`b`.`department_id` AS `department_id`,`b`.`business_entity_id` AS `business_entity_id`,`be`.`name` AS `business_entity_name`,`a`.`year` AS `year`,`a`.`month` AS `month`,ifnull(round(`ot`.`totalClaim`,2),0.00) AS `overtime`,(select ifnull(round(sum(`dt`.`amount_approved`),2),0.00) from `hr__claim_dental` `dt` where ((`dt`.`claim_id` = `a`.`id`) and (`dt`.`is_delete` = 0))) AS `dental_approved`,(select ifnull(round(sum(`hosp`.`amount_approved`),2),0.00) from `hr__claim_hospitalization` `hosp` where ((`hosp`.`claim_id` = `a`.`id`) and (`hosp`.`is_delete` = 0))) AS `hospitalization_approved`,(select ifnull(round(sum(`meals`.`amount_approved`),2),0.00) from `hr__claim_meals` `meals` where ((`meals`.`claim_id` = `a`.`id`) and (`meals`.`is_delete` = 0))) AS `meals_approved`,(select ifnull(round(sum(`medical`.`amount_approved`),2),0.00) from `hr__claim_medical_screening` `medical` where ((`medical`.`claim_id` = `a`.`id`) and (`medical`.`is_delete` = 0))) AS `medical_screening_approved`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'TNG'))) AS `others_tng`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'PURCHASE'))) AS `others_purchase`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'CALL'))) AS `others_call`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'AIRPORT_TAXES'))) AS `others_airport_taxes`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'SERVICE_TAXES'))) AS `others_service_taxes`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'TIPS_AND_PORTAGE'))) AS `others_tips_and_portage`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'LAUNDRY'))) AS `others_laundry`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'EXCESS_BAGGAGE'))) AS `others_excess_baggage`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'LOSS_IN_FOREIGN_EXCHANGE'))) AS `others_loss_in_foreign_exchange`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'FIRM_EVENT'))) AS `others_firm_Event`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'MOTOR_EXPENSES'))) AS `others_motor_expenses`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'SSM_SEARCH'))) AS `others_ssm_search`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'BOOK'))) AS `other_book`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'STATIONARY'))) AS `other_stationary`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'MEMBERSHIP'))) AS `other_membership`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'PRINTING'))) AS `other_printing`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'STAMPING'))) AS `other_stamping`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'LICENSE'))) AS `other_license`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'COURIER'))) AS `other_courier`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0))) AS `total_others_approved`,(select ifnull(round(sum(`outpatient`.`amount_approved`),2),0.00) from `hr__claim_outpatient` `outpatient` where ((`outpatient`.`claim_id` = `a`.`id`) and (`outpatient`.`is_delete` = 0))) AS `outpatient_approved`,(select ifnull(round(sum(`travelling`.`amount_approve`),2),0.00) from `hr__claim_travelling` `travelling` where ((`travelling`.`claim_id` = `a`.`id`) and (`travelling`.`is_delete` = 0))) AS `mileage_approved`,(select ifnull(round(sum(`accomodation`.`amount_approved`),2),0.00) from `hr__claim_accommodation` `accomodation` where ((`accomodation`.`claim_id` = `a`.`id`) and (`accomodation`.`is_delete` = 0))) AS `accomodation_claim_approved`,(select ifnull(round(sum(`subsistence`.`amount_approved`),2),0.00) from `hr__claim_subsistence` `subsistence` where ((`subsistence`.`claim_id` = `a`.`id`) and (`subsistence`.`is_delete` = 0) and (`subsistence`.`allowance` = 'OUTSTATION'))) AS `subsistence_outstation`,(select ifnull(round(sum(`subsistence`.`amount_approved`),2),0.00) from `hr__claim_subsistence` `subsistence` where ((`subsistence`.`claim_id` = `a`.`id`) and (`subsistence`.`is_delete` = 0) and (`subsistence`.`allowance` = 'MEALS'))) AS `subsistence_meals`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 3) and (`transportation`.`is_delete` = 0))) AS `transportation_car_rental_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 4) and (`transportation`.`is_delete` = 0))) AS `transportation_flight_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 5) and (`transportation`.`is_delete` = 0))) AS `transportation_public_transport_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 7) and (`transportation`.`is_delete` = 0))) AS `transportation_e_hailing_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 8) and (`transportation`.`is_delete` = 0))) AS `transportation_trains_approved`,(select ifnull(round(sum(`parking`.`amount_approved`),2),0.00) from `hr__claim_parking` `parking` where ((`parking`.`claim_id` = `a`.`id`) and (`parking`.`is_delete` = 0))) AS `parking_claim_approved`,(select ifnull(round(sum(`toll`.`amount_approved`),2),0.00) from `hr__claim_toll` `toll` where ((`toll`.`claim_id` = `a`.`id`) and (`toll`.`is_delete` = 0))) AS `toll_claim_approved`,(select ifnull(round(sum(`trainer`.`amount_approved`),2),0.00) from `hr__claim_trainer` `trainer` where ((`trainer`.`claim_id` = `a`.`id`) and (`trainer`.`is_delete` = 0))) AS `trainer_claim_approved`,(select ifnull(round(sum(`clinic`.`amount`),2),0.00) from (`hr__claim_panel_clinic` `panel` left join `hr__claim_panel_clinic_detail` `clinic` on(((`panel`.`id` = `clinic`.`panel_claim_id`) and (`clinic`.`is_delete` = 0)))) where ((`panel`.`is_delete` = 0) and (`panel`.`invoice_month` = (`a`.`month` - 1)) and (`panel`.`invoice_year` = `a`.`year`) and (`clinic`.`staff_id` = `a`.`user_id`))) AS `panel_claim`,(select ifnull(round(sum(`petrol`.`amount_approved`),2),0.00) from `hr__claim_petrol` `petrol` where ((`petrol`.`claim_id` = `a`.`id`) and (`petrol`.`is_delete` = 0))) AS `petrol_claim_approved`,(select ifnull(round(sum(`entertainment`.`amount_approved`),2),0.00) from `hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0))) AS `entertainment_claim_approved`,(select ifnull(round(sum(`entertainment`.`amount_approved`),2),0.00) from `hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0) and (`entertainment`.`type` = 0))) AS `entertainment_claim_client`,(select ifnull(round(sum(`entertainment`.`amount_approved`),2),0.00) from `hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0) and (`entertainment`.`type` = 1))) AS `entertainment_claim_staff` from (((`hr__claim` `a` left join `user__employment_detail` `b` on((`b`.`id` = `a`.`user_id`))) left join `hr__ot` `ot` on(((`a`.`user_id` = `ot`.`peopleID`) and (`a`.`year` = `ot`.`year`) and (`a`.`month` = `ot`.`month`) and (`ot`.`is_delete` = 0) and (`ot`.`claim_status` = 2)))) left join `company__business_entity` `be` on((`b`.`business_entity_id` = `be`.`id`))) where (`a`.`is_delete` = 0) */;

--
-- Final view structure for view `view_report_claim_20210111`
--

/*!50001 DROP TABLE IF EXISTS `view_report_claim_20210111`*/;
/*!50001 DROP VIEW IF EXISTS `view_report_claim_20210111`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_report_claim_20210111` AS select `a`.`user_id` AS `user_id`,`b`.`name` AS `name`,`b`.`department_id` AS `department_id`,`b`.`business_entity_id` AS `business_entity_id`,`be`.`name` AS `business_entity_name`,`a`.`year` AS `year`,`a`.`month` AS `month`,ifnull(round(`ot`.`totalClaim`,2),0.00) AS `overtime`,(select ifnull(round(sum(`dt`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_dental` `dt` where ((`dt`.`claim_id` = `a`.`id`) and (`dt`.`is_delete` = 0))) AS `dental_approved`,(select ifnull(round(sum(`hosp`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_hospitalization` `hosp` where ((`hosp`.`claim_id` = `a`.`id`) and (`hosp`.`is_delete` = 0))) AS `hospitalization_approved`,(select ifnull(round(sum(`meals`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_meals` `meals` where ((`meals`.`claim_id` = `a`.`id`) and (`meals`.`is_delete` = 0))) AS `meals_approved`,(select ifnull(round(sum(`medical`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_medical_screening` `medical` where ((`medical`.`claim_id` = `a`.`id`) and (`medical`.`is_delete` = 0))) AS `medical_screening_approved`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'TNG'))) AS `others_tng`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'PURCHASE'))) AS `others_purchase`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'CALL'))) AS `others_call`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'AIRPORT_TAXES'))) AS `others_airport_taxes`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'SERVICE_TAXES'))) AS `others_service_taxes`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'TIPS_AND_PORTAGE'))) AS `others_tips_and_portage`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'LAUNDRY'))) AS `others_laundry`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'EXCESS_BAGGAGE'))) AS `others_excess_baggage`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'LOSS_IN_FOREIGN_EXCHANGE'))) AS `others_loss_in_foreign_exchange`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'FIRM_EVENT'))) AS `others_firm_Event`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'MOTOR_EXPENSES'))) AS `others_motor_expenses`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'SSM_SEARCH'))) AS `others_ssm_search`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'BOOK'))) AS `other_book`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'STATIONARY'))) AS `other_stationary`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'MEMBERSHIP'))) AS `other_membership`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'PRINTING'))) AS `other_printing`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'STAMPING'))) AS `other_stamping`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'LICENSE'))) AS `other_license`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0) and (`others`.`type` = 'COURIER'))) AS `other_courier`,(select ifnull(round(sum(`others`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_others` `others` where ((`others`.`claim_id` = `a`.`id`) and (`others`.`is_delete` = 0))) AS `total_others_approved`,(select ifnull(round(sum(`outpatient`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_outpatient` `outpatient` where ((`outpatient`.`claim_id` = `a`.`id`) and (`outpatient`.`is_delete` = 0))) AS `outpatient_approved`,(select ifnull(round(sum(`travelling`.`mileage_amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_travelling` `travelling` where ((`travelling`.`claim_id` = `a`.`id`) and (`travelling`.`is_delete` = 0))) AS `mileage_approved`,(select ifnull(round(sum(`accomodation`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_accommodation` `accomodation` where ((`accomodation`.`claim_id` = `a`.`id`) and (`accomodation`.`is_delete` = 0))) AS `accomodation_claim_approved`,(select ifnull(round(sum(`subsistence`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_subsistence` `subsistence` where ((`subsistence`.`claim_id` = `a`.`id`) and (`subsistence`.`is_delete` = 0) and (`subsistence`.`allowance` = 'OUTSTATION'))) AS `subsistence_outstation`,(select ifnull(round(sum(`subsistence`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_subsistence` `subsistence` where ((`subsistence`.`claim_id` = `a`.`id`) and (`subsistence`.`is_delete` = 0) and (`subsistence`.`allowance` = 'MEALS'))) AS `subsistence_meals`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 3) and (`transportation`.`is_delete` = 0))) AS `transportation_car_rental_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 4) and (`transportation`.`is_delete` = 0))) AS `transportation_flight_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 5) and (`transportation`.`is_delete` = 0))) AS `transportation_public_transport_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 7) and (`transportation`.`is_delete` = 0))) AS `transportation_e_hailing_approved`,(select ifnull(round(sum(`transportation`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_transportation` `transportation` where ((`transportation`.`claim_id` = `a`.`id`) and (`transportation`.`transportation_id` = 8) and (`transportation`.`is_delete` = 0))) AS `transportation_trains_approved`,(select ifnull(round(sum(`parking`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_parking` `parking` where ((`parking`.`claim_id` = `a`.`id`) and (`parking`.`is_delete` = 0))) AS `parking_claim_approved`,(select ifnull(round(sum(`toll`.`amount_approved`),2),0.00) from `spserp_dev`.`hr__claim_toll` `toll` where ((`toll`.`claim_id` = `a`.`id`) and (`toll`.`is_delete` = 0))) AS `toll_claim_approved`,(select ifnull(round(sum(`trainer`.`amount_approved`),0),0.00) from `spserp_dev`.`hr__claim_trainer` `trainer` where ((`trainer`.`claim_id` = `a`.`id`) and (`trainer`.`is_delete` = 0))) AS `trainer_claim_approved`,(select ifnull(round(sum(`clinic`.`amount`),0),0.00) from (`spserp_dev`.`hr__claim_panel_clinic` `panel` left join `spserp_dev`.`hr__claim_panel_clinic_detail` `clinic` on(((`panel`.`id` = `clinic`.`panel_claim_id`) and (`clinic`.`is_delete` = 0)))) where ((`panel`.`is_delete` = 0) and (`panel`.`invoice_month` = (`a`.`month` - 1)) and (`panel`.`invoice_year` = `a`.`year`) and (`clinic`.`staff_id` = `a`.`user_id`))) AS `panel_claim`,(select ifnull(round(sum(`petrol`.`amount_approved`),0),0.00) from `spserp_dev`.`hr__claim_petrol` `petrol` where ((`petrol`.`claim_id` = `a`.`id`) and (`petrol`.`is_delete` = 0))) AS `petrol_claim_approved`,(select ifnull(round(sum(`entertainment`.`amount_approved`),0),0.00) from `spserp_dev`.`hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0))) AS `entertainment_claim_approved`,(select ifnull(round(sum(`entertainment`.`amount_approved`),0),0.00) from `spserp_dev`.`hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0) and (`entertainment`.`type` = 0))) AS `entertainment_claim_client`,(select ifnull(round(sum(`entertainment`.`amount_approved`),0),0.00) from `spserp_dev`.`hr__claim_entertainment` `entertainment` where ((`entertainment`.`claim_id` = `a`.`id`) and (`entertainment`.`is_delete` = 0) and (`entertainment`.`type` = 1))) AS `entertainment_claim_staff` from (((`spserp_dev`.`hr__claim` `a` left join `spserp_dev`.`user__employment_detail` `b` on((`b`.`id` = `a`.`user_id`))) left join `spserp_dev`.`hr__ot` `ot` on(((`a`.`user_id` = `ot`.`peopleID`) and (`a`.`year` = `ot`.`year`) and (`a`.`month` = `ot`.`month`) and (`ot`.`is_delete` = 0) and (`ot`.`claim_status` = 2)))) left join `spserp_dev`.`company__business_entity` `be` on((`b`.`business_entity_id` = `be`.`id`))) where (`a`.`is_delete` = 0) */;

--
-- Final view structure for view `view_terminate_by_month_by_dept`
--

/*!50001 DROP TABLE IF EXISTS `view_terminate_by_month_by_dept`*/;
/*!50001 DROP VIEW IF EXISTS `view_terminate_by_month_by_dept`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_terminate_by_month_by_dept` AS select distinct year(`a`.`date_termination`) AS `year`,`a`.`department_id` AS `department_id`,sum(if((month(`a`.`date_termination`) = 1),1,0)) AS `res_1`,sum(if((month(`a`.`date_termination`) = 2),1,0)) AS `res_2`,sum(if((month(`a`.`date_termination`) = 3),1,0)) AS `res_3`,sum(if((month(`a`.`date_termination`) = 4),1,0)) AS `res_4`,sum(if((month(`a`.`date_termination`) = 5),1,0)) AS `res_5`,sum(if((month(`a`.`date_termination`) = 6),1,0)) AS `res_6`,sum(if((month(`a`.`date_termination`) = 7),1,0)) AS `res_7`,sum(if((month(`a`.`date_termination`) = 8),1,0)) AS `res_8`,sum(if((month(`a`.`date_termination`) = 9),1,0)) AS `res_9`,sum(if((month(`a`.`date_termination`) = 10),1,0)) AS `res_10`,sum(if((month(`a`.`date_termination`) = 11),1,0)) AS `res_11`,sum(if((month(`a`.`date_termination`) = 12),1,0)) AS `res_12` from `user__employment_detail` `a` group by year(`a`.`date_termination`),`a`.`department_id` */;

--
-- Final view structure for view `view_user_accomodation_entitlement`
--

/*!50001 DROP TABLE IF EXISTS `view_user_accomodation_entitlement`*/;
/*!50001 DROP VIEW IF EXISTS `view_user_accomodation_entitlement`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_user_accomodation_entitlement` AS select `a`.`user_id` AS `user_id`,`a`.`name` AS `name`,`a`.`position_id` AS `position_id`,`b`.`parent_id` AS `parent_id`,`b`.`position` AS `position`,`c`.`zone_type_id` AS `zone_type_id`,`c`.`with_receipt` AS `with_receipt`,`c`.`without_receipt` AS `without_receipt`,`d`.`zone_id` AS `zone_id`,`e`.`zone` AS `zone` from ((((`user__employment_detail` `a` left join `company__position` `b` on((`b`.`id` = `a`.`position_id`))) left join `_ref__accomodation_entitlement` `c` on((`c`.`position_category_id` = `b`.`parent_id`))) left join `hr__ref_claim_traveling_zone_claim_type` `d` on((`d`.`id` = `c`.`zone_type_id`))) left join `hr__ref_claim_travelling_zone` `e` on((`e`.`id` = `d`.`zone_id`))) */;

--
-- Final view structure for view `view_user_latest_profiling`
--

/*!50001 DROP TABLE IF EXISTS `view_user_latest_profiling`*/;
/*!50001 DROP VIEW IF EXISTS `view_user_latest_profiling`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `view_user_latest_profiling` AS select `user__profiling`.`id` AS `id`,`user__profiling`.`user_id` AS `user_id`,max(`user__profiling`.`action_efective_date`) AS `date_commencement` from `user__profiling` where ((`user__profiling`.`is_delete` = 0) and (`user__profiling`.`action_efective_date` <= curdate())) group by `user__profiling`.`user_id` */;


