PHP code example of atk4 / report
1. Go to this page and download the library: Download atk4/report library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
atk4 / report example snippets
$m = new \smbo\GroupModel(new Sale($db));
$m->groupBy(['contractor_to', 'type'], [ // groups by 2 columns
'c' => 'count(*)', // defines aggregate formulas for fields
'qty' => 'sum([])', // [] refers back to qty
'total' => 'sum([amount])', // can specify any field here
]);
$m->addFields(['vat_registered', ['vat_no', 'caption' => 'VAT No']]);
// add 2 more fields which will bypass aggregation.
$m->getElement('total')->type = 'money';
// change the type