Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fbr 714 #1018

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,5 @@
<include file="parts/0132_AddConfigurationForAmountFormats.xml" relativeToChangelogFile="true"/>
<include file="parts/0133_UpdateNewHardPolicyQueries.xml" relativeToChangelogFile="true"/>
<include file="parts/0134_HardPolicyFixes.xml" relativeToChangelogFile="true"/>
<include file="parts/0135_FBR-714-BANCO_COMMUNAL_MEDA.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
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.
--

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';
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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';
Loading
Loading