ATK4 - addTotals() results in 0.00 for totals

三世轮回 提交于 2019-12-11 14:07:33

问题


I am working with ATK4.2.1 and trying to get the addTotals() functionality to work on my Grid. I have tried setting the data to the grid with both the setModel and setSource methods. My grid shows up correctly with all data showing and with what appears to be the addTotals() row, but the results are always 0.00 on any fields I try setting as the 'money' type.

Method #1-

class page_showStats extends Page {
    function init(){
    parent::init();

        $grid=$this->add('Grid');
        $grid->setModel('aggrStats');
        $grid->addTotals();

    }
}

class Model_aggrStats extends Model_Table {
    public $table='aggrReports';
    function init(){
        parent::init();
        $this->addField('date')->type('date');
        $sitename = $this->join('websites','websiteID');
        $sitename->addField('sitename','name')->caption('Client');
        $sitetype = $this->join('adTypes','typeID');
        $sitetype->addField('typename','name')->caption('Product');
        $siteorigin = $this->join('origins','originID');
        $siteorigin->addField('originname','name')->caption('Origin');
        $this->addField('impressionsTotal')->Caption('Imp Opps')->sortable(true);
        $this->addField('impressionsFilled')->caption('Imps Filled')->sortable(true);
        $this->addField('fillPercent')->sortable(true)->caption('Fill %');
        $this->addField('grossRevenue')->type('money')->sortable(true);
        $this->addField('grossCPM')->sortable(true);
        $this->addField('netRevenue')->type('money')->sortable(true);
        $this->addField('netCPM')->sortable(true);
    }   
} 

Method #2 -

class page_slicer extends Page {
    function init(){
    parent::init();

        $g=$this->add('Grid');
        $g->addColumn('date','date');
        $g->addColumn('text','impressionsTotal');
        $g->addColumn('text','impressionsFilled');
        $g->addColumn('text','fillPercent');
        $g->addColumn('text','grossRevenue');
        $g->addColumn('text','grossCPM');
        $g->addColumn('money','netRevenue');
        $g->addColumn('text','netCPM');

        $g->setSource('aggrReports');

        $g->addTotals();

    }
}

Both methods generate the grid with the empty totals row (the second method doesn't include some identifying pieces that the first method does because I was focused on just attempting to get a money column to sum.)

!Grid with zero-sum totals1

Any thoughts on what I could be missing? Thanks.

来源:https://stackoverflow.com/questions/11784194/atk4-addtotals-results-in-0-00-for-totals

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!