Dear Team,
I am currently facing an issue with the solution for two views in the P&L report: "Management perspective" and "Accounting perspective".
I need to implement two buttons. If I select the "Management perspective" button, the data should be retrieved from the table pl_report_management. Otherwise, if I select the other button, the data should come from the table pl_report_accounting. The default view should be pl_report_accounting.
I consulted with ChatGPT and found a proposed solution:
------------------------------------------------------------
DECLARE @sql NVARCHAR(MAX)
SET @sql = '';
EXEC sp_executesql @sql,
N'@language NVARCHAR(3), @currencyType NVARCHAR(3), @priceFormat NVARCHAR(10), @exchange_rate DECIMAL(18,4), @filterDepartment NVARCHAR(MAX), @version NVARCHAR(MAX), @startDate DATE, @endDate DATE',
@language, @currencyType, @priceFormat, @exchange_rate, @filterDepartment, @version, @startDate, @endDate
------------------------------------------------------------
My code base of this demo: https://mydbr.com/demo/mydbr/report.php?r=378&m=1&h=4eab3635679eaa678f6dc0c289c197cee152ca6c&i=1
However, I believe there might be a better approach. Would you assist me with this?
Thank you, Team!