update,
This commit is contained in:
132
jimmycheung93/task4/1/Var.bas
Normal file
132
jimmycheung93/task4/1/Var.bas
Normal file
@@ -0,0 +1,132 @@
|
||||
Attribute VB_Name = "Var"
|
||||
|
||||
Option Explicit
|
||||
|
||||
' Set the maximum number of sales to 100
|
||||
Global Const MAX_NUM_OF_SALES = 100
|
||||
|
||||
|
||||
' Arrays to store user details (usernames, passwords, teams, ages)
|
||||
' Each user's details are stored in a corresponding index of the arrays
|
||||
Global usernames(100) As String ' Array to store usernames of users
|
||||
Global passwords(100) As String ' Array to store passwords of users
|
||||
Global teams(100) As String ' Array to store teams of users
|
||||
Global ages(100) As String ' Array to store ages of users
|
||||
|
||||
' for calculation
|
||||
' Global arrays to store sales data for each agent for each month
|
||||
' monthly_sales(agent_index, month_index) stores the sales data for a particular agent in a particular month
|
||||
' MAX_NUM_OF_SALES is the maximum number of agents, 12 is the maximum number of months
|
||||
Global monthly_sales(MAX_NUM_OF_SALES, 12) As Double ' Array to store sales data for each agent for each month
|
||||
|
||||
|
||||
' Global variables to store file path and workbook objects for each workbook
|
||||
' agentSalesFilePath stores the path of the Agent Sales workbook
|
||||
' agentSalesFileOK stores whether the Agent Sales workbook was successfully opened or not
|
||||
' agent_sales_workbook and agent_sales_worksheet store the workbook and worksheet objects of the Agent Sales workbook
|
||||
Global agentSalesFilePath As String ' String to store the path of the Agent Sales workbook
|
||||
Global agent_sales_workbook As Workbook ' Workbook object for the Agent Sales workbook
|
||||
Global agent_sales_worksheet As Worksheet ' Worksheet object for the Agent Sales workbook
|
||||
Global agent_sales_file_OK As Boolean ' Boolean to store whether the Agent Sales workbook was successfully opened or not
|
||||
|
||||
' Similar comments apply to agent_working_performance_workbook, agent_working_performance_worksheet, agent_working_performance_OK, agentWorkingPerformancePath, product_sales_workbook, product_sales_worksheet, product_sales_OK, and productSalesPath
|
||||
Global agent_working_performance_workbook As Workbook ' Workbook object for the Agent Working Performance workbook
|
||||
Global agent_working_performance_worksheet As Worksheet ' Worksheet object for the Agent Working Performance workbook
|
||||
Global agent_working_performance_OK As Boolean ' Boolean to store whether the Agent Working Performance workbook was successfully opened or not
|
||||
Global agentWorkingPerformancePath As String ' String to store the path of the Agent Working Performance workbook
|
||||
Global product_sales_workbook As Workbook ' Workbook object for the Product Sales workbook
|
||||
Global product_sales_worksheet As Worksheet ' Worksheet object for the Product Sales workbook
|
||||
Global product_sales_OK As Boolean ' Boolean to store whether the Product Sales workbook was successfully opened or not
|
||||
Global productSalesPath As String ' String to store the path of the Product Sales workbook
|
||||
|
||||
' Arrays to store data for each agent and month for agent performance analysis
|
||||
Global AgentPerformanceAnalysisHelloworld As String ' String to store an item of analysis for agent performance
|
||||
Global AgentPerformanceAnalysisRankOfEachMonth(12, 5) As String ' Array to store the rank of each month for agent performance
|
||||
Global TempMonthlyComission(12) As String ' Array to store temporary monthly commission
|
||||
Global SortedMonthlyComission(12) As Double ' Array to store sorted monthly commission
|
||||
|
||||
' Array to store sorted array and sort result
|
||||
Global sortedArray As Variant ' Array to store sorted array
|
||||
Global sort_result As Variant ' Variant to store sort result
|
||||
|
||||
|
||||
' config
|
||||
|
||||
' Global variables to store the column numbers for each field in the sales analysis sheet
|
||||
' These constants are used to easily reference each column's number in the sales analysis sheet
|
||||
Global NumOfSales As Integer ' Variable to store the number of sales
|
||||
|
||||
Global SALES_ANALYSIS_COL_MONTH As String ' Column number for Month in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_QUARTER As String ' Column number for Quarter in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_PRODUCT_CATEGORY As String ' Column number for Product Category in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_SELLING_UNIT As String ' Column number for Selling Unit in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_MONTHLY_SALES As String ' Column number for Monthly Sales in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_QUARTELY_SALES As String ' Column number for Quarterly Sales in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_COMMISSION As String ' Column number for Commission in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_MONTHLY_MARGIN As String ' Column number for Monthly Margin in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_QUATERLY_MARGIN As String ' Column number for Quarterly Margin in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_COL_QUATERLY_COMMISSION_ As String ' Column number for Quarterly Commission in the sales analysis sheet
|
||||
|
||||
'row
|
||||
' Global constants to store the row numbers for each month in the sales analysis sheet
|
||||
' These constants are used to easily reference each month's row in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_JANUARY As String ' Row number for January in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_FEBURARY As String ' Row number for February in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_MARCH As String ' Row number for March in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_APRIL As String ' Row number for April in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_MAY As String ' Row number for May in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_JUNE As String ' Row number for June in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_JULY As String ' Row number for July in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_AUGEST As String ' Row number for August in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_SEPTEMBER As String ' Row number for September in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_OCTOBER As String ' Row number for October in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_NOVEMBER As String ' Row number for November in the sales analysis sheet
|
||||
Global SALES_ANALYSIS_ROW_DECEMBER As String ' Row number for December in the sales analysis sheet
|
||||
|
||||
' Global variables to store meta data for each month of sales per agent
|
||||
' Array to store sales data per agent for each month
|
||||
Global SALES_ARRAY As Variant
|
||||
|
||||
' Objects to store sales data per agent for each month
|
||||
Global monthly_commission_per_agent As Object ' Object to store monthly commission per agent
|
||||
Global monthly_product_sales_selling_unit_per_agent As Object ' Object to store monthly product sales selling unit per agent
|
||||
Global monthly_product_sales_selling_price_per_agent As Object ' Object to store monthly product sales selling price per agent
|
||||
Global monthly_product_sales_per_agent As Object ' Object to store monthly product sales per agent
|
||||
|
||||
' Global constant to store the string separator for concatenation
|
||||
Global STRING_SEPERATOR As String ' String separator for concatenation
|
||||
|
||||
' Global constant to store the array of month names
|
||||
Global MONTH_NAMES As Variant ' Array to store month names
|
||||
|
||||
|
||||
' NoOfCasesTable
|
||||
|
||||
' Objects to store data about new and collapsed cases per agent
|
||||
Global new_case_per_agent As Object ' Object to store data about new cases per agent
|
||||
Global collapsed_case_per_agent As Object ' Object to store data about collapsed cases per agent
|
||||
|
||||
' Variables to store data about new and collapsed cases per team
|
||||
Global new_case_team_a As Double ' Variable to store data about new cases for team A
|
||||
Global collapsed_case_team_a As Double ' Variable to store data about collapsed cases for team A
|
||||
|
||||
Global new_case_team_b As Double ' Variable to store data about new cases for team B
|
||||
Global collapsed_case_team_b As Double ' Variable to store data about collapsed cases for team B
|
||||
|
||||
' Object to store data about case persistency per agent
|
||||
Global case_persistency_by_agent As Object ' Object to store data about case persistency per agent
|
||||
|
||||
Global output_report_directory As String
|
||||
|
||||
' calculation
|
||||
|
||||
' Arrays to store meta data of each workbook
|
||||
Global AgentSalesMeta As Variant ' Meta data of Agent Sales workbook
|
||||
Global ProductSalesMeta As Variant ' Meta data of Product Sales workbook
|
||||
Global AgentWorkingPerformanceMeta As Variant ' Meta data of Agent Working Performance workbook
|
||||
Global CombinedSalesMeta As Variant ' Meta data of Combined Sales workbook
|
||||
|
||||
' Global constants to store color codes for status
|
||||
Global STATUS_COLOR_GREEN As String ' Color code for green status
|
||||
Global STATUS_COLOR_YELLOW As String ' Color code for yellow status
|
||||
Global STATUS_COLOR_RED As String ' Color code for red status
|
Reference in New Issue
Block a user