...
This commit is contained in:
@@ -18,24 +18,19 @@ bizmodel.play(heroscript_path:heroscript)!
|
|||||||
mut bm := bizmodel.get("threefold")!
|
mut bm := bizmodel.get("threefold")!
|
||||||
bm.sheet.pprint(nr_columns: 25)!
|
bm.sheet.pprint(nr_columns: 25)!
|
||||||
|
|
||||||
buildpath := '${os.home_dir()}/hero/var/mdbuild/bizmodel'
|
// buildpath := '${os.home_dir()}/hero/var/mdbuild/bizmodel'
|
||||||
println("buildpath: ${buildpath}")
|
// println("buildpath: ${buildpath}")
|
||||||
|
|
||||||
model.play(mut playbook.new(path: playbook_path)!)!
|
// model.play(mut playbook.new(path: playbook_path)!)!
|
||||||
|
|
||||||
println(model.sheet)
|
// println(model.sheet)
|
||||||
println(model.sheet.export()!)
|
// println(model.sheet.export()!)
|
||||||
|
|
||||||
// model.sheet.export(path:"~/Downloads/test.csv")!
|
// model.sheet.export(path:"~/Downloads/test.csv")!
|
||||||
// model.sheet.export(path:"~/code/github/freeflowuniverse/starlight_template/src/content/test.csv")!
|
// model.sheet.export(path:"~/code/github/freeflowuniverse/starlight_template/src/content/test.csv")!
|
||||||
|
|
||||||
report := model.new_report(
|
bm.export(
|
||||||
name: 'example_report'
|
name: 'example_report'
|
||||||
title: 'Example Business Model'
|
title: 'Example Business Model'
|
||||||
)!
|
path: '/tmp/bizmodel_export'
|
||||||
|
|
||||||
report.export(
|
|
||||||
path: build_path
|
|
||||||
overwrite: true
|
|
||||||
format: .docusaurus
|
|
||||||
)!
|
)!
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
!!bizmodel.department_define bizname:'threefold' name:'operations' descr:'Operations Department'
|
!!bizmodel.department_define bizname:'threefold' name:'operations' descr:'Operations Department'
|
||||||
!!bizmodel.department_define bizname:'threefold' name:'sales' descr:'Sales Department'
|
!!bizmodel.department_define bizname:'threefold' name:'sales' descr:'Sales Department'
|
||||||
!!bizmodel.department_define bizname:'threefold' name:'admin' descr:'Administrative Department'
|
!!bizmodel.department_define bizname:'threefold' name:'admin' descr:'Administrative Department'
|
||||||
|
!!bizmodel.department_define bizname:'threefold' name:'marketing' descr:'Marketing Department'
|
||||||
|
|
||||||
// Define engineering team with 10 people growing 10%/year (max 20)
|
// Define engineering team with 10 people growing 10%/year (max 20)
|
||||||
!!bizmodel.employee_define bizname:'threefold' name:'engineering_team' descr:'Engineering Team'
|
!!bizmodel.employee_define bizname:'threefold' name:'engineering_team' descr:'Engineering Team'
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
cost_percent_revenue:'0.5%'
|
cost_percent_revenue:'0.5%'
|
||||||
|
|
||||||
!!bizmodel.cost_define bizname:'test' name:'triptomoon'
|
!!bizmodel.cost_define bizname:'test' name:'triptomoon'
|
||||||
descr:'Office Rent'
|
descr:'Planet Rental We are crazy'
|
||||||
cost:'10:500000USD' extrapolate:0 //this means we do a one off cost in this case month 11
|
cost:'10:500000USD' extrapolate:0 //this means we do a one off cost in this case month 11
|
||||||
costcenter:'marketing_cc'
|
costcenter:'marketing_cc'
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
!!bizmodel.revenue_define bizname:'threefold' name:'cloud_services' extrapolate:1
|
|
||||||
descr:'Cloud Services Revenue'
|
|
||||||
revenue:'10:10000USD,46:1000000USD'
|
|
||||||
cogs_percent:'0%'
|
|
||||||
|
|
||||||
!!bizmodel.funding_define bizname:'threefold' name:'initial_investment'
|
|
||||||
descr:'Seed Capital'
|
|
||||||
investment:'0:5000000USD'
|
|
||||||
type:'capital'
|
|
||||||
|
|
||||||
!!bizmodel.department_define bizname:'threefold' name:'engineering' descr:'Engineering Department'
|
|
||||||
!!bizmodel.department_define bizname:'threefold' name:'operations' descr:'Operations Department'
|
|
||||||
!!bizmodel.department_define bizname:'threefold' name:'sales' descr:'Sales Department'
|
|
||||||
!!bizmodel.department_define bizname:'threefold' name:'admin' descr:'Admin Department'
|
|
||||||
|
|
||||||
!!bizmodel.employee_define bizname:'threefold' name:'engineer'
|
|
||||||
descr:'Engineer'
|
|
||||||
cost:'7000USD'
|
|
||||||
indexation:'5%'
|
|
||||||
nrpeople:'0:5,12:6,24:7,36:9,48:10,60:11,72:12,84:14,96:16,108:18,120:20'
|
|
||||||
department:'engineering'
|
|
||||||
|
|
||||||
!!bizmodel.employee_define bizname:'threefold' name:'operations_staff'
|
|
||||||
descr:'Operations Staff'
|
|
||||||
cost:'5000USD'
|
|
||||||
indexation:'5%'
|
|
||||||
nrpeople:'2'
|
|
||||||
department:'operations'
|
|
||||||
cost_percent_revenue:'4%'
|
|
||||||
|
|
||||||
!!bizmodel.cost_define bizname:'threefold' name:'travel'
|
|
||||||
descr:'Travel Costs'
|
|
||||||
cost:'0USD'
|
|
||||||
cost_percent_revenue:'3%'
|
|
||||||
|
|
||||||
!!bizmodel.cost_define bizname:'threefold' name:'office_rent'
|
|
||||||
descr:'Offices Rent (3 locations)'
|
|
||||||
cost:'24000USD'
|
|
||||||
indexation:'3%'
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env -S v -n -w -cg -gc none -cc tcc -d use_openssl -enable-globals run
|
|
||||||
|
|
||||||
import freeflowuniverse.herolib.biz.bizmodel
|
|
||||||
import os
|
|
||||||
|
|
||||||
bizmodel.play(heroscript_path: '${os.dir(@FILE)}/bizmodel.heroscript')!
|
|
||||||
|
|
||||||
mut m := bizmodel.get("threefold")!
|
|
||||||
m.sheet.pprint(nr_columns: 5)!
|
|
||||||
@@ -89,7 +89,7 @@ fn (mut m BizModel) new_report_action(action Action) !Action {
|
|||||||
name := p.get_default('name', '')!
|
name := p.get_default('name', '')!
|
||||||
title := p.get_default('title', '')!
|
title := p.get_default('title', '')!
|
||||||
description := p.get_default('description', '')!
|
description := p.get_default('description', '')!
|
||||||
m.export_all(path:path,name:name,title:title,description:description)!
|
m.export(path:path,name:name,title:title,description:description)!
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub mut:
|
|||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (b BizModel) export_all(args ExportArgs) ! {
|
pub fn (b BizModel) export(args ExportArgs) ! {
|
||||||
name := if args.name != '' { args.name } else { texttools.snake_case(args.title) }
|
name := if args.name != '' { args.name } else { texttools.snake_case(args.title) }
|
||||||
path := pathlib.get_dir(
|
path := pathlib.get_dir(
|
||||||
path: os.join_path(os.home_dir(), '/hero/var/bizmodel/exports/${name}')
|
path: os.join_path(os.home_dir(), '/hero/var/bizmodel/exports/${name}')
|
||||||
|
|||||||
@@ -48,13 +48,17 @@ pub fn (mut m BizModel) play(mut plbook PlayBook) ! {
|
|||||||
m.act(*action)!
|
m.act(*action)!
|
||||||
}
|
}
|
||||||
|
|
||||||
m.cost_total()!
|
|
||||||
m.revenue_total()!
|
m.revenue_total()!
|
||||||
m.funding_total()!
|
|
||||||
|
|
||||||
for action in actions.filter(it.name in action_priorities[2]) {
|
for action in actions.filter(it.name in action_priorities[2]) {
|
||||||
m.act(*action)!
|
m.act(*action)!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.hrcost_total()!
|
||||||
|
m.funding_total()!
|
||||||
|
m.cost_total()!
|
||||||
|
|
||||||
|
|
||||||
for action in actions.filter(it.name in action_priorities[3]) {
|
for action in actions.filter(it.name in action_priorities[3]) {
|
||||||
m.act(*action)!
|
m.act(*action)!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ fn (mut m BizModel) cost_define_action(action Action) !Action {
|
|||||||
mut cost_row := m.sheet.row_new(
|
mut cost_row := m.sheet.row_new(
|
||||||
name: 'cost_${name}'
|
name: 'cost_${name}'
|
||||||
growth: cost
|
growth: cost
|
||||||
tags: 'department:${department} cost'
|
tags: 'department:${department} ocost'
|
||||||
descr: descr
|
descr: descr
|
||||||
extrapolate: action.params.get_default_true('extrapolate')
|
extrapolate: action.params.get_default_true('extrapolate')
|
||||||
)!
|
)!
|
||||||
@@ -73,11 +73,14 @@ fn (mut m BizModel) cost_define_action(action Action) !Action {
|
|||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fn (mut sim BizModel) cost_total() ! {
|
fn (mut sim BizModel) cost_total() ! {
|
||||||
sim.sheet.group2row(
|
sim.sheet.group2row(
|
||||||
name: 'hr_cost_total'
|
name: 'cost_total'
|
||||||
include: ['hrcost']
|
include: ['ocost']
|
||||||
tags: 'pl'
|
tags: 'pl'
|
||||||
descr: 'total cost for hr'
|
descr: 'Operational Costs Total.'
|
||||||
)!
|
)!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,6 @@ fn (mut sim BizModel) funding_total() ! {
|
|||||||
name: 'funding_total'
|
name: 'funding_total'
|
||||||
include: ['funding']
|
include: ['funding']
|
||||||
tags: 'pl'
|
tags: 'pl'
|
||||||
descr: 'Total funding'
|
descr: 'Funding Total'
|
||||||
)!
|
)!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ fn (mut m BizModel) employee_define_action(action Action) !Action {
|
|||||||
name: 'hr_cost_${name}'
|
name: 'hr_cost_${name}'
|
||||||
growth: cost
|
growth: cost
|
||||||
tags: 'department:${department} hrcost'
|
tags: 'department:${department} hrcost'
|
||||||
descr: 'Department ${department} Cost For Person ${name}'
|
descr: '${descr} Cost'
|
||||||
subgroup: 'HR cost per department.'
|
subgroup: 'HR cost per department.'
|
||||||
)!
|
)!
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ fn (mut m BizModel) employee_define_action(action Action) !Action {
|
|||||||
name: 'hr_nrpeople_${name}'
|
name: 'hr_nrpeople_${name}'
|
||||||
growth: nrpeople
|
growth: nrpeople
|
||||||
tags: 'hrnr'
|
tags: 'hrnr'
|
||||||
descr: '# people for ${descr}'
|
descr: '${descr} Nr of People'
|
||||||
aggregatetype: .avg
|
aggregatetype: .avg
|
||||||
)!
|
)!
|
||||||
costpeople_row = costpeople_row.action(action: .multiply, rows: [nrpeople_row])!
|
costpeople_row = costpeople_row.action(action: .multiply, rows: [nrpeople_row])!
|
||||||
@@ -101,3 +101,13 @@ fn (mut m BizModel) employee_define_action(action Action) !Action {
|
|||||||
}
|
}
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn (mut sim BizModel) hrcost_total() ! {
|
||||||
|
sim.sheet.group2row(
|
||||||
|
name: 'hr_cost_total'
|
||||||
|
include: ['hrcost']
|
||||||
|
tags: 'pl'
|
||||||
|
descr: 'Human Resources Costs Total'
|
||||||
|
)!
|
||||||
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ fn (mut m BizModel) revenue_action(action Action) !Action {
|
|||||||
name: '${r.name}_cogs_param'
|
name: '${r.name}_cogs_param'
|
||||||
growth: action.params.get_default('cogs', '0:0')!
|
growth: action.params.get_default('cogs', '0:0')!
|
||||||
tags: 'name:${r.name}'
|
tags: 'name:${r.name}'
|
||||||
descr: 'COGS for ${r.name}'
|
descr: 'COGS Param for ${r.name}'
|
||||||
extrapolate: action.params.get_default_false('extrapolate')
|
extrapolate: action.params.get_default_false('extrapolate')
|
||||||
)!
|
)!
|
||||||
|
|
||||||
@@ -70,6 +70,7 @@ fn (mut m BizModel) revenue_action(action Action) !Action {
|
|||||||
rows: [cogs_percent_temp]
|
rows: [cogs_percent_temp]
|
||||||
name: '${r.name}_cogs'
|
name: '${r.name}_cogs'
|
||||||
tags: 'cogs name:${r.name}'
|
tags: 'cogs name:${r.name}'
|
||||||
|
descr: 'COGS for ${r.name}'
|
||||||
)!
|
)!
|
||||||
|
|
||||||
if revenue.max() > 0 {
|
if revenue.max() > 0 {
|
||||||
|
|||||||
@@ -9,19 +9,24 @@ fn (mut sim BizModel) revenue_total() ! {
|
|||||||
mut revenue_total := sheet.group2row(
|
mut revenue_total := sheet.group2row(
|
||||||
name: 'revenue_total'
|
name: 'revenue_total'
|
||||||
include: ['rev']
|
include: ['rev']
|
||||||
tags: 'total'
|
tags: 'total revtotal pl'
|
||||||
descr: 'total revenue.'
|
descr: 'Revenue Total'
|
||||||
)!
|
)!
|
||||||
mut cogs_total := sheet.group2row(
|
mut cogs_total := sheet.group2row(
|
||||||
name: 'cogs_total'
|
name: 'cogs_total'
|
||||||
include: ['cogs']
|
include: ['cogs']
|
||||||
tags: 'total'
|
tags: 'total cogstotal pl'
|
||||||
descr: 'total cogs.'
|
descr: 'Cost of Goods Total.'
|
||||||
)!
|
)!
|
||||||
mut margin_total := sheet.group2row(
|
mut margin_total := sheet.group2row(
|
||||||
name: 'margin_total'
|
name: 'margin_total'
|
||||||
include: ['margin']
|
include: ['margin']
|
||||||
tags: 'total'
|
tags: 'total margintotal'
|
||||||
descr: 'total margin.'
|
descr: 'total margin.'
|
||||||
)!
|
)!
|
||||||
|
|
||||||
|
// println(revenue_total)
|
||||||
|
// println(cogs_total)
|
||||||
|
// println(margin_total)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,23 +10,28 @@
|
|||||||
|
|
||||||
@{model.sheet.wiki(includefilter:['rev']) or {panic(err)}}
|
@{model.sheet.wiki(includefilter:['rev']) or {panic(err)}}
|
||||||
|
|
||||||
#### Revenue Lines
|
#### Revenue
|
||||||
|
|
||||||
@{model.sheet.wiki(title:'Revenue Total', includefilter:['revtotal']) or {panic(err)}}
|
@{model.sheet.wiki(title:'Revenue Total', includefilter:['revtotal']) or {panic(err)}}
|
||||||
|
|
||||||
#### COGS Lines
|
#### Cost of Goods
|
||||||
|
|
||||||
@{model.sheet.wiki(title:'COGS', includefilter:['cogstotal']) or {panic(err)}}
|
@{model.sheet.wiki(title:'COGS', includefilter:['cogstotal']) or {panic(err)}}
|
||||||
|
|
||||||
|
#### Margin
|
||||||
|
|
||||||
|
@{model.sheet.wiki(title:'COGS', includefilter:['margintotal']) or {panic(err)}}
|
||||||
|
|
||||||
|
|
||||||
## HR
|
## HR
|
||||||
|
|
||||||
@{model.sheet.wiki(title:'HR Teams', includefilter:['hrnr']) or {panic(err)}}
|
@{model.sheet.wiki(title:'#### HR Teams', includefilter:['hrnr']) or {panic(err)}}
|
||||||
|
|
||||||
@{model.sheet.wiki(title:'HR Costs', includefilter:['hrcost']) or {panic(err)}}
|
@{model.sheet.wiki(title:'#### HR Costs', includefilter:['hrcost']) or {panic(err)}}
|
||||||
|
|
||||||
## Operational Costs
|
## Operational Costs
|
||||||
|
|
||||||
@{model.sheet.wiki(title:'COSTS', includefilter:['ocost']) or {panic(err)}}
|
@{model.sheet.wiki( includefilter:['ocost']) or {panic(err)}}
|
||||||
|
|
||||||
## P&L Overview
|
## P&L Overview
|
||||||
|
|
||||||
@@ -34,7 +39,7 @@
|
|||||||
|
|
||||||
@{model.sheet.wiki(title:'P&L Overview', includefilter:['pl']) or {panic(err)}}
|
@{model.sheet.wiki(title:'P&L Overview', includefilter:['pl']) or {panic(err)}}
|
||||||
|
|
||||||
@{model.sheet.bar_chart(rowname:'revenue_total', unit: .million, title:'A Title', title_sub:'Sub') or {panic(err)}.mdx()}
|
@{model.sheet.bar_chart(rowname:'revenue_total', unit: .million, title:'Total Revenue', title_sub:'Sub') or {panic(err)}.mdx()}
|
||||||
|
|
||||||
Unit is in Million USD.
|
Unit is in Million USD.
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ pub fn (s Sheet) wiki(args_ RowGetArgs) !string {
|
|||||||
mut sheet := s.filter(args)! // this will do the filtering and if needed make smaller
|
mut sheet := s.filter(args)! // this will do the filtering and if needed make smaller
|
||||||
|
|
||||||
mut out := ''
|
mut out := ''
|
||||||
if args.title.len > 0 {
|
|
||||||
out = '## ${args.title}\n\n'
|
|
||||||
}
|
|
||||||
if args.title != '' {
|
if args.title != '' {
|
||||||
out += args.title + '\n\n'
|
out += args.title + '\n\n'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user