Skip to content

Commit

Permalink
BAC-52/Feature: Add Daily Journal Posting Report (#300)
Browse files Browse the repository at this point in the history
Co-authored-by: Julius Peter Oketayot <[email protected]>
  • Loading branch information
fiter-julius-oketayot and Julius Peter Oketayot authored Nov 27, 2023
1 parent b0b3669 commit 50de5cc
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public String schema() {
.append(" creatingUser.username as createdByUserName, journalEntry.description as comments, ")
.append(" journalEntry.created_date as createdDate, journalEntry.reversed as reversed, ")
.append(" journalEntry.currency_code as currencyCode, curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ")
.append(" curr.display_symbol as currencyDisplaySymbol, curr.decimal_places as currencyDigits, curr.currency_multiplesof as inMultiplesOf ");
.append(" curr.display_symbol as currencyDisplaySymbol, curr.decimal_places as currencyDigits, curr.currency_multiplesof as inMultiplesOf, curr.int_code AS intCode ");
if (associationParametersData.isRunningBalanceRequired()) {
sb.append(" ,journalEntry.is_running_balance_calculated as runningBalanceComputed, ")
.append(" journalEntry.office_running_balance as officeRunningBalance, ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ private AccountNumberFormatEnumerations() {
.unmodifiableSet(new HashSet<>(Arrays.asList(AccountNumberPrefixType.OFFICE_NAME,
AccountNumberPrefixType.LOAN_PRODUCT_SHORT_NAME, AccountNumberPrefixType.PREFIX_SHORT_NAME)));

public static final Set<AccountNumberPrefixType> accountNumberPrefixesForSavingsAccounts = Collections
.unmodifiableSet(new HashSet<>(Arrays.asList(AccountNumberPrefixType.OFFICE_NAME,
AccountNumberPrefixType.SAVINGS_PRODUCT_SHORT_NAME, AccountNumberPrefixType.PREFIX_SHORT_NAME,
AccountNumberPrefixType.SAVINGS_CLIENT_ID)));
public static final Set<AccountNumberPrefixType> accountNumberPrefixesForSavingsAccounts = Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(AccountNumberPrefixType.OFFICE_NAME, AccountNumberPrefixType.SAVINGS_PRODUCT_SHORT_NAME,
AccountNumberPrefixType.PREFIX_SHORT_NAME, AccountNumberPrefixType.SAVINGS_CLIENT_ID)));

public static final Set<AccountNumberPrefixType> accountNumberPrefixesForCenters = Collections
.unmodifiableSet(new HashSet<>(Collections.singletonList(AccountNumberPrefixType.OFFICE_NAME)));
Expand All @@ -60,7 +59,7 @@ public enum AccountNumberPrefixType {
"accountNumberPrefixType.loanProductShortName"), SAVINGS_PRODUCT_SHORT_NAME(301,
"accountNumberPrefixType.savingsProductShortName"), PREFIX_SHORT_NAME(401,
"accountNumberPrefixType.prefixShortName"), SAVINGS_CLIENT_ID(501,
"accountNumberPrefixType.savingsAccountClientId");
"accountNumberPrefixType.savingsAccountClientId");

private final Integer value;
private final String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ public Map<String, Object> update(JsonCommand command) {
}

if (command.isChangeInBigDecimalParameterNamed(PrequalificatoinApiConstants.approvedAmountParamName, this.approvedAmount)) {
final BigDecimal newValue = command
.bigDecimalValueOfParameterNamed(PrequalificatoinApiConstants.approvedAmountParamName);
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(PrequalificatoinApiConstants.approvedAmountParamName);
actualChanges.put(PrequalificatoinApiConstants.approvedAmountParamName, newValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class PrequalificationNotMappedException extends AbstractPlatformDomainRu

public PrequalificationNotMappedException(final String prequalificationId) {
super("error.msg.prequalification.not.mapped.exception",
"The Prequalification `" + prequalificationId + "` Should be mapped to a group before validating hard policies. ", prequalificationId);
"The Prequalification `" + prequalificationId + "` Should be mapped to a group before validating hard policies. ",
prequalificationId);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.fineract.portfolio.client.domain;

import static org.apache.fineract.portfolio.savings.SavingsApiConstants.GURANTEE_PRODUCT_NAME;

import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -38,8 +40,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static org.apache.fineract.portfolio.savings.SavingsApiConstants.GURANTEE_PRODUCT_NAME;

/**
* Example {@link AccountNumberGenerator} for clients that takes an entities auto generated database id and zero fills
* it ensuring the identifier is always of a given <code>maxLength</code>.
Expand All @@ -55,7 +55,7 @@ public class AccountNumberGenerator {
private static final String OFFICE_NAME = "officeName";
private static final String LOAN_PRODUCT_SHORT_NAME = "loanProductShortName";
private static final String SAVINGS_PRODUCT_SHORT_NAME = "savingsProductShortName";
private static final String SAVINGS_CLIENT_ID= "savingsAccountClientId";
private static final String SAVINGS_CLIENT_ID = "savingsAccountClientId";
private static final String SHARE_PRODUCT_SHORT_NAME = "sharesProductShortName";
private static final String PREFIX_SHORT_NAME = "prefixShortName";
private final AccountNumberFormatRepository accountNumberFormatRepository;
Expand Down Expand Up @@ -101,7 +101,7 @@ public String generate(SavingsAccount savingsAccount, AccountNumberFormat accoun
propertyMap.put(ID, savingsAccount.getId().toString());
propertyMap.put(OFFICE_NAME, savingsAccount.office().getName());
propertyMap.put(SAVINGS_PRODUCT_SHORT_NAME, savingsAccount.savingsProduct().getShortName());
if(savingsAccount.savingsProduct().getName().equals(GURANTEE_PRODUCT_NAME)){
if (savingsAccount.savingsProduct().getName().equals(GURANTEE_PRODUCT_NAME)) {
propertyMap.put(SAVINGS_CLIENT_ID, String.valueOf(savingsAccount.clientId()));
}
propertyMap.put(ENTITY_TYPE, "savingsAccount");
Expand Down Expand Up @@ -165,7 +165,7 @@ private String generateAccountNumber(Map<String, String> propertyMap, AccountNum

case SAVINGS_CLIENT_ID:
prefix = propertyMap.get(SAVINGS_CLIENT_ID);
break;
break;
}

// FINERACT-590
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ public static GroupGeneralData withAssocations(final GroupGeneralData grouping,
}

public static GroupGeneralData instance(final Long id, final String accountNo, final String name, final String externalId,
final EnumOptionData status, final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId,
final String centerName, final Long staffId, final String staffName, final String hierarchy, final String groupLevel,
final GroupTimelineData timeline, LocalTime meetingStartTime, LocalTime meetingEndTime) {
final EnumOptionData status, final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId,
final String centerName, final Long staffId, final String staffName, final String hierarchy, final String groupLevel,
final GroupTimelineData timeline, LocalTime meetingStartTime, LocalTime meetingEndTime) {

final Collection<ClientData> clientMembers = null;
final Collection<ClientData> activeClientMembers = null;
Expand All @@ -365,22 +365,23 @@ public static GroupGeneralData instance(final Long id, final String accountNo, f
return new GroupGeneralData(id, accountNo, name, externalId, status, activationDate, officeId, officeName, centerId, centerName,
staffId, staffName, hierarchy, groupLevel, clientMembers, activeClientMembers, centerOptions, officeOptions, staffOptions,
clientOptions, groupRoles, availableRoles, role, calendarsData, collectionMeetingCalendar, closureReasons, timeline,
parentOfficesOptions, responsibleUserOptions, portfolioCenterOptions, centerGroupLocations,
null, null, null, meetingStartTime, meetingEndTime);
parentOfficesOptions, responsibleUserOptions, portfolioCenterOptions, centerGroupLocations, null, null, null,
meetingStartTime, meetingEndTime);
}

private GroupGeneralData(final Long id, final String accountNo, final String name, final String externalId, final EnumOptionData status,
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
final Long staffId, final String staffName, final String hierarchy, final String groupLevel,
final Collection<ClientData> clientMembers, final Collection<ClientData> activeClientMembers,
final Collection<CenterData> centerOptions, final Collection<OfficeData> officeOptions,
final Collection<StaffData> staffOptions, final Collection<ClientData> clientOptions,
final Collection<GroupRoleData> groupRoles, final Collection<CodeValueData> availableRoles, final GroupRoleData role,
final Collection<CalendarData> calendarsData, final CalendarData collectionMeetingCalendar,
final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline,
final Collection<OfficeData> parentOfficesOptions, final Collection<AppUserData> responsibleUserOptions,
final Collection<PortfolioCenterData> portfolioCenterOptions, Collection<EnumOptionData> centerGroupLocations,
String prequalificationNumber, Long prequalificationId, EnumOptionData prequalificationStatus, LocalTime meetingStartTime, LocalTime meetingEndTime) {
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
final Long staffId, final String staffName, final String hierarchy, final String groupLevel,
final Collection<ClientData> clientMembers, final Collection<ClientData> activeClientMembers,
final Collection<CenterData> centerOptions, final Collection<OfficeData> officeOptions,
final Collection<StaffData> staffOptions, final Collection<ClientData> clientOptions,
final Collection<GroupRoleData> groupRoles, final Collection<CodeValueData> availableRoles, final GroupRoleData role,
final Collection<CalendarData> calendarsData, final CalendarData collectionMeetingCalendar,
final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline,
final Collection<OfficeData> parentOfficesOptions, final Collection<AppUserData> responsibleUserOptions,
final Collection<PortfolioCenterData> portfolioCenterOptions, Collection<EnumOptionData> centerGroupLocations,
String prequalificationNumber, Long prequalificationId, EnumOptionData prequalificationStatus, LocalTime meetingStartTime,
LocalTime meetingEndTime) {
this.id = id;
this.accountNo = accountNo;
this.name = name;
Expand Down Expand Up @@ -467,8 +468,8 @@ public static GroupGeneralData updateSelectedRole(final GroupGeneralData groupin
grouping.staffName, grouping.hierarchy, grouping.groupLevel, grouping.clientMembers, grouping.activeClientMembers,
grouping.centerOptions, grouping.officeOptions, grouping.staffOptions, grouping.clientOptions, grouping.groupRoles,
grouping.availableRoles, selectedRole, grouping.calendarsData, grouping.collectionMeetingCalendar, grouping.closureReasons,
null, null, null, null, null, grouping.prequalificationNumber, grouping.prequalificationId,
grouping.prequalificationStatus, grouping.meetingStartTime, grouping.meetingEndTime);
null, null, null, null, null, grouping.prequalificationNumber, grouping.prequalificationId, grouping.prequalificationStatus,
grouping.meetingStartTime, grouping.meetingEndTime);
}

public static GroupGeneralData withClosureReasons(final Collection<CodeValueData> closureReasons) {
Expand Down Expand Up @@ -505,8 +506,7 @@ public static GroupGeneralData withClosureReasons(final Collection<CodeValueData
return new GroupGeneralData(id, accountNo, name, externalId, status, activationDate, officeId, officeName, centerId, centerName,
staffId, staffName, hierarchy, groupLevel, clientMembers, activeClientMembers, centerOptions, officeOptions, staffOptions,
clientOptions, groupRoles, availableRoles, role, calendarsData, collectionMeetingCalendar, closureReasons, null,
parentOfficesOptions, responsibleUserOptions, portfolioCenterOptions, centerGroupLocations,
null, null, null, null, null);
parentOfficesOptions, responsibleUserOptions, portfolioCenterOptions, centerGroupLocations, null, null, null, null, null);
}

public Collection<ClientData> clientMembers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") f
closedByUsername, closedByFirstname, closedByLastname);

return GroupGeneralData.instance(id, accountNo, name, externalId, status, activationDate, officeId, officeName, null, null,
staffId, staffName, hierarchy, groupLevel, timeline, meetingStartTime,meetingEndTime);
staffId, staffName, hierarchy, groupLevel, timeline, meetingStartTime, meetingEndTime);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private CommandProcessingResult createGroupingType(final JsonCommand command, fi
LocalTime newMeetingEndTime = newMeetingStarTime.plusMinutes(meetingDefaultDuration).plusMinutes(timeBetweenMeetings);
meetingEndTime = newMeetingEndTime;

if (centerId !=null){
if (centerId != null) {
String schemaSql = "select cgroup.id from m_group cgroup where cgroup.parent_id = ? and "
+ "( ( ? >= cgroup.meeting_start_time and ? < cgroup.meeting_end_time) OR "
+ "( ? > cgroup.meeting_start_time and ? < cgroup.meeting_end_time) ) order by id desc";
Expand All @@ -259,7 +259,8 @@ private CommandProcessingResult createGroupingType(final JsonCommand command, fi
Long groupId = groupIds.get(0);
GroupGeneralData existingGroup = this.groupReadPlatformService.retrieveOne(groupId);

throw new GroupMeetingTimeCollisionException(existingGroup.getName(), existingGroup.getId(), meetingStartTime, meetingEndTime);
throw new GroupMeetingTimeCollisionException(existingGroup.getName(), existingGroup.getId(), meetingStartTime,
meetingEndTime);
}
}

Expand Down Expand Up @@ -550,20 +551,21 @@ private CommandProcessingResult updateGroupingType(final Long groupId, final Jso
Group parent = groupForUpdate.getParent();
if (actualChanges.containsKey(GroupingTypesApiConstants.meetingStartTime)) {

if (parent !=null){
if (parent != null) {
String schemaSql = "select cgroup.id from m_group cgroup where cgroup.parent_id = ? and "
+ "( ( ? >= cgroup.meeting_start_time and ? < cgroup.meeting_end_time) OR "
+ "( ? > cgroup.meeting_start_time and ? < cgroup.meeting_end_time) ) order by id desc";
LocalTime meetingEndTime = groupForUpdate.getMeetingEndTime();
LocalTime meetingStartTime = groupForUpdate.getMeetingStartTime();
List<Long> groupIds = jdbcTemplate.queryForList(schemaSql, Long.class, parent.getId(), meetingStartTime, meetingStartTime,
meetingEndTime, meetingEndTime);
List<Long> groupIds = jdbcTemplate.queryForList(schemaSql, Long.class, parent.getId(), meetingStartTime,
meetingStartTime, meetingEndTime, meetingEndTime);

if (groupIds.size() > 0) {
Long existingGroupId = groupIds.get(0);
GroupGeneralData existingGroup = this.groupReadPlatformService.retrieveOne(existingGroupId);

throw new GroupMeetingTimeCollisionException(existingGroup.getName(), existingGroup.getId(), meetingStartTime, meetingEndTime);
throw new GroupMeetingTimeCollisionException(existingGroup.getName(), existingGroup.getId(), meetingStartTime,
meetingEndTime);
}
}
}
Expand Down
Loading

0 comments on commit 50de5cc

Please sign in to comment.