This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

AMM-Report (2025)

Starting with 2025, there is a nationwide AMM-Report that should be used regardless of the canton. This new AMM-Report is not a traditional report. We used the official PDF form and fill in values. How each field is mapped, may be individualised in intermediate- or customer-modules.

Override field-mapping

To override the field-mapping of a AMM-Report field, create a contribution in the desired target module using the AmmFieldMapping record. To make sure your contribution is used, use the @Order annotation to set a higher priority (lower order value) than the default mapping. The default mappings have an order value of Integer.MAX_VALUE and are defined in the class ch.tocco.nice2.optional.amm.impl.actions.ammpdf.DefaultAmmFieldMapping.

Example that resolves the BUR number from the related address of the project place.

@Bean
@Order(1000) // higher priority (lower number) than the default mapping
public AmmFieldMapping customerBurAmmFieldMapping() {
    return new AmmFieldMapping("Textfeld 99", FORMS_2025_04, string("bur_number", i -> Optional.ofNullable(i.projectPlace()).map(p -> p.getRelatedEntity("relAddress")).orElse(null)));
}

Default Field mapping

A documentation of all fieldnames and the default mapping may be found in sharepoint: https://tocco.sharepoint.com/:x:/s/Produkt-Gilde/IQBdU432udF2TanyO5Sm50C0AS7eELOXghx4s38oRcs2rXg?e=hfEqLB

Structure of AmmFieldMapping record

Field

Type

Description

fieldName

String

The field name in the AMM-Report Acro PDF Form

supportedForms

List<String>

The supported forms for this field. Use the FORMS_2025_04 constant of AmmMappingHelper if this mapping is used for all current forms.

mappingFunction

Function<AmmFieldInput, @Nullable String>

The mapping function. All fields must be set as String values. Use Null to leave a field empty. AmmMappingHelper contains helper functions for common mappings.

How to Map different Field Types

Field Type

Value

String

1:1

Number

Format the number as a string in the way you want it to be printed on the form.

Date

Dates are formatted using ddMMyyyy format. The separators are automatically added in the PDF form

Checkbox

The checkboxes may be set by setting the value 0 or 1.

Radiobutton

Radiobuttons may be set by setting the index (0, 1, …). You need to try this out / check the result. The indexes are not always in the order they are printed on the form

Override how presences are resolved

The ch.tocco.nice2.optional.amm.api.service.AmmServiceConditions interface defines how working days and reservation registrations are resolved for the presence table in the AMM-Report. The interface contains all default implementations. To override one or multiple conditions, define a new spring component with the @Primary annotations and implement the desired methods.

Example that overrides the reservationRegistrationPmCondition.

@Primary
@Component
public class AozAmmServiceConditons implements AmmServiceConditions {
    public Condition reservationRegistrationPmCondition(DateTime date, Entity caseEntity) {
        return and(
            relationTo("relRegistration.relCase", caseEntity.requireKey()),
            field("relReservation.date_till").greaterThan(date.plusMinutes(750)),
            field("relReservation.date_from").between(date, date.plusDays(1))
        );
    }
}

Override how registrations and project activities are resolved

Some fields (e.g. start and end date) are resolved from the “relevant” project activity or registration. The default logic how these entities are resolved is defined in the ch.tocco.nice2.optional.amm.api.actions.ammpdf.AmmPdfConditions interface and may be overwritten in a similar way as described above for the AmmServiceConditions.