<?php
 namespace App\Dashboard\Widget; class QuickReports_BalanceProfit extends QuickReports_GeneralAbstract { use Traits\FinancialWidget; protected function definePivotSheets(\App\Dashboard\Widget\Helper\QrSheetsManager $qrSheetsManager) { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); $lang = $_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\QuickReports_BalanceProfit']['sheets']; $periodEnd = TODAY_YEAR; $periodStart = $periodEnd - 3; $defaultFilters = [ ['column'=>'balanceVirtualDateY', 'operation'=>'BETWEEN', 'value'=>[$periodStart, $periodEnd]], ['column'=>'balanced', 'operation'=>'=', 'value'=>'1'], ['column'=>'statusOp', 'operation'=>'=', 'value'=>'OK'], ]; $pivotContentGen1 = new \App\QuickReports\PivotTables\GenerateContent('OrderServices'); $pivotContentGen1->addFilters($defaultFilters); $pivotContentGen1->setRowsField('balanceVirtualDateY'); $pivotContentGen1->setRowsOrder('balanceVirtualDateY', null, 'ASC'); $pivotContentGen1->setDataField('balanceProfitDef', 'SUM'); $sh1 = new \App\Dashboard\Widget\Helper\QrSheet($pivotContentGen1, $lang['balanceProfiYearly']['name'], $lang['balanceProfiYearly']['description'], $lang['balanceProfiYearly']['title']); $sh1->setDisplayCurrency(\App\Config\Currencies::getInstance()->getDefaultCurrency()); $qrSheetsManager->addQrSheet($sh1, 'balanceProfiYearly'); $pivotContentGen2 = new \App\QuickReports\PivotTables\GenerateContent('OrderServices'); $pivotContentGen2->addFilters($defaultFilters); $pivotContentGen2->setRowsField('serviceName'); $pivotContentGen2->setRowsOrder('balanceProfitDef', 'SUM', 'DESC'); $pivotContentGen2->setRowsLimit(5, true); $pivotContentGen2->setColsField('balanceVirtualDateM'); $pivotContentGen2->setColsOrder('balanceVirtualDateM', null, 'ASC'); $pivotContentGen2->setDataField('balanceProfitDef', 'SUM'); $sh2 = new \App\Dashboard\Widget\Helper\QrSheet($pivotContentGen2, $lang['balanceProfiDetais']['name'], $lang['balanceProfiDetais']['description'], $lang['balanceProfiDetais']['title']); $sh2->setDisplayCurrency(\App\Config\Currencies::getInstance()->getDefaultCurrency()); $qrSheetsManager->addQrSheet($sh2, 'balanceProfiDetais'); $qrSheetsManager->addReference('balanceProfiYearly', 'rowsFields', 'balanceProfiDetais'); $qrSheetsManager->setIdDefaultSheet('balanceProfiYearly'); } } 