We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Changing Duration value on a FixedDuration type task is resulting in an incorrect Task cost value when WorkContour is anything other than Flat

It appears that the cost calculation for FixedDuration type tasks when a WorkContour is set is not calculating correctly.

I have an example Microsoft project with only a small number of tasks. Each task is assigned WorkContour of Back Loaded. If I read the project and adjust each task’s duration via code by 10 days, the Fixed Work and Fixed Units calculated Cost match that of those provided by Microsoft Project, if the same changes are made directly.

            Project m_CalcProject_Original = new Project(@"C:\Examples_FixedDurationIssue.mpp");

            ChildTasksCollector m_coll = new ChildTasksCollector();
            TaskUtils.Apply(m_CalcProject_Original.RootTask, m_coll, 0);
            List<Aspose.Tasks.Task> m_Tasks = m_coll.Tasks;

            Console.WriteLine("BEFORE");

            foreach (Aspose.Tasks.Task x in m_Tasks)
            {
                Console.WriteLine("Name: {0}  Duration: {1}  Type: {2} Work: {3} Cost: {4}", x.Get(Tsk.Name), x.Get(Tsk.Duration), x.Get(Tsk.Type), x.Get(Tsk.Work), x.Get(Tsk.Cost));

                x.Set(Tsk.Duration, m_CalcProject_Original.GetDuration(x.Get(Tsk.Duration).ToDouble() + 10));
            }

            m_CalcProject_Original.Recalculate();

            Console.WriteLine("");
            Console.WriteLine("AFTER");

            foreach (Aspose.Tasks.Task x in m_Tasks)
            {
                Console.WriteLine("Name: {0}  Duration: {1}  Type: {2} Work: {3} Cost: {4}", x.Get(Tsk.Name), x.Get(Tsk.Duration), x.Get(Tsk.Type), x.Get(Tsk.Work), x.Get(Tsk.Cost));
            }

I’m also including a sample Microsoft project file that has the complete set of types and work contours. It appears that only the Fixed Duration types are calculating incorrectly.

MSProject_GanttView.jpg (162.9 KB)
MSProject_TaskUsage.jpg (171.9 KB)
SampleProgram.jpg (156.1 KB)
Examples_FixedDurationIssue.zip (140.9 KB)
Examples.zip (41.5 KB)

@leglandpalisade,
we need to investigate the issue further on our end and a ticket with ID TASKSNET-10505 has been created to further investigate the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed

The issues you have found earlier (filed as TASKSNET-10505) have been fixed in this update.