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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Request page on AL not matching what was on CAL

(0) ShareShare
ReportReport
Posted on by 2
Hello,
I am trying to achieve the below on AL
 
 
my AL code is as below
 
 
report 72162587 /Payroll Summary Cumulative/
{
    DefaultLayout = RDLC;
    RDLCLayout = './PayrollSummaryCumulative.rdlc';
 
    dataset
    {
        dataitem(Employee; Employee)
        {
            PrintOnlyIfDetail = true;
            column(EmployeeNo; Employee./No./)
            {
            }
            column(Name; Name)
            {
            }
            column(EDname11; EDname[11])
            {
            }
            column(EDname1; EDname[1])
            {
            }
            column(EDname2; EDname[2])
            {
            }
            column(EDname3; EDname[3])
            {
            }
            column(EDname4; EDname[4])
            {
            }
            column(EDname5; EDname[5])
            {
            }
            column(EDname6; EDname[6])
            {
            }
            column(EDname7; EDname[7])
            {
            }
            column(EDname8; EDname[8])
            {
            }
            column(EDname9; EDname[9])
            {
            }
            column(EDname10; EDname[10])
            {
            }
            column(gvcostcentrecode; gvcostcentrecode)
            {
            }
            dataitem(/Payroll Header/; /Payroll Header/)
            {
                DataItemLink = /Employee no./ = FIELD(/No./);
                PrintOnlyIfDetail = true;
                dataitem(/Payroll Line/; /Payroll Lines/)
                {
                    DataItemLink = /Payroll ID/ = FIELD(/Payroll ID/),
                                   /Employee No./ = FIELD(/Employee no./);
                    RequestFilterFields = /Posting Date/;
                    column(PostingDate_PayrollLine; /Payroll Line/./Posting Date/)
                    {
                    }
                    column(DateFilter; /Payroll Line/.GETFILTER(/Posting Date/))
                    {
                    }
                    column(Region; RegionFilter)
                    {
                    }
                    column(EDAmount1; EDAmount[1])
                    {
                    }
                    column(EDAmount2; EDAmount[2])
                    {
                    }
                    column(EDAmount3; EDAmount[3])
                    {
                    }
                    column(EDAmount4; EDAmount[4])
                    {
                    }
                    column(EDAmount5; EDAmount[5])
                    {
                    }
                    column(EDAmount6; EDAmount[6])
                    {
                    }
                    column(EDAmount7; EDAmount[7])
                    {
                    }
                    column(EDAmount8; EDAmount[8])
                    {
                    }
                    column(EDAmount9; EDAmount[9])
                    {
                    }
                    column(EDAmount10; EDAmount[10])
                    {
                    }
                    column(EDAmount11; EDAmount[11])
                    {
                    }
 
                    trigger OnAfterGetRecord()
                    begin
                        i := 1;
                        REPEAT
                            IF EDcode[i] <> '' THEN
                                IF EDcode[i] = /Payroll Line/./ED Code/ THEN BEGIN
                                    EDDefinition.RESET;
                                    IF EDDefinition.GET(EDcode[i]) THEN BEGIN
                                        EDAmount[i] := EDAmount[i] + /Payroll Line/.Amount;
                                        TotEDAmount[i] := TotEDAmount[i] + /Payroll Line/.Amount;
                                        IF EDDefinition./Calculation Group/ = EDDefinition./Calculation Group/::Payments THEN BEGIN
                                            SumEarnings := SumEarnings + /Payroll Line/.Amount;
 
                                        END;
 
                                    END;
                                END;
                            IF EDcode[i + 5] <> '' THEN
                                IF EDcode[i + 5] = /Payroll Line/./ED Code/ THEN BEGIN
                                    EDDefinition.RESET;
                                    IF EDDefinition.GET(EDcode[i + 5]) THEN BEGIN
                                        EDAmount[i + 5] := EDAmount[i + 5] + /Payroll Line/.Amount;
                                        TotEDAmount[i + 5] := TotEDAmount[i + 5] + /Payroll Line/.Amount;
 
                                        IF EDDefinition./Calculation Group/ = EDDefinition./Calculation Group/::Deduction THEN BEGIN
                                            SumDeductions := SumDeductions + /Payroll Line/.Amount;
                                        END;
 
                                    END;
                                END;
 
                            i += 1;
                        UNTIL i = 5;


 
                        EDAmount[5] := TotalEarnings - SumEarnings;
                        EDAmount[10] := TotalDeductions - SumDeductions;
                        EDAmount[11] := NetSalary;
                    end;
                }
 
                trigger OnPostDataItem()
                begin
                    TotEDAmount[5] := TotEDAmount[5] + EDAmount[5];
                    TotEDAmount[10] := TotEDAmount[10] + EDAmount[10];
                    TotEDAmount[11] := TotEDAmount[11] + EDAmount[11];
                end;
            }
 
            trigger OnPreDataItem()
            begin
                i := 1;
                REPEAT
                    IF EDcode[i] <> '' THEN BEGIN
                        EDDefinition.RESET;
                        IF EDDefinition.GET(EDcode[i]) THEN
                            EDname[i] := EDDefinition.Description;
 
                    END;
                    IF EDcode[i + 5] <> '' THEN BEGIN
                        EDDefinition.RESET;
                        IF EDDefinition.GET(EDcode[i + 5]) THEN
                            EDname[i + 5] := EDDefinition.Description;
                    END;
 
                    i += 1;
                UNTIL i = 5;
                EDname[5] := 'Other Earnings';
 
                EDname[10] := 'Other Deductions';
                EDname[11] := 'Net Salary';
            end;
 
            trigger OnAfterGetRecord()
            begin
                gvcostcentrecode := '';
                CLEAR(EDAmount);
                CLEAR(SumEarnings);
                CLEAR(SumDeductions);
                Name := Employee.FullName;


 
                Employee.SETFILTER(Employee./Calculation Group Filter/, '1');
                Employee.SETFILTER(Employee./Date Filter/, DateRange);
                Employee.CALCFIELDS(Employee.Amount);
                TotalEarnings := Employee.Amount;
 
                Employee.SETFILTER(Employee./Calculation Group Filter/, '3');
                Employee.CALCFIELDS(Employee.Amount);
                TotalDeductions := Employee.Amount;
 
                NetSalary := TotalEarnings - TotalDeductions;
 
                //REGIONS Dimension
                IF RegionFilter <> '' THEN BEGIN
                    DefaultDimension.RESET;
                    DefaultDimension.SETFILTER(DefaultDimension./Table ID/, '5200');
                    DefaultDimension.SETFILTER(DefaultDimension./No./, Employee./No./);
                    DefaultDimension.SETFILTER(/Dimension Code/, 'REGIONS');
                    DefaultDimension.SETFILTER(/Dimension Value Code/, RegionFilter);
 
                    IF DefaultDimension.FIND('-') THEN
                        gvRegion := DefaultDimension./Dimension Value Code/
                    ELSE
                        CurrReport.SKIP;
                END;
 
                //REGIONS Dimension
                IF CostCenterFilter <> '' THEN BEGIN
                    DefaultDimension.RESET;
                    DefaultDimension.SETFILTER(DefaultDimension./Table ID/, '5200');
                    DefaultDimension.SETFILTER(DefaultDimension./No./, Employee./No./);
                    DefaultDimension.SETFILTER(/Dimension Code/, 'COSTCENTER');
                    DefaultDimension.SETFILTER(/Dimension Value Code/, CostCenterFilter);
 
                    IF DefaultDimension.FIND('-') THEN
                        gvcostcentrecode := DefaultDimension./Dimension Value Code/
                    ELSE
                        CurrReport.SKIP;
                END;
            end;
        }
        dataitem(Integer; Integer)
        {
            DataItemTableView = WHERE(Number = CONST(1));
            column(TotEDAmount1; TotEDAmount[1])
            {
            }
            column(TotEDAmount2; TotEDAmount[2])
            {
            }
            column(TotEDAmount3; TotEDAmount[3])
            {
            }
            column(TotEDAmount4; TotEDAmount[4])
            {
            }
            column(TotEDAmount5; TotEDAmount[5])
            {
            }
            column(TotEDAmount6; TotEDAmount[6])
            {
            }
            column(TotEDAmount7; TotEDAmount[7])
            {
            }
            column(TotEDAmount8; TotEDAmount[8])
            {
            }
            column(TotEDAmount9; TotEDAmount[9])
            {
            }
            column(TotEDAmount10; TotEDAmount[10])
            {
            }
            column(TotEDAmount11; TotEDAmount[11])
            {
            }
        }
    }
 
    requestpage
    {
 
        layout
        {
            area(content)
            {
                group(/ED filters/)
                {
                    Caption = 'ED filters';
                    field(/EDcode 1/; EDcode[1])
                    {
                        Caption = 'Earning 1';
                        TableRelation = /ED Definitions/;
                    }
                    field(/EDcode 2/; EDcode[2])
                    {
                        Caption = 'Earning 2';
                        TableRelation = /ED Definitions/;
                    }
                    field(/EDcode 3/; EDcode[3])
                    {
                        Caption = 'Earning 3';
                        TableRelation = /ED Definitions/;
                    }
                    field(/EDcode 4/; EDcode[4])
                    {
                        Caption = 'Earning 4';
                        TableRelation = /ED Definitions/;
                    }
                    field(/EDcode 6/; EDcode[6])
                    {
                        Caption = 'Deduction 1';
                        TableRelation = /ED Definitions/;
                    }
                    field(/EDcode 7/; EDcode[7])
                    {
                        Caption = 'Deduction 2';
                        TableRelation = /ED Definitions/;
                    }
                    field(/EDcode 8/; EDcode[8])
                    {
                        Caption = 'Deduction 3';
                        TableRelation = /ED Definitions/;
                    }
                    field(/EDcode 9/; EDcode[9])
                    {
                        Caption = 'Deduction 4';
                        TableRelation = /ED Definitions/;
                    }
                    group(/Dimension Filters/)
                    {
                        Caption = 'Dimension Filters';
                        field(RegionFilter; RegionFilter)
                        {
                            Caption = 'Region';
                            TableRelation = /Dimension Value/.Code WHERE(/Dimension Code/ = FILTER('REGIONS'));
                        }
                        field(CostCenterFilter; CostCenterFilter)
                        {
                            Caption = 'Cost Centre';
                            TableRelation = /Dimension Value/.Code WHERE(/Dimension Code/ = FILTER('COSTCENTER'));
                        }
                    }
                }
            }
        }
 
        actions
        {
        }
    }
 
    labels
    {
    }
 
    trigger OnPreReport()
    begin
 
        DateRange := /Payroll Line/.GETFILTER(/Payroll Line/./Posting Date/);
    end;
 
    var
        Name: Text[50];
        TransportAllowance: Code[20];
        Otherallowances: Code[20];
        PFEmployer: Code[20];
        PFEmployee: Code[20];
        OtherEarnings: Code[20];
        IncomeTax: Code[20];
        PFLoanDeduction: Code[20];
        MedicalTreatment: Code[20];
        OtherDeductions: Code[20];
        BasicSalaryED: Code[20];
        PayrollLine: Record /Payroll Lines/;
        PayrollLine1: Record /Payroll Lines/;
        PayrollLine2: Record /Payroll Lines/;
        TransportAmountM: Decimal;
        TransportAmount: Decimal;
        AllowancesAmountM: Decimal;
        AllowancesAmount: Decimal;
        OtherEarningsAmountM: Decimal;
        OtherEarningsAmount: Decimal;
        TaxAmountM: Decimal;
        TaxAmount: Decimal;
        PFDeductionAmountM: Decimal;
        PFDeductionAmount: Decimal;
        MedicalAmountM: Decimal;
        MedicalAmount: Decimal;
        DeductionsAmountM: Decimal;
        DeductionsAmount: Decimal;
        PayrollSetup: Record /USL Payroll Setup/;
        LoansAdvance: Record /LoansAdvances/;
        PayrollHeader: Record /Payroll Header/;
        NetSalaryM: Decimal;
        NetSalary: Decimal;
        BasicSalaryM: Decimal;
        BasicSalary: Decimal;
        DefaultDimension: Record 352;
        RegionFilter: Code[20];
        gvRegion: Code[20];
        PFEmployeeAmtM: Decimal;
        PFEmployeeAmt: Decimal;
        PFEmployerAmtM: Decimal;
        PFEmployerAmt: Decimal;
        SumEarningsM: Decimal;
        SumEarnings: Decimal;
        SumDeductionsM: Decimal;
        SumDeductions: Decimal;
        EDDefinition: Record /ED Definitions/;
        TotalEarningsM: Decimal;
        TotalEarnings: Decimal;
        TotalDeductionsM: Decimal;
        TotalDeductions: Decimal;
        DateFilter: Date;
        DateRange: Text[30];
        TotalBasicSalary: Decimal;
        TotalTransportAllowance: Decimal;
        TotalOtherallowances: Decimal;
        TotalPFEmployer: Decimal;
        TotalPFEmployee: Decimal;
        TotalIncomeTax: Decimal;
        TotalPFLoanDeduction: Decimal;
        TotalMedicalTreatment: Decimal;
        TotalNetSalary: Decimal;
        OtherEarningsTotalG: Decimal;
        TotalEarningsG: Decimal;
        TotalDeductionsG: Decimal;
        OtherDeductionTotalG: Decimal;
        EDname: array[20] of Text;
        EDcode: array[20] of Code[20];
        EDAmount: array[20] of Decimal;
        i: Integer;
        TotEDAmount: array[20] of Decimal;
        CostCenterFilter: Code[20];
        gvcostcentrecode: Code[20];
 
}
 
On BC this is what I get
 
I have the same question (0)
  • Verified answer
    Mohamed Amine Mahmoudi Profile Picture
    26,803 Super User 2026 Season 1 on at
    Hi,
     
    you must add ApplicationArea in requestpage fields
    for e.g.
    field("EDcode 1"; EDcode[1])
    {
        Caption = 'Earning 1';
        TableRelation = "ED Definitions";
        ApplicationArea = All,
    }
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,419 User Group Leader on at
    Hi,
     
    As suggested earlier you can either set Application area to each field in Request page.
     
    OR
     
    If you are on latest version, then in Top of the report Set ApplicationArea = All;
    With this you don't have to set it on individual columns.
     
    Regards,
    Saurav Dhyani

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 953 Super User 2026 Season 1

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 559 Super User 2026 Season 1

#3
YUN ZHU Profile Picture

YUN ZHU 518 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans