Files
herolib/lib/biz/bizmodel/play_funding.v
2025-02-18 05:09:06 +03:00

43 lines
1.1 KiB
V

module bizmodel
import freeflowuniverse.herolib.core.playbook { Action }
import freeflowuniverse.herolib.core.texttools
// populate the params for hr .
// !!hr.funding_define .
// - name, e.g. for a specific person .
// - descr: description of the funding .
// - investment is month:amount,month:amount, ... .
// - type: loan or capital .
fn (mut m BizModel) funding_define_action(action Action) !Action {
mut name := action.params.get_default('name', '')!
mut descr := action.params.get_default('descr', '')!
if descr.len == 0 {
descr = action.params.get('description')!
}
if name.len == 0 {
// make name ourselves
name = texttools.name_fix(descr) // TODO:limit len
}
mut investment := action.params.get_default('investment', '0.0')!
fundingtype := action.params.get_default('type', 'capital')!
m.sheet.row_new(
name: 'funding_${name}'
growth: investment
tags: 'funding type:${fundingtype}'
descr: descr
extrapolate: false
)!
return action
}
fn (mut sim BizModel) funding_total() ! {
sim.sheet.group2row(
name: 'funding_total'
include: ['funding']
tags: 'pl'
descr: 'total funding'
)!
}