update,
This commit is contained in:
12
quote1/workspace/.editorconfig
Normal file
12
quote1/workspace/.editorconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
BIN
quote1/workspace/_docs/Proposal.docx
Normal file
BIN
quote1/workspace/_docs/Proposal.docx
Normal file
Binary file not shown.
BIN
quote1/workspace/_docs/Proposal.pdf
Normal file
BIN
quote1/workspace/_docs/Proposal.pdf
Normal file
Binary file not shown.
BIN
quote1/workspace/_docs/Report1.xlsm
Normal file
BIN
quote1/workspace/_docs/Report1.xlsm
Normal file
Binary file not shown.
70
quote1/workspace/_docs/sortDictionary.md
Normal file
70
quote1/workspace/_docs/sortDictionary.md
Normal file
@@ -0,0 +1,70 @@
|
||||
'Force the explicit declaration of variables
|
||||
Option Explicit
|
||||
|
||||
Sub SortDictionaryByItem()
|
||||
|
||||
'Set a reference to Microsoft Scripting Runtime by using
|
||||
'Tools > References in the Visual Basic Editor (Alt+F11)
|
||||
|
||||
'Declare the variables
|
||||
Dim Dict As Scripting.Dictionary
|
||||
Dim Arr() As Variant
|
||||
Dim Temp1 As Variant
|
||||
Dim Temp2 As Variant
|
||||
Dim Txt As String
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
|
||||
'Create an instance of the Dictionary
|
||||
Set Dict = New Dictionary
|
||||
|
||||
'Set the comparison mode to perform a textual comparison
|
||||
Dict.CompareMode = TextCompare
|
||||
|
||||
'Add keys and items to the Dictionary
|
||||
Dict.Add "Mango", "M250"
|
||||
Dict.Add "Kiwi", "K150"
|
||||
Dict.Add "Apple", "A325"
|
||||
Dict.Add "Peach", "P350"
|
||||
Dict.Add "Lime", "L275"
|
||||
|
||||
'Allocate storage space for the dynamic array
|
||||
ReDim Arr(0 To Dict.Count - 1, 0 To 1)
|
||||
|
||||
'Fill the array with the keys and items from the Dictionary
|
||||
For i = 0 To Dict.Count - 1
|
||||
Arr(i, 0) = Dict.Keys(i)
|
||||
Arr(i, 1) = Dict.Items(i)
|
||||
Next i
|
||||
|
||||
'Sort the array using the bubble sort method
|
||||
For i = LBound(Arr, 1) To UBound(Arr, 1) - 1
|
||||
For j = i + 1 To UBound(Arr, 1)
|
||||
If Arr(i, 1) > Arr(j, 1) Then
|
||||
Temp1 = Arr(j, 0)
|
||||
Temp2 = Arr(j, 1)
|
||||
Arr(j, 0) = Arr(i, 0)
|
||||
Arr(j, 1) = Arr(i, 1)
|
||||
Arr(i, 0) = Temp1
|
||||
Arr(i, 1) = Temp2
|
||||
End If
|
||||
Next j
|
||||
Next i
|
||||
|
||||
'Clear the Dictionary
|
||||
Dict.RemoveAll
|
||||
|
||||
'Add the sorted keys and items from the array back to the Dictionary
|
||||
For i = LBound(Arr, 1) To UBound(Arr, 1)
|
||||
Dict.Add Key:=Arr(i, 0), Item:=Arr(i, 1)
|
||||
Next i
|
||||
|
||||
'Build a list of keys and items from the Dictionary
|
||||
For i = 0 To Dict.Count - 1
|
||||
Txt = Txt & Dict.Keys(i) & vbTab & Dict.Items(i) & vbCrLf
|
||||
Next i
|
||||
|
||||
'Display the list in a message box
|
||||
MsgBox Txt, vbInformation
|
||||
|
||||
End Sub
|
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,57 @@
|
||||
# source dataset
|
||||
|
||||
which they have the common column `Member ID`.
|
||||
|
||||
- `workbook_salesrecord.xlsm`
|
||||
- the spending of members
|
||||
- `workbook_memberInformation.xlsm`
|
||||
- salaries
|
||||
- marital status
|
||||
- birthdays in the month
|
||||
|
||||
# generated
|
||||
|
||||
- `workbook_sales_report.xlsm` sales report workbook
|
||||
- i `weekly_sales_report.xlsm`
|
||||
- from the `workbook_salesrecord`
|
||||
- reporting the __weekly unit sales__ of different region.
|
||||
- It show the number of products sold by different regions. (Pic.3)
|
||||
- It also generate the `pie chart` to visible the data. (Pic.4)
|
||||
- __weekly profit report__ for different product.
|
||||
- It shows the total number of products sold at that week. (Pic.5)
|
||||
- Also, the __frequency table__ of type of product will be calculated and shown. (Pic. 6)
|
||||
- unit sales of product chart
|
||||
- unit sales chart
|
||||
- profit of product type chart (Pic.7)
|
||||
|
||||
- ii `monthly_sales_report.xlsm`
|
||||
- from the `workbook_salesrecord`
|
||||
- `first report`
|
||||
- fields
|
||||
- product
|
||||
- quantity sales
|
||||
- Revenue
|
||||
- Cost
|
||||
- profit margin for different region
|
||||
- the total profit
|
||||
- the summary statistic of the profit
|
||||
- product analysis
|
||||
- calculating and profit margin of each product
|
||||
- `Margin` is calculated by `( Profit / Revenue )`
|
||||
|
||||
- `workbook_membership_and_discount.xlsm`
|
||||
- Membership and Discount workbook
|
||||
- fields:
|
||||
- Member ID
|
||||
- total amount spending
|
||||
- birthday discount received
|
||||
- valentine's day discount received
|
||||
- membership elvel
|
||||
- amount spended
|
||||
- discount received
|
||||
|
||||
> For example, the `NT002` is having total spending of `240` which is extract for
|
||||
`workbook_salesrecord` in February.
|
||||
He had birthday in February and married. The valentine’s Day discount is depended on Marital status.
|
||||
He spent $20 at the 13-Feb.
|
||||
He can received discount of ( 20 - 20 * 0.92 * 0.88 * 0.95 )= 4.6176 in March.
|
@@ -0,0 +1,61 @@
|
||||
Objects manipulation and utilisation (46 marks)
|
||||
|
||||
• Sufficient workbook manipulation:
|
||||
At least
|
||||
two workbooks for the source data sets,
|
||||
- workbook_salesrecord
|
||||
- workbook_memberInformation
|
||||
|
||||
at least one workbook for the derived data sets,
|
||||
at least one workbook for the report,
|
||||
|
||||
and one workbook for the programme code and Userform.
|
||||
Sufficiently utilized object variables, references, properties, and methods. (0-5)
|
||||
|
||||
• Sufficient worksheet manipulation:
|
||||
Sufficiently utilized object variables, references, properties, and methods. (0-4)
|
||||
|
||||
• Sufficient data manipulation:
|
||||
Generate at least one new data set in a new workbook by applying non-trivial manipulation on the source data sets. (0-8)
|
||||
|
||||
• Create at least
|
||||
two non-Pivot tables for character variables in the report workbook.
|
||||
At least one table includes
|
||||
summary statistics of a numeric variable for each level of the character variable. All elements of the tables, such as
|
||||
data range,
|
||||
variables,
|
||||
statistics, etc.,
|
||||
must be appropriately coded in the application. (0-4)
|
||||
|
||||
• Create at least
|
||||
one non-Pivot frequency table for a numeric variable in the report workbook.
|
||||
All elements of the tables, such as
|
||||
data range,
|
||||
variables,
|
||||
statistics, etc.,
|
||||
must be appropriately coded in the application. (0-3)
|
||||
|
||||
• Create at least two types of non-Pivot charts in the report workbook.
|
||||
All features of the charts, such as
|
||||
data range,
|
||||
type of chart,
|
||||
labels, etc.
|
||||
of the charts must be appropriately coded in the application. (0-4)
|
||||
|
||||
|
||||
- [ ] Utilise OptionButton control. (0-2)
|
||||
|
||||
- [ ] Utilise CheckBox control. (0-2)
|
||||
|
||||
- [ ] Utilise RefEdit control. (0-1)
|
||||
|
||||
- [ ] Utilise ScrollBar or SpinButton controls. (0-2)
|
||||
|
||||
- [ ] Utilise ComboBox control. (0-3)
|
||||
|
||||
- [ ] Utilise Frame control. (0-2)
|
||||
|
||||
- [ ] Utilise ListBox control. (0-4)
|
||||
|
||||
- [ ] Utilise MultiPage control. (0-2)
|
||||
|
Binary file not shown.
@@ -0,0 +1,194 @@
|
||||
CWC drinking shop is a shop is a shop selling drink like
|
||||
|
||||
- tea, coffee.
|
||||
- It also sells ice cream.
|
||||
- It has three branches in
|
||||
- Hong Kong Island,
|
||||
- Kowloon and New Territories
|
||||
|
||||
respectively.
|
||||
|
||||
## Member discount:
|
||||
|
||||
Provide discounts to members based on their spending and the holiday.
|
||||
|
||||
The source dataset includes two workbooks:
|
||||
|
||||
- `workbook_salesrecord` and
|
||||
- `workbook_memberInformation`,
|
||||
- which have the common column `Member ID`.
|
||||
|
||||
### The `sales record` gives
|
||||
|
||||
- the spending of members,
|
||||
|
||||
### The `member information` gives information such as
|
||||
|
||||
- salaries,
|
||||
- marital status,
|
||||
- and birthdays in the month.
|
||||
|
||||
### Rule set
|
||||
|
||||
- Customers who accumulate spending above a certain amount can receive a percentage discount.
|
||||
- Customers can also receive a 10% discount if they purchase items during their own birthday month. Additionally,
|
||||
- customers who are married can receive a 10% discount if they buy drinks between February 10 and February 14 to celebrate
|
||||
Valentine's Day.
|
||||
- Discounts can be used together by multiplying them.
|
||||
- Memberships are usually upgraded at the end of the month,
|
||||
|
||||
### sales reports for members are generated monthly.
|
||||
|
||||
- To achieve this objective, two workbooks need to be generated:
|
||||
- `Workbook_salesreport` and
|
||||
- `Workbook_Membership&discount`.
|
||||
- summarize the number of members in each tier and the discount given.
|
||||
|
||||
| | Accumulated Spending | Discount |
|
||||
| ---------------------------------- | -------------------- | -------- |
|
||||
| Basic | $100 | 1% |
|
||||
| Advanced | $250 | 5% |
|
||||
| Platinum | $400 | 10% |
|
||||
| Birthday | N/A | 8% |
|
||||
| Valentine's day (10/Feb to 14/Feb) | N/A | 12% |
|
||||
|
||||
## Weekly sales report:
|
||||
|
||||
- Generate a sales report as a new workbook by extracting data from the `workbook_salesrecord`.
|
||||
- This report will be generated at the end of each week
|
||||
- to help the marketing department identify which products have the potential to generate more profit for the company.
|
||||
|
||||
## Monthly sales report:
|
||||
|
||||
- Generate a sales report as a new workbook by extracting data from the `workbook_salesrecord`.
|
||||
- This report will be generated at the end of each month and will include the weekly sales report.
|
||||
- The purpose of this report is to provide a comprehensive overview of sales trends over time.
|
||||
|
||||
## Type of Product
|
||||
|
||||
| Espresso | Price | Cost |
|
||||
| ---------------- | ------ | ------ |
|
||||
| Decaf Espresso | $32.50 | $15.20 |
|
||||
| Caffe Latte | $25.00 | $12.20 |
|
||||
| Caffe Mocha | $30.30 | $13.00 |
|
||||
| Regular Espresso | $22.00 | $14.20 |
|
||||
|
||||
| Coffee | Price | Cost |
|
||||
| --------- | ------ | ------ | ------ | ------ |
|
||||
| Amaretto | $15.20 | $8.50 |
|
||||
| Decaf | Irish | Cream | $35.30 | $28.00 |
|
||||
| Columbian | $20.00 | $15.00 |
|
||||
|
||||
| Herbal Tea | Price | Cost |
|
||||
| ---------- | ------ | ------ | ------ | ------ |
|
||||
| Amaretto | $15.20 | $8.50 |
|
||||
| Decaf | Irish | Cream | $35.30 | $28.00 |
|
||||
| Columbian | $20.00 | $15.00 |
|
||||
|
||||
| Herbal Tea | Price | Cost |
|
||||
| ---------- | ------ | ------ |
|
||||
| Lemon | $18.50 | $5.50 |
|
||||
| Chamomile | $21.00 | $14.00 |
|
||||
| Mint | $18.32 | $8.90 |
|
||||
|
||||
| Tea | Price | Cost |
|
||||
| ---------- | ----- | ----- | ----- |
|
||||
| Green Tea | 17.50 | 7.00 |
|
||||
| Earl | Grey | 22.00 | 14.00 |
|
||||
| Darjeeling | 25.00 | 15.00 |
|
||||
|
||||
## Data source description
|
||||
|
||||
### The `workbook_MemberInformation` (`MemberInformation.xlsm`) have following column.
|
||||
|
||||
- Member ID,
|
||||
- Gender,
|
||||
- Age,
|
||||
- Salary,
|
||||
- Martial Status,
|
||||
- Living District and
|
||||
- Birthday in Month
|
||||
|
||||
### The Workbook_salesrecord (`SalesData.xlsm`) have following columns.
|
||||
|
||||
- Member ID,
|
||||
- Order Date,
|
||||
- Product Name,
|
||||
- Product Category,
|
||||
- Quantity,
|
||||
- Price Per Unit,
|
||||
- Total sales,
|
||||
- Total revenue by member ID
|
||||
|
||||
### Pic 2 shows the sales record in Hong Kong Island.
|
||||
|
||||
There are three worksheets which represent different region in this workbook.
|
||||
|
||||
The member ID will be - NTXXX (New Territories), - HKXXX(Hong Kong Island) and - KLXXX(Kowloon).(Add case to other region)
|
||||
|
||||
## Report generated
|
||||
|
||||
1. Membership and Discount workbook (Workbook_Membership & discount)
|
||||
|
||||
The officer needs to update the `membership` and `discount` workbook monthly to ensure giving correct discount to the customers.
|
||||
|
||||
In this workbook, Officer needs to enter the column of
|
||||
|
||||
- Member ID,
|
||||
- total amount
|
||||
- spending,
|
||||
- Birthday discount received,
|
||||
- Valentine’s Day discount received,
|
||||
- Membership level,
|
||||
- Amount spent,
|
||||
- Amount of discount received.
|
||||
|
||||
For example, the `NT002` is having total spending of `240` which is extract for
|
||||
`workbook_salesrecord` in February.
|
||||
He had birthday in February and married. The valentine’s Day discount is depended on Marital status.
|
||||
He spent $20 at the 13-Feb.
|
||||
He can received discount of ( 20 - 20 _ 0.92 _ 0.88 \* 0.95 )= 4.6176 in March.
|
||||
|
||||
In this workbook report,
|
||||
|
||||
1. total amount spending need to be extract from the `workbook_salesrecord` first.
|
||||
1. Then birthday discount and Valentine’s Day discount need to be extracted from the `workbook_MemberInformation` because the birthday month and Marital status is the key of determining the discount is `true` or `false`.
|
||||
|
||||
## Sales report workbook (Workbook_salesreport)
|
||||
|
||||
The first need to be done is weekly report worksheets,
|
||||
the weekly sales report have two parts,
|
||||
|
||||
- the first part is reporting the weekly unit sales of different region.
|
||||
|
||||
- It show the number of products sold by different regions.
|
||||
- It also generate the `pie chart` to visible the data.
|
||||
|
||||
- The second thing need to be done for weekly report is generate weekly profit report for different product.
|
||||
- It shows the total number of products sold at that week.
|
||||
- Also, the frequency table of type of product will be calculated and shown.
|
||||
|
||||
The data of weekly sales will be shown as chart in product type, unit sales and profit.
|
||||
The unit sales of product type can help company to know what customers would like to buy.
|
||||
The Unit sales in product can point out more specifically of what product the
|
||||
customer would like to buy.
|
||||
The profit chart shows the profit generated by that week.
|
||||
It may help company to adjust the inventory in next week.
|
||||
|
||||
Another report would be generated is `Monthly sales and profit report`.
|
||||
|
||||
The report will generate the
|
||||
|
||||
- quantity sales,
|
||||
- Revenue and Cost, and
|
||||
- profit margin for different region respectively.
|
||||
- It will also calculate the total profit and he summary statistic of the profit.
|
||||
|
||||
The data is extracted the source data `Workbook_salesrecord`.
|
||||
With analyzing the data, marketing strategies for different region can be suggested.
|
||||
|
||||
The second of Monthly report is Product analysis, by calculating and profit margin of each product. Company can know which product having a higher margin can generate higher profit in future. New variable `Margin` is calculated by `( Profit / Revenue )`.
|
||||
|
||||
It shows only few products have a relatively high margin for selling.
|
||||
|
||||
With acknowledging the Frequency of customers spending, company can know who is target customers, and adjust price in the future.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
quote1/workspace/_test/Book4.xlsx
Normal file
BIN
quote1/workspace/_test/Book4.xlsx
Normal file
Binary file not shown.
BIN
quote1/workspace/_test/test_open_excel.xlsm
Normal file
BIN
quote1/workspace/_test/test_open_excel.xlsm
Normal file
Binary file not shown.
BIN
quote1/workspace/cost.xlsx
Normal file
BIN
quote1/workspace/cost.xlsx
Normal file
Binary file not shown.
BIN
quote1/workspace/input/workbook_memberInformation.xlsm
Normal file
BIN
quote1/workspace/input/workbook_memberInformation.xlsm
Normal file
Binary file not shown.
BIN
quote1/workspace/input/workbook_salesrecord.xlsm
Normal file
BIN
quote1/workspace/input/workbook_salesrecord.xlsm
Normal file
Binary file not shown.
12
quote1/workspace/package.json
Normal file
12
quote1/workspace/package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "xlwings-tryout",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
BIN
quote1/workspace/report-delivery.xlsm
Normal file
BIN
quote1/workspace/report-delivery.xlsm
Normal file
Binary file not shown.
BIN
quote1/workspace/report.xlsm
Normal file
BIN
quote1/workspace/report.xlsm
Normal file
Binary file not shown.
5
quote1/workspace/scripts/up.bat
Normal file
5
quote1/workspace/scripts/up.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
@REM xlwings addin install
|
||||
|
||||
xlwings vba edit --file .\report.xlsm
|
||||
|
||||
@REM xlwings quickstart -s hello_quickstart
|
BIN
quote1/workspace/workbook_membership_and_discount.xlsx
Normal file
BIN
quote1/workspace/workbook_membership_and_discount.xlsx
Normal file
Binary file not shown.
BIN
quote1/workspace/workbook_monthly_report-February-2023.xlsx
Normal file
BIN
quote1/workspace/workbook_monthly_report-February-2023.xlsx
Normal file
Binary file not shown.
BIN
quote1/workspace/workbook_weekly_report-week-2.xlsx
Normal file
BIN
quote1/workspace/workbook_weekly_report-week-2.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user