KVSPSADistributionEntryMgt#
Procedures#
UpdateJobBudgetEntries(Record KVSPSA Job Budget Line) :#
Summary: Updates the job budget entries based on the provided job budget line. This procedure recalculates the unit cost, updates the invoicing quantity, and creates or modifies job budget entries as necessary. It also handles the distribution of costs and sales budgets, ensuring that all entries are correctly aligned with the job budget line's specifications. At last the unit cost of the Budget line gets updated based on the average unit cost of the related budget entries. It checks for sales budget blocking and ensures that invoicing quantities are consistent with distributed quantities. If the sales budget is blocked, it verifies that the invoicing quantity matches the distributed quantity. If there are discrepancies, it raises an error with a detailed message.
procedure UpdateJobBudgetEntries(JobBudgetLine: Record "KVSPSA Job Budget Line"):
Parameters:
JobBudgetLine: The job budget line record that contains the details for updating job budget entries.
CreateEmptyActualLedgerEntries(Date, Record KVSPSA Job Budget Line, Record KVSPSAJobPSPLine, Integer, Record KVSPSADistributionEntry, Integer) :#
Summary: Creates empty actual distribution ledger entries for periods that have already ended (before the work date). The entry is created based on either the job budget line (when a budget line is specified) or the job PSP line. If a matching distribution entry already exists for the posting date, no new entry is created.
procedure CreateEmptyActualLedgerEntries(PostingDate: Date; CurrJobBudgetLine: Record "KVSPSA Job Budget Line"; CurrJobPSPLine: Record "KVSPSAJobPSPLine"; BudgetLineNo: Integer; var TempDistributionEntry: Record "KVSPSADistributionEntry" temporary; var CurrEntryNo: Integer):
Parameters:
PostingDate: The posting date used to locate the period for the actual entry.CurrJobBudgetLine: The job budget line to derive values from when a budget line is specified.CurrJobPSPLine: The job PSP line to derive values from and to filter the distribution entries.BudgetLineNo: The budget line number; use zero to work on PSP line level.TempDistributionEntry: The temporary distribution entry buffer the created entry is added to.CurrEntryNo: The current entry number used and incremented when inserting new entries.
CreatePlanningLedgerEntries(Date, Record KVSPSA Job Budget Line, Record KVSPSAJobPSPLine, Integer, Record KVSPSADistributionEntry, Integer) :#
Summary: Creates or updates the planning distribution ledger entry for the unassigned invoicing quantity and amount. Out-of-range entries are removed first. If an entry exists for the posting date it is updated with the unassigned invoicing values, otherwise a new entry is inserted based on the job budget line or job PSP line.
procedure CreatePlanningLedgerEntries(PostingDate: Date; CurrJobBudgetLine: Record "KVSPSA Job Budget Line"; CurrJobPSPLine: Record "KVSPSAJobPSPLine"; BudgetLineNo: Integer; var TempDistributionEntry: Record "KVSPSADistributionEntry" temporary; var CurrEntryNo: Integer):
Parameters:
PostingDate: The posting date used to locate the period for the planning entry.CurrJobBudgetLine: The job budget line to derive values from when a budget line is specified.CurrJobPSPLine: The job PSP line to derive values from and to filter the distribution entries.BudgetLineNo: The budget line number; use zero to work on PSP line level.TempDistributionEntry: The temporary distribution entry buffer the created entry is added to.CurrEntryNo: The current entry number used and incremented when inserting new entries.
DeleteOutsideEntries(Record KVSPSAJobPSPLine, Integer) :#
Summary: Deletes all distribution entries of the given job PSP line (and budget line) that are marked as out of range.
procedure DeleteOutsideEntries(CurrJobPSPLine: Record "KVSPSAJobPSPLine"; BudgetLineNo: Integer):
Parameters:
CurrJobPSPLine: The job PSP line whose distribution entries are filtered.BudgetLineNo: The budget line number; use zero to work on PSP line level.
InsertDistrEntriesFromTempInstance(Record KVSPSADistributionEntry, Code[20]) :#
Summary: Inserts the distribution entries from the temporary buffer as persisted entries for the given job. Existing entries are not skipped.
procedure InsertDistrEntriesFromTempInstance(var TempDistributionEntry: Record "KVSPSADistributionEntry" temporary; JobNo: Code[20]):
Parameters:
TempDistributionEntry: The temporary distribution entry buffer to persist.JobNo: The job number the entries belong to.
InsertDistrEntriesFromTempInstance(Record KVSPSADistributionEntry, Code[20], Boolean) :#
Summary: Inserts the distribution entries from the temporary buffer as persisted entries for the given job.
procedure InsertDistrEntriesFromTempInstance(var TempDistributionEntry: Record "KVSPSADistributionEntry" temporary; JobNo: Code[20]; SkipExistingEntries: Boolean):
Parameters:
TempDistributionEntry: The temporary distribution entry buffer to persist.JobNo: The job number the entries belong to.SkipExistingEntries: Set to true to skip entries that already exist for the job.
Events#
KVSPSAOnAfterTransferValuesFromBudgetLine(Record KVSPSA Job Budget Line) :#
Summary: Integration event raised after transferring values from a budget line to update related entities. This event allows subscribers to perform additional processing or validation after the transfer operation is completed.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnAfterTransferValuesFromBudgetLine(var JobBudgetLine: Record "KVSPSA Job Budget Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSADistributionEntryMgt", 'KVSPSAOnAfterTransferValuesFromBudgetLine', '', false, false)]
local procedure DoSomethingKVSPSAOnAfterTransferValuesFromBudgetLine(var JobBudgetLine: Record "KVSPSA Job Budget Line")
begin
end;
Parameters:
JobBudgetLine: The job budget line record that was updated during the transfer process.
KVSPSAOnBeforeUpdateTotalCostInDistrEntries(Record KVSPSAJobPSPLine, Integer, Boolean, Enum KVSPSAPeriodUnitType, Enum KVSPSADistributionBaseType, Boolean) :#
Summary: Integration event raised before updating total cost in distribution entries. This event allows subscribers to handle the update operation or skip the default processing. It provides parameters to control the recalculation. It can be used to implement custom logic for specific scenarios. Or for example to implement a confirm dialog before proceeding with the update.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeUpdateTotalCostInDistrEntries(CurrJobPSPLine: Record "KVSPSAJobPSPLine"; BudgetLineNo: Integer; var SkipRecalc: Boolean; PeriodUnit: Enum "KVSPSAPeriodUnitType"; DistributionBase: Enum "KVSPSADistributionBaseType"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSADistributionEntryMgt", 'KVSPSAOnBeforeUpdateTotalCostInDistrEntries', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeUpdateTotalCostInDistrEntries(CurrJobPSPLine: Record "KVSPSAJobPSPLine"; BudgetLineNo: Integer; var SkipRecalc: Boolean; PeriodUnit: Enum "KVSPSAPeriodUnitType"; DistributionBase: Enum "KVSPSADistributionBaseType"; var IsHandled: Boolean)
begin
end;
Parameters:
CurrJobPSPLine: The current Job PSP Line record.BudgetLineNo: The budget line number.SkipRecalc: Boolean indicating whether to skip recalculation.PeriodUnit: The period unit type.DistributionBase: The distribution base type.IsHandled: Boolean parameter to indicate if the event subscriber has handled the operation.
OnBeforeInsertTempDistributionEntry(Record KVSPSADistributionEntry, Record KVSPSAJobPSPLine, Record KVSPSA Job Budget Line) :#
Summary: Integration event raised before inserting a temporary distribution entry.
[IntegrationEvent(false, false)]
local procedure OnBeforeInsertTempDistributionEntry(var TempDistributionEntry: Record "KVSPSADistributionEntry" temporary; CurrJobPSPLine: Record "KVSPSAJobPSPLine"; CurrJobBudgetLine: Record "KVSPSA Job Budget Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSADistributionEntryMgt", 'OnBeforeInsertTempDistributionEntry', '', false, false)]
local procedure DoSomethingOnBeforeInsertTempDistributionEntry(var TempDistributionEntry: Record "KVSPSADistributionEntry" temporary; CurrJobPSPLine: Record "KVSPSAJobPSPLine"; CurrJobBudgetLine: Record "KVSPSA Job Budget Line")
begin
end;
Parameters:
TempDistributionEntry: The temporary distribution entry record to be inserted.CurrJobPSPLine: The current Job PSP Line record.CurrJobBudgetLine: The current Job Budget Line record.
KVSPSAOnAfterTransferQuantity(Record KVSPSA Job Budget Line, Record KVSPSADistributionEntry) :#
Summary: Called after Quantity is transferred before Invoicing Quantity is transferred
[IntegrationEvent(false, false)]
local procedure KVSPSAOnAfterTransferQuantity(var JobBudgetLine: Record "KVSPSA Job Budget Line"; var PlanningDistributionEntry: Record "KVSPSADistributionEntry"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSADistributionEntryMgt", 'KVSPSAOnAfterTransferQuantity', '', false, false)]
local procedure DoSomethingKVSPSAOnAfterTransferQuantity(var JobBudgetLine: Record "KVSPSA Job Budget Line"; var PlanningDistributionEntry: Record "KVSPSADistributionEntry")
begin
end;
Parameters:
JobBudgetLine: The job budget line record that was updated during the transfer process.PlanningDistributionEntry: The planning distribution entry record that was updated during the transfer process.
KVSPSAOnBeforeTransferQuantity(Record KVSPSA Job Budget Line, Record KVSPSADistributionEntry) :#
Summary: Event triggered before the Job Budget Entries are created
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeTransferQuantity(var JobBudgetLine: Record "KVSPSA Job Budget Line"; var PlanningDistributionEntry: Record "KVSPSADistributionEntry"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSADistributionEntryMgt", 'KVSPSAOnBeforeTransferQuantity', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeTransferQuantity(var JobBudgetLine: Record "KVSPSA Job Budget Line"; var PlanningDistributionEntry: Record "KVSPSADistributionEntry")
begin
end;
Parameters:
JobBudgetLine: Job Budget Line record that is about to be updatedPlanningDistributionEntry: filtered Planning Distribution Entry record that is about to be updated
KVSPSAOnBeforeUpdateJobBudgetEntries(Record KVSPSA Job Budget Line) :#
Summary: Triggered before updating Job Budget Line with transferred values, allows to perform additional updates on distribution entries or skip the update on Job Budget Line by setting a parameter in the event.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeUpdateJobBudgetEntries(var JobBudgetLine: Record "KVSPSA Job Budget Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSADistributionEntryMgt", 'KVSPSAOnBeforeUpdateJobBudgetEntries', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeUpdateJobBudgetEntries(var JobBudgetLine: Record "KVSPSA Job Budget Line")
begin
end;
Parameters:
JobBudgetLine: Job Budget Line record that is about to be updated