Hi -
I have a requirement to work on Inventory Value Report. I have to customize the existing report in AX 2012 "InventValue" to add a logic that will insert a new column on the report which will output the values of Physical Inventory Amount as per the current date. The current date is the date when you are Executing the report.
As of now the report pulls out the physical inventory amount totals for the previous month. I have to add a new column which will display the physical inventory total amount of the date/month I'm executing the report. this way we can compare the amount changes(Variance) of our inventory from last month and as of today.
For now I have added a new column in InventValueReportTempLine table which will store the physical Inventory Amount as on todays date.
I have customized the InventValueDP class and InventValueReportPopulateItem class.
Method customized in InventValueReportPopulateItem class
1. updateReportLineBalance (I have added my code in this method to populate the report with my new columns data)
2. getCurrentDateAmountValue () this is my original method to get the values of Physical Inventory amount as of current date.

public CostAmount getCurrentDateAmountValue()
{
InventValueReportTmpLine inventValueReportTmpLine;
select * from inventValueReportTmpLine
order by inventValueReportTmpLine.TransDate desc
where inventValueReportTmpLine.TransDate == today() ||
inventValueReportTmpLine.TransDate != str2Date('',213);
inventValueReportTmpLine.CurrentDatePhysicalPostedAmountValue = inventValueReportTmpLine.InventoryPhysicalPostedAmount;
return inventValueReportTmpLine.CurrentDatePhysicalPostedAmountValue;
}
My understanding is that If I write the code correcttly for getCurrentDateAmountValue() which can return the physical inventory amount for the current date or closest date to the current date (Assuming if there is no data for inventory on the current date then the code should get the data for the first available date which has data) then I can store this value in the new field I have added in InventValueReportTempLine table and display in on the report.
Can you please suggest me the logic or how I can improve my code to fulfill my requirement here ?
Thanks in advance.