Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-template into fix/FBR-367
  • Loading branch information
BrianMuhimbura committed Nov 10, 2023
2 parents 7dba3dc + 2e79a2e commit 6c2bd62
Show file tree
Hide file tree
Showing 10 changed files with 676 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ public class ClientData {
private String clientCategorization;
private String clientArea;
private String recreditCategorization;
private Boolean president;
private Integer buroCheckStatus;
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

-- liquibase formatted sql
-- changeset fineract:1
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
--
-- Host: localhost Database: fineract_default
-- ------------------------------------------------------
-- Server version 5.1.60-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES UTF8MB4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- External Credit History Policy Check --
INSERT INTO stretchy_report (report_name,report_type,report_category,report_sql,description,core_report,use_report,self_service_user_report)
VALUES ("President of the Board of Directors of the BC Policy Check", "Table", "Prequalification",
"SELECT
prequalification_details.recreditCategorization,
CASE
WHEN (${loanProductId} = 2) AND ('${buroCheckClassification}' = 'A') THEN 'GREEN'
WHEN (${loanProductId} = 2) AND ('${buroCheckClassification}' = 'B') THEN 'GREEN'
WHEN (${loanProductId} = 2) AND ('${buroCheckClassification}' = 'C') THEN 'YELLOW'
WHEN (${loanProductId} = 2) AND ('${buroCheckClassification}' = 'D') THEN 'ORANGE'
WHEN (${loanProductId} = 9) AND ('${buroCheckClassification}' = 'A') THEN 'GREEN'
WHEN (${loanProductId} = 9) AND ('${buroCheckClassification}' = 'B') THEN 'GREEN'
WHEN (${loanProductId} = 9) AND ('${buroCheckClassification}' = 'C') THEN 'YELLOW'
WHEN (${loanProductId} = 9) AND ('${buroCheckClassification}' = 'D') THEN 'ORANGE'
WHEN (${loanProductId} = 8) AND ('${buroCheckClassification}' = 'A') THEN 'GREEN'
WHEN (${loanProductId} = 8) AND ('${buroCheckClassification}' = 'B') THEN 'GREEN'
WHEN (${loanProductId} = 8) AND ('${buroCheckClassification}' = 'C') THEN 'YELLOW'
WHEN (${loanProductId} = 8) AND ('${buroCheckClassification}' = 'D') THEN 'ORANGE'
WHEN (${loanProductId} = 4) AND ('${buroCheckClassification}' = 'A') THEN 'GREEN'
WHEN (${loanProductId} = 4) AND ('${buroCheckClassification}' = 'B') THEN 'GREEN'
WHEN (${loanProductId} = 4) AND ('${buroCheckClassification}' = 'C') THEN 'YELLOW'
WHEN (${loanProductId} = 4) AND ('${buroCheckClassification}' = 'D') THEN 'ORANGE'
WHEN (${loanProductId} = 5) AND ('${buroCheckClassification}' = 'A') THEN 'GREEN'
WHEN (${loanProductId} = 5) AND ('${buroCheckClassification}' = 'B') THEN 'GREEN'
WHEN (${loanProductId} = 5) AND ('${buroCheckClassification}' = 'C') THEN 'YELLOW'
WHEN (${loanProductId} = 5) AND ('${buroCheckClassification}' = 'D') THEN 'ORANGE'
END AS color
FROM m_prequalification_group mpg
INNER JOIN (
SELECT p.id AS prequalification_id,
(CASE WHEN p.previous_prequalification IS NOT NULL THEN 'RECREDITO' ELSE 'NUEVO' END) AS recreditCategorization
FROM m_prequalification_group p
) prequalification_details ON prequalification_details.prequalification_id = mpg.id
WHERE mpg.id = ${prequalificationId}", "President of the Board of Directors of the BC Policy Check", 0, 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

-- liquibase formatted sql
-- changeset fineract:1
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
--
-- Host: localhost Database: fineract_default
-- ------------------------------------------------------
-- Server version 5.1.60-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES UTF8MB4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- Percentage of members of the same group who they can have parallel product --
INSERT INTO stretchy_report (report_name,report_type,report_category,report_sql,description,core_report,use_report,self_service_user_report)
VALUES ("Percentage of members of the same group who they can have parallel product Policy Check", "Table", "Prequalification",
"SELECT
COALESCE(prequalification_details.percentage, 0) AS percentage,
CASE
WHEN (${loanProductId} = 7) AND ((COALESCE(prequalification_details.percentage, 0)) <= 50) THEN 'GREEN'
END AS color
FROM m_prequalification_group pg
INNER JOIN (
SELECT
mpg.id AS prequalification_id, ((COUNT(DISTINCT details.client_id) * 100) / (${numberOfMembers})) AS percentage
FROM m_prequalification_group mpg
LEFT JOIN (
SELECT mpg.id AS prequalification_id, mc.id AS client_id
FROM m_prequalification_group mpg
LEFT JOIN m_prequalification_group_members mpgm ON mpgm.group_id = mpg.id
LEFT JOIN m_client mc ON mc.dpi = mpgm.dpi
LEFT JOIN m_loan ml ON ml.client_id = mc.id
WHERE ml.loan_status_id = 300 AND ml.product_id = ${loanProductId}
GROUP BY ml.id, mpg.id
) details ON details.prequalification_id = mpg.id
WHERE mpg.id = ${prequalificationId}
GROUP BY mpg.id
) prequalification_details ON prequalification_details.prequalification_id = pg.id
WHERE pg.id = ${prequalificationId}", "Percentage of members of the same group who they can have parallel product Policy Check", 0, 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

-- liquibase formatted sql
-- changeset fineract:1
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
--
-- Host: localhost Database: fineract_default
-- ------------------------------------------------------
-- Server version 5.1.60-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES UTF8MB4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- Nationality --
INSERT INTO stretchy_report (report_name,report_type,report_category,report_sql,description,core_report,use_report,self_service_user_report)
VALUES ("Gender Policy Check", "Table", "Prequalification",
"SELECT mc.id,
client_details.client_gender,
CASE
WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'NUEVO') AND ('MUJER' = UPPER(COALESCE(client_details.client_gender, ''))) THEN 'GREEN'
WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'RECREDITO') AND ('MUJER' = UPPER(COALESCE(client_details.client_gender, ''))) THEN 'GREEN'
WHEN (${loanProductId} = 6) AND (mc.status_enum = 300) THEN 'GREEN'
END AS color
FROM m_client mc
INNER JOIN (
SELECT mct.id AS client_id, client_gender.code_value AS client_gender
FROM m_client mct
LEFT JOIN m_code_value client_gender ON mct.gender_cv_id = client_gender.id
) client_details ON client_details.client_id = mc.id
WHERE mc.id = ${clientId}", "Gender Policy Check", 0, 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

-- liquibase formatted sql
-- changeset fineract:1
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
--
-- Host: localhost Database: fineract_default
-- ------------------------------------------------------
-- Server version 5.1.60-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES UTF8MB4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- Nationality --
INSERT INTO stretchy_report (report_name,report_type,report_category,report_sql,description,core_report,use_report,self_service_user_report)
VALUES ("Nationality Policy Check", "Table", "Prequalification",
"SELECT mc.id,
UPPER(COALESCE(mc.nationality, '')) AS client_nationality,
CASE
WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'NUEVO') AND ('GUATEMALA' = UPPER(COALESCE(mc.nationality, ''))) THEN 'GREEN'
WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'NUEVO') AND ('GUATEMALA' <> UPPER(COALESCE(mc.nationality, ''))) THEN 'RED'
WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'RECREDITO') AND ('GUATEMALA' = UPPER(COALESCE(mc.nationality, ''))) THEN 'GREEN'
WHEN (${loanProductId} = 6) AND ('${recreditCategorization}' = 'RECREDITO') AND ('GUATEMALA' <> UPPER(COALESCE(mc.nationality, ''))) THEN 'RED'
WHEN (${loanProductId} = 6) AND (mc.status_enum = 300) THEN 'GREEN'
END AS color
FROM m_client mc
WHERE mc.id = ${clientId}", "Nationality Policy Check", 0, 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

-- liquibase formatted sql
-- changeset fineract:1
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
--
-- Host: localhost Database: fineract_default
-- ------------------------------------------------------
-- Server version 5.1.60-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES UTF8MB4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- Internal Credit History Policy Check --
INSERT INTO stretchy_report (report_name,report_type,report_category,report_sql,description,core_report,use_report,self_service_user_report)
VALUES ("Internal Credit History Policy Check", "Table", "Prequalification",
"SELECT
mc.id AS client_id,
CASE
WHEN (${loanProductId} = 6) AND (mc.status_enum = 300) THEN 'GREEN'
END AS color
FROM m_client mc
WHERE mc.id = ${clientId}", "Internal Credit History Policy Check", 0, 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

-- liquibase formatted sql
-- changeset fineract:1
-- MySQL dump 10.13 Distrib 5.1.60, for Win32 (ia32)
--
-- Host: localhost Database: fineract_default
-- ------------------------------------------------------
-- Server version 5.1.60-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES UTF8MB4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- External Credit History Policy Check --
INSERT INTO stretchy_report (report_name,report_type,report_category,report_sql,description,core_report,use_report,self_service_user_report)
VALUES ("External Credit History Policy Check", "Table", "Prequalification",
"SELECT
mc.id AS client_id,
CASE
WHEN (${loanProductId} = 6) AND (mc.status_enum = 300) THEN 'GREEN'
END AS color
FROM m_client mc
WHERE mc.id = ${clientId}", "External Credit History Policy Check", 0, 0, 0);
Loading

0 comments on commit 6c2bd62

Please sign in to comment.