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
| Quintiq file version 2.0
| #parent: #root
| StaticMethod Update (
| output owning StockingPointCosts stockingPointCosts,
| StockingPoint_MPs stockingPoints,
| Account_MP account,
| String costDriver,
| Date start,
| Boolean isEditTimeUnit,
| String timeUnit,
| Boolean isEditLengthOfTime,
| Number lengthOfTime,
| Boolean isEditCost,
| Real cost,
| Boolean isFromDB
| )
| {
| TextBody:
| [*
| // Update single/batch SP costs
| isSingleEdit := stockingPointCosts.Size() = 1;
|
| if( isSingleEdit )
| {// If batch edit different SPs, UI will not be able change SP this safe to check for single SP to change owner
| stockingPointCosts.First().ChangeOwnerStockingPoint( stockingPoints.First() );
| }
| // Update each sp cost
| traverse( stockingPointCosts, Elements, spCost )
| {
|
| spCost.Update( ifexpr( isSingleEdit, account, spCost.Account_MP() ),
| ifexpr( isSingleEdit, costDriver, spCost.CostDriver() ),
| ifexpr( isSingleEdit, start, spCost.Start() ),
| ifexpr( isEditTimeUnit or isSingleEdit, timeUnit, spCost.TimeUnit() ),
| ifexpr( isEditLengthOfTime or isSingleEdit, lengthOfTime, spCost.LengthOfTime() ),
| ifexpr( isEditCost or isSingleEdit, cost, spCost.Cost() ),
| isFromDB );
| }
| *]
| }
|
|