1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| Quintiq file version 2.0
| #parent: #root
| Method SetIsActiveStatusCombis (
| Date earlieststart,
| Date lateststart
| ) as Number
| {
| TextBody:
| [*
| nractive := 0;
| if ( counter( this, Unit.OptCampaignElementType.astype( OptCampaignCampaignType ), occt, true, occt.IsActive() ) > 0 )
| {
| traverse( this, OptCampaignUnitSubPeriod, ocusp )
| {
| nractive := nractive + ocusp.SetIsActiveStatusCombis( earlieststart, lateststart );
| }
| }
| else
| {
| // special case no active campaigns
| traverse( this, OptCampaignUnitSubPeriod.OptCampaignCombiSelected, combi )
| {
| combi.IsActive( true );
| nractive++;
| }
| }
|
| // throw in combis that can solve sequence problems
| traverse( this, OptCampaignUnitSubPeriod.OptCampaignCombiSelected, combi, combi.HasSequenceProblem() )
| {
| nextperiod := combi.LastCombiElement().OptCampaignUnitSubPeriod().NextSubPeriod();
| lastelttype := combi.LastCombiElement().OptCampaignElementType();
| traverse( nextperiod, OptCampaignCombi, combimatch, combimatch.FirstCombiElement().OptCampaignElementType() = lastelttype )
| {
| combimatch.IsActive( true );
| }
| }
|
| return nractive;
| *]
| }
|
|