Skip to content

Commit

Permalink
mittagstisch export: Add Commission LoLa and Net Income LoLa
Browse files Browse the repository at this point in the history
  • Loading branch information
ursjoss committed Jun 3, 2023
1 parent 541e0e4 commit 1b425db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*.csv
*.xlsx
.~lock.*
workdir/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ The columns of the resulting file are defined as follows:
- Income by ownership (MiTi or LoLa):
- `Gross Income MiTi`: Gross income from menus [`Gross MiTi (MiTi)`]
- `Gross Income LoLa`: Gross income from LoLa items [`Gross MiTi (LoLa)`]
- `Commission LoLa`: Commission for LoLa payments [`LoLa_Commission_MiTi`]
- `Net Income LoLa`: Net Income for selling LoLa items [`Gross Income LoLa` - `Commission LoLa`]
- Card related income, gross, commission and net, income from selling LoLa and total credit:
- `Gross Card MiTi`: Gross income from menus payed by card [`Gross MiTi (MiTi) Card`]
- `Commission MiTi`: Commission on `Gross Card MiTi` [`MiTi_Commission`]
- `Net Card MiTi`: Net income from menus payed by card [`Net MiTi (MiTi) Card`]
- `Contribution LoLa`: 20% share on net income from selling lola items
- `Contribution LoLa`: 20% share on net income from selling lola items [0.2 * `Net Income LoLa`]
- `Credit MiTi`: Total credit, i.e. [`Net Card MiTi` + `Contribution LoLa` + `Tips Card`, or `Credit MiTi`]

### Accounting Report
Expand Down
9 changes: 9 additions & 0 deletions src/export/export_miti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ pub fn gather_df_miti(df: &DataFrame) -> PolarsResult<DataFrame> {
.round(2)
.alias("Payment Total"),
)
.with_column(
(col("Gross MiTi (LoLa)").fill_null(0.0) - col("LoLa_Commission_MiTi").fill_null(0.0))
.round(2)
.alias("Net Income LoLa"),
)
.select([
col("Date"),
col("MiTi_Cash").alias("Income Cash"),
Expand All @@ -37,6 +42,8 @@ pub fn gather_df_miti(df: &DataFrame) -> PolarsResult<DataFrame> {
col("Payment Total"),
col("Gross MiTi (MiTi)").alias("Gross Income MiTi"),
col("Gross MiTi (LoLa)").alias("Gross Income LoLa"),
col("LoLa_Commission_MiTi").alias("Commission LoLa"),
col("Net Income LoLa"),
col("Gross MiTi (MiTi) Card").alias("Gross Card MiTi"),
col("MiTi_Commission").alias("Commission MiTi"),
col("Net MiTi (MiTi) Card").alias("Net Card MiTi"),
Expand Down Expand Up @@ -112,6 +119,8 @@ mod tests {
"Payment Total" => &[304.5],
"Gross Income MiTi" => &[Some(250.0)],
"Gross Income LoLa" => &[Some(53)],
"Commission LoLa" => &[0.44],
"Net Income LoLa" => &[52.56],
"Gross Card MiTi" => &[Some(167.0)],
"Commission MiTi" => &[2.75],
"Net Card MiTi" => &[164.25],
Expand Down

0 comments on commit 1b425db

Please sign in to comment.