Final Project Part 3 - Staff Analysis

Staff Analysis

- Create a new form named frmStaffAnalysis with Text property as “Staff Analysis”. Add a panel object to it and dock it at the top of the form using the Dock property in the Properties window. Adjust the height of the panel so that it does not take too much space on the form. Add two radio buttons on this panel and name them rdoBudgetedCost and rdoIdleCost with the Text properties “Budgeted Cost” and “Idle Cost”, respectively. Add a Chart object to the form below the Panel object and dock it in the parent container. Name the Chart object as chrStaffAnalysis.

- In the code page for frmStaffAnalysis, declare a public property called StaffClassList as a list of string values, a public property called BudgetedCostList as a list of decimal values, and a public property called IdleCostList as a list of decimal values. Refer to the code from the lecture W10B-Charts. Copy the AddSeries sub (from the frmChart class of to the project for W10B lecture) to the frmStaffAnalysis class of your final project. Delete the with structure on the AxisX properties and the line of code on the AxisY properties. Remove the xTitle and yTitle parameters. Set the Area3DStyle.Enable3D property of “ChatArea1” to True.

- In the code page for frmStaffAnalysis, create a private sub called ShowSeries. In this sub, clear the series collection of chrStaffAnalysis. Then add an if-then-else structure, in which you check if the Checked property of rdoBudgetedCost equals True. Under the if condition, call AddSeries with the 6 parameters as chrStaffAnalysis, “Budgeted”, StaffClassList, BudgetedCostList, SeriesChartType.Pie and “Budgeted Cost”. Set chrStaffAnalysis.Titles(0).Text equal to “Budgeted Cost”. Under the else condition, call AddSeries with the 6 parameters as, chrStaffAnalysis, “Idle”, StaffClassList, IdleCostList, SeriesChartType.Pie and “Idle Cost”. Set chrStaffAnalysis.Titles(0).Text equal to “Idle Cost”. In the design view of frmStaffAnalysis, double-click on rdoBudgetedCost to create the CheckedChange event handler. In this event handler, call the sub Show Series. Repeat the same with rdoIdleCost.

- In the code page for frmDashboard, make a copy the sub GetCost and change its name to GetStaffCost. Add a third parameter as Staff. In this sub, replace the outer for-each loop variable with this third parameter, and then remove the outer for-each loop line at the top and the corresponding Next at the bottom.

- In the code page for frmDashboard, create a public sub called StaffAnalysis. In this sub, declare a variable called StaffClassList as a new list of string, a variable called BudgetedCostList as a new list of decimal, and a variable called IdleCost as a new list of decimal. Create a For-loop with loop variable from 1 to 5. In this loop, declare a variable for staff class as a string. Declare a variable for total budgeted cost as decimal and initialize it to 0. Declare a variable for total idle cost as decimal and initialize it to zero.

Declare a variable for staff class id as integer and assign the counter variable to it. Create a LINQ query over the values collection of StaffSList property of the class frmDashboard where the StaffClassID property of the query variable equals the staff class id variable. Create an inner for-each loop over the output of the LINQ query. In this inner for-each loop, declare a variable for budgeted cost as decimal and a variable for idle cost as decimal, and call the sub GetStaffCost with these two variables respectively.

Increment the total budgeted cost variable by the value of the budgeted cost variable; also increment the total idle cost variable by the value of idle cost variable. Assign the StaffClass property of the inner for-each loop variable to the staff class variable. After the inner for-each loop (still within the outer for- loop), add the staff class variable to the StaffClassList, add the total budgeted cost variable to BudgetedCostList and add the total idle cost variable to IdleCostList. After the outer for-each loop,

 

create a variable named staffAnalysisForm as frmStaffAnalysis type form and call GetForm function of the MainForm property of the class frmDashboard with the parameter “StaffAnalysis” to assign to this variable. Assign StaffClassList, BudgetedCostList and IdleCostList to the properties of staffAnalysisForm with the same name. Finally, call the subs Show and BringToFront of staffAnalysisForm, respectively.

- Create a button on frmDashboard called btnStaffAnalysis with the Text property “Staff Analysis”. Double-click on this button to create its Click even handler. In this even handler, call the sub StaffAnalysis. In the code page for frmMain, create a case called “StaffAnalysis” in the select-case structure inside UpdateFormSList, under this case, assign a new instance of frmStaffAnalysis to FormSList(formName). In the sub InitializeFormSList, include a line to add the key “StaffAnalysis” with value Nothing inside the With structure.

- In the design view of frmMain, create a top-level menu item called “Analysis”, under which add the menu item “Staff Analysis”. Double-click on this menu item to create its event handler. In this even handler, add an if-then structure to check if the call to DatabaseLoaded function equals true. Inside the if-then structure, create a variable of type frmDashboard and call GetForm with parameter “Dashboard” to assign to this variable. Call BringToFront sub of this variable followed by the StaffAnalysis sub of this variable.

 

Need a custom answer at your budget?

This assignment has been answered 5 times in private sessions.

Or buy a ready solution below.

Buy ready solution

Solution previews

© 2024 Codify Tutor. All rights reserved