using AccountsDAL.CustomCode.Reports; using AccountsDAL.DTO.Reports; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.Telemetry; namespace AccountsBLL.AccountReports.BSReport { // BLL for the REAL, live-wired "Balance Sheet Vertical" (MREPORT -1399971488) and // "Balance Sheet Horizontal" (MREPORT -1399975249) — see BSVerticalHorizontalReportQB.cs's // class header for the full GB4->GB5 migration context (same pattern as the P&L Vertical/ // Horizontal cutover this session already completed). AsOnDate-based, not period-range — // EnforceForAsOnDateAsync (not EnforceAsync) matches the existing AccountBalanceSheetReportBLL's // own access-control call for the same report family. public class BSReportBLL : IBSReportBLL { private readonly IBSReportDAL _dal; private readonly AccountReports.IAccountReportAccessControlBLL _accessControlBLL; public BSReportBLL(IBSReportDAL dal, AccountReports.IAccountReportAccessControlBLL accessControlBLL) { _dal = dal; _accessControlBLL = accessControlBLL; } public async Task> GetBSVertical(int groupType, CriteriaDTO criteriaDTO, int menuId, LoginDTO loginDTO) { try { GB5Trace.Step("parse-criteria-bs-vertical", new { groupType, menuId }); var criteria = AccountReports.AccountReportCriteriaParser.Parse(criteriaDTO, loginDTO); await _accessControlBLL.EnforceForAsOnDateAsync(criteria, int.MaxValue, menuId, loginDTO).ConfigureAwait(false); GB5Trace.Step("query-bs-vertical", new { groupType }); return await _dal.GetBSVertical(groupType, criteria, loginDTO).ConfigureAwait(false); } catch (Exception ex) { GB5Trace.MarkFailed("bs-vertical-failed", ex); throw; } } public async Task> GetBSHorizontal(int groupType, CriteriaDTO criteriaDTO, int menuId, LoginDTO loginDTO) { try { GB5Trace.Step("parse-criteria-bs-horizontal", new { groupType, menuId }); var criteria = AccountReports.AccountReportCriteriaParser.Parse(criteriaDTO, loginDTO); await _accessControlBLL.EnforceForAsOnDateAsync(criteria, int.MaxValue, menuId, loginDTO).ConfigureAwait(false); GB5Trace.Step("query-bs-horizontal", new { groupType }); return await _dal.GetBSHorizontal(groupType, criteria, loginDTO).ConfigureAwait(false); } catch (Exception ex) { GB5Trace.MarkFailed("bs-horizontal-failed", ex); throw; } } } }