diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java index 0c561a09078..69f2942a7a3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationChecklistWritePlatformServiceImpl.java @@ -605,7 +605,7 @@ private CheckValidationColor runCheck7(final ClientData clientData) { reportParams.put("${prequalificationId}", prequalificationId); reportParams.put("${loanProductId}", productId); reportParams.put("${clientArea}", clientArea); - reportParams.put("${categorization}", clientData.getCategorization()); + reportParams.put("${categorization}", clientData.getRecreditCategorization()); reportParams.put("${isTopup}", String.valueOf(clientData.getIsLoanTopup())); reportParams.put("${requestedAmount}", String.valueOf(clientData.getRequestedAmount())); final GenericResultsetData result = this.readReportingService.retrieveGenericResultset(reportName, "report", reportParams, false); diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index ee0b7047449..5ede958db2f 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -154,4 +154,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/client_age.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/client_age.sql new file mode 100644 index 00000000000..1183afe4d0c --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/client_age.sql @@ -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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat('SELECT mc.id, + client_age.client_age AS client_age, + mc.date_of_birth AS date_of_birth, + CASE + -- Banco Comunal normal + WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW'' + WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + + -- Banco Comunal normal meda + WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW'' + WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + + -- Banco Comunal temporal + WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW'' + WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + + + -- Banco Comunal Agricola + WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW'' + WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + + + -- Grupo Solidario + WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN'' + WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW'' + WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN'' + WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + + + -- Grupo Solidario Agricola + WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN'' + WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW'' + WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN'' + WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED'' + END AS color + FROM m_client mc + INNER JOIN ( + SELECT mct.id AS client_id, mct.date_of_birth AS date_of_birth, IFNULL(TIMESTAMPDIFF(YEAR, mct.date_of_birth, CURDATE()), 0) AS client_age + FROM m_client mct + ) client_age ON client_age.client_id = mc.id + WHERE mc.id = ${clientId}') +WHERE report_name = 'Client age Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/investment_plan.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/investment_plan.sql new file mode 100644 index 00000000000..390c28036d6 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/investment_plan.sql @@ -0,0 +1,27 @@ +-- +-- 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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat(' SELECT CASE + WHEN (${loanProductId} IN (9)) AND ''${categorization}'' = ''RECREDITO'' AND ${requestedAmount} <= 6000 THEN ''GREEN'' + WHEN (${loanProductId} IN (2,',@productId,',8)) AND ${requestedAmount} <= 6000 THEN ''GREEN'' + WHEN (${loanProductId} IN (2,',@productId,',9,8,4,5,7)) AND (${photographs} <= 0 OR ${investmentPlan} <= 0) THEN ''RED'' + ELSE ''GREEN'' + END AS color') +WHERE report_name = 'Mandatory to attach photographs and investment plan Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/maxium_and_minimum_amount.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/maxium_and_minimum_amount.sql new file mode 100644 index 00000000000..e858bf55af5 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/maxium_and_minimum_amount.sql @@ -0,0 +1,58 @@ +-- +-- 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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat('SELECT + CASE + WHEN (${isTopup} = true) AND (${loanProductId} IN (2,8,9,',@productId,')) AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + WHEN (${isTopup} = true) AND (${loanProductId} IN (4,5)) AND (${requestedAmount} BETWEEN 5000 AND 25000) THEN ''GREEN'' + + WHEN (${isTopup} = false) AND (${loanProductId} = 2) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 2) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 2) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 2) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + + WHEN (${isTopup} = false) AND (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + + WHEN (${isTopup} = false) AND (${loanProductId} = 8) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 8) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 8) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 8) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + + WHEN (${isTopup} = false) AND (${loanProductId} = 9) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 9) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 9) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 5000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 9) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 1500 AND 20000) THEN ''GREEN'' + + WHEN (${isTopup} = false) AND (${loanProductId} = 4) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 5000 AND 10000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 4) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 5000 AND 25000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 4) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 5000 AND 10000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 4) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 5000 AND 25000) THEN ''GREEN'' + + WHEN (${isTopup} = false) AND (${loanProductId} = 5) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 5000 AND 10000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 5) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBAN'') AND (${requestedAmount} BETWEEN 5000 AND 20000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 5) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 5000 AND 10000) THEN ''GREEN'' + WHEN (${isTopup} = false) AND (${loanProductId} = 5) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${requestedAmount} BETWEEN 5000 AND 20000) THEN ''GREEN'' + + ELSE ''RED'' + END AS color') +WHERE report_name = 'Minimum and maximum amount Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/number_of_members.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/number_of_members.sql new file mode 100644 index 00000000000..5b9a2b220e2 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/number_of_members.sql @@ -0,0 +1,35 @@ +-- +-- 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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat('SELECT + CASE + WHEN (${loanProductId} = 2) AND (${numberOfMembers} >= 7) THEN ''GREEN'' + + WHEN (${loanProductId} = ',@productId,') AND (${numberOfMembers} >= 7) THEN ''GREEN'' + + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''NUEVO'') AND (${recreditPercent} < 50) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''RECREDITO'') AND (${recreditPercent} >= 50) THEN ''GREEN'' + + WHEN (${loanProductId} = 8) AND (${numberOfMembers} >= 7) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (${numberOfMembers} < 7) THEN ''ORANGE'' + + ELSE ''RED'' + END AS color') +WHERE report_name = 'Number of members according to policy Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/own_home_policy.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/own_home_policy.sql new file mode 100644 index 00000000000..b23627bdc8c --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/own_home_policy.sql @@ -0,0 +1,40 @@ +-- +-- 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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat('SELECT + housing_type.owner_percent, + CASE + WHEN (${loanProductId} = 2) AND (housing_type.owner_percent >=50) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (housing_type.owner_percent <50) THEN ''YELLOW'' + + WHEN (${loanProductId} = ',@productId,') AND (housing_type.owner_percent >=50) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (housing_type.owner_percent <50) THEN ''YELLOW'' + + WHEN (${loanProductId} = 8) AND (housing_type.owner_percent >=50) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (housing_type.owner_percent <50) THEN ''YELLOW'' + + END AS color + FROM m_prequalification_group mpg + INNER JOIN ( select (((select count(*) from m_prequalification_group_members mpm INNER JOIN m_client mc on mc.dpi = mpm.dpi + INNER JOIN m_client_contact_info mcinf on mcinf.client_id = mc.id INNER JOIN m_code_value mcv on mcv.id = mcinf.housing_type where mcv.code_value = ''Propia'' and mpm.group_id = ${prequalificationId})/ + (select count(*) from m_prequalification_group_members mpg where mpg.group_id = ${prequalificationId}))*100) as owner_percent, ${prequalificationId} as grp_id ) + housing_type ON housing_type.grp_id = mpg.id + WHERE mpg.id = ${prequalificationId}') +WHERE report_name = 'Percentage of members with their own home Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/percentage_increase.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/percentage_increase.sql new file mode 100644 index 00000000000..2da8e5db11e --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/percentage_increase.sql @@ -0,0 +1,73 @@ +-- +-- 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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat('SELECT + CASE + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) <= 200) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) <= 150) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) <= 100) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) <= 80) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) <= 60) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) > 200) THEN ''RED'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) > 150) THEN ''RED'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) > 100) THEN ''RED'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) > 80) THEN ''RED'' + WHEN (${loanProductId} = 2) AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) > 60) THEN ''RED'' + + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) <= 200) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) <= 150) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) <= 100) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) <= 80) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) <= 60) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) > 200) THEN ''RED'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) > 150) THEN ''RED'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) > 100) THEN ''RED'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) > 80) THEN ''RED'' + WHEN (${loanProductId} = ',@productId,') AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) > 60) THEN ''RED'' + + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) <= 200) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) <= 150) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) <= 100) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) <= 80) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) <= 60) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) > 200) THEN ''RED'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) > 150) THEN ''RED'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) > 100) THEN ''RED'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) > 80) THEN ''RED'' + WHEN (${loanProductId} = 9) AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) > 60) THEN ''RED'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) <= 200) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) <= 150) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) <= 100) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) <= 80) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) <= 60) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) <= 1500) AND (IFNULL(${percentageIncrease}, 0) > 200) THEN ''RED'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 1500) AND (IFNULL(${currentCreditValue}, 0) <= 3000) AND (IFNULL(${percentageIncrease}, 0) > 150) THEN ''RED'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 3000) AND (IFNULL(${currentCreditValue}, 0) <= 3500) AND (IFNULL(${percentageIncrease}, 0) > 100) THEN ''RED'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 3500) AND (IFNULL(${currentCreditValue}, 0) <= 4000) AND (IFNULL(${percentageIncrease}, 0) > 80) THEN ''RED'' + WHEN (${loanProductId} = 8) AND (IFNULL(${currentCreditValue}, 0) > 4000) AND (IFNULL(${percentageIncrease}, 0) > 60) THEN ''RED'' + WHEN (${loanProductId} = 4) AND (IFNULL(${percentageIncrease}, 0) <= 60) THEN ''GREEN'' + WHEN (${loanProductId} = 4) AND (IFNULL(${percentageIncrease}, 0) > 60) THEN ''ORANGE'' + WHEN (${loanProductId} = 5) AND (IFNULL(${percentageIncrease}, 0) <= 60) THEN ''GREEN'' + WHEN (${loanProductId} = 5) AND (IFNULL(${percentageIncrease}, 0) > 60) THEN ''ORANGE'' + END AS color + FROM m_client mc + WHERE mc.id = ${clientId} + GROUP BY mc.id') +WHERE report_name = 'Increase percentage Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/presidet_board_of_directors.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/presidet_board_of_directors.sql new file mode 100644 index 00000000000..f7ebdb2ea62 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/presidet_board_of_directors.sql @@ -0,0 +1,61 @@ +-- +-- 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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat(' 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} = ',@productId,') AND (''${buroCheckClassification}'' = ''A'') THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${buroCheckClassification}'' = ''B'') THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${buroCheckClassification}'' = ''C'') THEN ''YELLOW'' + WHEN (${loanProductId} = ',@productId,') 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}') +WHERE report_name = 'President of the Board of Directors of the BC Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/value_disparity.sql b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/value_disparity.sql new file mode 100644 index 00000000000..550dbb5cd3f --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/commands/BACCOMMEDA/value_disparity.sql @@ -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. +-- + +SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1); +UPDATE stretchy_report SET report_sql = concat(' SELECT + CASE + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = 2) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = ',@productId,') AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = 9) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''URBANA'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 3) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''NUEVO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 3) THEN ''YELLOW'' + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} BETWEEN 1 AND 4) THEN ''GREEN'' + WHEN (${loanProductId} = 8) AND (''${categorization}'' = ''RECREDITO'') AND (''${clientArea}'' = ''RURAL'') AND (${disparityRatio} > 4) THEN ''YELLOW'' + ELSE ''RED'' + + END AS color + FROM m_prequalification_group mpg + LEFT JOIN ( + SELECT p.id AS prequalification_id, + (select count(ml.id) FROM m_prequalification_group mp + LEFT JOIN m_prequalification_group_members mpgm ON mpgm.group_id = mp.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} AND ml.is_topup = 1 + AND mp.id = ${prequalificationId} + ) recredit_count + FROM m_prequalification_group p + ) recredit_loan ON recredit_loan.prequalification_id = mpg.id + WHERE mpg.id = ${prequalificationId}') +WHERE report_name = 'Value disparity Policy Check'; diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0135_FBR-714-BANCO_COMMUNAL_MEDA.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0135_FBR-714-BANCO_COMMUNAL_MEDA.xml new file mode 100644 index 00000000000..f751e3a99b2 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0135_FBR-714-BANCO_COMMUNAL_MEDA.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +