백분율 완전한 계산
Contents
[
Hide
Show
]Microsoft Project는 완료된 작업의 백분율을 보여줍니다. 백분율은 프로젝트 관리자가 수동으로 추가하거나 응용 프로그램에서 자동으로 계산할 수 있습니다. ASPOSE.TASK의 C ++는 작업과 관련된 몇 퍼센트 계산을 지원합니다.
백분율
TSK 클래스는 백분율을 계산하는 데 사용되는 여러 속성을 노출시킵니다.
- PercentComplete는 작업 기간 (정수)의 완료된 비율을 나타냅니다.
- 퍼센트 WorksComplete는 작업 작업의 완료된 비율 (정수)을 나타냅니다.
- PhyshicperCentComplete는 프로젝트 관리자 (정수)가 입력 한 완료된 비율을 나타냅니다.
Microsoft Project에서 완료된 물리적 백분율을 보려면 :
- 작업 입력 양식에서 삽입 메뉴에서 열을 선택하십시오.
- 열을 추가하십시오.
Microsoft Project에서 완료된 비율을 보려면 :
- 작업 입력 양식에서 원하는 열을 두 번 클릭하십시오.
백분율 얻기
다음 코드 예제는 작업과 관련된 작업 비율을 얻는 방법을 보여줍니다.
1// Create project instance
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"TaskPercentageCompletion.mpp");
4
5// Access tasks and display percentage completion
6auto tasks = project1->get_RootTask()->get_Children();
7
8{
9 auto tsk1_enumerator = (tasks)->GetEnumerator();
10 decltype(tsk1_enumerator->get_Current()) tsk1;
11 while (tsk1_enumerator->MoveNext() && (tsk1 = tsk1_enumerator->get_Current(), true))
12 {
13 System::Console::WriteLine(tsk1->Get<int32_t>(Tsk::PercentComplete()));
14 System::Console::WriteLine(System::Convert::ToString(tsk1->Get<int32_t>(Tsk::PercentWorkComplete())));
15 System::Console::WriteLine(System::Convert::ToString(tsk1->Get<int32_t>(Tsk::PhysicalPercentComplete())));
16 }
17}
Changing Task Progress
Aspose.Tasks for C++ API supports changing a task’s progress in terms of its percentage completion through the Task class’ SetPercentComplete() method. This method takes an integer argument as input for the percentage work completed.
The following piece of code shows how to change the progress of a task.
1System::SharedPtr<Project> project = System::MakeObject<Project>();
2System::Console::WriteLine(u"Project Calculation mode is Automatic: {0}", System::ObjectExt::Box<bool>(System::ObjectExt::Equals(project->get_CalculationMode(), Aspose::Tasks::CalculationMode::Automatic)));
3
4System::SharedPtr<Task> task = project->get_RootTask()->get_Children()->Add(u"Task");
5task->Set<Duration>(Tsk::Duration(), project->GetDuration(2));
6task->Set<int32_t>(Tsk::PercentComplete(), 50);