-
Notifications
You must be signed in to change notification settings - Fork 692
Open
Labels
SCMGitHub request for SCM areaGitHub request for SCM areaevent-requestRequest for adding an eventRequest for adding an event
Description
Why do you need this change?
We need add another actions after ModifyServiceItem. We are recreate default dimensions by specific setup. It also depends on some fields in Service Item Table it is reason why we have to check it after modify.
Describe the request
local procedure ModifyServiceItem(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; SalesShipmentLine: Record "Sales Shipment Line"; var ServItem: Record "Service Item"; Item: Record Item; TrackingLinesExist: Boolean)
var
ItemTrackingCode: Record "Item Tracking Code";
PurchaseHeader: Record "Purchase Header";
ItemTrackingWarrantyDF: DateFormula;
WarrantyStartDate: Date;
begin
ServItem."Sales/Serv. Shpt. Document No." := SalesShipmentLine."Document No.";
ServItem."Sales/Serv. Shpt. Line No." := SalesShipmentLine."Line No.";
ServItem."Shipment Type" := ServItem."Shipment Type"::Sales;
ServItem.Validate(Description,
CopyStr(SalesLine.Description, 1, MaxStrLen(ServItem.Description)));
ServItem."Description 2" := CopyStr(
StrSubstNo('%1 %2', SalesHeader."Document Type", SalesHeader."No."),
1, MaxStrLen(ServItem."Description 2"));
ServItem.Validate("Customer No.", SalesHeader."Sell-to Customer No.");
ServItem.Validate("Ship-to Code", SalesHeader."Ship-to Code");
ServItem.OmitAssignResSkills(true);
ServItem.Validate("Item No.", Item."No.");
ServItem.OmitAssignResSkills(false);
if TrackingLinesExist then
ServItem."Serial No." := TempReservEntry."Serial No.";
ServItem."Variant Code" := SalesLine."Variant Code";
ItemUnitOfMeasure.Get(Item."No.", SalesLine."Unit of Measure Code");
ServItem.Validate("Sales Unit Cost", Round(SalesLine."Unit Cost (LCY)" /
ItemUnitOfMeasure."Qty. per Unit of Measure", GLSetup."Unit-Amount Rounding Precision"));
if SalesHeader."Currency Code" <> '' then
ServItem.Validate(
"Sales Unit Price",
CalcAmountLCY(
Round(SalesLine."Unit Price" /
ItemUnitOfMeasure."Qty. per Unit of Measure", GLSetup."Unit-Amount Rounding Precision"),
SalesHeader."Currency Factor",
SalesHeader."Currency Code",
SalesHeader."Posting Date"))
else
ServItem.Validate("Sales Unit Price", Round(SalesLine."Unit Price" /
ItemUnitOfMeasure."Qty. per Unit of Measure", GLSetup."Unit-Amount Rounding Precision"));
ServItem."Vendor No." := Item."Vendor No.";
ServItem."Vendor Item No." := Item."Vendor Item No.";
ServItem."Unit of Measure Code" := Item."Base Unit of Measure";
ServItem."Sales Date" := SalesHeader."Posting Date";
ServItem."Installation Date" := SalesHeader."Posting Date";
ServItem."Warranty % (Parts)" := ServMgtSetup."Warranty Disc. % (Parts)";
ServItem."Warranty % (Labor)" := ServMgtSetup."Warranty Disc. % (Labor)";
if not ItemTrackingCode.Get(Item."Item Tracking Code") then
ItemTrackingCode.Init();
if TrackingLinesExist and (TempReservEntry."Warranty Date" <> 0D) then
if Format(ItemTrackingCode."Warranty Date Formula") <> '' then begin
Evaluate(ItemTrackingWarrantyDF, StrSubstNo('-%1', ItemTrackingCode."Warranty Date Formula"));
WarrantyStartDate := CalcDate(ItemTrackingWarrantyDF, TempReservEntry."Warranty Date");
end
else
WarrantyStartDate := TempReservEntry."Warranty Date"
else begin
WarrantyStartDate := SalesHeader."Posting Date";
if (WarrantyStartDate = 0D) and SalesLine."Drop Shipment" then
if PurchaseHeader.Get(PurchaseHeader."Document Type"::Order, SalesLine."Purchase Order No.") then
WarrantyStartDate := PurchaseHeader."Posting Date";
end;
CalcServiceWarrantyDates(
ServItem, WarrantyStartDate, ItemTrackingCode."Warranty Date Formula", ServMgtSetup."Default Warranty Duration");
OnCreateServItemOnSalesLineShpt(ServItem, SalesHeader, SalesLine);
ServItem.Modify();
//-----------------------------OnAfterModifyServiceItem:BEGIN
OnAfterModifyServiceItem(ServItem, SalesShipmentLine);
//-----------------------------OnAfterModifyServiceItem:END
end;
//-----------------------------OnAfterModifyServiceItem:BEGIN
[IntegrationEvent(false, false)]
local procedure OnAfterModifyServiceItem(var ServItem: Record "Service Item"; SalesShipmentLine: Record "Sales Shipment Line")
begin
end;
//-----------------------------OnAfterModifyServiceItem:ENDInternal work item: AB#625531
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
SCMGitHub request for SCM areaGitHub request for SCM areaevent-requestRequest for adding an eventRequest for adding an event