| 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
 | | Quintiq file version 2.0 |  | #parent: #root |  | FunctionOverride CalcQuantity |  | { |  |   TextBody: |  |   [* |  |     //For hourly buckets, SD will be linked to the last hourly bucket of the day |  |     value := 0.0 |  |     if( not isnull( this.AsSalesDemandInPeriodBase() ) ) |  |     { |  |       qtyToPlan := ifexpr( this.IsPostponed(), |  |                            this.QuantityToPlan(), |  |                            // if not postponed the quantity is derived from the Sales Demand |  |                            this.GetUnPostponedQuantity() ); // Convert to stocking point uom, same as dependent demand. |  |        |  |       postponedqty := sum( this, |  |                            PostponedSalesDemand, |  |                            sd, |  |                            sd.QuantityToPlan() ); |  |        |  |       // We need to have this piece of code here specifically because real value |  |       // after arithmetic operation is inaccurate, and even when they are equal |  |       // subtraction can result in values which are inaccurate, so we need to force it |  |       // to be zero if they are equal. E.g., create two values, value1 := 0.12345 * 2,  |  |       // value2 := 0.2469, subtraction should net to zero, but you will get decimals |  |       value := ifexpr( qtyToPlan = postponedqty, 0.0, qtyToPlan - postponedqty ); |  |     } |  |     this.Quantity( value ); |  |   *] |  | } | 
 |