Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ codeunit 1303 "Correct Posted Sales Invoice"
var
SalesCrMemoLine: Record "Sales Cr.Memo Line";
SalesInvoiceLine: Record "Sales Invoice Line";
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
SalesCrMemoLine.SetLoadFields("Document No.", "No.", "Appl.-from Item Entry", Quantity, "Variant Code");
SalesCrMemoLine.SetRange("Document No.", SalesCreditMemoNo);
Expand All @@ -1036,9 +1037,12 @@ codeunit 1303 "Correct Posted Sales Invoice"
if SalesCrMemoLine.FindSet() then
repeat
Clear(SalesInvoiceLine);
SalesCrMemoLine.GetSalesInvoiceLine(SalesInvoiceLine);
if SalesInvoiceLine."Line No." <> 0 then
SalesCrMemoLine.GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
if SalesInvoiceLine."Line No." <> 0 then begin
UpdateSalesOrderLinesFromCreditMemo(SalesInvoiceLine, SalesCrMemoLine);
TempUsedSalesInvoiceLine := SalesInvoiceLine;
if TempUsedSalesInvoiceLine.Insert() then;
Comment thread
neeleshsinghal marked this conversation as resolved.
end;
until SalesCrMemoLine.Next() = 0;
end;

Expand Down
29 changes: 27 additions & 2 deletions src/Layers/APAC/BaseApp/Sales/History/SalesCrMemoLine.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,13 @@ table 115 "Sales Cr.Memo Line"
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line")
var
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary)
var
ItemLedgerEntry: Record "Item Ledger Entry";
SalesCreditMemoHeader: Record "Sales Cr.Memo Header";
Expand Down Expand Up @@ -1281,14 +1288,32 @@ table 115 "Sales Cr.Memo Line"
SalesInvoiceLine.SetRange("Document No.", SalesCreditMemoHeader."Applies-to Doc. No.");
SalesInvoiceLine.SetRange(Type, Type);
SalesInvoiceLine.SetRange("No.", "No.");
SalesInvoiceLine.SetRange("Variant Code", "Variant Code");

SalesInvoiceLine.SetRange(Quantity, Quantity);
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetFilter(Quantity, '>=%1', Quantity);
if SalesInvoiceLine.FindFirst() then
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetRange(Quantity);
if SalesInvoiceLine.FindFirst() then;
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;

Clear(SalesInvoiceLine);
end;
end;

local procedure FindUnusedSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary): Boolean
begin
if SalesInvoiceLine.FindSet() then
Comment thread
neeleshsinghal marked this conversation as resolved.
repeat
if not TempUsedSalesInvoiceLine.Get(SalesInvoiceLine."Document No.", SalesInvoiceLine."Line No.") then
exit(true);
until SalesInvoiceLine.Next() = 0;
exit(false);
end;

local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-from Item Entry" = 0 then
Expand Down
29 changes: 27 additions & 2 deletions src/Layers/CH/BaseApp/Sales/History/SalesCrMemoLine.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,13 @@ table 115 "Sales Cr.Memo Line"
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line")
var
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary)
var
ItemLedgerEntry: Record "Item Ledger Entry";
SalesCreditMemoHeader: Record "Sales Cr.Memo Header";
Expand Down Expand Up @@ -1247,14 +1254,32 @@ table 115 "Sales Cr.Memo Line"
SalesInvoiceLine.SetRange("Document No.", SalesCreditMemoHeader."Applies-to Doc. No.");
SalesInvoiceLine.SetRange(Type, Type);
SalesInvoiceLine.SetRange("No.", "No.");
SalesInvoiceLine.SetRange("Variant Code", "Variant Code");

SalesInvoiceLine.SetRange(Quantity, Quantity);
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetFilter(Quantity, '>=%1', Quantity);
if SalesInvoiceLine.FindFirst() then
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetRange(Quantity);
if SalesInvoiceLine.FindFirst() then;
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;

Clear(SalesInvoiceLine);
end;
end;

local procedure FindUnusedSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary): Boolean
begin
if SalesInvoiceLine.FindSet() then
Comment thread
neeleshsinghal marked this conversation as resolved.
repeat
if not TempUsedSalesInvoiceLine.Get(SalesInvoiceLine."Document No.", SalesInvoiceLine."Line No.") then
exit(true);
until SalesInvoiceLine.Next() = 0;
exit(false);
end;

local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-from Item Entry" = 0 then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ codeunit 1303 "Correct Posted Sales Invoice"
var
SalesCrMemoLine: Record "Sales Cr.Memo Line";
SalesInvoiceLine: Record "Sales Invoice Line";
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
SalesCrMemoLine.SetLoadFields("Document No.", "No.", "Appl.-from Item Entry", Quantity, "Variant Code");
SalesCrMemoLine.SetRange("Document No.", SalesCreditMemoNo);
Expand All @@ -1035,9 +1036,12 @@ codeunit 1303 "Correct Posted Sales Invoice"
if SalesCrMemoLine.FindSet() then
repeat
Clear(SalesInvoiceLine);
SalesCrMemoLine.GetSalesInvoiceLine(SalesInvoiceLine);
if SalesInvoiceLine."Line No." <> 0 then
SalesCrMemoLine.GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
if SalesInvoiceLine."Line No." <> 0 then begin
UpdateSalesOrderLinesFromCreditMemo(SalesInvoiceLine, SalesCrMemoLine);
TempUsedSalesInvoiceLine := SalesInvoiceLine;
if TempUsedSalesInvoiceLine.Insert() then;
end;
until SalesCrMemoLine.Next() = 0;
end;

Expand Down
29 changes: 27 additions & 2 deletions src/Layers/ES/BaseApp/Sales/History/SalesCrMemoLine.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,13 @@ table 115 "Sales Cr.Memo Line"
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line")
var
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary)
var
ItemLedgerEntry: Record "Item Ledger Entry";
SalesCreditMemoHeader: Record "Sales Cr.Memo Header";
Expand Down Expand Up @@ -1217,14 +1224,32 @@ table 115 "Sales Cr.Memo Line"
SalesInvoiceLine.SetRange("Document No.", SalesCreditMemoHeader."Applies-to Doc. No.");
SalesInvoiceLine.SetRange(Type, Type);
SalesInvoiceLine.SetRange("No.", "No.");
SalesInvoiceLine.SetRange("Variant Code", "Variant Code");

SalesInvoiceLine.SetRange(Quantity, Quantity);
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetFilter(Quantity, '>=%1', Quantity);
if SalesInvoiceLine.FindFirst() then
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetRange(Quantity);
if SalesInvoiceLine.FindFirst() then;
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;

Clear(SalesInvoiceLine);
end;
end;

local procedure FindUnusedSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary): Boolean
begin
if SalesInvoiceLine.FindSet() then
Comment thread
neeleshsinghal marked this conversation as resolved.
repeat
if not TempUsedSalesInvoiceLine.Get(SalesInvoiceLine."Document No.", SalesInvoiceLine."Line No.") then
exit(true);
until SalesInvoiceLine.Next() = 0;
exit(false);
end;

local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-from Item Entry" = 0 then
Expand Down
29 changes: 27 additions & 2 deletions src/Layers/FI/BaseApp/Sales/History/SalesCrMemoLine.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,13 @@ table 115 "Sales Cr.Memo Line"
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line")
var
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary)
var
ItemLedgerEntry: Record "Item Ledger Entry";
SalesCreditMemoHeader: Record "Sales Cr.Memo Header";
Expand Down Expand Up @@ -1215,14 +1222,32 @@ table 115 "Sales Cr.Memo Line"
SalesInvoiceLine.SetRange("Document No.", SalesCreditMemoHeader."Applies-to Doc. No.");
SalesInvoiceLine.SetRange(Type, Type);
SalesInvoiceLine.SetRange("No.", "No.");
SalesInvoiceLine.SetRange("Variant Code", "Variant Code");

SalesInvoiceLine.SetRange(Quantity, Quantity);
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetFilter(Quantity, '>=%1', Quantity);
if SalesInvoiceLine.FindFirst() then
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetRange(Quantity);
if SalesInvoiceLine.FindFirst() then;
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;

Clear(SalesInvoiceLine);
end;
end;

local procedure FindUnusedSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary): Boolean
begin
if SalesInvoiceLine.FindSet() then
Comment thread
neeleshsinghal marked this conversation as resolved.
repeat
if not TempUsedSalesInvoiceLine.Get(SalesInvoiceLine."Document No.", SalesInvoiceLine."Line No.") then
exit(true);
until SalesInvoiceLine.Next() = 0;
exit(false);
end;

local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-from Item Entry" = 0 then
Expand Down
29 changes: 27 additions & 2 deletions src/Layers/GB/BaseApp/Sales/History/SalesCrMemoLine.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,13 @@ table 115 "Sales Cr.Memo Line"
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line")
var
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary)
var
ItemLedgerEntry: Record "Item Ledger Entry";
SalesCreditMemoHeader: Record "Sales Cr.Memo Header";
Expand Down Expand Up @@ -1232,14 +1239,32 @@ table 115 "Sales Cr.Memo Line"
SalesInvoiceLine.SetRange("Document No.", SalesCreditMemoHeader."Applies-to Doc. No.");
SalesInvoiceLine.SetRange(Type, Type);
SalesInvoiceLine.SetRange("No.", "No.");
SalesInvoiceLine.SetRange("Variant Code", "Variant Code");

SalesInvoiceLine.SetRange(Quantity, Quantity);
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetFilter(Quantity, '>=%1', Quantity);
if SalesInvoiceLine.FindFirst() then
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetRange(Quantity);
if SalesInvoiceLine.FindFirst() then;
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;

Clear(SalesInvoiceLine);
end;
end;

local procedure FindUnusedSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary): Boolean
begin
if SalesInvoiceLine.FindSet() then
Comment thread
neeleshsinghal marked this conversation as resolved.
repeat
if not TempUsedSalesInvoiceLine.Get(SalesInvoiceLine."Document No.", SalesInvoiceLine."Line No.") then
exit(true);
until SalesInvoiceLine.Next() = 0;
exit(false);
end;

local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-from Item Entry" = 0 then
Expand Down
29 changes: 27 additions & 2 deletions src/Layers/IT/BaseApp/Sales/History/SalesCrMemoLine.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,13 @@ table 115 "Sales Cr.Memo Line"
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line")
var
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary)
var
ItemLedgerEntry: Record "Item Ledger Entry";
SalesCreditMemoHeader: Record "Sales Cr.Memo Header";
Expand Down Expand Up @@ -1238,14 +1245,32 @@ table 115 "Sales Cr.Memo Line"
SalesInvoiceLine.SetRange("Document No.", SalesCreditMemoHeader."Applies-to Doc. No.");
SalesInvoiceLine.SetRange(Type, Type);
SalesInvoiceLine.SetRange("No.", "No.");
SalesInvoiceLine.SetRange("Variant Code", "Variant Code");

SalesInvoiceLine.SetRange(Quantity, Quantity);
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetFilter(Quantity, '>=%1', Quantity);
if SalesInvoiceLine.FindFirst() then
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetRange(Quantity);
if SalesInvoiceLine.FindFirst() then;
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;

Clear(SalesInvoiceLine);
end;
end;

local procedure FindUnusedSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary): Boolean
begin
if SalesInvoiceLine.FindSet() then
Comment thread
neeleshsinghal marked this conversation as resolved.
repeat
if not TempUsedSalesInvoiceLine.Get(SalesInvoiceLine."Document No.", SalesInvoiceLine."Line No.") then
exit(true);
until SalesInvoiceLine.Next() = 0;
exit(false);
end;

local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-from Item Entry" = 0 then
Expand Down
29 changes: 27 additions & 2 deletions src/Layers/NA/BaseApp/Sales/History/SalesCrMemoLine.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,13 @@ table 115 "Sales Cr.Memo Line"
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line")
var
TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary;
begin
GetSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine);
end;

internal procedure GetSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary)
var
ItemLedgerEntry: Record "Item Ledger Entry";
SalesCreditMemoHeader: Record "Sales Cr.Memo Header";
Expand Down Expand Up @@ -1224,14 +1231,32 @@ table 115 "Sales Cr.Memo Line"
SalesInvoiceLine.SetRange("Document No.", SalesCreditMemoHeader."Applies-to Doc. No.");
SalesInvoiceLine.SetRange(Type, Type);
SalesInvoiceLine.SetRange("No.", "No.");
SalesInvoiceLine.SetRange("Variant Code", "Variant Code");

SalesInvoiceLine.SetRange(Quantity, Quantity);
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetFilter(Quantity, '>=%1', Quantity);
if SalesInvoiceLine.FindFirst() then
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;
SalesInvoiceLine.SetRange(Quantity);
if SalesInvoiceLine.FindFirst() then;
if FindUnusedSalesInvoiceLine(SalesInvoiceLine, TempUsedSalesInvoiceLine) then
exit;

Clear(SalesInvoiceLine);
end;
end;

local procedure FindUnusedSalesInvoiceLine(var SalesInvoiceLine: Record "Sales Invoice Line"; var TempUsedSalesInvoiceLine: Record "Sales Invoice Line" temporary): Boolean
begin
if SalesInvoiceLine.FindSet() then
Comment thread
neeleshsinghal marked this conversation as resolved.
repeat
if not TempUsedSalesInvoiceLine.Get(SalesInvoiceLine."Document No.", SalesInvoiceLine."Line No.") then
exit(true);
until SalesInvoiceLine.Next() = 0;
exit(false);
end;

local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-from Item Entry" = 0 then
Expand Down
Loading
Loading