Class AmmServiceImpl

java.lang.Object
ch.tocco.nice2.optional.amm.impl.service.AmmServiceImpl
All Implemented Interfaces:
AmmService

@Component public class AmmServiceImpl extends Object implements AmmService
  • Field Details

  • Constructor Details

  • Method Details

    • getAmmMonth

      public AmmMonth getAmmMonth(Entity caseEntity, int year, int month)
      Description copied from interface: AmmService
      Creates an AmmMonth Bean containing information about presences for each "half-day" of the month (e.g. am + pm for days 1-31). Missing days (days without presences or days of shorter months) are filled with empty AmmDay beans. It works as follows 1. Try to resolve Working_day of case for the current half day 2. Try to resolve Reservation_registration for the current half day 3. Resolve the Registration_accomplishment_status of the resolved entity 4. Resolve the Subvention_canton of the case 5. Get the code of the Registration_accomplishment_status_subvention_canton corresponding to the canton + status and write it into the AmmDay bean Additionally, it calculates expense totals for the current month by type as follows: 1. Select all expenses of current month (date >= first day of month invalid input: '&' date invalid input: '<'= last day of month) 2. Group expenses by Expense_type 3. Create a AmmExpenses record per type containing type, number of expeneses, avg amount, and total amount The queries that are used to resolve Working_days or Reservation_registration can be configured using the interface AmmServiceConditions
      Specified by:
      getAmmMonth in interface AmmService
      Parameters:
      caseEntity - the case for
      year - the year for which the presences are generated (yyyy, e.g. 2025)
      month - month for which the presences are generated (1-12)
      Returns:
      the generated AmmMonth
    • getAmmMonth

      public AmmMonth getAmmMonth(Entity caseEntity, int year, int month, @Nullable Entity subventionCanton)
      Description copied from interface: AmmService
      This method can be used to generate an AmmMonth with a fixed Subvention_canton entity. The Subvention_canton of the caseEntity is no longer resolved / considered.
      Specified by:
      getAmmMonth in interface AmmService
      Parameters:
      caseEntity - the case for
      year - the year for which the presences are generated (yyyy, e.g. 2025)
      month - month for which the presences are generated (1-12)
      subventionCanton - the subvention canton entity to be used
      Returns:
      the generated AmmMonth