- Setting up temporary table
- name: "InvoiceQueryStatus"
- fields: "No.", "Job No.", "Amount"
- Setting up the queries
- name1: "Purchase Invoice Overdue"
- name2: "Sales Invoice Overdue"
- remark: both with identical column names
- Setting up the page as in the following
page 50001 InvoiceStatus
{
ApplicationArea = All;
PageType = List;
SourceTable = InvoiceQueryStatus;
UsageCategory = ReportsAndAnalysis;
layout
{
area(Content)
{
repeater(General)
{
field(No; Rec."Job No.")
{}
field(Amount; Rec.Amount)
{}
}
}
}
actions
{
area(Processing)
{
action("Purchase Overdue")
{
trigger OnAction()
var
InvoiceQuery: Query "Purchase Invoice Overdue";
begin
if Rec.Next() > 0 then begin
Rec.DeleteAll();
end;
if InvoiceQuery.Open() then begin
while InvoiceQuery.Read() do begin
Rec.Init();
Rec."No." := Rec."No." + 1;
Rec."Job No." := InvoiceQuery.JobNo;
Rec.Amount := InvoiceQuery.Amount;
Rec.Insert();
end;
InvoiceQuery.Close();
end;
end;
}
action("Sales Overdue")
{
trigger OnAction()
begin
SalesOverdue();
end;
}
}
}
trigger OnOpenPage()
begin
SalesOverdue();
end;
local procedure SalesOverdue()
var
InvoiceQuery: Query "Sales Invoice Overdue";
begin
if Rec.IsEmpty() <> true then begin
Rec.DeleteAll();
end;
if InvoiceQuery.Open() then begin
while InvoiceQuery.Read() do begin
Rec.Init();
Rec."No." := Rec."No." + 1;
Rec."Job No." := InvoiceQuery.JobNo;
Rec.Amount := InvoiceQuery.Amount;
Rec.Insert();
end;
InvoiceQuery.Close();
end;
end;
}