CREATE TABLE `monthly_percentage_sets` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`month` INT(11) NULL DEFAULT NULL,
	`year` INT(11) NULL DEFAULT NULL,
	`class_a_ratio` FLOAT NULL DEFAULT '0',
	`class_b_ratio` FLOAT NULL DEFAULT '0',
	`class_c_ratio` FLOAT NULL DEFAULT '0',
	`class_d_ratio` FLOAT NULL DEFAULT '0',
	`class_e_ratio` FLOAT NULL DEFAULT '0',
	`class_f_ratio` FLOAT NULL DEFAULT '0',
	`created_by` INT(11) NULL DEFAULT NULL,
	`updated_by` INT(11) NULL DEFAULT NULL,
	`created_at` TIMESTAMP NULL DEFAULT NULL,
	`updated_at` TIMESTAMP NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;

ALTER TABLE `business_agent_commission` ADD `package_id` INT(11) NULL DEFAULT NULL AFTER `designation_id`;

ALTER TABLE `investments` ADD `ac_number` VARCHAR(255) NULL DEFAULT NULL AFTER `ac_name`;


ALTER TABLE `monthly_percentage_sets`
	CHANGE COLUMN `class_a_ratio` `A` FLOAT NULL DEFAULT '0' AFTER `year`,
	CHANGE COLUMN `class_b_ratio` `B` FLOAT NULL DEFAULT '0' AFTER `A`,
	CHANGE COLUMN `class_c_ratio` `C` FLOAT NULL DEFAULT '0' AFTER `B`,
	CHANGE COLUMN `class_d_ratio` `D` FLOAT NULL DEFAULT '0' AFTER `C`,
	CHANGE COLUMN `class_e_ratio` `E` FLOAT NULL DEFAULT '0' AFTER `D`,
	CHANGE COLUMN `class_f_ratio` `F` FLOAT NULL DEFAULT '0' AFTER `E`;

CREATE TABLE `iposolution`.`balance_transfers` ( `id` INT(11) NOT NULL AUTO_INCREMENT , `user_id` INT(11) NULL DEFAULT NULL , `amount` FLOAT NOT NULL DEFAULT '0' , `created_by` INT(11) NULL DEFAULT NULL , `updated_by` INT(11) NULL DEFAULT NULL , `created_at` TIMESTAMP NULL DEFAULT NULL , `updated_at` TIMESTAMP NULL DEFAULT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;

ALTER TABLE `users` ADD `transfer_balance` FLOAT NOT NULL DEFAULT '0' AFTER `remember_token`;

ALTER TABLE `monthly_percentage_sets` ADD `G` FLOAT NOT NULL DEFAULT '0' AFTER `F`, ADD `H` FLOAT NOT NULL DEFAULT '0' AFTER `G`, ADD `I` FLOAT NOT NULL DEFAULT '0' AFTER `H`, ADD `J` FLOAT NOT NULL DEFAULT '0' AFTER `I`, ADD `K` FLOAT NOT NULL DEFAULT '0' AFTER `J`, ADD `L` FLOAT NOT NULL DEFAULT '0' AFTER `K`;

INSERT INTO `classes` (`id`, `value`, `name`, `status`, `created_at`, `updated_at`) VALUES ('8', 'H', 'H', '1', current_timestamp(), NULL), ('9', 'I', 'I', '1', current_timestamp(), NULL), ('10', 'J', 'J', '1', current_timestamp(), NULL), ('11', 'K', 'K', '1', current_timestamp(), NULL), ('12', 'L', 'L', '1', current_timestamp(), NULL);

ALTER TABLE `withdraw_request` CHANGE `status` `status` ENUM('Pending','Confirmed','Completed') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;

ALTER TABLE `withdraw_request` ADD `type` VARCHAR(255) NULL DEFAULT NULL AFTER `status`, ADD `cheque_name` VARCHAR(255) NULL DEFAULT NULL AFTER `type`, ADD `issue_date` DATE NULL DEFAULT NULL AFTER `cheque_name`;
ALTER TABLE `withdraw_request` ADD `cheque_bank_id` INT(11) NULL DEFAULT NULL AFTER `issue_date`;

ALTER TABLE `investments` ADD `closing_request_date` DATE NULL DEFAULT NULL AFTER `closing_request`, ADD `closing_request_approved_date` DATE NULL DEFAULT NULL AFTER `closing_request_date`;

ALTER TABLE `investments` ADD `payment_date` DATE NULL DEFAULT NULL AFTER `closing_request_date`;

ALTER TABLE `balance_transfers` ADD `comment` TEXT NULL DEFAULT NULL AFTER `amount`;

ALTER TABLE `investments` ADD `reference` INT(11) NULL DEFAULT NULL AFTER `class_name`;

ALTER TABLE `users` ADD `husband_name` VARCHAR(255) NULL DEFAULT NULL AFTER `transfer_balance`;

ALTER TABLE `bank_cash_accounts` ADD `print_type` ENUM('islami_bank','padma_bank') NULL DEFAULT NULL AFTER `title`, ADD `account_number` VARCHAR(255) NULL DEFAULT NULL AFTER `print_type`, ADD `branch_name` VARCHAR(255) NULL DEFAULT NULL AFTER `account_number`, ADD `address` VARCHAR(255) NULL DEFAULT NULL AFTER `branch_name`;

ALTER TABLE `withdraw_request`
	CHANGE COLUMN `type` `type` ENUM('By_Bank_Account_Cheque','By_Cash_Cheque','By_Cash') NULL DEFAULT NULL AFTER `status`;

ALTER TABLE `bank_details` ADD `is_primary` TINYINT NULL DEFAULT NULL AFTER `address`;

ALTER TABLE `teams` ADD `parent_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`;

CREATE TABLE `departments` ( `id` INT(11) NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NULL DEFAULT NULL , `status` TINYINT NULL DEFAULT NULL , `created_at` TIMESTAMP NULL DEFAULT NULL , `updated_at` TIMESTAMP NULL DEFAULT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;

INSERT INTO `departments` (`id`, `name`, `status`, `created_at`, `updated_at`) VALUES ('1', 'Administration', '1', '2022-08-24 10:24:55', '2022-08-24 10:24:55'), ('2', 'Marketing', '1', '2022-08-24 10:24:55', '2022-08-24 10:24:55'), ('3', 'Accounts', '1', '2022-08-24 10:25:32', '2022-08-24 10:25:32'), ('4', 'Others', '1', '2022-08-24 10:25:32', '2022-08-24 10:25:32');

ALTER TABLE `users` ADD `department_id` INT(11) NULL DEFAULT NULL AFTER `designation_id`;

ALTER TABLE `user_relatives` ADD `relation` VARCHAR(255) NULL DEFAULT NULL AFTER `relative_id`;

ALTER TABLE `investments` ADD `capital_return_status` ENUM('Due','Paid') NOT NULL DEFAULT 'Due' AFTER `reference`;

CREATE TABLE `withdraw_request_checks` ( `id` INT(11) NOT NULL AUTO_INCREMENT , `agent_id` INT(11) NULL DEFAULT NULL , `type` VARCHAR(255) NULL DEFAULT NULL , `date` DATE NULL DEFAULT NULL , `created_at` TIMESTAMP NULL DEFAULT NULL , `updated_at` TIMESTAMP NULL DEFAULT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
