Options
All
  • Public
  • Public/Protected
  • All
Menu

cashflow-projections

Index

Type aliases

CashflowAccrual

CashflowAccrual: number | CashflowAccrualObject

CashflowAccrualCollection

CashflowAccrualCollection: CashflowAccrualObject[] & {}

CashflowAccrualDefinition

CashflowAccrualDefinition: (period: CashflowProjection) => void | CashflowAccrual | {} | CashflowAccrual[]

Type declaration

CashflowAccrualDefinitions

CashflowAccrualDefinitions: CashflowAccrualDefinition[] | {}

Defines how to generate accrual for a cashflow projection.

example
accruals:{ // Can be dictionary of functions
  salary:()=>100000/12,  //this will create accrual cf.accruals.salary={amount:8333.3333}
  tax:cf=>({amount:-cf.salary*0.25, description:'tax'}), //because tax definition is after salary, by the time tax accrual is executed, salary will be already in the accrual collection
  bonus:cf=>cf.date.getMonth()==11?cf.salary*0.1:undefined //if returns undefined, it will not be added to the accrual collection
}
//---OR---
accruals: // Can be dictionary of functions
[
  cf=>{
    var salary = 100000/12;
    var tax= -salary*0.25,
    return { //this will add 2 accruals salary:{amount:8333.3333} and  tax:{amount:-2083.3333)
      salary,
      tax
    }
  },
  cf=>{
    if(cf.date.getMonth()==11) return { bonus:{amount:10000, description:'second part of bonus'}};
    //this will conditionaly add to accrual bonus:{amount:10000, description:'second part of bonus'}
  }
]

CashflowAccrualObject

CashflowAccrualObject: { amount: number; description?: string; key?: string }

Type declaration

  • [customProp: string]: any
  • amount: number
  • Optional description?: string
  • Optional key?: string

CashflowArgs

CashflowArgs: { accruals?: CashflowAccrualDefinitions; endDate?: Date; periods?: number; startDate?: Date; totals?: CashflowAccrualDefinitions; finalizePeriod?: any; getNextDate?: any; initPeriod?: any }

Type declaration

  • Optional accruals?: CashflowAccrualDefinitions

    defines how to generate accruals for each cashflow projection

  • Optional endDate?: Date

    end date of the cashflow. If not provided, it will try to use periods as a limit of periods

  • Optional periods?: number

    amount of periods to generate. If not provided, it will use 12 as default

  • Optional startDate?: Date

    start date of the cashflow. If not provided, it will be current time

  • Optional totals?: CashflowAccrualDefinitions

    defines how to generate totals for each cashflow projection

  • finalizePeriod: function
    • Parameters

      Returns void

  • getNextDate: function
    • function defining how to get date for next period from a given date and cashflow projection

      Parameters

      Returns Date

  • initPeriod: function
    • Parameters

      Returns void

CashflowProjection

CashflowProjection: { accruals: CashflowAccrualCollection; context: CashflowArgs; date: Date; period: number; previous: CashflowProjection[]; totals: CashflowAccrualCollection }

Projection of cashflow for particular period

export

Type declaration

Functions

generateCashflowProjections

  • generates cashflow projections

    export

    Parameters

    Returns Iterable<CashflowProjection>

getCashflowProjections

getNextDay

  • getNextDay(date: Date): Date
  • Parameters

    • date: Date

    Returns Date

getNextMonth

  • getNextMonth(date: Date): Date
  • Parameters

    • date: Date

    Returns Date

getNextWorkDay

  • getNextWorkDay(date: Date, isHoliday?: (date: Date) => boolean): Date
  • Parameters

    • date: Date
    • Optional isHoliday: (date: Date) => boolean
        • (date: Date): boolean
        • Parameters

          • date: Date

          Returns boolean

    Returns Date

Generated using TypeDoc