Skip to content

Commit

Permalink
Added page extension for Sales Order page to display customer sales d…
Browse files Browse the repository at this point in the history
…etails,

created a query to retrieve customer sales by quantity, and developed a codeunit
to filter and display customer sales greater than 10.
  • Loading branch information
kibexd committed Jun 20, 2024
1 parent 338fa23 commit 5372ab3
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 10 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Path":"","Timestamp":1717751496500,"Items":[],"CreatedwithVersion":"0.2.4"}
{"Path":"","Timestamp":1718884524409,"Items":[],"CreatedwithVersion":"0.2.4"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Path":"","Timestamp":1717751496500,"Items":[],"CreatedwithVersion":"0.2.4"}
{"Path":"","Timestamp":1718884524409,"Items":[],"CreatedwithVersion":"0.2.4"}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"server": "http://localhost:8080/BC210/",
"serverInstance": "BC210",
"authentication": "Windows",
"startupObjectId": 50108,
"startupObjectType": "Query",
"startupObjectId": 42,
"startupObjectType": "Page",
"breakOnError": "All",
"launchBrowser": true,
"enableLongRunningSqlStatements": true,
Expand Down
26 changes: 26 additions & 0 deletions Codeunit Query.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This is a codeunit to filter and display customer sales greater than 10.
codeunit 50107 MyCodeunit
{
// This is the main trigger that gets executed when the codeunit is run.
trigger OnRun()
begin
// We're setting a filter on the CustomerQuery to only include records where the Quantity is greater than 10.
CustomerQuery.SetFilter(Quantity, '>10');
// We're opening the query to prepare it for reading.
CustomerQuery.Open();
// We're reading each record in the query and executing the code inside the loop.
while CustomerQuery.Read do begin
// We're displaying a message for each record, showing the customer name and quantity.
Message(Textbox, CustomerQuery.CustName, CustomerQuery.Quantity);
end;
// We're closing the query after it has been processed.
CustomerQuery.Close();
end;

// This is a variable declaration for the query.
var
CustomerQuery: Query "Customer Sales by quantity";

// This is a variable declaration for the message format.
Textbox: TextConst ENU = 'Customer name = %1, Quantity =%2,';
}
Binary file modified Default Publisher_ALM_1.0.0.0.app
Binary file not shown.
34 changes: 34 additions & 0 deletions Pageextension Query codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pageextension 50107 SalesCustomer extends "Sales Order"
{
layout
{
// Add changes to page layout here
}

actions
{
addafter(AssemblyOrders)
{
action("Customer Sales Quantity")
{
ApplicationArea = All;
Caption = 'Customer Details';
Image = Customer;
Promoted = true;
PromotedCategory = New;

trigger OnAction()
var
MyCodeunit: Codeunit 50107;
begin
Clear(MyCodeunit);
MyCodeunit.Run();
end;
}
}
// Add changes to page actions here
}

var
myInt: Integer;
}
2 changes: 2 additions & 0 deletions Query Sales Volume.al
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This is a query to retrieve customer sales by quantity.
query 50108 "Customer Sales by quantity"
{
// This specifies the type of query. In this case, it's a normal query.
Expand All @@ -6,6 +7,7 @@ query 50108 "Customer Sales by quantity"
// This sorts the query results in descending order by the Quantity column.
OrderBy = descending(Quantity);

// This defines the elements of the query.
elements
{
// This data item is for the Customer table.
Expand Down

0 comments on commit 5372ab3

Please sign in to comment.