started with template fixes

This commit is contained in:
Dennis Eichhorn 2024-03-29 15:26:00 +00:00
parent d144dcc400
commit 065d2e2e37
15 changed files with 318 additions and 130 deletions

0
Controller/ApiController.php Normal file → Executable file
View File

View File

@ -305,27 +305,31 @@ final class BackendController extends Controller
///
$regions = RegionEnum::getConstants();
unset($regions[\array_search('Export', $regions, true)]);
unset($regions[\array_search('Domestic', $regions, true)]);
$view->data['ytdARegions'] = RegionMapper::countryToRegion(
$view->data['ytdAClientCountry'],
RegionEnum::getConstants(),
$regions,
['net_sales', 'net_profit']
);
$view->data['ytdPYRegions'] = RegionMapper::countryToRegion(
$view->data['ytdPYClientCountry'],
RegionEnum::getConstants(),
$regions,
['net_sales', 'net_profit']
);
$view->data['mtdARegions'] = RegionMapper::countryToRegion(
$view->data['mtdAClientCountry'],
RegionEnum::getConstants(),
$regions,
['net_sales', 'net_profit']
);
$view->data['mtdPYRegions'] = RegionMapper::countryToRegion(
$view->data['mtdPYClientCountry'],
RegionEnum::getConstants(),
$regions,
['net_sales', 'net_profit']
);

View File

@ -53,9 +53,11 @@ class ClientMapper extends DataMapperFactory
clientmgmt_attr_value_l11n_title,
YEAR(billing_bill_performance_date) as salesyear,
MONTH(billing_bill_performance_date) as salesmonth,
SUM(billing_bill_netsales) as netsales,
SUM(billing_bill_netprofit) as netprofit
SUM(billing_bill_netsales * billing_type_transfer_sign) as netsales,
SUM(billing_bill_netprofit * billing_type_transfer_sign) as netprofit
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
LEFT JOIN clientmgmt_client
ON clientmgmt_client_id = billing_bill_client
LEFT JOIN clientmgmt_client_attr
@ -69,7 +71,8 @@ class ClientMapper extends DataMapperFactory
LEFT JOIN clientmgmt_attr_value_l11n
ON clientmgmt_attr_value_id = clientmgmt_attr_value_l11n_value AND clientmgmt_attr_value_l11n_lang = \'' . $language . '\'
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $startComparison->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $endCurrent->format('Y-m-d') . '\'
AND clientmgmt_attr_type_name IN (\'segment\', \'section\', \'client_group\', \'client_type\')

View File

@ -47,11 +47,14 @@ class GeneralMapper extends DataMapperFactory
'SELECT
YEAR(billing_bill_performance_date) as salesyear,
MONTH(billing_bill_performance_date) as salesmonth,
SUM(billing_bill_netsales) as netsales,
SUM(billing_bill_netprofit) as netprofit
SUM(billing_bill_netsales * billing_type_transfer_sign) as netsales,
SUM(billing_bill_netprofit * billing_type_transfer_sign) as netprofit
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $startComparison->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $endCurrent->format('Y-m-d') . '\'
GROUP BY
@ -59,7 +62,7 @@ class GeneralMapper extends DataMapperFactory
MONTH(billing_bill_performance_date)
ORDER BY
YEAR(billing_bill_performance_date) ASC,
MONTH(billing_bill_performance_date) ASC'
MONTH(billing_bill_performance_date) ASC;'
);
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
@ -140,11 +143,14 @@ class GeneralMapper extends DataMapperFactory
'SELECT
YEAR(billing_bill_performance_date) as salesyear,
MONTH(billing_bill_performance_date) as salesmonth,
SUM(billing_bill_netsales) as netsales,
SUM(billing_bill_netprofit) as netprofit
SUM(billing_bill_netsales * billing_type_transfer_sign) as netsales,
SUM(billing_bill_netprofit * billing_type_transfer_sign) as netprofit
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $historyStart->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $endCurrent->format('Y-m-d') . '\'
GROUP BY

View File

@ -53,9 +53,11 @@ class ItemMapper extends DataMapperFactory
itemmgmt_attr_value_l11n_title,
YEAR(billing_bill_performance_date) as salesyear,
MONTH(billing_bill_performance_date) as salesmonth,
SUM(billing_bill_element_total_netsalesprice) as netsales,
SUM(billing_bill_element_total_netprofit) as netprofit
SUM(billing_bill_element_total_netsalesprice * billing_type_transfer_sign) as netsales,
SUM(billing_bill_element_total_netprofit * billing_type_transfer_sign) as netprofit
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
LEFT JOIN billing_bill_element
ON billing_bill_id = billing_bill_element_bill
LEFT JOIN itemmgmt_item
@ -71,10 +73,11 @@ class ItemMapper extends DataMapperFactory
LEFT JOIN itemmgmt_attr_value_l11n
ON itemmgmt_attr_value_id = itemmgmt_attr_value_l11n_value AND itemmgmt_attr_value_l11n_lang = \'' . $language . '\'
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $startComparison->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $endCurrent->format('Y-m-d') . '\'
AND itemmgmt_attr_type_name IN (\'segment\', \'section\', \'product_group\', \'product_type\')
AND itemmgmt_attr_type_name IN (\'segment\', \'section\', \'sales_group\', \'product_group\', \'product_type\')
GROUP BY
itemmgmt_attr_type_name,
itemmgmt_attr_type_l11n_title,

View File

@ -50,15 +50,18 @@ class RegionMapper extends DataMapperFactory
address_country,
YEAR(billing_bill_performance_date) as salesyear,
MONTH(billing_bill_performance_date) as salesmonth,
SUM(billing_bill_netsales) as netsales,
SUM(billing_bill_netprofit) as netprofit
SUM(billing_bill_netsales * billing_type_transfer_sign) as netsales,
SUM(billing_bill_netprofit * billing_type_transfer_sign) as netprofit
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
LEFT JOIN clientmgmt_client
ON clientmgmt_client_id = billing_bill_client
LEFT JOIN address
ON clientmgmt_client_address = address_id
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $start->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $end->format('Y-m-d') . '\'
GROUP BY
@ -133,12 +136,15 @@ class RegionMapper extends DataMapperFactory
MONTH(billing_bill_performance_date) as salesmonth,
COUNT(billing_bill_netsales) as client_count
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
LEFT JOIN clientmgmt_client
ON clientmgmt_client_id = billing_bill_client
LEFT JOIN address
ON clientmgmt_client_address = address_id
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $historyStart->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $endCurrent->format('Y-m-d') . '\'
GROUP BY
@ -214,12 +220,15 @@ class RegionMapper extends DataMapperFactory
MONTH(billing_bill_performance_date) as salesmonth,
COUNT(billing_bill_netsales) as client_count
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
LEFT JOIN clientmgmt_client
ON clientmgmt_client_id = billing_bill_client
LEFT JOIN address
ON clientmgmt_client_address = address_id
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $startComparison->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $endCurrent->format('Y-m-d') . '\'
GROUP BY
@ -316,23 +325,30 @@ class RegionMapper extends DataMapperFactory
$query->raw(
'SELECT
address_country,
billing_bill_performance_date,
SUM(billing_bill_netsales) as netsales,
SUM(billing_bill_netprofit) as netprofit
YEAR(billing_bill_performance_date) as salesyear,
MONTH(billing_bill_performance_date) as salesmonth,
SUM(billing_bill_netsales * billing_type_transfer_sign) as netsales,
SUM(billing_bill_netprofit * billing_type_transfer_sign) as netprofit
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
LEFT JOIN clientmgmt_client
ON clientmgmt_client_id = billing_bill_client
LEFT JOIN address
ON clientmgmt_client_address = address_id
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $historyStart->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $currentEnd->format('Y-m-d') . '\'
GROUP BY
address_country, billing_bill_performance_date
address_country,
YEAR(billing_bill_performance_date),
MONTH(billing_bill_performance_date)
ORDER BY
billing_bill_performance_date ASC,
address_country'
YEAR(billing_bill_performance_date) ASC,
MONTH(billing_bill_performance_date) ASC,
address_country ASC'
);
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
@ -341,15 +357,8 @@ class RegionMapper extends DataMapperFactory
$period = 0;
foreach ($results as $result) {
$date = new \DateTime($result['billing_bill_performance_date']);
if ($date->getTimestamp() <= $historyEnd->getTimestamp()) {
$period = 0;
} elseif ($date->getTimestamp() >= $currentStart->getTimestamp()) {
$period = 1;
} else {
continue;
}
// @todo Handle fiscal year
$period = $result['salesyear'] - ((int) $historyStart->format('Y')) + 1;
if (!isset($sales[$result['address_country']])) {
for ($i = 1; $i < 11; ++$i) {
$sales[$result['address_country']][$i] = [
@ -385,15 +394,18 @@ class RegionMapper extends DataMapperFactory
address_country,
YEAR(billing_bill_performance_date) as salesyear,
MONTH(billing_bill_performance_date) as salesmonth,
SUM(billing_bill_netsales) as netsales,
SUM(billing_bill_netprofit) as netprofit
SUM(billing_bill_netsales * billing_type_transfer_sign) as netsales,
SUM(billing_bill_netprofit * billing_type_transfer_sign) as netprofit
FROM billing_bill
LEFT JOIN billing_type
ON billing_bill_type = billing_type_id
LEFT JOIN clientmgmt_client
ON clientmgmt_client_id = billing_bill_client
LEFT JOIN address
ON clientmgmt_client_address = address_id
WHERE
billing_bill_type = ' . BillTransferType::SALES . '
billing_type_transfer_type = ' . BillTransferType::SALES . '
AND billing_type_accounting = 1
AND billing_bill_performance_date >= \'' . $startComparison->format('Y-m-d') . '\'
AND billing_bill_performance_date <= \'' . $endCurrent->format('Y-m-d') . '\'
GROUP BY

View File

@ -0,0 +1,24 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\SalesAnalysis
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Analysis' => 'Analyse',
'Dashboard' => 'Dashboard',
'Database' => 'Database',
'Invoices' => 'Rechnungen',
'Marketing' => 'Marketing',
'Overview' => 'Übersicht',
'Products' => 'Produkte',
'Regions' => 'Regionen',
]];

71
Theme/Backend/Lang/de.lang.php Executable file
View File

@ -0,0 +1,71 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\SalesAnalysis
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['SalesAnalysis' => [
'ItemAttribute' => 'Item Attribute',
'ClientAttribute' => 'Client Attribute',
'Months' => 'Months',
'Year' => 'Year',
'Month' => 'Month',
'All' => 'All',
'New' => 'New',
'Lost' => 'Lost',
'Continent' => 'Continent',
'SalesPY' => 'Sales PY',
'SalesA' => 'Sales A',
'ProfitPY' => 'Profit PY',
'ProfitA' => 'Profit A',
'DiffPY' => 'Δ PY',
'Actual' => 'Actual',
'Segment' => 'Segment',
'Section' => 'Section',
'Group' => 'Group',
'Region' => 'Region',
'Filter' => 'Filter',
'Country' => 'Country',
'Category' => 'Category',
'General' => 'General',
'MTD' => 'MTD',
'YTD' => 'YTD',
'GrossProfit' => 'Gross Profit',
'SalesProfit' => 'Sales / Profit',
'monthly' => 'monthly',
'annually' => 'annually',
'Profit' => 'Profit',
'Start' => 'Start',
'End' => 'End',
'Sales' => 'Sales',
'Client' => 'Client',
'Clients' => 'Clients',
'World' => 'World',
'DomesticExport' => 'Domestic & Export',
'Comparison' => 'Comparison',
'Continents' => 'Continents',
'Data' => 'Data',
'Domestic' => 'Domestic',
'Export' => 'Export',
'Current' => 'Current',
'Analyze' => 'Analyze',
'Regions' => 'Regions',
'Total' => 'Total',
'Type' => 'Type',
'SalesGroup' => 'Sales Group',
'ProductGroup' => 'Product Group',
'Other' => 'Sonstige',
'Europe' => 'Europa',
'Asia' => 'Asien',
'America' => 'Amerika',
'Oceania' => 'Ozeanien',
'Africa' => 'Afrika',
]];

View File

@ -60,4 +60,12 @@ return ['SalesAnalysis' => [
'Regions' => 'Regions',
'Total' => 'Total',
'Type' => 'Type',
'SalesGroup' => 'Sales Group',
'ProductGroup' => 'Product Group',
'Other' => 'Other',
'Europe' => 'Europe',
'Asia' => 'Asia',
'America' => 'America',
'Oceania' => 'Oceania',
'Africa' => 'Africa',
]];

View File

@ -23,8 +23,9 @@ echo $this->data['nav']->render();
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Segment'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Section'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Group'); ?></label>
<li><label for="c-tab-4"><?= $this->getHtml('Type'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('SalesGroup'); ?></label>
<li><label for="c-tab-4"><?= $this->getHtml('ProductGroup'); ?></label>
<li><label for="c-tab-5"><?= $this->getHtml('Type'); ?></label>
<!--<li><label for="c-tab-5"><?= $this->getHtml('Filter'); ?></label>-->
</ul>
</div>
@ -126,7 +127,53 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Group'); ?></div>
<div class="portlet-head"><?= $this->getHtml('SalesGroup'); ?></div>
<div class="slider">
<table class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('Category'); ?>
<td><?= $this->getHtml('SalesPY'); ?> (<?= $this->getHtml('YTD'); ?>)
<td><?= $this->getHtml('SalesA'); ?> (<?= $this->getHtml('YTD'); ?>)
<td><?= $this->getHtml('DiffPY'); ?> (<?= $this->getHtml('YTD'); ?>)
<td><?= $this->getHtml('SalesPY'); ?> (<?= $this->getHtml('MTD'); ?>)
<td><?= $this->getHtml('SalesA'); ?> (<?= $this->getHtml('MTD'); ?>)
<td><?= $this->getHtml('DiffPY'); ?> (<?= $this->getHtml('MTD'); ?>)
<tbody>
<?php
foreach ($this->data['ytdAItemAttribute'] as $type => $values) :
if ($type !== 'sales_group') {
continue;
}
?>
<tr>
<td><?= $this->printHtml($this->data['ytdPYItemAttribute'][$type]['value_l11n']); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency(
((int) ($this->data['ytdAItemAttribute'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['ytdPYItemAttribute'][$type]['net_sales'] ?? 0))
); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency(
((int) ($this->data['mtdAItemAttribute'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['mtdPYItemAttribute'][$type]['net_sales'] ?? 0))
); ?>
<?php endforeach; ?>
</table>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('ProductGroup'); ?></div>
<div class="slider">
<table class="default sticky">
<thead>
@ -167,7 +214,7 @@ echo $this->data['nav']->render();
</div>
</div>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12">

View File

@ -24,7 +24,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-lg-4">
<section class="portlet">
<form id="sales-dashboard-analysis" action="<?= UriFactory::build('{/backend}sales/analysis'); ?>" method="get">
<form id="sales-dashboard-analysis" action="<?= UriFactory::build('{/base}/sales/analysis?csrf={$CSRF}'); ?>" method="get">
<div class="portlet-body">
<div><?= $this->getHtml('Current'); ?></div>
<div class="form-group">
@ -124,7 +124,7 @@ echo $this->data['nav']->render();
$temp[] = $sales[1][$i]['net_sales'] == 0
? 0
: $sales[1][$i]['net_profit'] * 100 / $sales[1][$i]['net_sales'];
: \number_format($sales[1][$i]['net_profit'] * 100 / $sales[1][$i]['net_sales'], 2);
}
echo \implode(',', $temp);
?>
@ -150,7 +150,7 @@ echo $this->data['nav']->render();
$temp[] = $sales[2][$i]['net_sales'] == 0
? 0
: $sales[2][$i]['net_profit'] * 100 / $sales[2][$i]['net_sales'];
: \number_format($sales[2][$i]['net_profit'] * 100 / $sales[2][$i]['net_sales'], 2);
}
echo \implode(',', $temp);
?>
@ -261,15 +261,15 @@ echo $this->data['nav']->render();
?>
<tr>
<td><?= \sprintf('%02d', $i + 1); ?>
<td><?= $this->getCurrency((int) ($sales[1][$i]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($sales[2][$i]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($sales[1][$i]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($sales[2][$i]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= \sprintf('%.2f', ($sales[1][$i]['net_sales'] ?? 0) == 0 ? 0 : $sales[1][$i]['net_profit'] * 100 / $sales[1][$i]['net_sales']); ?> %
<td><?= \sprintf('%.2f', ($sales[2][$i]['net_sales'] ?? 0) == 0 ? 0 : $sales[2][$i]['net_profit'] * 100 / $sales[2][$i]['net_sales']); ?> %
<?php endfor; ?>
<tr>
<td><?= $this->getHtml('Total'); ?>
<td><?= $this->getCurrency($sum1); ?>
<td><?= $this->getCurrency($sum2); ?>
<td><?= $this->getCurrency($sum1, symbol: ''); ?>
<td><?= $this->getCurrency($sum2, symbol: ''); ?>
<td><?= \sprintf('%.2f', $sum3 == 0 ? 0 : $sum1 / $sum3); ?> %
<td><?= \sprintf('%.2f', $sum4 == 0 ? 0 : $sum2 / $sum4); ?> %
</table>
@ -398,7 +398,7 @@ echo $this->data['nav']->render();
?>
<tr>
<td>
<td><?= $this->getCurrency(((int) $values['net_sales']) / FloatInt::DIVISOR); ?>
<td><?= $this->getCurrency(((int) $values['net_sales']) / FloatInt::DIVISOR, symbol: ''); ?>
<td><?= \sprintf('%.2f', $values['net_sales'] == 0 ? 0 : $values['net_profit'] * 100 / $values['net_sales']); ?> %
<?php endforeach; ?>
</table>
@ -430,17 +430,19 @@ echo $this->data['nav']->render();
<?php foreach ($this->data['ytdAItemAttribute'] as $type => $values) : ?>
<tr>
<td><?= $this->printHtml($this->data['ytdPYItemAttribute'][$type]['value_l11n']); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYItemAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAItemAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['ytdAItemAttribute'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['ytdPYItemAttribute'][$type]['net_sales'] ?? 0))
((int) ($this->data['ytdPYItemAttribute'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAItemAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYItemAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAItemAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['mtdAItemAttribute'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['mtdPYItemAttribute'][$type]['net_sales'] ?? 0))
((int) ($this->data['mtdPYItemAttribute'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<?php endforeach; ?>
</table>
@ -470,17 +472,19 @@ echo $this->data['nav']->render();
<?php foreach ($this->data['ytdAClientAttribute'] as $type => $values) : ?>
<tr>
<td><?= $this->printHtml($this->data['ytdPYClientAttribute'][$type]['value_l11n']); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYClientAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAClientAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYClientAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAClientAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['ytdAClientAttribute'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['ytdPYClientAttribute'][$type]['net_sales'] ?? 0))
((int) ($this->data['ytdPYClientAttribute'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYClientAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAClientAttribute'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYClientAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAClientAttribute'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['mtdAClientAttribute'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['mtdPYClientAttribute'][$type]['net_sales'] ?? 0))
((int) ($this->data['mtdPYClientAttribute'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<?php endforeach; ?>
</table>
@ -510,17 +514,19 @@ echo $this->data['nav']->render();
<?php foreach ($this->data['ytdAClientCountry'] as $type => $values) : ?>
<tr>
<td><?= $this->printHtml(ISO3166NameEnum::getBy2Code($type)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['ytdAClientCountry'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0))
((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['mtdAClientCountry'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0))
((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<?php endforeach; ?>
</table>

View File

@ -100,17 +100,19 @@ echo $this->data['nav']->render();
<?php foreach ($this->data['ytdAClientCountry'] as $type => $values) : ?>
<tr>
<td><?= $this->printHtml(ISO3166NameEnum::getBy2Code($type)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdAClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['ytdAClientCountry'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0))
((int) ($this->data['ytdPYClientCountry'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAClientCountry'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdAClientCountry'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['mtdAClientCountry'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0))
((int) ($this->data['mtdPYClientCountry'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<?php endforeach; ?>
</table>
@ -296,15 +298,15 @@ echo $this->data['nav']->render();
?>
<tr>
<td><?= \sprintf('%02d', $i); ?>
<td><?= $this->getCurrency((int) ($sales[1][$this->data['domestic']][$i]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($sales[2][$this->data['domestic']][$i]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($sales[1][$this->data['domestic']][$i]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($sales[2][$this->data['domestic']][$i]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= \sprintf('%.2f', ($sales[1][$this->data['domestic']][$i]['net_sales'] ?? 0) == 0 ? 0 : $sales[1][$this->data['domestic']][$i]['net_profit'] * 100 / $sales[1][$this->data['domestic']][$i]['net_sales']); ?> %
<td><?= \sprintf('%.2f', ($sales[2][$this->data['domestic']][$i]['net_sales'] ?? 0) == 0 ? 0 : $sales[2][$this->data['domestic']][$i]['net_profit'] * 100 / $sales[2][$this->data['domestic']][$i]['net_sales']); ?> %
<?php endfor; ?>
<tr>
<td><?= $this->getHtml('Total'); ?>
<td><?= $this->getCurrency($sum1); ?>
<td><?= $this->getCurrency($sum2); ?>
<td><?= $this->getCurrency($sum1, symbol: ''); ?>
<td><?= $this->getCurrency($sum2, symbol: ''); ?>
<td><?= \sprintf('%.2f', $sum3 == 0 ? 0 : $sum1 / $sum3); ?> %
<td><?= \sprintf('%.2f', $sum4 == 0 ? 0 : $sum2 / $sum4); ?> %
</table>
@ -486,15 +488,15 @@ echo $this->data['nav']->render();
?>
<tr>
<td><?= \sprintf('%02d', $i); ?>
<td><?= $this->getCurrency((int) ($sales[1]['Other'][$i]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($sales[2]['Other'][$i]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($sales[1]['Other'][$i]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($sales[2]['Other'][$i]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= \sprintf('%.2f', ($sales[1]['Other'][$i]['net_sales'] ?? 0) == 0 ? 0 : $sales[1]['Other'][$i]['net_profit'] * 100 / $sales[1]['Other'][$i]['net_sales']); ?> %
<td><?= \sprintf('%.2f', ($sales[2]['Other'][$i]['net_sales'] ?? 0) == 0 ? 0 : $sales[2]['Other'][$i]['net_profit'] * 100 / $sales[2]['Other'][$i]['net_sales']); ?> %
<?php endfor; ?>
<tr>
<td><?= $this->getHtml('Total'); ?>
<td><?= $this->getCurrency($sum1); ?>
<td><?= $this->getCurrency($sum2); ?>
<td><?= $this->getCurrency($sum1, symbol: ''); ?>
<td><?= $this->getCurrency($sum2, symbol: ''); ?>
<td><?= \sprintf('%.2f', $sum3 == 0 ? 0 : $sum1 / $sum3); ?> %
<td><?= \sprintf('%.2f', $sum4 == 0 ? 0 : $sum2 / $sum4); ?> %
</table>
@ -551,11 +553,11 @@ echo $this->data['nav']->render();
foreach ($this->data['ytdADomesticExport'] as $region => $values) : $sum += $values['net_sales']; ?>
<tr>
<td><?= $region; ?>
<td><?= $this->getCurrency($values['net_sales']); ?>
<td><?= $this->getCurrency($values['net_sales'], symbol: ''); ?>
<?php endforeach; ?>
<tr>
<td><?= $this->getHtml('Total'); ?>
<td><?= $this->getCurrency($sum); ?>
<td><?= $this->getCurrency($sum, symbol: ''); ?>
</table>
</div>
</div>
@ -692,11 +694,11 @@ echo $this->data['nav']->render();
foreach ($this->data['ytdADomesticExport'] as $region => $values) : $sum += $values['net_profit']; ?>
<tr>
<td><?= $region; ?>
<td><?= $this->getCurrency($values['net_profit']); ?>
<td><?= $this->getCurrency($values['net_profit'], symbol: ''); ?>
<?php endforeach; ?>
<tr>
<td><?= $this->getHtml('Total'); ?>
<td><?= $this->getCurrency($sum); ?>
<td><?= $this->getCurrency($sum, symbol: ''); ?>
</table>
</div>
</div>
@ -987,11 +989,11 @@ echo $this->data['nav']->render();
foreach ($this->data['ytdAContinent'] as $region => $values) : $sum += $values['net_sales']; ?>
<tr>
<td><?= $region; ?>
<td><?= $this->getCurrency($values['net_sales']); ?>
<td><?= $this->getCurrency($values['net_sales'], symbol: ''); ?>
<?php endforeach; ?>
<tr>
<td><?= $this->getHtml('Total'); ?>
<td><?= $this->getCurrency($sum); ?>
<td><?= $this->getCurrency($sum, symbol: ''); ?>
</table>
</div>
</div>
@ -1132,7 +1134,7 @@ echo $this->data['nav']->render();
<?php endforeach; ?>
<tr>
<td><?= $this->getHtml('Total'); ?>
<td><?= $this->getCurrency($sum); ?>
<td><?= $this->getCurrency($sum, symbol: ''); ?>
</table>
</div>
</div>
@ -1396,17 +1398,19 @@ echo $this->data['nav']->render();
<?php foreach ($this->data['ytdARegions'] as $type => $values) : ?>
<tr>
<td><?= $this->printHtml($type); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYRegions'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdARegions'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdPYRegions'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['ytdARegions'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['ytdARegions'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['ytdPYRegions'][$type]['net_sales'] ?? 0))
((int) ($this->data['ytdPYRegions'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYRegions'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdARegions'][$type]['net_sales'] ?? 0)); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdPYRegions'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency((int) ($this->data['mtdARegions'][$type]['net_sales'] ?? 0), symbol: ''); ?>
<td><?= $this->getCurrency(
((int) ($this->data['mtdARegions'][$type]['net_sales'] ?? 0)) -
((int) ($this->data['mtdPYRegions'][$type]['net_sales'] ?? 0))
((int) ($this->data['mtdPYRegions'][$type]['net_sales'] ?? 0)),
symbol: ''
); ?>
<?php endforeach; ?>
</table>