Here I have quantity 2 and when I ship /invoice 1 quantity, I should only return sales order for remaining two quantity,
In my field when I enter quantity 2 or more i should get error,
Because I have only one quantity left so I should send return for that, i have done validation for more that 2 quantity, but need for quantity Shipped and remaining quantity only need to send, please need help in this part.
This is my code:
trigger OnValidate()
var
cu_ItemVatCalculation: Codeunit ItemVatCalculation;
rec_Item: Record Item;
itemVat: Decimal;
rec_SalesLine: Record "Sales Line";
enum_DocumentType: Enum "Sales Document Type";
begin
Rec.VAT := Rec."Unit Price" * Rec."Return/Replace";
if (Rec."Return/Replace" > rec.Quantity) or (Rec."Return/Replace" < 0) then begin Error('Please provide valid Return/Replace quantity');
end;