You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Scope('OnPrem')]
procedure CalcPosition(FixedNumber: Integer)
var
PosBefore: Integer;
PosAfter: Integer;
begin
if not (CheckQuoteMgtPermission() or (CopyStr(SerialNumber, 7, 3) = '000')) then
exit;
if (FixedNumber >= 10) and ("No." <> '') then begin
Position := FixedNumber;
exit;
end;
if HasTypeToFillMandatoryFields() and ("No." <> '') then begin
PosBefore := 0;
PosAfter := 0;
SalesLine2.Reset();
SalesLine2 := Rec;
SalesLine2.SetRange("Document No.", "Document No.");
SalesLine2.SetRange("Document Type", "Document Type");
SalesLine2.SetRange(Type, Type::"G/L Account", Type::"Charge (Item)");
SalesLine2.SetFilter("No.", '<>%1', '');
if SalesLine2.Find('<') then
PosBefore := SalesLine2.Position;
SalesLine2 := Rec;
if SalesLine2.Find('>') then
PosAfter := SalesLine2.Position;
if PosAfter > 0 then begin
if PosAfter - PosBefore < 2 then
Error(Text90801 + Text90802, "Document Type");
Position := Round((PosAfter + PosBefore) / 2, 1);
end else
Position := PosBefore + 10;
end else
Position := 0;
end;
New Code
[Scope('OnPrem')]
procedure CalcPosition(FixedNumber: Integer)
var
PosBefore: Integer;
PosAfter: Integer;
IsHandled: Boolean;
begin
OnBeforeCalcPosition(Rec, IsHandled);
if IsHandled then begin
exit;
end;
if not (CheckQuoteMgtPermission() or (CopyStr(SerialNumber, 7, 3) = '000')) then
exit;
if (FixedNumber >= 10) and ("No." <> '') then begin
Position := FixedNumber;
exit;
end;
if HasTypeToFillMandatoryFields() and ("No." <> '') then begin
PosBefore := 0;
PosAfter := 0;
SalesLine2.Reset();
SalesLine2 := Rec;
SalesLine2.SetRange("Document No.", "Document No.");
SalesLine2.SetRange("Document Type", "Document Type");
SalesLine2.SetRange(Type, Type::"G/L Account", Type::"Charge (Item)");
SalesLine2.SetFilter("No.", '<>%1', '');
if SalesLine2.Find('<') then
PosBefore := SalesLine2.Position;
SalesLine2 := Rec;
if SalesLine2.Find('>') then
PosAfter := SalesLine2.Position;
if PosAfter > 0 then begin
if PosAfter - PosBefore < 2 then
Error(Text90801 + Text90802, "Document Type");
Position := Round((PosAfter + PosBefore) / 2, 1);
end else
Position := PosBefore + 10;
end else
Position := 0;
end;
Event
[IntegrationEvent(false, false)]
local procedure OnBeforeCalcPosition(var Rec: Record "Sales Line"; var IsHandled: Boolean)
begin
end;
Additional context
We use our own CalcPosition procedure for different BC localisations and need to disable the base CalcPosition procedure for CH localisations.
The text was updated successfully, but these errors were encountered:
Describe the request
Please add the following new publisher.
Previous Code
New Code
Event
Additional context
We use our own CalcPosition procedure for different BC localisations and need to disable the base CalcPosition procedure for CH localisations.
The text was updated successfully, but these errors were encountered: