Home Manual Reference Source
import LineItem from 'pvbid-sdk/src/domain/LineItem.js'
public class | source

LineItem

Extends:

eventemitter3~EventEmitterAdvanceEventEmitterBidEntity → LineItem

Represents line item data.

Constructor Summary

Public Constructor
public

constructor(entityData: object, bid: Bid)

Creates an instance of LineItem.

Member Summary

Public Members
public get

Base Property

public set
public

bid: Bid

Reference to the bid that the line item belongs to.

public get

Burden Property

public set
public get

Config Property

public get

Cost Property

public set
public get

Cost per watt

public set
public get

Cost With Markup

public get

Cost With Tax

public get

Gets the line item's definition id.

public get

Escalator Property

public set
public get

Is Included Property

public set
public get

Is Weighted Property - determines whether or not the contribution weight should be applied to the cost

public set
public get

Labor Hours Property

public set
public get

Markup Property

public set
public get

Markup Percent Property

public set
public
public get
public set
public get

OH&P Property (overhead and profit)

public set
public get
this get was deprecated. Please use Scalar instead.

Per Quantity Property

public set
this set was deprecated. Please use Scalar instead.
public get

Price Property

public set
public get

Price per watt

public set
public get

Quantity Property

public set
public get

Scalar Property

public get

Gets Subtotal aka Initial Results.

public get

Gets the line items tags array

public get

Tax Property

public set
public get

Tax Percent Property

public set
public get

When using predictive pricing, should the computed value be used if it's available?

public set

Overrides the bid variable for the line item

public get

Wage Property

public set
public get

Method Summary

Public Methods
public

applyContributionWeight(weightedNormalValues: *): *

public

assess(dependency: BidEntity, forceUpdate: boolean)

Assess line item for changes.

public
public

bind()

Binds the "updated" event for all dependant bid entities.

public

calculateNormalError(range: *, model: *): float

Calculates the normal inverse based on a distribution range, a model's standard_deviation_error_mean and error

public

calculateNormalValue(value: *, error: *): number

Calculates the normal value from the normal error

public

calculateStdDevSumR2(): sumOfR2 | null

Calculates the sum of the r2 values from each model's ['standard_deviation'] object

public

calculateWeightedLaborCost(weightedValue: *): number

Calculates the weighted labor hours cost.

public

calculateWeightedNormalValue(currentModelNormalValue: *, currentModelSumR2: *, nextModelNormalValue: *, nextModelSumR2: *): number

Calculates the weighted normal value from the current normal value and sumOfR2 and the next normal value and sumOfR2

public

Gets an array of components that the line item is under.

public

async delete(): Promise<void>

Deletes line item.

public

Gets dependant bid entities that rely on line item instance.

public

Gets a list of bid entities that the line item instance relies on.

public

dirty()

Flags the line item and corresponding bid as dirty and to be saved.

public

exportData(alwaysIncludeConfig: boolean): object

Exports the line item's internal data structure.

public

Get the line item's assembly if it has one

public

Evaluates the cost prediction models for the line item.

public
public

Evaluates the labor hours prediction models for the line item.

public
public

Gets the predicted value for the line item based on type

public

Gets the prediction models for the current line item by type

public

Gets the line item's value. Either Cost or Labor Hours

public

Gets an array of the calculated weighted labor hour cost

public

getWeightedNormalValue(range: *): int | null

Calculates the weighted normal value at x range

public

Calculate the weighted normal value given a set of distribution ranges.

public

getWorkup(): *

public

Determines if the field is dependent on null/undefined dependencies

public

Determines if the line item is has changed for it's original data.

public

Determines if the line item represents labor costs.

public

Determine if the line item or one of its properties is overridden

public

isPredicted(property: string): boolean

Determines if the line item or a property is predicted by recursively checking the properties calculation dependencies prediction status.

public

Moves line item to a new component and self removes from original component in the same ComponentGroup

public

override(property: string, value: number | string | boolean)

public

reset()

Resets the line item, removing all user override inputs.

public

Resets the markup, removing user override inputs for markup and markup percent.

public

resetProperty(property: string)

Resets a specific line item member, remove override value.

public

Adds the line item to an assembly.

public

setPredictionService(serviceType: *)

Sets the current prediction service being used as well as the distribution ranges.

public

Bind a field dependency to the workup

public

unsetAssembly(): void

Removes any assembly reference from the line item.

Inherited Summary

From class AdvanceEventEmitter
public

Maximum number of events fired for the requester before events stop.

public

on(eventName: string, requesterId: string, callback: function)

public

onDelay(eventName: string, ms: number, requesterId: string, callback: function)

public

removeListenerByRequester(eventName: string, requesterId: string)

Removes event listeners by event and requesterId.

From class BidEntity
public get

Determine if the entity is in an assembly

public get

Gets the id of the bid entity.

public get

Gets the bid entity title.

public set

Sets the bid entity title.

public get

Gets the bid entity type.

public abstract

assess(dependency: BidEntity)

Assesses bid entity.

public

Gets an array of depndants that rely on the bid entity.

public

Gets all the dependencies that the bid entity relies on.

public

dirty()

Flags the bid entity as dirty and to be saved.

public

Exports the internal data for the bid entity.

public

Determines if bid entity relies on a null or undefined dependency value

public

async initSaveChangeLog(originalValue: *, newValue: *, valueType: *, entityProperty: *, metaData: *): *

public

Determines of bid entity is dirty.

public

Marks the bid entity as clean.

Public Constructors

public constructor(entityData: object, bid: Bid) source

Creates an instance of LineItem.

Override:

BidEntity#constructor

Params:

NameTypeAttributeDescription
entityData object
bid Bid

Public Members

public get base: number source

Base Property

public set base: number source

public bid: Bid source

Reference to the bid that the line item belongs to.

public get burden: number source

Burden Property

public set burden: number source

public get config: object source

Config Property

public get cost: number source

Cost Property

public set cost: number source

public get costWatt: number source

Cost per watt

public set costWatt: number source

public get costWithMarkup: number source

Cost With Markup

public get costWithTax: number source

Cost With Tax

public get definitionId: number source

Gets the line item's definition id.

public get escalator: number source

Escalator Property

public set escalator: number source

public get isIncluded: boolean source

Is Included Property

public set isIncluded: boolean source

public get isWeighted: boolean source

Is Weighted Property - determines whether or not the contribution weight should be applied to the cost

public set isWeighted: boolean source

public get laborHours: number source

Labor Hours Property

public set laborHours: number source

public get markup: number source

Markup Property

public set markup: number source

public get markupPercent: number source

Markup Percent Property

public set markupPercent: number source

public maxEvents: number source

Maximum number of events fired for the requester before events stop.

Override:

AdvanceEventEmitter#maxEvents

public get multiplier: number source

public set multiplier: number source

public get ohp: number source

OH&P Property (overhead and profit)

public set ohp: number source

public get perQuantity: number source

this get was deprecated. Please use Scalar instead.

Per Quantity Property

public set perQuantity: number source

this set was deprecated. Please use Scalar instead.

public get price: number source

Price Property

public set price: number source

public get priceWatt: number source

Price per watt

public set priceWatt: number source

public get quantity: number source

Quantity Property

public set quantity: number source

public get scalar: number source

Scalar Property

public get subtotal: number: * source

Gets Subtotal aka Initial Results.

Return:

number

public get tags: Array<string|number|boolean> source

Gets the line items tags array

public get tax: number source

Tax Property

public set tax: number source

public get taxPercent: number source

Tax Percent Property

public set taxPercent: number source

public get useComputedValueWhenAvailable: boolean source

When using predictive pricing, should the computed value be used if it's available?

public set useComputedValueWhenAvailable: boolean source

Overrides the bid variable for the line item

public get wage: number source

Wage Property

public set wage: number source

public get workup: number source

Public Methods

public applyContributionWeight(weightedNormalValues: *): * source

Params:

NameTypeAttributeDescription
weightedNormalValues *

Return:

*

public assess(dependency: BidEntity, forceUpdate: boolean) source

Assess line item for changes.

Override:

BidEntity#assess

Params:

NameTypeAttributeDescription
dependency BidEntity
  • optional
  • nullable: true

The calling dependency

forceUpdate boolean
  • optional
  • nullable: true

Emit:

assessing

fires event before assessement.

assessed

updated

public assessWorkup() source

public bind() source

Binds the "updated" event for all dependant bid entities.

public calculateNormalError(range: *, model: *): float source

Calculates the normal inverse based on a distribution range, a model's standard_deviation_error_mean and error

Params:

NameTypeAttributeDescription
range *
model *

Return:

float

The CDF - inverse normal distribution result

public calculateNormalValue(value: *, error: *): number source

Calculates the normal value from the normal error

Params:

NameTypeAttributeDescription
value *
error *

Return:

number

public calculateStdDevSumR2(): sumOfR2 | null source

Calculates the sum of the r2 values from each model's ['standard_deviation'] object

Return:

sumOfR2 | null

// @todo this is the old way. we need to add a new way that takes into account if the range is above or below the predicted value // which would be > 50% (above) or < 50% (below) // if plus and minus exist in the model, use the above or below r2 values. above and below should be summed separately if the data is available // as a positive sum and a negative sum - r2ValuesHigh and r2ValuesLow returned to parent function

public calculateWeightedLaborCost(weightedValue: *): number source

Calculates the weighted labor hours cost. If line item has a contribution weight, multiply the result by the contribution

Params:

NameTypeAttributeDescription
weightedValue *

Return:

number

public calculateWeightedNormalValue(currentModelNormalValue: *, currentModelSumR2: *, nextModelNormalValue: *, nextModelSumR2: *): number source

Calculates the weighted normal value from the current normal value and sumOfR2 and the next normal value and sumOfR2

Params:

NameTypeAttributeDescription
currentModelNormalValue *
currentModelSumR2 *
nextModelNormalValue *
nextModelSumR2 *

Return:

number

public components(): Component[] source

Gets an array of components that the line item is under. A line item is either uncategorized or under one Component per ComponentGroup

Return:

Component[]

public async delete(): Promise<void> source

Deletes line item.

Return:

Promise<void>

public dependants(): BidEntity[] source

Gets dependant bid entities that rely on line item instance.

Override:

BidEntity#dependants

Return:

BidEntity[]

public dependencies(): BidEntity[] source

Gets a list of bid entities that the line item instance relies on.

Override:

BidEntity#dependencies

Return:

BidEntity[]

public dirty() source

Flags the line item and corresponding bid as dirty and to be saved.

Override:

BidEntity#dirty

public exportData(alwaysIncludeConfig: boolean): object source

Exports the line item's internal data structure.

Override:

BidEntity#exportData

Params:

NameTypeAttributeDescription
alwaysIncludeConfig boolean
  • optional
  • default: false

Flag to include config object regardless of whether it has changed or not. The config is always included if it has been modified but is omitted by to improve save performance if there have been no changes by default to improve save performance.

Return:

object

public getAssembly(): Assembly | undefined source

Get the line item's assembly if it has one

Return:

Assembly | undefined

public getPredictedCost(): number source

Evaluates the cost prediction models for the line item.

Return:

number

The predicted cost value

public getPredictedCostExperimental(): * source

Return:

*

public getPredictedLaborHours(): number source

Evaluates the labor hours prediction models for the line item.

Return:

number

The predicted cost value

public getPredictedLaborHoursExperimental(): * source

Return:

*

public getPredictedValue(): number source

Gets the predicted value for the line item based on type

Return:

number

public getPredictionModels(): Object[] source

Gets the prediction models for the current line item by type

Return:

Object[]

public getValue(): number source

Gets the line item's value. Either Cost or Labor Hours

Return:

number

public getWeightedLaborHourCost(): [] source

Gets an array of the calculated weighted labor hour cost

Return:

[]

public getWeightedNormalValue(range: *): int | null source

Calculates the weighted normal value at x range

Params:

NameTypeAttributeDescription
range *

Return:

int | null

weighted normal value

public getWeightedNormalValues(): array source

Calculate the weighted normal value given a set of distribution ranges.

Return:

array

Array of weighted normal values

public getWorkup(): * source

Return:

*

public hasNullDependency(field: string): boolean source

Determines if the field is dependent on null/undefined dependencies

Override:

BidEntity#hasNullDependency

Params:

NameTypeAttributeDescription
field string

The field value in question

Return:

boolean

public isDirty(): boolean source

Determines if the line item is has changed for it's original data.

Override:

BidEntity#isDirty

Return:

boolean

public isLabor(): boolean source

Determines if the line item represents labor costs.

Return:

boolean

public isOverridden(property: string): boolean source

Determine if the line item or one of its properties is overridden

Params:

NameTypeAttributeDescription
property string
  • optional
  • default: null

Return:

boolean

public isPredicted(property: string): boolean source

Determines if the line item or a property is predicted by recursively checking the properties calculation dependencies prediction status.

Params:

NameTypeAttributeDescription
property string
  • optional

snake case property name

Return:

boolean

public moveToComponent(component: Component) source

Moves line item to a new component and self removes from original component in the same ComponentGroup

Params:

NameTypeAttributeDescription
component Component

public override(property: string, value: number | string | boolean) source

Params:

NameTypeAttributeDescription
property string
value number | string | boolean

public reset() source

Resets the line item, removing all user override inputs.

public resetMarkup() source

Resets the markup, removing user override inputs for markup and markup percent.

public resetProperty(property: string) source

Resets a specific line item member, remove override value.

Params:

NameTypeAttributeDescription
property string

public setAssembly(assembly: Assembly | string): Assembly source

Adds the line item to an assembly.

Params:

NameTypeAttributeDescription
assembly Assembly | string

The assembly entity or an assembly ref id

Return:

Assembly

the new assembly setting

public setPredictionService(serviceType: *) source

Sets the current prediction service being used as well as the distribution ranges.

Params:

NameTypeAttributeDescription
serviceType *

public setWorkupField(field: Field) source

Bind a field dependency to the workup

Params:

NameTypeAttributeDescription
field Field
  • optional
  • default: null

The field entity to bind to the workup. Must be a 'list' type field.

public unsetAssembly(): void source

Removes any assembly reference from the line item.

Return:

void