Please try something like this.
procedure Warehousestats()
var
rec_SalesHeader: Record "Sales Header";
rec_SalesLine: Record "Sales Line";
en_DocumentType: Enum "Sales Document Type";
en_status: Enum "Sales Document Status";
Status: Text;
begin
rec_SalesHeader.SetRange("Document Type", en_DocumentType::Order);
rec_SalesHeader.SetFilter("Order Date", '=%1', Today);
if rec_SalesHeader.FindSet() then
repeat
rec_SalesLine.SetRange("Document Type", rec_SalesHeader."Document Type");
rec_SalesLine.SetRange("Document No.", rec_SalesHeader."No.");
rec_SalesLine.SetRange(Type, rec_SalesLine.Type::Item); //change as per your requirement
rec_SalesLine.SetRange("Completely Shipped", false);
if rec_SalesLine.IsEmpty then begin
Message('%1 Complete', rec_SalesHeader."No.");
exit;
end;
rec_SalesLine.SetFilter("Quantity Shipped", '<>%1', 0);
if not rec_SalesLine.IsEmpty then begin
Message('%1 Picked', rec_SalesHeader."No.");
exit;
end;
if rec_SalesHeader.Status = en_status::Open then
Message('%1 OPEN', rec_SalesHeader."No.");
until rec_SalesHeader.Next() = 0;
end;