--------------------------------------- STEP 1

INSERT INTO `approval_config` (`cid`, `module_id`, `role_id`, `portal_id`, `desingation_id`, `configuration_type`, 
`level_count`, `approval_type`, `reporting_column_sequence`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) 
VALUES ((SELECT id FROM proll_client WHERE short_code LIKE 'people'), (SELECT id FROM modules WHERE name LIKE 'payroll'),
 (SELECT id FROM roles WHERE role LIKE 'hr'), (SELECT id FROM acm_portals WHERE role LIKE 'hr'),
  NULL, 'branch', NULL, 'sequential', NULL, 1, NULL, NULL, '2021-08-25 10:07:38', '2022-12-01 11:43:26');
  
  INSERT INTO `approval_config` (`cid`, `module_id`, `role_id`, `portal_id`, `desingation_id`, `configuration_type`, 
`level_count`, `approval_type`, `reporting_column_sequence`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) 
VALUES ((SELECT id FROM proll_client WHERE short_code LIKE 'people'), (SELECT id FROM modules WHERE name LIKE 'payroll'),
 (SELECT id FROM roles WHERE role LIKE 'Finance'), (SELECT id FROM acm_portals WHERE role LIKE 'Finance'),
  NULL, 'branch', NULL, 'sequential', NULL, 1, NULL, NULL, '2021-08-25 10:07:38', '2022-12-01 11:43:26');
  
  INSERT INTO `approval_config` (`cid`, `module_id`, `role_id`, `portal_id`, `desingation_id`, `configuration_type`, 
`level_count`, `approval_type`, `reporting_column_sequence`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) 
VALUES ((SELECT id FROM proll_client WHERE short_code LIKE 'people'), (SELECT id FROM modules WHERE name LIKE 'payroll'),
 (SELECT id FROM roles WHERE role LIKE 'ceo'), (SELECT id FROM acm_portals WHERE role LIKE 'ceo'),
  NULL, 'branch', NULL, 'sequential', NULL, 1, NULL, NULL, '2021-08-25 10:07:38', '2022-12-01 11:43:26');


-------------------------------------- STEP 2

INSERT INTO `approval_role_config` (`assist_id`, `cid`, `empid`, `designation_id`, `location_id`, 
`approval_config_id`, `can_approve`, `approval_priority`, `dept_id`, `configuration_type`, 
`status`, `created_at`, `updated_at`) 
VALUES (NULL,
		(SELECT id FROM proll_client WHERE short_code LIKE 'people'),
		(SELECT id FROM proll_employee WHERE empcode =79105),
		NULL, NULL,
		(SELECT ac.id FROM approval_config ac
		 INNER JOIN roles r ON ac.role_id=r.id
		 INNER JOIN acm_portals ap ON ac.portal_id=ap.id
		 INNER JOIN modules m ON ac.module_id=m.id
		 WHERE r.role LIKE 'hr' AND ap.role LIKE 'hr'
		  AND m.name LIKE 'payroll'),
		NULL, NULL, NULL, 'branch', 1, '2021-08-25 10:47:07', '2022-12-01 11:43:26');
			 
INSERT INTO `approval_role_config` (`assist_id`, `cid`, `empid`, `designation_id`, `location_id`, 
`approval_config_id`, `can_approve`, `approval_priority`, `dept_id`, `configuration_type`, 
`status`, `created_at`, `updated_at`) 
VALUES (NULL,
		(SELECT id FROM proll_client WHERE short_code LIKE 'people'),
		(SELECT id FROM proll_employee WHERE empcode =191204),
		NULL, NULL,
		(SELECT ac.id FROM approval_config ac
		 INNER JOIN roles r ON ac.role_id=r.id
		 INNER JOIN acm_portals ap ON ac.portal_id=ap.id
		  INNER JOIN modules m ON ac.module_id=m.id
		 WHERE r.role LIKE 'Finance' AND ap.role LIKE 'Finance'
		 AND m.name LIKE 'payroll'),
		NULL, NULL, NULL, 'branch', 1, '2021-08-25 10:47:07', '2022-12-01 11:43:26');
		
INSERT INTO `approval_role_config` (`assist_id`, `cid`, `empid`, `designation_id`, `location_id`, 
`approval_config_id`, `can_approve`, `approval_priority`, `dept_id`, `configuration_type`, 
`status`, `created_at`, `updated_at`) 
VALUES (NULL,
		(SELECT id FROM proll_client WHERE short_code LIKE 'people'),
		(SELECT id FROM proll_employee WHERE empcode =23137),
		NULL, NULL,
		(SELECT ac.id FROM approval_config ac
		 INNER JOIN roles r ON ac.role_id=r.id
		 INNER JOIN acm_portals ap ON ac.portal_id=ap.id
		  INNER JOIN modules m ON ac.module_id=m.id
		 WHERE r.role LIKE 'CEO' AND ap.role LIKE 'CEO'
		 AND m.name LIKE 'payroll'),
		NULL, NULL, NULL, 'branch', 1, '2021-08-25 10:47:07', '2022-12-01 11:43:26');		