0

I am creating a custom report.

I don't need Period and Empty Rows Option from the report.

How can I remove it?

io

0

You can able to find the Period and Empty Rows from the below core block file. You can override that core file to custom module and remove that field.

File path: magento/vendor/magento/module-reports/Block/Adminhtml/Filter/Form.php

$fieldset->addField(
            'period_type',
            'select',
            [
                'name' => 'period_type',
                'options' => ['day' => __('Day'), 'month' => __('Month'), 'year' => __('Year')],
                'label' => __('Period'),
                'title' => __('Period')
            ]
        );

$fieldset->addField(
    'show_empty_rows',
    'select',
    [
        'name' => 'show_empty_rows',
        'options' => ['1' => __('Yes'), '0' => __('No')],
        'label' => __('Empty Rows'),
        'title' => __('Empty Rows')
    ]
);

Hope it help.

1
  • I got the same solution, But Thanks for the Answer. May It helps someone else. – Ravi Soni Nov 9 '19 at 7:22
0

You can hide the column using layout xml. File path : app/code/Vendor/Module/view/adminhtml/layout/salereport_report_sales_customsalereport.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="reports_sales"/>
    <body>
        <referenceContainer name="content">
            <block class="Vendor\Module\Block\Adminhtml\Sales\Customsalereport" template="Magento_Reports::report/grid/container.phtml" name="sales.report.grid.container">
                <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form" name="grid.filter.form">
                    <action method="setFieldVisibility">
                        <argument name="field" xsi:type="string">period_type</argument>
                        <argument name="visibility" xsi:type="string">0</argument>
                    </action>
                    <action method="setFieldVisibility">
                        <argument name="field" xsi:type="string">show_empty_rows</argument>
                        <argument name="visibility" xsi:type="string">0</argument>
                    </action>
                </block>
            </block>
        </referenceContainer>
    </body>
</page>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.