Skip to content

KVSPSADistributionMgt#

Procedures#

TransferValuesFromBudgetDistribution(Record KVSPSAJobPSPLine, Boolean) :#

Summary: Transfers values from the budget distribution to the job PSP line. This procedure updates the job PSP line with budget values and calculates the total cost and price. If CommitChanges is true, it commits the changes to the database. It also checks for missing information in the PSP line and sends notifications if necessary. The procedure uses the JobPSPLine record to filter and retrieve budget lines related to the job. It updates the job budget entries and calculates the total cost and price for the PSP line. If the job PSP line is empty, it sets the "Line Updated" field to true and sends a notification if necessary.

procedure TransferValuesFromBudgetDistribution(var JobPSPLine: Record "KVSPSAJobPSPLine"; CommitChanges: Boolean): 

Parameters:

  • JobPSPLine: The job PSP line record to update with budget values.
  • CommitChanges: Indicates whether to commit the changes to the database.

UpdateDistributionCombined(Record KVSPSAJobPSPLine, Boolean, Enum KVSPSADistribDifferenceType, Boolean, Boolean) :#

Summary: Rebuilds and synchronizes distribution data for one or many Job PSP Lines (WBS or Budget lines). This routine iterates the filtered set of PSP lines and applies distribution difference logic, recalculates actual vs. planned quantities/amounts, optionally transfers budget values into the WBS line, and persists changes with optional commit after each line.

procedure UpdateDistributionCombined(var JobPSPLine: Record "KVSPSAJobPSPLine"; TransferIntoWBSLine: Boolean; DistributionDifference: Enum "KVSPSADistribDifferenceType"; SkipFilter: Boolean; CommitChanges: Boolean): 

Parameters:

  • JobPSPLine: Reference PSP line record whose current filters determine the set of lines to process. The record is iterated with FindSet() and modified in place.
  • TransferIntoWBSLine: If true and the line is a budget calculation line, calculated budget totals are copied into PSP line financial fields (Total Cost/Price, Discounts).
  • DistributionDifference: Controls how forecast differences are transferred to planned values (e.g. Distribute All, Nothing, or According to WBS/Budget).
  • SkipFilter: True to bypass standard work status and "Line Updated" filters allowing a full recalculation; false keeps default restrictions.
  • CommitChanges: True to mark each processed line as updated and call COMMIT after modification; use sparingly to avoid unintended transaction splits.

Remarks: Side Effects: - Updates planning metrics (Quantity Assigned, Rem. Quantity, etc.). - May perform multiple COMMITs when CommitChanges = true (audit trail / history requirement). - Respects GlobalJobsSetup filters (e.g. KVSPSADistEntrFiltPSPWorkStat). Use SkipFilter with caution: skipping filters can process lines the UI would normally exclude.

UpdateDistributionCombined(Record KVSPSA Job Budget Line, Record KVSPSAJobPSPLine, Decimal, Enum KVSPSADistribDifferenceType, Boolean) :#

Summary: Applies distribution recalculation for one or more Job Budget Lines belonging to a PSP Line. For each budget line the method recalculates actual entries, transfers forecast to planned according to the chosen difference strategy, distributes invoicing values, updates unassigned metrics and timestamps the manual update.

procedure UpdateDistributionCombined(var JobBudgetLine: Record "KVSPSA Job Budget Line"; JobPSPLine: Record "KVSPSAJobPSPLine"; Precision: Decimal; DistributionDifference: Enum "KVSPSADistribDifferenceType"; IgnoreFilter: Boolean): 

Parameters:

  • JobBudgetLine: Budget line record with active filters defining the set to process (FindSet iteration). Filters are extended internally.
  • JobPSPLine: The parent PSP line providing context for actual entry distribution and invoicing operations.
  • Precision: Initial rounding precision; overridden per line using GetPrecisionForBudgetLine() to ensure correct resource/item rounding.
  • DistributionDifference: Determines how forecast differences are merged into planned (All / Nothing / According to WBS/Budget).
  • IgnoreFilter: True to skip work status filtering and process all qualifying lines; false keeps configured status restrictions.

Remarks: Behavior: - Calls DistributionCalcMgt.DistrActualEntries twice (before and after invoicing distribution) for accuracy. - Updates Quantity Assigned and related fields via UpdateBudgetLine. - Sets "Last Manual Update" to today for traceability. Performance Consideration: Large sets can incur multiple Modify() calls; consider batching externally if needed.

Events#

KVSPSAOnAfterTransferValuesFromBudgetDistribution(Record KVSPSAJobPSPLine, Record KVSPSA Job Budget Line) :#

Summary: Integration event raised after transferring values from budget distribution to job PSP line. This event allows subscribers to perform additional processing or validation after the budget distribution transfer process is completed.

[IntegrationEvent(false, false)]
local procedure KVSPSAOnAfterTransferValuesFromBudgetDistribution(var JobPSPLine: Record "KVSPSAJobPSPLine"; var JobBudgetLine: Record "KVSPSA Job Budget Line"): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSADistributionMgt", 'KVSPSAOnAfterTransferValuesFromBudgetDistribution', '', false, false)]
local procedure DoSomethingKVSPSAOnAfterTransferValuesFromBudgetDistribution(var JobPSPLine: Record "KVSPSAJobPSPLine"; var JobBudgetLine: Record "KVSPSA Job Budget Line")
begin
end;

Parameters:

  • JobPSPLine: The job PSP line record that was updated during the budget distribution transfer process.
  • JobBudgetLine: The job budget line record that was processed during the transfer operation.