Quintiq file version 2.0
|
#parent: #root
|
StaticMethod GetRequiredQuantityByDurations (
|
output Real remainingdays_o,
|
Real durationindays,
|
Real demandquantity,
|
Boolean hasnonextperiod
|
) const declarative remote as Real
|
{
|
Description:
|
[*
|
Given a number of days, period duration and a quantity. Return the quantity for the particular period by repect to the number of day and duration.
|
E.g Period 1 2 3 in days, remainding day = 2, this will return the quantity * 1.
|
*]
|
TextBody:
|
[*
|
// desmondt Nov-13-2015 (created)
|
value := demandquantity;
|
|
numberofdaysused := minvalue( remainingdays_o, durationindays ) // If period is day, we only use 1 day
|
|
// If there is no next period and the duration of the current period is shorter than the remaining days
|
// Then the numberofdaysused for the ratio should be equal to the remaining days
|
// (which means we keep repeating the last period for the purposes of the target calculation)
|
if( hasnonextperiod
|
and ( durationindays < remainingdays_o ) )
|
{
|
numberofdaysused := remainingdays_o;
|
}
|
|
ratioinday := numberofdaysused / durationindays; // The ratio of the remaining day in the period
|
value := demandquantity * ratioinday;
|
|
remainingdays_o := maxvalue( ( remainingdays_o - numberofdaysused ), 0 );
|
|
return value;
|
*]
|
}
|