You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
procedure CalcCellValue(AccSchedLine: Record "Acc. Schedule Line"; ColumnLayout: Record "Column Layout"; CalcAddCurr: Boolean) Result: Decimal
var
GLAcc: Record "G/L Account";
GLAccountCategory: Record "G/L Account Category";
CostType: Record "Cost Type";
CFAccount: Record "Cash Flow Account";
GLAccCategoriesToVisit: Record "G/L Acc. Cat. Buffer";
GLAccCategoriesVisited: Record "G/L Acc. Cat. Buffer";
GLAccCatCode: Integer;
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeCalcCellValue(AccSchedLine, ColumnLayout, CalcAddCurr, Result, IsHandled, AccountScheduleLine, TempAccSchedCellValue);
if not IsHandled then begin
if AccSchedLine.Totaling = '' then
exit(Result);
if TempAccSchedCellValue.Get(AccSchedLine."Line No.", ColumnLayout."Line No.") then begin
Result := TempAccSchedCellValue.Value;
DivisionError := DivisionError or TempAccSchedCellValue."Has Error";
PeriodError := PeriodError or TempAccSchedCellValue."Period Error";
end else begin
if ColumnLayout."Column Type" = ColumnLayout."Column Type"::Formula then
Result :=
EvaluateExpression(
false, ColumnLayout.Formula, AccSchedLine, ColumnLayout, CalcAddCurr)
else
if AccSchedLine."Totaling Type" in
[AccSchedLine."Totaling Type"::Formula, AccSchedLine."Totaling Type"::"Set Base For Percent"]
then
Result :=
EvaluateExpression(
true, AccSchedLine.Totaling, AccSchedLine, ColumnLayout, CalcAddCurr)
else
if (StartDate = 0D) or (EndDate = 0D) or (EndDate = DMY2Date(31, 12, 9999)) then begin
Result := 0;
PeriodError := true;
end else
case AccSchedLine."Totaling Type" of
AccSchedLine."Totaling Type"::"Posting Accounts",
AccSchedLine."Totaling Type"::"Total Accounts":
begin
AccSchedLine.CopyFilters(AccountScheduleLine);
SetGLAccRowFilters(GLAcc, AccSchedLine);
SetGLAccColumnFilters(GLAcc, AccSchedLine, ColumnLayout);
if (AccSchedLine."Totaling Type" = AccSchedLine."Totaling Type"::"Posting Accounts") and
(StrLen(AccSchedLine.Totaling) <= MaxStrLen(GLAcc.Totaling)) and (StrPos(AccSchedLine.Totaling, '*') = 0)
then begin
GLAcc."Account Type" := GLAcc."Account Type"::Total;
GLAcc.Totaling := AccSchedLine.Totaling;
Result := Result + CalcGLAcc(GLAcc, AccSchedLine, ColumnLayout, CalcAddCurr);
end else
if GLAcc.Find('-') then
repeat
Result := Result + CalcGLAcc(GLAcc, AccSchedLine, ColumnLayout, CalcAddCurr);
until GLAcc.Next() = 0;
end;
AccSchedLine."Totaling Type"::"Cost Type",
AccSchedLine."Totaling Type"::"Cost Type Total":
begin
AccSchedLine.CopyFilters(AccountScheduleLine);
SetCostTypeRowFilters(CostType, AccSchedLine, ColumnLayout);
SetCostTypeColumnFilters(CostType, AccSchedLine, ColumnLayout);
if (AccSchedLine."Totaling Type" = AccSchedLine."Totaling Type"::"Cost Type") and
(StrLen(AccSchedLine.Totaling) <= MaxStrLen(GLAcc.Totaling)) and (StrPos(AccSchedLine.Totaling, '*') = 0)
then begin
CostType.Type := CostType.Type::Total;
CostType.Totaling := AccSchedLine.Totaling;
Result := Result + CalcCostType(CostType, AccSchedLine, ColumnLayout, CalcAddCurr);
end else
if CostType.Find('-') then
repeat
Result := Result + CalcCostType(CostType, AccSchedLine, ColumnLayout, CalcAddCurr);
until CostType.Next() = 0;
end;
AccSchedLine."Totaling Type"::"Cash Flow Entry Accounts",
AccSchedLine."Totaling Type"::"Cash Flow Total Accounts":
begin
AccSchedLine.CopyFilters(AccountScheduleLine);
SetCFAccRowFilter(CFAccount, AccSchedLine);
SetCFAccColumnFilter(CFAccount, AccSchedLine, ColumnLayout);
if (AccSchedLine."Totaling Type" = AccSchedLine."Totaling Type"::"Cash Flow Entry Accounts") and
(StrLen(AccSchedLine.Totaling) <= 30)
then begin
CFAccount."Account Type" := CFAccount."Account Type"::Total;
CFAccount.Totaling := AccSchedLine.Totaling;
Result := Result + CalcCFAccount(CFAccount, AccSchedLine, ColumnLayout);
end else
if CFAccount.Find('-') then
repeat
Result := Result + CalcCFAccount(CFAccount, AccSchedLine, ColumnLayout);
until CFAccount.Next() = 0;
end;
AccSchedLine."Totaling Type"::"Account Category":
begin
AccSchedLine.CopyFilters(AccountScheduleLine);
GLAccountCategory.Reset();
GLAccountCategory.SetFilter("Entry No.", AccSchedLine.Totaling);
if GLAccountCategory.FindSet() then
repeat
GLAccCategoriesToVisit."Entry No." := GLAccountCategory."Entry No.";
GLAccCategoriesToVisit.Insert();
until GLAccountCategory.Next() = 0;
while GLAccCategoriesToVisit.Count() > 0 do begin
GLAccCategoriesToVisit.FindFirst();
GLAccCatCode := GLAccCategoriesToVisit."Entry No.";
GLAcc.Reset();
GlAcc.SetRange("Account Type", GlAcc."Account Type"::Posting);
GlAcc.SetRange("Account Subcategory Entry No.", GLAccCatCode);
SetGLAccColumnFilters(GLAcc, AccSchedLine, ColumnLayout);
if GLAcc.FindSet() then
repeat
GLAcc.CalcFields(Balance);
Result := Result + CalcGLAcc(GLAcc, AccSchedLine, ColumnLayout, CalcAddCurr);
until GLAcc.Next() = 0;
GLAccCategoriesVisited."Entry No." := GLAccCatCode;
GLAccCategoriesVisited.Insert();
GLAccountCategory.Reset();
GLAccountCategory.SetRange("Parent Entry No.", GLAccCatCode);
if GLAccountCategory.FindSet() then
repeat
if (not GLAccCategoriesVisited.Get(GLAccountCategory."Entry No.")) and (not GLAccCategoriesToVisit.Get(GLAccountCategory."Entry No.")) then begin
GLAccCategoriesToVisit."Entry No." := GLAccountCategory."Entry No.";
GLAccCategoriesToVisit.Insert();
end;
until GLAccountCategory.Next() = 0;
GLAccCategoriesToVisit."Entry No." := GLAccCatCode;
GLAccCategoriesToVisit.Delete();
end;
end
//---------------------------------------------------------OnCalcCellValueOnElseTotalingType:BEGIN
else
OnCalcCellValueOnElseTotalingType(AccSchedLine, AccountScheduleLine, ColumnLayout, Result);
//---------------------------------------------------------OnCalcCellValueOnElseTotalingType:END
end;
OnAfterCalcCellValue(AccSchedLine, ColumnLayout, Result, AccountScheduleLine, GLAcc);
TempAccSchedCellValue."Row No." := AccSchedLine."Line No.";
TempAccSchedCellValue."Column No." := ColumnLayout."Line No.";
TempAccSchedCellValue.Value := Result;
TempAccSchedCellValue."Has Error" := DivisionError;
TempAccSchedCellValue."Period Error" := PeriodError;
TempAccSchedCellValue.Insert();
end;
end;
OnCalcCellValueOnBeforeExit(AccSchedLine, ColumnLayout, CalcAddCurr, StartDate, EndDate, Result);
end;
//---------------------------------------------------------OnCalcCellValueOnElseTotalingType:BEGIN
[IntegrationEvent(true, false)]
local procedure OnCalcCellValueOnElseTotalingType(AccSchedLine: Record "Acc. Schedule Line"; AccountScheduleLine: Record "Acc. Schedule Line"; var ColumnLayout: Record "Column Layout"; var Result: Decimal)
begin
end;
//---------------------------------------------------------OnCalcCellValueOnElseTotalingType:END
Additional context
We have another option for "Totaling Type" and we need calculated it.
Internal work item: AB#562614
The text was updated successfully, but these errors were encountered:
Describe the request
Please add new event
Additional context
We have another option for "Totaling Type" and we need calculated it.
Internal work item: AB#562614
The text was updated successfully, but these errors were encountered: