Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -57,45 +57,20 @@ class _markets extends \IPS\Dispatcher\Controller
|
||||
$tabs[ $currency ] = \IPS\Member::loggedIn()->language()->addToStack( 'nexus_report_income', FALSE, array( 'sprintf' => array( $currency ) ) );
|
||||
}
|
||||
|
||||
$activeTab = ( isset( \IPS\Request::i()->tab ) and array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'count';
|
||||
|
||||
$chart = new \IPS\Helpers\Chart\Database(
|
||||
\IPS\Http\Url::internal( 'app=nexus&module=reports&controller=markets&tab=' . $activeTab ),
|
||||
'nexus_invoices',
|
||||
'i_paid',
|
||||
'',
|
||||
array(
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#c9e2de', '#10967e' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
'GeoChart',
|
||||
'monthly',
|
||||
array( 'start' => 0, 'end' => 0 ),
|
||||
array(),
|
||||
$activeTab
|
||||
);
|
||||
$chart->availableTypes[] = 'GeoChart';
|
||||
$chart->where[] = array( 'i_status=? AND i_billcountry IS NOT NULL', \IPS\nexus\Invoice::STATUS_PAID );
|
||||
\IPS\Request::i()->tab ??= 'count';
|
||||
$activeTab = ( array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'count';
|
||||
$extension = \IPS\core\Statistics\Chart::loadFromExtension( 'nexus', 'Market' );
|
||||
$chart = $extension->getChart( \IPS\Http\Url::internal( "app=nexus&module=reports&controller=markets&tab={$activeTab}" ) );
|
||||
|
||||
if ( $activeTab !== 'count' )
|
||||
{
|
||||
$chart->where[] = array( 'i_currency=?', $activeTab );
|
||||
$chart->format = $activeTab;
|
||||
}
|
||||
$chart->groupBy = 'i_billcountry';
|
||||
|
||||
foreach ( \IPS\GeoLocation::$countries as $countryCode )
|
||||
{
|
||||
$chart->addSeries( [ 'value' => \IPS\Member::loggedIn()->language()->get( 'country-' . $countryCode ), 'key' => $countryCode ], 'number', $activeTab === 'count' ? 'COUNT(*)' : 'SUM(i_total)', TRUE, $countryCode );
|
||||
try
|
||||
{
|
||||
$extension->setCurrency( $chart, $activeTab );
|
||||
}
|
||||
catch( \InvalidArgumentException ) {}
|
||||
}
|
||||
|
||||
if ( $chart->type === 'GeoChart' )
|
||||
{
|
||||
$chart->options['height'] = 750;
|
||||
$chart->options['keepAspectRatio'] = true;
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user