I’ve tried creating a cross-company version of the Voucher transactions report without much luck. Does anyone know how to achieve that?
I’ve changed GeneralJournalEntry data souce CrossCompanyAutoQuery property to Yes but it still ran for a particular company. I didn’t find any DataAreaId filters in data source or form methods related to output.
Report: GL > Inquiries >Voucher transactions
Display menu item and ftorm: LedgerTransVoucher
Thanks for you help
I made the following code change inside of the LedgerTransVoucher form’s init method and it still does’t work:
query = generalJournalEntry_ds.query();
ds = query.dataSourceTable(tableNum(MainAccount));
query.allowCrossCompany(true); // <== new line
// set the DimensionAttributeValueCombination–>MainAccount relation because the wrong one is the default
ds.addLink(fieldNum(DimensionAttributeValueCombination, MainAccount), fieldNum(MainAccount, RecId));
// manually add the natural key query field
// sort by accounting date because it is the preferred user sort
// additionally sort by journal and voucher to provide a consistent order within duplicate dates
ds = query.dataSourceTable(tableNum(GeneralJournalEntry));
Most of the ledger related tables are by default won’t save the data per company.
Example: look at saveDataPerCompany for \Data Dictionary\Tables\GeneralJournalEntry
Look at \Forms\LedgerTransVoucher\Data Sources\GeneralJournalEntry\Methods\executeQuery
rangeLedger = dataSourceGeneralJournalEntry.addRange(fieldNum(GeneralJournalEntry, Ledger));
there is a range applied with current company ledger, this is restricting to show only the current company vouchers.
Thanks for you reply. It seems to be working during my initial testing when comment those two lines out. The next step will be for me to modify the report so it can pull data across all companies or only for particular one(s).