How to add Doctype and fields in script report (Add Purchase Invoice in Stock Balance)?

Hello,

We need to add some fields from Purchase Invoice DocType in the Stock Balance report columns Can someone show what server side code is required to link Purchase Invoice Doctype and add the columns subsequently:

And:

Thanks in advance.