Quintiq file version 2.0
|
#parent: #root
|
Function CalcAge
|
{
|
TextBody:
|
[*
|
value := 0.0;
|
pispip := this.ProductInStockingPointInPeriod();
|
|
/* End age of actual is the duration between manufactured date to period end date
|
rounded up to the multiple of period's duration.
|
e.g. actual in W2, manufactured on 3-Jan, assuming W1: 1 Jan to 8 Jan, W2: 8 Jan to 15 Jan
|
age = 15-3 rounded up to multiple of 7 = 14
|
*/
|
if ( not isnull( pispip ) and this.ProductInStockingPoint_MP().Product_MP().HasShelfLifeOrMaturation() )
|
{
|
manufaturedate := this.ManufacturedDate();
|
date := pispip.End();
|
period := pispip.Period_MP();
|
|
value := ifexpr( manufaturedate.IsFinite() and date.IsFinite(),
|
ShelfLife::GetSupplyAge( manufaturedate, date.Date(), period ), 0.0 );
|
}
|
|
this.Age( value );
|
*]
|
}
|