web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Prev Day Sale on Role Center

(0) ShareShare
ReportReport
Posted on by 224

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;
                }
}

}

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    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.

    www.yammer.com/dynamicsnavdev

    www.dynamicsuser.net/.../14

    I will open this up to the community in case they have something to add.

    Thanks.

  • JAngle Profile Picture
    133 on at

    What is the code for the new field on the table? The page extension doesn’t reveal much.

  • LearnBC Profile Picture
    224 on at

    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;
    }
    
    
    

  • Suggested answer
    JAngle Profile Picture
    133 on at

    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

  • LearnBC Profile Picture
    224 on at

    Pls anyone tell me what is the issue in this code. i want to get last working day/or last posting day sales only

    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";
                        begin
                            // Clear(CustLedEntry);
                            // CustLedEntry.Reset();

                            // //   if (CustLedEntry."Global Dimension 1 Code" = 'SSD') or (CustLedEntry."Global Dimension 1 Code" = 'HID') or (CustLedEntry."Global Dimension 1 Code" = 'IND') then begin
                            // CustLedEntry.SetFilter("Global Dimension 1 Code", '%1|%2|%3', 'SSD', 'IND', 'HID');
                            // CustLedEntry.SetRange("Posting Date", CalcDate('-6M', Today));

                            Clear(CustLedEntrylist);
                            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

                                CustLedEntrylist.SETTABLEVIEW(CustLedEntry);

                                CustLedEntrylist.Run();
                                CustLedEntrylist.Close();

                            end;


                        end;
                    }
                }

            }
        }

        trigger OnAfterGetCurrRecord()
        var
            CustLedEntry: Record "Cust. Ledger Entry";
            CustLedEntrylist: Page "Customer Ledger Entries";
        begin
            // CustLedEntry.SetFilter("Global Dimension 1 Code", '%1|%2|%3', 'SSD', 'IND', 'HID');
            // CustLedEntry.SetAscending("Posting Date", false);

            Clear(CustLedEntrylist);
            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

                CustLedEntrylist.SETTABLEVIEW(CustLedEntry);

                CustLedEntrylist.RunModal();

            end;

        end;

        var

            LastDaySalevar: Decimal;
            style: Text;
    }
  • Suggested answer
    Vaishnavi J Profile Picture
    3,062 on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans