STO - Utilitaires de facturation
[En rédaction]
Amf
- generateAMFNights(List<Object[]> events, String resultDayformat) -
_facUtils.generateAMFNights(List<Object[]> events, String resultDayformat)
- Generates one result line for each given event that will span over two consecutive days. Events in array must have the following properties 1 - key 2 - group 3 - start date 4 - end date 5 - priority 6 - type
_facUtils.generateAMFNights(_events, "dd/MM"));
- getAMFFromGroup(String group, Date atDate) -
_facUtils.getAMFFromGroup(String group, Date atDate)
- Retrieves the AMF employee that is responsable of the given group at a given date.
_facUtils.getAMFFromGroup(group, date));
- getAMFDepartement(String employee) -
_facUtils.getAMFDepartement(String employee)
- Retrieves the employee contract departement at the current period start date. The employee is expected to have only one contract.
_facUtils.getAMFDepartement(employee));
- isAmfDayCancelled(DateTime date, List
cancellationEvents, String department) - _facUtils.isAmfDayCancelled(DateTime date, List<String> cancellationEvents, String department)
- Check if there are any cancelling events for the given department at a given date. Returns true if there is at least one cancelling event during that day.
_facUtils.isAmfDayCancelled(date, cancellingEventsTypes, department));
// This will check if there is at least one event of one of the types listed in cancellingEventsTypes
// for the department.
AMF
- getAMFEvents() -
_facUtils.getAMFEvents()
- Returns all P.THEORIQUE, P.C_SUPPLEMENT and all absence events that are related to an AMF and the given child in the period
int allAmfEvs = _facUtils.getAMFEvents();
- getAMFEvents(List{String} extraTypes) -
_facUtils.getAMFEvents(List{String} extraTypes)
- Returns all P.THEORIQUE, P.C_SUPPLEMENT, any type from the list and all absence events that are related to an AMF and the given child in the period
int allAmfEvs = _facUtils.getAMFEvents(["P.C_SPECIAL"]);
- getAMFEvents(List{String} extraTypes, boolean currentChildOnly) -
_facUtils.getAMFEvents(List{String} extraTypes, boolean currentChildOnly)
- Returns all P.THEORIQUE, P.C_SUPPLEMENT, any type from the list and all absence events that are related to an AMF and either the given child or all children in the period
int allAmfEvs = _facUtils.getAMFEvents(["P.C_SPECIAL"], false);
- getAMFTypedEvents(List
types) - _facUtils.getAMFTypedEvents(List<String> types)
- Returns all given types events that are related to an AMF and the given child in the period. The returned entries are objects containing : id, department, start, end, priority, type.
int allAmfEvs = _facUtils.getAMFTypedEvents(['A.NONFAC', 'A.MALADIE']);
- getAMFTypedEvents(List
types, String departement) - _facUtils.getAMFTypedEvents(List<String> types, String departement)
- Returns all given types events that are related to an AMF in the period. The returned entries are objects containing : id, department, start, end, priority, type.
int allAmfEvs = _facUtils.getAMFEmployeeTypedEvents(['A.NONFAC', 'A.MALADIE'], "710A1002");
Child
- getDossier(Child childEntry) -
_facUtils.getDossier(Child childEntry)
- Returns the cached dossier of the given Child. The current plan execution child is available throught the ‘_child’ variable.
_facUtils.getDossier(_child);
- getChildMonthAge() -
_facUtils.getChildMonthAge()
- Returns number of full monthes that occured between the current child birth date and the current period start date.
_facUtils.getChildMonthAge();
- getFrateriePosition() -
_facUtils.getFrateriePosition()
- Returns the position of the child in the fratrie. Without any override,
this will count the number of children at the start of the period that
have an active
SECTION
page.
_facUtils.getFrateriePosition();
- getFrateriePositionReversed() -
_facUtils.getFrateriePositionReversed()
- Returns the position of the child by young age order in the fratrie, the start number is ONE. Without any override,
this will count the number of children at the start of the period that
have an active
SECTION
page.
_facUtils.getFrateriePosition();
- getFrateriePosition() -
_facUtils.getFrateriePosition()
- Returns the position of the child in the fratrie. Without any override,
this will count the number of children at the start of the period that
have an active
SECTION
page.
_facUtils.getFrateriePosition(rabaisFratrieForAllSiblings, keepChildrenAtSamePosition, rabaisFratrieMustHaveSameAddress);
rabaisFratrieForAllSiblings - true if then all the siblings will have the same position, false then each sibling will get a different index,starting from 1 keepChildrenAtSamePosition - false if position depends on the date of birth and the alphabetical order of the first name rabaisFratrieMustHaveSameAddress - true if siblings must have the same address in order to get the rabais fratrie
- getChildMonthAge(Date atDate) -
_facUtils.getChildMonthAge(Date atDate)
- Returns the age of the child in full month between the birthdate and the given date.
int nbMonth = _facUtils.getChildMonthAge(new Date().toJavaDate());
Computation Periods
- getActiveCategories() -
_facUtils.getActiveCategories()
- Returns the
Set<string>
of categories from the active planning page during the current period.
Be careful, this will return all the categories, even if the line doesn’t care about all. See getCurrentSection() for a restricted usage of active pages.
- getActivePages() -
_facUtils.getActivePages()
- Returns the List of SECTION DossierPage using the dossier API on the current child Dossier. The pages are only the ones that are active during the current computation period.
//The goal here is to output 1 as the line result if one of the active
//page is using the reservation mode.
var pages = _facUtils.getActivePages();
for(var key in pages) {
//The DossierPage API gives us direct access to fields in the requested mode
if(pages.getValueAsBoolean('RESERVATION')) {
result.set('MONTANT', BigDecimal.ONE);
}
}
Be careful, this will return all the active pages, even if the line doesn’t care about all of them. See getCurrentSection() for a restricted usage of active pages.
- isAdaptation() -
_facUtils.isAdaptation()
- Returns true if the current period is an adaptation period, based on the
number of adaptation days in the current
SECTION
pages. If one of the page is an adaptation, the whole period yields true.
_facUtils.isAdaptation();
- getAdaptationDepartement() -
_facUtils.getAdaptationDepartement()
- Returns The list of departement that are in adaptation for the current period but only if the current period is the first one of the section page.
var deps = _facUtils.getAdaptationDepartement();
for(var key in deps) {
var res = _facUtils.newLineResult();
res.setDepartement(deps[key]);
res.set("MONTANT", new BigDecimal(100));
res.setArticle("DIV01");
}
- getAdaptationDepartement(boolean onlyFirstPeriod) -
_facUtils.getAdaptationDepartement(boolean onlyFirstPeriod)
- Returns The list of departement that are in adaptation for the current period or, only if the current period is the first one of the section page.
var deps = _facUtils.getAdaptationDepartement();
for(var key in deps) {
var res = _facUtils.newLineResult();
res.setDepartement(deps[key]);
res.set("MONTANT", new BigDecimal(100));
res.setArticle("DIV01");
}
onlyFirstPeriod - True if you want to return the list only if the current period is the first one in the section page. False if you want to return the list of all current periods.
- isReservation() -
_facUtils.isReservation()
- Returns true if the current period is a reservation period, based on the
RESERVATION
field in the currentSECTION
pages. If one active page is a reservation then the period yields true.
_facUtils.isReservation();
- isMajored() -
_facUtils.isMajored()
- By default, returns true if the current period income has a state field with a value of “2”. This is widely used for exemple to separate children that live within the structure associated cities and the one that leave further and need to be given extra fees.
_facUtils.isMajored();
- isFirstPeriodEver() -
_facUtils.isFirstPeriodEver()
- Returns true if there is no
SECTION
page that starts before the current period start boundary.
Be careful, if the beginning of the month starts with a restriction period, then the following period considers that it is not the first period.
_facUtils.isFirstPeriodEver();
- isFirstPresenceEver() -
_facUtils.isFirstPresenceEver()
- Returns true if there is no
SECTION
page that starts before the date on the last day of the past month and the line has not already been applied during the current month
_facUtils.isFirstPresenceEver();
- getAbsenceDurationAtPeriod(List
types) - _facUtils.getAbsenceDurationAtPeriod(List<String> types)
- Based on the given event type, this function retrieves all events that span over the current period and computes at the end date the number of days that have been elapsed since the start of the event. This allows to define for exemple special rabais based on sickness durations.
int duration = _facUtils.getAbsenceDurationAtPeriod(["A.C_MALADIE", "A.C_ACCIDENT"]);
- generateAMFDepassementHours(List<Object[]> timingEvents, String requestedEventType, int day, String minHour, String maxHour, String format, boolean generateIfMultiDays, List
canCancelHours) - _facUtils.generateAMFDepassementHours(List<Object[]> timingEvents, String requestedEventType, int day, String minHour, String maxHour, String format, boolean generateIfMultiDays, List<String> canCancelHours)
- Generate a result every time a child is present but was not supposed to be. This happen when the child arrives early or leaves late, based on the real events.
_facUtils.generateAMFDepassementHours(amfEvents, "P.REELLE", DateTimeConstants.MONDAY, null, null, "yy-MM-dd", true, cancellingEventsTypes);
//This will generate all the hours on mondays where the P.REELLE events are not expected and not cancelled by events from cancellingEventsTypes.
- generateDepassementHours(List<Object[]> timingEvents, String requestedEventType, List
requestedMissingUnderType, List days, String format, boolean generateIfMultiDays) - _facUtils.generateDepassementHours(List<Object[]> timingEvents, String requestedEventType, List<String> requestedMissingUnderType, List<Integer> days, String format, boolean generateIfMultiDays)
- Generate a result every time a child is present but was not supposed to be. This happens for exemple when the child arrives early or leaves late, based on the real events. Note, absences are not considered when looking at under-types which means that if a child has theoretical presence and is not there on some day, the theoretical presence will still be considered when looking at exceeding.
_facUtils.generateDepassementHours(amfEvents, "P.REELLE", ["P.THEORIQUE"], [1,2,3], "yy-MM-dd", true);
//This will generate all the hours on mondays to wednesdays where the P.REELLE events are over missing P.THEORIQUE.
- generatePresenceMinutesByGroup(List
eventTypes) - _facUtils.generatePresenceMinutesByGroup(List<String> eventTypes)
- Generate a line of result for each group giving the count of minutes of presence of the current child. The types given as argument allow to know which types must be retrieved in the events of the child during the current period to slice and count.
_facUtils.generatePresenceMinutesByGroup(["P.REELLE", "P.THEORIQUE"]);
Debitor
- getDebitorsByDay() -
_facUtils.getDebitorsByDay()
- Returns a map that contains for each day the relevant debitor that is selected in the DONNEES_FACTURATION page. This can be used to select which debitor should be selected for the facturation of the given day
//This will retrieve for exemple a sharing between debitors 00001 and 00002 as
//1 => 00001, 2 => 00001, 3 => 00002, 4 => 00002, 5 => 00002
int debsByDay = _facUtils.getDebitorsByDay();
Discounts
- applyFirstAvailableDiscount(List{String}) -
_facUtils.applyFirstAvailableDiscount(List{String})
- Iterates over all the line result entries of the given discount list and applies the first available one to the current lines result values. All the discounts must be line numbers. If a discount line yields multiple results, then the first one will be taken
_facUtils.applyAvailableDiscount(["A01". "A02"]);
- applyAvailableDiscounts(List{String}, boolean) -
_facUtils.applyAvailableDiscounts(List{String}, boolean)
- Iterates over all the line result entries of the given discount list and applies the available one to the current lines values. All the discounts must be line numbers. If a discount line yields multiple results, then the first one will be taken. This function might stop after applying the first discount if the second parameters of the function says so
//Applies A01 if found, otherwise A02 if found.
_facUtils.applyAvailableDiscounts(["A01". "A02"], true);
//Applies both A01 and A02 if found.
_facUtils.applyAvailableDiscounts(["A01". "A02"], true);
- getRabaisFraterie(int position) -
_facUtils.getRabaisFraterie(int position)
- Based on the given integer position, returns the BigDecimal value of the discount that matches the position using the FAC-RABAIS-FRATRIE tabelle in UNI85
_facUtils.getRabaisFraterie(2);
- getRabaisFraterie(BigDecimal position) -
_facUtils.getRabaisFraterie(BigDecimal position)
- Based on the given integer position, returns the BigDecimal value of the discount that matches the position using the FAC-RABAIS-FRATRIE tabelle in UNI85
_facUtils.getRabaisFraterie(BigDecimal.valueOf(2));
Events
- generateEventsByDay(List
events, Predicate predicate, String article) - _facUtils.generateEventsByDay(List<Gtpevt> events, Predicate<Gtpdep> predicate, String article)
- Generates results that contain the length in decimal hours of the event as amount but only if it matches the given predicate.
- generateEventsByDay(SlotGroup slotGroup, List
events, Predicate predicate, Integer day, String format) - _facUtils.generateEventsByDay(SlotGroup slotGroup, List<Gtpevt> events, Predicate<Gtpdep> predicate, Integer day, String format)
- Generates a result that contains the start date of the event for each attendance slot corresponding to the additional/breakdown events
// Creates a line if a supplement of an extracurricular group corresponding to the slot id "MON_H1".
_facUtils.generateEventsByDayForSlot(new _global.SlotGroup("MONS01", ["MON_H1"],[]), _global.supplements, _global.isParaScolaire, DateTimeConstants.MONDAY, "yy-MM-dd");
- slotContainsOneOfEvents(List
events, String slotId) - _facUtils.slotContainsOneOfEvents(List<Gtpevt> events, String slotId)
- Return a boolean for the first event that corresponds to the slot identifier
_facUtils.slotContainsOneOfEvents(_events, "MON_H1"));
- generateLineIfEventIsInSlot(List
events, String slotId, String format) - _facUtils.generateLineIfEventIsInSlot(List<Gtpevt> events, String slotId, String format)
- Generates a result line for each given event that corresponds to the slot identifier
_facUtils.generateLineIfEventIsInSlot(_events, "MON_H1", "dd/MM"));
- getAbsenceEventTypes(List
noDesiredTypes) - _facUtils.getAbsenceEventTypes(List<String> noDesiredTypes)
- Returns the existing all event types in the domain according to wildcard and not including the event type list provided in parameter. Warning, the underscore character must be preceded by the double escape character. For example ‘A.C\_%’
_facUtils.getAbsenceEventTypes("A.%", ["A.MALADIE", "A.VACANCES"]);
- getDayActivityByGroupBasedStructurePlanning(List{String}, Predicate{Gtpdep}, List{String}, String) -
_facUtils.getDayActivityByGroupBasedStructurePlanning(List{String}, Predicate{Gtpdep}, List{String}, String)
- Iterates on all the events of the period in order to deduce the affected slots based strcuture planning and the affected schedules by including the cuts of the reference schedule. See getDayActivityByGroup() for more informations.
- getDayActivityByGroupBasedSectorPlanning(List{String}, Predicate{Gtpdep}, List{String}, String) -
_facUtils.getDayActivityByGroupBasedSectorPlanning(List{String}, Predicate{Gtpdep}, List{String}, String)
- Iterates on all the events of the period in order to deduce the affected slots based sector planning and the affected schedules by including the cuts of the reference schedule. See getDayActivityByGroup() for more informations.
- getDayActivityByGroupBasedGroupPlanning(List{String}, Predicate{Gtpdep}, List{String}, String) -
_facUtils.getDayActivityByGroupBasedGroupPlanning(List{String}, Predicate{Gtpdep}, List{String}, String)
- Iterates on all the events of the period in order to deduce the affected slots based group planning and the affected schedules by including the cuts of the reference schedule.
// Retrieve billed event (retrieves all events beginning with A., except unbilled events)
var unbilledEventTypes = _facUtils.getAbsenceEventTypes("A.%", ["A.C_NONFAC", "A.C_NONFACLON", "A.C_VACNONFAC"]);
// Retrieve the day's activities by group
_facUtils.getDayActivityByGroupBasedGroupPlanning(["P.THEORIQUE", "P.C_SUPPLEMENT"], null, unbilledEventTypes, null);
// Planning slots of group GR1 : Slot 1 08h-11h ; Slot 2 : 11h-14h ; Slot 3 : 14h-18h
// Example 1 :
// Planning of child hours GR1 : 9h-11h ; 17h-18h only monday 01.05.2023
// Group GR1 -> Day 01.05.2023 -> ConsecutiveActivity (2) -> slot indexes = 1 ; prescences = 9h-11h with duration = 120 minutes
// -> slot indexes = 3 ; prescences = 16h-18h with duration = 60 minutes
// Example 2 :
// Planning of child hours GR1 : 9h-10h ; 13h-16h only monday 01.05.2023
// Group GR1 -> Day 01.05.2023 -> ConsecutiveActivity (2) -> slot indexes = 1 ; prescences = 9h-10h with duration = 60 minutes
// -> slot indexes = 2,3 ; prescences = 13h-14h, 14h-16h with duration = 180 minutes
Group
- isHolidays(Gtpdep grp) -
_facUtils.isHolidays(Gtpdep grp)
- Predicate on group type that will yield true if the group type is ‘holidays’
var isHoly = _facUtils.isHolidays(_facUtils.getGroup("VA1"));
- getGroup(String groupId) -
_facUtils.getGroup(String groupId)
- Allows to fetch a group entity from its id
var myGroup = _facUtils.getGroup("VA1");
Income
- getIncomesByDay() -
_facUtils.getIncomesByDay()
- Returns a map that contains for each day the relevant income that is the sum of the incomes of the selected intervenants in the DONNEES_FACTURATION page for each day through the “INTERV_” fields. The computations are performed at the beginning of the computation period.
//This will retrieve for exemple
//1 => 0, 2 => 1500, 3 => 0, 4 => 6000, 5 => 6000
int incomeByDay = _facUtils.getIncomesByDay();
- getStatusByDay() -
_facUtils.getStatusByDay()
- Returns a map that contains for each day the associated billing status
//This will retrieve for exemple
//1 => 1, 2 => 2, 3 => 1, 4 => 2, 5 => 2
int statusByDay = _facUtils.getStatusByDay();
Prestation Computations
- generatePrestationForSlot(String slotId, String prestation, Predicate{Gtpdep}, String dateFormat) -
_facUtils.generatePrestationForSlot(String slotId, String prestation, Predicate{Gtpdep}, String dateFormat)
- Generates a result every time the wanted slot and prestation appears on the given day in the current period. If the prestation isn’t cancelled by another absence event, then the function yields it
_facUtils.generatePrestationForSlot(MON_H3", "REP01PS", null, "EEE dd/MM");
//This yields for exemple a result with amount 1 and "Lun 06/12" as details label if this event isn't cancelled
- generatePrestationsOverwrittenByACertainTypeOfEvent(List
eventTypesThatCount, List eventTypesThatTopLevel, List eventTypesCancel, Predicate{Gtpdep}, String dateFormat) - _facUtils.generatePrestationsOverwrittenByACertainTypeOfEvent(List<String> eventTypesThatCount, List<String> eventTypesThatTopLevel, List<String> eventTypesCancel, Predicate{Gtpdep}, String dateFormat)
- Generates a result whenever the requested event type appears on any day of the current period and is overwritten by a certain event type and if the event is not overwritten by another absence event or overwriting event type, then the function produces it.
_facUtils.generatePrestationsOverwrittenByACertainTypeOfEvent(["P.PRESTATION.MIDI"], ["P.SORTIE.EXCEPTIONNELLE"], null, "EEE dd/MM");
// This gives, for example, a result with the amount 1 and "Mon 06/12" as the detail label
// if the event P.PRESTATION.MIDI is not canceled and is covered by one of the events that must be above it.
- generateFraisForType(String typeFrais, String articleId, String dateFormat) -
_facUtils.generateFraisForType(String typeFrais, String articleId, String dateFormat)
- Generates a result every time the requested fee type appears on some day within the current period. If the event isn’t cancelled by another absence event, then the function yields it.
_facUtils.generateFraisForType("FRAIS_KILOMETRIQUES", "P3200.1", "yy-MM-dd");
//This yields for example a result with amount 1 and "21/06/12" as details label if this event isn't cancelled
- generateFraisPapier(String articleId) -
_facUtils.generateFraisPapier(String articleId)
- Generates paper charges for debtors who receive paper invoices
_facUtils.generateFraisPapier("P3200.1");
- generateFraisKilometriques(String articleId, String dateFormat) -
_facUtils.generateFraisKilometriques(String articleId, String dateFormat)
- Generates a result every time the km fees type appears on some day within the current period. If the event isn’t cancelled by another absence event, then the function yields it
_facUtils.generateFraisKilometriques("P3200.1", "yy-MM-dd");
//This yields for example a result with amount 1 and "21/06/12" as details label if this event isn't cancelled
- generateFraisRecurrent(BigDecimal amount, int nbMonths, boolean multiDomain) -
_facUtils.generateFraisRecurrent(BigDecimal amount, int nbMonths, boolean multiDomain)
- Generates a result when the {@code amount} has not been (fully) generated during the previous {@code nbMonths}. The {@link #currentLine} is used to retrieve amounts already generated in the past months. The difference will be set in the resulting line.
_facUtils.generateFraisRecurrent(50.0, 1, true); //each month
_facUtils.generateFraisRecurrent(50.0, 12, true); //each year
- generateFraisBricolage(String articleId, String dateFormat) -
_facUtils.generateFraisBricolage(String articleId, String dateFormat)
- Generates a result every time the bricolage fees type appears on some day within the current period. If the event isn’t cancelled by another absence event, then the function yields it
_facUtils.generateFraisBricolage("P3200.2", "yy-MM-dd");
//This yields for example a result with amount 1 and "21/06/12" as details label if this event isn't cancelled
- generateCancelledPrestationsHours(List
eventTypesThatCount, List eventTypesThatCancel, Predicate groupCondition) - _facUtils.generateCancelledPrestationsHours(List<String> eventTypesThatCount, List<String> eventTypesThatCancel, Predicate<Gtpdep> groupCondition)
- Generates a result with a duration whenever the requested event type appears on any day of the current period
and is overwritten by a certain absence event type. By default, the
EEE dd/MM
date format is used as details.
_facUtils.generateCancelledPrestationsHours(["P.PRESTATION.MIDI"], ["A.SORTIE.EXCEPTIONNELLE"], null);
// This gives, for example, a result with the amount 1 and "Mon 06/12" as the detail label
- generateCancelledPrestationsHours(List
eventTypesThatCount, List eventTypesThatCancel, Predicate groupCondition, String format) - _facUtils.generateCancelledPrestationsHours(List<String> eventTypesThatCount, List<String> eventTypesThatCancel, Predicate<Gtpdep> groupCondition, String format)
- Generates a result with a duration whenever the requested event type appears on any day of the current period and is overwritten by a certain absence event type.
_facUtils.generateCancelledPrestationsHours(["P.PRESTATION.MIDI"], ["A.SORTIE.EXCEPTIONNELLE"], null, "EEE dd/MM");
// This gives, for example, a result with the amount 1 and "Mon 06/12" as the detail label
Resulting lines
- generateAmountLine(Map{String, Integer}) -
_facUtils.generateAmountLine(Map{String, Integer})
- With the given map department -> amount, this function generates a result for each department and associates the corresponding number as its main result amount.
//Any map with some results
var deps = {
"ONE" : 3,
"TWO" : 15
};
_facUtils.generateAmountLine(deps);
- clonePreviousLines(String linesIdToClone) -
_facUtils.clonePreviousLines(String linesIdToClone)
- Clone the lines from the given previous lines and set them as current line result. This can be useful sometimes when we want to perform divide and conquer plan strategy instead of storing all computations in the same line.
//Generating 3 result lines that are copys of "PS0100"
_facUtils.clonePreviousLines("PS0100");
Section
- getAMFIrregularPages(Date periodStart, List
cancellationEvents) - _facUtils.getAMFIrregularPages(Date periodStart, List<String> cancellationEvents)
- Get the active AMF section pages with irregular hours at a given date that are not cancelled by the given even type. If there are multiple AMF section page at the given date, return the all that are not cancelled by events of type cancellationEvents. If there is no AMF page with irregular hours, this will return an empty list.
_facUtils.getAMFIrregularPages(startDate, cancellationEventsTypes);
- getIrregularPages(Date periodStart) -
_facUtils.getIrregularPages(Date periodStart)
- Get all the active pages that have a minimal number of hours set in the
HEURES_MINIMALES
field.
_facUtils.getIrregularPages(startDate);
Section Computations
- getDepartementFromSection() -
_facUtils.getDepartementFromSection()
- Returns the debitor department as
G_group
withgroup
beeing the group value of the active section page during the current period.
result.setDepartement(_facUtils.getDepartementFromSection());
- getCurrentSection(boolean allowEmpty) -
_facUtils.getCurrentSection(boolean allowEmpty)
- Returns the given SECTION DossierPage if exists. If it doesn’t exist, then it crashes if asked to do so, or return null if allowed. Note that the returned page is based on the current line allowed categories. Thus, if we’re working on Prescolaire pages, only the prescolaire pages can be returned. This allows to automatically fetch the right page from a multi page children.
//Setting the current line as 1 if the current page is a reservation
var sec = _facUtils.getCurrentSection(true);
if(sec.getValueAsBoolean("RESERVATION")) {
result.set("MONTANT", BigDecimal.ONE);
}
- getCurrentSection(Period period, boolean allowEmpty) -
_facUtils.getCurrentSection(Period period, boolean allowEmpty)
- Returns the given SECTION DossierPage in the given period if exists. If it doesn’t exist, then it crashes if asked to do so, or return null if allowed. Note that the returned page is based on the current line allowed categories. Thus, if we’re working on Prescolaire pages, only the prescolaire pages can be returned. This allows to automatically fetch the right page from a multi page children.
//Setting the current line as 1 if the current page is a reservation
var period = new SimplePeriod(..., ...);
var sec = _facUtils.getCurrentSection(period, true);
if(sec.getValueAsBoolean("RESERVATION")) {
result.set("MONTANT", BigDecimal.ONE);
}
- getSlotDuration() -
_facUtils.getSlotDuration()
- Returns the duration in minute of the given slot in the active group of the current period. If there is no active group, then it returns 0. If the slot is not found in the slot list, it returns 0.
Slot Computations
- computeDaysForSlot(SlotGroup config, int dayOfWeek, Predicate{Gtpdep}) -
_facUtils.computeDaysForSlot(SlotGroup config, int dayOfWeek, Predicate{Gtpdep})
- Computes the number of times the combinaison of wanted and excluded slots appear on the given day in the current period. This is based on the getCurrentSection function that allows empty period. It returns this number as an integer.
var SlotGroup = Java.type("saierp.dbcode.business.gtp.tasks.cre.SlotGroup");
var amounr = _facUtils.computeDaysForSlot(new SlotGroup("SOMEID", ["MON_H1"], ["MON_H2"]), DateTimeConstants.MONDAY, null);
- hasSlotCombinaison(SlotGroup config, int dayOfWeek, Predicate{Gtpdep}) -
_facUtils.hasSlotCombinaison(SlotGroup config, int dayOfWeek, Predicate{Gtpdep})
- Returns true if the combinaison of wanted and excluded slots appear on the given day in the current period. This is based on the getCurrentSection function that allows empty period.
var SlotGroup = Java.type("saierp.dbcode.business.gtp.tasks.cre.SlotGroup");
var isUsed = _facUtils.hasSlotCombinaison(new SlotGroup("SOMEID", ["MON_H1"], ["MON_H2"]), DateTimeConstants.MONDAY, null);
- hasSlotCombinaison(SlotGroup config, int dayOfWeek, Predicate{Gtpdep}, Date atDate) -
_facUtils.hasSlotCombinaison(SlotGroup config, int dayOfWeek, Predicate{Gtpdep}, Date atDate)
- Returns true if the combinaison of wanted and excluded slots appear on the given day in the pages defined at the given date.
var SlotGroup = Java.type("saierp.dbcode.business.gtp.tasks.cre.SlotGroup");
var isUsed = _facUtils.hasSlotCombinaison(new SlotGroup("SOMEID", ["MON_H1"], ["MON_H2"]), DateTimeConstants.MONDAY, null, null);
- generateDaysForSlot(SlotGroup config, int dayOfWeek, Predicate{Gtpdep}, String dateFormat) -
_facUtils.generateDaysForSlot(SlotGroup config, int dayOfWeek, Predicate{Gtpdep}, String dateFormat)
- Generates a result every time the combinaison of wanted and excluded slots appear on the given day in the current period. This is based on the getCurrentSection function that allows empty period. Each result is associated with the given day formatted as given set in the SpecificLabel of the line
var SlotGroup = Java.type("saierp.dbcode.business.gtp.tasks.cre.SlotGroup");
_facUtils.generateDaysForSlot(new SlotGroup("SOMEID", ["MON_H1"], ["MON_H2"]), DateTimeConstants.MONDAY, null, "EEE dd/MM");
//This yields for exemple a result with amount 1 and "Lun 06/12" as details label
- getSlotPrice(String slotId, Predicate
groupCondition, String tabelleOverride) - _facUtils.getSlotPrice(String slotId, Predicate<Gtpdep> groupCondition, String tabelleOverride)
- If the group condition matches the current section page of the current child, or null if there is no condition, then this function retrieves in UNI85 the given slotId combo entry from the specified tabelle. If the tabelle is null or empty, it uses the ‘TARIF_category’ tabelle based on the current section category field value. The row value is based on the child parents’s income at the start of the period.
_facUtils.getSlotPrice("1", null, "TARIF_PRE");
- computeSlotTotal(String prefix, String article) -
_facUtils.computeSlotTotal(String prefix, String article)
- Based on the given prefix, fetches all lines that ends with
prefix
+01
to07
and sum their amounts by departement and specific labels. It then loads the value of theprefix
+PU
line and generate final lines with the departement amount as number, the specific label, and the total amount as the number times the PU amount
//The following line will multiply SOME_01, SOME_02, .... SOME_07 lines
//by SOME_PU and output the result using "PA_1000.1" article on the final bill
_facUtils.computeSlotTotal("SOME_", "PA_1000.1");
- getGroupRelevantSlots(String groupId, int dayOfWeek) -
_facUtils.getGroupRelevantSlots(String groupId, int dayOfWeek)
- The retrieves the list of slots (not the modules) for the given group and day. The date of the retrieval is the first day of the perdiod.
var slotLists = _facUtils.getGroupRelevantSlots("GR1", DateTimeConstants.MONDAY);
- getNonCancelledPresenceSlotInPeriod(List
slots, List groups) - _facUtils.getNonCancelledPresenceSlotInPeriod(List<String> slots, List<String> groups)
- Returns the list of days in which the presence period events are not cancelled by absence ones.
var presenceDays = getNonCancelledPresenceSlotInPeriod(["MON_H1_SLOT", "TUE_H2_SLOT"], ["GR1", "GR2"]);
- getNonCancelledPresenceSlotInPeriod(List
slots, List groups) - _facUtils.getNonCancelledPresenceSlotInPeriod(List<String> slots, List<String> groups)
- Returns the list of days in which the presence period events are not cancelled by absence ones. The last parameter of the function allows to request exact slot matching.
var presenceDays = getNonCancelledPresenceSlotInPeriod(["MON_H1_SLOT", "TUE_H2_SLOT"], ["GR1", "GR2"], true);
useContractDefinition - true to use the events from the contract pages, false to also use the events from the direct planning
Utils
- getTabellePrice(String tabelle, Date atDate, BigDecimal rowValue, String entryKey) -
_facUtils.getTabellePrice(String tabelle, Date atDate, BigDecimal rowValue, String entryKey)
- Returns the value from the given tabelle or throws an exception otherwise
_facUtils.getTabellePrice("TARIF_PRE", new Date().toJavaDate(), Bigdecimal.valueOf("14"), "1");
- getTabellePriceRow(String tabelle, Date atDate, BigDecimal rowValue, String domain) -
_facUtils.getTabellePriceRow(String tabelle, Date atDate, BigDecimal rowValue, String domain)
- Returns the row from the given tabelle or throws an exception otherwise
_facUtils.getTabellePriceRow("TARIF_PRE", new Date().toJavaDate(), Bigdecimal.valueOf("14"), "CRE");
- isValueExistsFromGivenTabelle(String tabelle, Date atDate, BigDecimal rowValue, String entryKey, String Domain) -
_facUtils.isValueExistsFromGivenTabelle(String tabelle, Date atDate, BigDecimal rowValue, String entryKey, String Domain)
- Returns if the value from the given table exists in specified domain
_facUtils.isValueExistsFromGivenTabelle("TARIF_PRE", new Date().toJavaDate(), Bigdecimal.valueOf("14"), "1", null);
- getTabellePrice(String tabelle, Date atDate, BigDecimal rowValue, int entryKey) -
_facUtils.getTabellePrice(String tabelle, Date atDate, BigDecimal rowValue, int entryKey)
- Returns the value from the given tabelle or throws an exception otherwise
_facUtils.getTabellePrice("TARIF_PRE", new Date().toJavaDate(), Bigdecimal.valueOf("14"), 1);
- isPreScolaire(Gtpdep group) -
_facUtils.isPreScolaire(Gtpdep group)
- Based on the given Gtpdep group entity, defines if the group is associated with Prescolaire type of schooling. This is useful to construct Predicate objects to be used in the plan
var myGroup = someGroup;
_global.isPreScolaire = new java.util.function.Predicate(function(group) { return _facUtils.isPreScolaire(group);})
- isPreScolaire(Gtpdep group) -
_facUtils.isPreScolaire(Gtpdep group)
- Based on the given Gtpdep group entity, defines if the group is associated with Parascolaire type of schooling. This is useful to construct Predicate objects to be used in the plan
var myGroup = someGroup;
_global.isParaScolaire = new java.util.function.Predicate(function(group) { return _facUtils.isParaScolaire(group);})
- getCategory() -
_facUtils.getCategory()
- Retrieves based on the current
SECTION
page the associated category.
var articleId = "2000" + getCategory();
- countActiveMonths() -
_facUtils.countActiveMonths()
- Defines the number of months in the period in which the child has some active pages.
//This example computes the number of active months for the child during
the current scholar year
var startYear = _month > 7 ? _year : _year - 1;
var startP = new DateTime(_startYear, 8, 1 ,0, 0,0);
var endYear = _month > 7 ? _year + 1 : _year;
var endP = new DateTime(endYear, 7, 31, 0, 0, 0);
var nbMonthes = _facUtils.countActiveMonths(startP, endP);
- getPeriodDaysSize() -
_facUtils.getPeriodDaysSize()
- Returns as an integer the number of full days during the current period
var periodDays = _facUtils.getPeriodDaysSize();
- getMonthDaysSize() -
_facUtils.getMonthDaysSize()
- Returns as an integer the number of full days during the month of the current period
var periodDays = _facUtils.getMonthDaysSize();
- getSummedResultForSubPeriods(String lineId) -
_facUtils.getSummedResultForSubPeriods(String lineId)
- Get the sum of all the lines of a given type that have been computed so far. This will search in all the previous subperiod and in the current period if the line has been computed and return the sum of all the computation.
_facUtils.getSummedResultForSubPeriods("PF1000003");
//This will return the result of all the lines PF1000003 that have been computed so far.
- getSummedResultForThisArticleAndForSubPeriods(String lineId, String articleId) -
_facUtils.getSummedResultForThisArticleAndForSubPeriods(String lineId, String articleId)
- Get the sum of all the lines of a given type that have been computed so far. This will search in all the previous subperiod and in the current period if the line has been computed for the article and return the sum of all the computation.
_facUtils.getSummedResultForThisArticleAndForSubPeriods("F03", ["NUUV01.00"]);
//This will return the result of all the lines F03 with article NUUV01.00 that have been computed so far.
- computeSubPeriods(DateTime start, DateTime end) -
_facUtils.computeSubPeriods(DateTime start, DateTime end)
- Computes all the sub-periods between the two given boundaries.
_facUtils.computeSubPeriods(startDate, endDate));
- getOverlapDuration(Date start1, Date end1, Date start2, Date end2) -
_facUtils.getOverlapDuration(Date start1, Date end1, Date start2, Date end2)
- Provide the duration in decimal hours of two overlapping periods
var duration = _facUtils.getOverlapDuration(start1, end1, start2, end2);
- hasArticleBeenBilled(String article, DateTime startD, DateTime endD) -
_facUtils.hasArticleBeenBilled(String article, DateTime startD, DateTime endD)
- Returns true if the given article has been during the given period of time. This uses the summed amount of gtpcal.
var alreadyBilledLast12 = _facUtils.hasArticleBeenBilled('MYARTICLE', new DateTime(currentPeriod.getStart()).minusYear(1), new DateTime(currentPeriod.getEnd()).minusYear(1));