Announcements
Hello,
am trying to bring Previous Day Sale into the Cue Activites. pls correct if am doing wrong. right now am not getting it
pageextension 60102 "Last Day Sale" extends "O365 Activities" { Caption = 'Activities'; layout { // Add changes to page layout here } actions { } } cuegroup(Control54) { CueGroupLayout = Wide; ShowCaption = false; field("Previous Day Sale";Rec.Preious Day Sale); { ApplicationArea = Basic, Suite; DrillDownPageID = "Posted Sales Invoices "; ToolTip = 'Specifies the sum of sales in the Last Working Day'; trigger OnDrillDown() begin ActivitiesMgt.DrillDownPostedSalesInvoice; end; } } }
Hi,
You can write the below logic .
Page 60113 "LastDaySale"
{
PageType = CardPart;
RefreshOnActivate = true;
layout
{
area(Content)
{
cuegroup(cuegroup1)
{
Caption = 'Previous Day Sale';
field(LastDaySale; LastDaySalevar)
{
Caption = 'Prev Day Sale';
ApplicationArea = All;
StyleExpr = Style;
Lookup = true;
trigger OnDrillDown()
var
CustLedEntry: Record "Cust. Ledger Entry";
CustLedEntrylist: Page "Customer Ledger Entries";
CustLedEntry1: Record "Cust. Ledger Entry";
begin
Clear(CustLedEntry);
CustLedEntry.Reset();
Clear(CustLedEntry1);
CustLedEntry1.Reset();
Clear(CustLedEntrylist);
CustLedEntry.SetCurrentKey("Posting Date", "Global Dimension 1 Code");
CustLedEntry.SetFilter("Global Dimension 1 Code", '%1|%2|%3', 'SSD', 'IND', 'HID');
CustLedEntry.SetAscending("Posting Date", false);
// CustLedEntry.SetRange("Posting Date", CustLedEntry."Posting Date");
IF CustLedEntry.FindFirst() THEN BEGIN
CustLedEntry1.SetRange("Posting Date", CustLedEntry."Posting Date");
CustLedEntry1.SetFilter("Global Dimension 1 Code", '%1|%2|%3', 'SSD', 'IND', 'HID');
CustLedEntrylist.SETTABLEVIEW(CustLedEntry1);
CustLedEntrylist.Run();
end;
end;
}
}
}
}
trigger OnAfterGetCurrRecord()
var
CustLedEntry: Record "Cust. Ledger Entry";
CustLedEntry1: Record "Cust. Ledger Entry";
CustLedEntrylist: Page "Customer Ledger Entries";
begin
Clear(CustLedEntrylist);
Clear(CustLedEntry);
CustLedEntry.Reset();
Clear(CustLedEntry1);
CustLedEntry1.Reset();
Clear(LastDaySaleVar);
CustLedEntry.SetCurrentKey("Posting Date");
CustLedEntry.SetFilter("Global Dimension 1 Code", '%1|%2|%3', 'SSD', 'IND', 'HID');
CustLedEntry.SetAscending("Posting Date", false);
IF CustLedEntry.FindFirst() THEN begin
CustLedEntry1.SetRange("Posting Date", CustLedEntry."Posting Date");
CustLedEntry1.SetAutoCalcFields("Amount (LCY)");
if CustLedEntry1.FindSet() then
repeat
LastDaySaleVar := CustLedEntry1."Amount (LCY)" + LastDaySalevar;
until CustLedEntry1.Next() = 0;
end;
end;
var
LastDaySalevar: Decimal;
style: Text;
}
If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much
Pls anyone tell me what is the issue in this code. i want to get last working day/or last posting day sales only
Codeunit 1311 "Activities Mgt." is used in conjunction to the table and page. The codeunit runs a function called RefreshActivitiesCueData which then iterates through various fields to give them values for the user. the one to copy is probably CalcSalesThisMonthAmount as that eventually results in a filter on the customer ledger entry table. This approach is long winded so you might want to try an easier method. This blog discusses some: businesscentralgeek.com/2-ways-to-create-cues
tableextension 60100 "Last Day Sale RC" extends "Activities Cue" { fields { field(55003; LastDaySale; Decimal) { AutoFormatExpression = GetAmountFormats(); AutoFormatType = 11; Caption = 'Previous Day Sale'; DecimalPlaces = 0 : 0; } } procedure GetAmountFormats(): Text var GeneralLedgerSetup: Record "General Ledger Setup"; UserPersonalization: Record "User Personalization"; CurrencySymbol: Text[10]; begin GeneralLedgerSetup.Get(); CurrencySymbol := GeneralLedgerSetup.GetCurrencySymbol; if UserPersonalization.Get(UserSecurityId) and (CurrencySymbol <> '') then case UserPersonalization."Locale ID" of 1030, // da-DK 1053, // sv-Se 1044: // no-no exit('' CurrencySymbol); 2057, // en-gb 1033, // en-us 4108, // fr-ch 1031, // de-de 2055, // de-ch 1040, // it-it 2064, // it-ch 1043, // nl-nl 2067, // nl-be 2060, // fr-be 3079, // de-at 1035, // fi 1034: // es-es exit(CurrencySymbol ''); end; exit(GetDefaultAmountFormat); end; local procedure GetDefaultAmountFormat(): Text begin exit(''); end; }
What is the code for the new field on the table? The page extension doesn’t reveal much.
Hello,
We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.
I will open this up to the community in case they have something to add.
Thanks.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156