microsoft / microsoft/BCApps

[Bug]: report 109 "Customer - Summary Aging Simp." - TotalCustBalanceLCY

Open
#8,710 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved Bug Team: SCM
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Describe the issue

TotalCustBalanceLCY in report 109 "Customer - Summary Aging Simp." is accumulated.
This vairabel needs to be cleared to show the correct balance per customer.

            trigger OnAfterGetRecord()
            var
                FilteredCustomer: Record Customer;
                ShouldSkipCustomer: Boolean;
            begin
                // >>>>>>>>>>>>
                TotalCustBalanceLCY := 0;
                // <<<<<<<<<<<<
                FilteredCustomer.CopyFilters(Customer);
                FilteredCustomer.SetFilter("Date Filter", '..%1', StartDate);
                FilteredCustomer.SetRange("No.", "No.");
                ShouldSkipCustomer := FilteredCustomer.IsEmpty();
                OnCustomerOnAfterGetRecordOnAfterCalcShouldSkipCustomer(Customer, FilteredCustomer, DtldCustLedgEntry, CustBalanceDueLCY, PrintCust, ShouldSkipCustomer);
                if ShouldSkipCustomer then
                    CurrReport.Skip();

                PrintCust := false;
                for i := 1 to 5 do begin
                    DtldCustLedgEntry.SetCurrentKey("Customer No.", "Initial Entry Due Date", "Posting Date");
                    DtldCustLedgEntry.SetRange("Customer No.", "No.");
                    DtldCustLedgEntry.SetRange("Posting Date", 0D, StartDate);
                    DtldCustLedgEntry.SetRange("Initial Entry Due Date", PeriodStartDate[i], PeriodStartDate[i + 1] - 1);
                    OnAfterGetRecordOnAfterDtldCustLedgEntrySetFilters(DtldCustLedgEntry);
                    DtldCustLedgEntry.CalcSums("Amount (LCY)");
                    CustBalanceDueLCY[i] := DtldCustLedgEntry."Amount (LCY)";
                    if CustBalanceDueLCY[i] <> 0 then
                        PrintCust := true;
                    TotalCustBalanceLCY := TotalCustBalanceLCY + CustBalanceDueLCY[i];
                end;
                if not PrintCust then
                    CurrReport.Skip();
            end;
Expected behavior

Show the total per customer, not accumulated totals for all customers.

Steps to reproduce

Print the report with multiple customers

Additional context

No response

I will provide a fix for a bug
  • I will provide a fix for a bug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with report 109, Customer - Summary Aging Simp., and its OnAfterGetRecord trigger shown in the issue. Reproduce the report with multiple customers and inspect how TotalCustBalanceLCY is handled for each customer; done means the output shows each customer's total rather than an accumulated total across customers.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.