Create custom PDF Template which is generated while execution of report schedule

Requirement: Show data table in received pdf template as same as shown into the run report view of UI

I have some requirement, which is not fulfill using default report schedule. So i have created custom scheduler, custom report scheduler. But the PDF is generated is displayed incorrect format of data. 

I have did below changes:

(Note: All files is copied from default file path and rename file name as well as class name)
1. create custom scheduler
custom/Extension/modules/Schedulers/Ext/Language/en_us.custom_scheduler.php
custom/Extension/modules/Schedulers/Ext/ScheduledTasks/custom_scheduler.php
2. create custom ReportSchedule file on
custom/modules/ReportSchedules/CustomReportSchedule.php
3. create custom save_scheduler file on
custom/modules/Reports/schedule/save_schedule.php
4. create custom view file on
custom/modules/Reports/views/view.schedule.php
5. create custom tpl file on
custom/modules/Reports/tpls/AddSchedule.tpl

6. repair rebuild

7. Execute custom scheduler

I need help for changing PDF Template data table.

For more understanding purpose i have shared images below:

Image 1

Look at above image highlighted data. This data is displayed when run report from UI. 

And it displayed incorrect formatted data table on PDF Template which i got received from email as an attachment. below image shown more clarification

Image 2

I want to show same data table as shown on Image 1 into PDF Template after receiving template in email as an attachment. 

  • Actually you need to extend the classes inside modules/Reports/Exporters, these ones print pdf for exporting reports and scheduling reports as well.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • As per my understanding, to write PDF template data is pass from modules/Reports/ugarpdf/sugarpdf.summary.php file on display() function. 

    Below code prepare data array which is helpful for write pdf template

    $header_row = $this->bean->get_summary_header_row(); ///To get All header columns
    if (count($this->bean->report_def['summary_columns']) > 0) {

    while ($row = $this->bean->get_summary_next_row()) {
    for ($i= 0; $i < sizeof($header_row); $i++) {
    $label = $header_row[$i];
    $value = '';
    if (isset($row['cells'][$i])) {
    $value = $row['cells'][$i];
    }
    $item[$count][$label] = $value;
    }
    $count++;
    }
    $this->writeCellTable($item, $this->options);// writeCellTable function write cell of PDF data table cell by cell.

    //$items have data which is print to PDF Template and $this->options have even and odd column background color

    $items have data like:

    Array
    (
    [0] => Array
    (
    [User Name] => abhinav
    [Region] => Americas
    [Account Count] => 3
    )

    [1] => Array
    (
    [User Name] => abhinav
    [Region] => EMEA
    [Account Count] => 7
    )

    )

    $this->options have array data is like:

    (
    [evencolor] => #DCDCDC
    [oddcolor] => #FFFFFF
    [header] => Array
    (
    [fill] => #4B4B4B
    [fontStyle] => B
    [textColor] => #FFFFFF
    )

    )

    But first of all we need to modify PDF Template data table header row. 

    Correct me if my understanding is wrong.