KVSPSAGeneral Functions PSA#
Procedures#
AppendToTextBuilder(TextBuilder, Text, Text) :#
Summary: Add Text with a Delimiter to a TextBuilder. If the TextBuilder is not empty, the Delimiter will be set before the new text
procedure AppendToTextBuilder(var TextBuilderToAppend: TextBuilder; TextToAdd: Text; Delimiter: Text):
Parameters:
TextBuilderToAppend
:TextToAdd
:Delimiter
:
CalcOutStandingPrice(Record KVSPSAJobPSPLine) :#
Summary: Calculate the outstanding sales price for a JobPSPLine based on its invoicing type and other fields. This procedure modifies the JobPSPLine record with the calculated outstanding sales total price. The calculation logic varies based on the invoicing type of the JobPSPLine. The procedure handles different invoicing types such as "without Calc.", "Fixed Price", "on Cost", "Milestone", "POC", "TC Fixed Rate", and "Package Invoice". If the "Line No." of the JobPSPLine is 0, the procedure exits without performing any calculations. The "Outstanding Sales Total Price" field is updated based on the invoicing type and other relevant fields.
procedure CalcOutStandingPrice(var JobPSPLine: Record "KVSPSAJobPSPLine"):
Parameters:
JobPSPLine
: The JobPSPLine record for which the outstanding sales price is to be calculated.
DeleteRecordWithQuestion(Variant) :#
Summary: Delete a record with a confirmation question. This procedure checks if the record is valid and prompts the user for confirmation before deleting it. If the record is a single record, it asks for confirmation to delete that specific record. If the record has multiple entries, it asks for confirmation to delete all records of that table. If the user confirms, the record(s) will be deleted. If the record is not valid or if the user cancels the confirmation, the procedure exits without deleting anything.
procedure DeleteRecordWithQuestion(RecordAsVariant: Variant):
Parameters:
RecordAsVariant
: The record to be deleted, passed as a Variant type.
GetCountingPartOfNumber(Code[20], Integer, Integer) :#
Summary: GetCountingPartOfNumber gets the first position of the last part of the text, where only numbers exist - so 5 for e.g. A01F0000.
procedure GetCountingPartOfNumber(Number: Code[20]; var StartPosition: Integer; var EndPosition: Integer):
Parameters:
Number
: Probably a number from a number series like 25INV00001StartPosition
:EndPosition
:
TestBlocked(Code[20], Code[10], Code[20], Integer) :#
Summary: Test Blocked field in Job Budget Name / Job WBS Header / Job WBS Line
procedure TestBlocked(TestJobNo: Code[20]; TestJobBudgetName: Code[10]; TestVersion: Code[20]; TestLineNo: Integer):
Parameters:
TestJobNo
: Job No. to testTestJobBudgetName
: Job Budget Name to testTestVersion
: Version No. to testTestLineNo
: Line No. to test
TransferPurchInvLedgerFromPurchaseLineToPurchaseLine(Record Purchase Line, Record Purchase Line) :#
Summary: Transfer purchase invoice ledger entries from one purchase line to another. This procedure updates the purchase invoice ledger entries associated with a source purchase line and transfers them to a target purchase line. It retrieves the purchase invoice ledger entries for the source purchase line and modifies them to reflect the target purchase line's document type, document number, and line number. If the source purchase line has no associated purchase invoice ledger entries, this procedure does nothing.
procedure TransferPurchInvLedgerFromPurchaseLineToPurchaseLine(SourcePurchaseLine: Record "Purchase Line"; TargetPurchaseLine: Record "Purchase Line"):
Parameters:
SourcePurchaseLine
: The source Puchase Line to get the document Information.TargetPurchaseLine
: The target Purchase Line to transfer the document Information.
UpdateBudgetFromPSPLines(Code[20], Code[10], Code[20]) :#
Summary: Update the budget values in the Job WBS lines based on the detailed planning values stored in the budget lines. This procedure checks if the budget calculation is enabled for each Job WBS line and updates the total cost, total price, and line discount amounts accordingly. If the values in the Job WBS lines differ from the budget lines, it prompts the user for confirmation to update the WBS lines. If the user confirms, it updates the Job WBS lines with the new values calculated from the budget lines. If the budget calculation is not enabled for a Job WBS line, it skips that line. The procedure also handles the case where the user has opted to confirm the update of WBS lines from differing budget lines amounts.
procedure UpdateBudgetFromPSPLines(JobNo: Code[20]; BudgetName: Code[10]; VersionNo: Code[20]):
Parameters:
JobNo
: The Job No. to update the WBS lines for.BudgetName
: The name of the budget to update from.VersionNo
: The version number of the budget to update from.
UpdatePSP(Record KVSPSAJobPSPHeader) :#
Summary: Update the PSP (Project Structure Plan) for a given JobPSPHeader. This procedure buffers the JobPSPHeader data and updates the work package lines and sum lines based on the temporary global job PSP line records. It calculates the total price for usage and sales, and updates the outstanding sales total price for each work package line. It also updates the subtotal total cost and subtotal total price for each sum line. The procedure iterates through the temporary global job PSP lines and applies the necessary calculations and updates.
procedure UpdatePSP(var JobPSPHeader: Record "KVSPSAJobPSPHeader"):
Parameters:
JobPSPHeader
: The JobPSPHeader record to be updated.
Events#
KVSPSAOnAfterCalcPSPLineUsageFieldsSubtotals(Record KVSPSAJobPSPLine) :#
Obsolete
This Element will be removed or changed with a future Version of the App.
[Obsolete('Use KVSPSAOnBeforeCalcUsageFieldSubtotalModified instead', '22.4')]
[IntegrationEvent(false, false)]
local procedure KVSPSAOnAfterCalcPSPLineUsageFieldsSubtotals(var JobPSPLine: Record "KVSPSAJobPSPLine"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSAGeneral Functions PSA", 'KVSPSAOnAfterCalcPSPLineUsageFieldsSubtotals', '', false, false)]
local procedure DoSomethingKVSPSAOnAfterCalcPSPLineUsageFieldsSubtotals(var JobPSPLine: Record "KVSPSAJobPSPLine")
begin
end;
KVSPSAOnAfterInitPSPLineUsageFields(Record KVSPSAJobPSPLine) :#
Summary: Integration event that is raised after initializing PSP line usage fields. This event allows subscribers to perform additional initialization or customization of usage fields after the standard initialization has been completed.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnAfterInitPSPLineUsageFields(var JobPSPLine: Record "KVSPSAJobPSPLine"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSAGeneral Functions PSA", 'KVSPSAOnAfterInitPSPLineUsageFields', '', false, false)]
local procedure DoSomethingKVSPSAOnAfterInitPSPLineUsageFields(var JobPSPLine: Record "KVSPSAJobPSPLine")
begin
end;
Parameters:
JobPSPLine
: The Job PSP Line record for which the usage fields were initialized.
KVSPSAOnBeforeCalcUsageFieldSubtotalJobPSPLineModify(Record KVSPSAJobPSPLine, Record KVSPSAJobPSPLine) :#
Summary: Integration event that is raised before calculating usage field subtotals and modifying the Job PSP Line. This event allows subscribers to perform custom calculations or validations before the usage field subtotal calculation and record modification takes place.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeCalcUsageFieldSubtotalJobPSPLineModify(var JobPSPLine: Record "KVSPSAJobPSPLine"; var JobPSPLine2: Record "KVSPSAJobPSPLine"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSAGeneral Functions PSA", 'KVSPSAOnBeforeCalcUsageFieldSubtotalJobPSPLineModify', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeCalcUsageFieldSubtotalJobPSPLineModify(var JobPSPLine: Record "KVSPSAJobPSPLine"; var JobPSPLine2: Record "KVSPSAJobPSPLine")
begin
end;
Parameters:
JobPSPLine
: The primary Job PSP Line record being processed.JobPSPLine2
: The secondary Job PSP Line record used in the calculation process.
KVSPSAOnBeforeCalcUsageFieldSubtotalModified(Record KVSPSAJobPSPLine, Boolean) :#
Summary: Integration event that is raised before calculating usage field subtotals to check if modification is needed. This event allows subscribers to control whether the usage field subtotal calculation should result in a record modification, providing an opportunity to skip the modification based on custom logic.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeCalcUsageFieldSubtotalModified(var JobPSPLine: Record "KVSPSAJobPSPLine"; var Modified: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSAGeneral Functions PSA", 'KVSPSAOnBeforeCalcUsageFieldSubtotalModified', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeCalcUsageFieldSubtotalModified(var JobPSPLine: Record "KVSPSAJobPSPLine"; var Modified: Boolean)
begin
end;
Parameters:
JobPSPLine
: The Job PSP Line record being processed for usage field subtotal calculation.Modified
: Boolean flag indicating whether the record should be modified after calculation.
KVSPSAOnBeforeTestBlocked(Code[20], Code[10], Code[20], Integer, Boolean) :#
Summary: Integration event that is raised before testing if a job is blocked. This event allows subscribers to perform custom validation or override the standard blocked status check for jobs, job budgets, or specific PSP line entries.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeTestBlocked(TestJobNo: Code[20]; TestJobBudgetName: Code[10]; TestVersion: Code[20]; TestLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSAGeneral Functions PSA", 'KVSPSAOnBeforeTestBlocked', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeTestBlocked(TestJobNo: Code[20]; TestJobBudgetName: Code[10]; TestVersion: Code[20]; TestLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
TestJobNo
: The job number to test for blocked status.TestJobBudgetName
: The job budget name to test for blocked status.TestVersion
: The version number to test for blocked status.TestLineNo
: The line number to test for blocked status.IsHandled
: Boolean flag to indicate if the blocked test has been handled by a subscriber.
KVSPSAOnBeforeTestStartEndDateConsistency(Record KVSPSAJobPSPLine, Text, Date, Date, Boolean) :#
Summary: Integration event that is raised before testing start and end date consistency in Job PSP Lines. This event allows subscribers to perform custom date validation logic or override the standard date consistency checks between start and end dates in PSP line records.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeTestStartEndDateConsistency(JobPSPLine: Record "KVSPSAJobPSPLine"; FieldName: Text; OldValue: Date; NewValue: Date; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSAGeneral Functions PSA", 'KVSPSAOnBeforeTestStartEndDateConsistency', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeTestStartEndDateConsistency(JobPSPLine: Record "KVSPSAJobPSPLine"; FieldName: Text; OldValue: Date; NewValue: Date; var IsHandled: Boolean)
begin
end;
Parameters:
JobPSPLine
: The Job PSP Line record being validated for date consistency.FieldName
: The name of the field being validated (e.g., "Start Date" or "End Date").OldValue
: The previous date value before the change.NewValue
: The new date value being validated.IsHandled
: Boolean flag to indicate if the date consistency test has been handled by a subscriber.
KVSPSAOnBeforeUpdateBudgetFromPSPLines(Code[20], Code[10], Code[20], Boolean) :#
Summary: Integration event that is raised before updating budget from PSP lines. This event allows subscribers to perform custom logic or validation before the budget update process begins, or to completely override the standard budget update functionality.
[IntegrationEvent(false, false)]
local procedure KVSPSAOnBeforeUpdateBudgetFromPSPLines(JobNo: Code[20]; BudgetName: Code[10]; VersionNo: Code[20]; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSPSAGeneral Functions PSA", 'KVSPSAOnBeforeUpdateBudgetFromPSPLines', '', false, false)]
local procedure DoSomethingKVSPSAOnBeforeUpdateBudgetFromPSPLines(JobNo: Code[20]; BudgetName: Code[10]; VersionNo: Code[20]; var IsHandled: Boolean)
begin
end;
Parameters:
JobNo
: The job number for which the budget will be updated.BudgetName
: The budget name to be updated from PSP lines.VersionNo
: The version number of the budget to be updated.IsHandled
: Boolean flag to indicate if the budget update has been handled by a subscriber.