mirror of
https://github.com/Karaka-Management/oms-SalesAnalysis.git
synced 2026-01-11 11:28:41 +00:00
code fixes
This commit is contained in:
parent
67416e99c1
commit
997ccfec85
|
|
@ -29,6 +29,9 @@ use phpOMS\Stdlib\Base\SmartDateTime;
|
|||
*/
|
||||
class ClientMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function mtdYtdClientAttribute(
|
||||
\DateTime $startCurrent,
|
||||
\DateTime $endCurrent,
|
||||
|
|
@ -36,7 +39,8 @@ class ClientMapper extends DataMapperFactory
|
|||
\DateTime $endComparison,
|
||||
int $businessStart = 1,
|
||||
string $language = 'en'
|
||||
) {
|
||||
) : array
|
||||
{
|
||||
$endCurrentIndex = SmartDateTime::calculateMonthIndex((int) $endCurrent->format('m'), $businessStart);
|
||||
|
||||
// @todo this query doesn't return clients that have not segment etc. defined.
|
||||
|
|
@ -81,7 +85,7 @@ class ClientMapper extends DataMapperFactory
|
|||
MONTH(billing_bill_performance_date) ASC'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$oldIndex = 1;
|
||||
$period = 1;
|
||||
|
|
|
|||
|
|
@ -29,13 +29,17 @@ use phpOMS\Stdlib\Base\SmartDateTime;
|
|||
*/
|
||||
class GeneralMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* @todo Probably re-implement, still used?
|
||||
*/
|
||||
public static function monthlySalesProfit(
|
||||
\DateTime $startCurrent,
|
||||
\DateTime $endCurrent,
|
||||
\DateTime $startComparison,
|
||||
\DateTime $endComparison,
|
||||
int $businessStart = 1
|
||||
) {
|
||||
) : array
|
||||
{
|
||||
$endCurrentIndex = SmartDateTime::calculateMonthIndex((int) $endCurrent->format('m'), $businessStart);
|
||||
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -58,7 +62,7 @@ class GeneralMapper extends DataMapperFactory
|
|||
MONTH(billing_bill_performance_date) ASC'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$oldIndex = 1;
|
||||
$period = 1;
|
||||
|
|
@ -123,6 +127,9 @@ class GeneralMapper extends DataMapperFactory
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Probably re-implement, still used?
|
||||
*/
|
||||
public static function annualSalesProfit(
|
||||
SmartDateTime $historyStart,
|
||||
\DateTime $endCurrent,
|
||||
|
|
@ -148,7 +155,7 @@ class GeneralMapper extends DataMapperFactory
|
|||
MONTH(billing_bill_performance_date) ASC'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$annualSales = [];
|
||||
for ($i = 1; $i < 11; ++$i) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ use phpOMS\Stdlib\Base\SmartDateTime;
|
|||
*/
|
||||
class ItemMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function mtdYtdItemAttribute(
|
||||
\DateTime $startCurrent,
|
||||
\DateTime $endCurrent,
|
||||
|
|
@ -36,7 +39,8 @@ class ItemMapper extends DataMapperFactory
|
|||
\DateTime $endComparison,
|
||||
int $businessStart = 1,
|
||||
string $language = 'en'
|
||||
) {
|
||||
) : array
|
||||
{
|
||||
$endCurrentIndex = SmartDateTime::calculateMonthIndex((int) $endCurrent->format('m'), $businessStart);
|
||||
|
||||
// @todo this query doesn't return clients that have not segment etc. defined.
|
||||
|
|
@ -83,7 +87,7 @@ class ItemMapper extends DataMapperFactory
|
|||
MONTH(billing_bill_performance_date) ASC'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$oldIndex = 1;
|
||||
$period = 1;
|
||||
|
|
|
|||
|
|
@ -33,11 +33,15 @@ use phpOMS\Stdlib\Base\SmartDateTime;
|
|||
*/
|
||||
class RegionMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function monthlySalesProfit(
|
||||
\DateTime $start,
|
||||
\DateTime $end,
|
||||
int $businessStart = 1
|
||||
) {
|
||||
) : array
|
||||
{
|
||||
$endCurrentIndex = SmartDateTime::calculateMonthIndex((int) $end->format('m'), $businessStart);
|
||||
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -67,7 +71,7 @@ class RegionMapper extends DataMapperFactory
|
|||
address_country'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$monthlySales = [];
|
||||
|
||||
|
|
@ -113,6 +117,9 @@ class RegionMapper extends DataMapperFactory
|
|||
return [$mtd, $ytd, $monthlySales];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function annualCustomerCountry(
|
||||
SmartDateTime $historyStart,
|
||||
\DateTime $endCurrent,
|
||||
|
|
@ -144,7 +151,7 @@ class RegionMapper extends DataMapperFactory
|
|||
address_country'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$annualCustomer = [];
|
||||
|
||||
|
|
@ -186,6 +193,9 @@ class RegionMapper extends DataMapperFactory
|
|||
return $annualCustomer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function mtdYtdClientCountry(
|
||||
\DateTime $startCurrent,
|
||||
\DateTime $endCurrent,
|
||||
|
|
@ -222,7 +232,7 @@ class RegionMapper extends DataMapperFactory
|
|||
address_country ASC'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$oldIndex = 1;
|
||||
$period = 1;
|
||||
|
|
@ -293,9 +303,12 @@ class RegionMapper extends DataMapperFactory
|
|||
|
||||
// @todo remove businessStart, that should be baked into the historyStart
|
||||
// Explanation: in the past I had to compare periods which weren't even business years!!!
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function salesProfitCountry(
|
||||
SmartDateTime $historyStart,
|
||||
SmartDateTime $historyEnd,
|
||||
\DateTime $historyStart,
|
||||
\DateTime $historyEnd,
|
||||
\DateTime $currentStart,
|
||||
\DateTime $currentEnd
|
||||
) : array {
|
||||
|
|
@ -322,7 +335,7 @@ class RegionMapper extends DataMapperFactory
|
|||
address_country'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$sales = [];
|
||||
$period = 0;
|
||||
|
|
@ -354,6 +367,9 @@ class RegionMapper extends DataMapperFactory
|
|||
return $sales;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function mtdYtdCountry(
|
||||
\DateTime $startCurrent,
|
||||
\DateTime $endCurrent,
|
||||
|
|
@ -390,7 +406,7 @@ class RegionMapper extends DataMapperFactory
|
|||
address_country ASC'
|
||||
);
|
||||
|
||||
$results = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$results = $query->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? [];
|
||||
|
||||
$oldIndex = 1;
|
||||
$period = 1;
|
||||
|
|
@ -464,6 +480,9 @@ class RegionMapper extends DataMapperFactory
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function countryToRegion(array $countries, array $region, array $columns) : array
|
||||
{
|
||||
$tempStruct = [];
|
||||
|
|
@ -472,6 +491,7 @@ class RegionMapper extends DataMapperFactory
|
|||
}
|
||||
|
||||
$regions = ['Other' => $tempStruct];
|
||||
$definitions = [];
|
||||
|
||||
foreach ($region as $r) {
|
||||
$definitions[$r] = ($temp = ISO3166TwoEnum::getRegion($r)) === [] ? [$r] : $temp;
|
||||
|
|
@ -500,6 +520,9 @@ class RegionMapper extends DataMapperFactory
|
|||
return $regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Re-implement, still in use?
|
||||
*/
|
||||
public static function countryIntervalToRegion(array $countries, array $region, array $columns) : array
|
||||
{
|
||||
if (empty($countries)) {
|
||||
|
|
@ -517,6 +540,8 @@ class RegionMapper extends DataMapperFactory
|
|||
'Other' => \array_fill(1, $count, $tempStruct),
|
||||
];
|
||||
|
||||
$definitions = [];
|
||||
|
||||
foreach ($region as $r) {
|
||||
$definitions[$r] = ($temp = ISO3166TwoEnum::getRegion($r)) === [] ? [$r] : $temp;
|
||||
$regions[$r] = \array_fill(1, $count, $tempStruct);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ return ['SalesAnalysis' => [
|
|||
'ItemAttribute' => 'Item Attribute',
|
||||
'ClientAttribute' => 'Client Attribute',
|
||||
'Months' => 'Months',
|
||||
'Total' => 'Total',
|
||||
'Year' => 'Year',
|
||||
'Month' => 'Month',
|
||||
'All' => 'All',
|
||||
|
|
@ -28,7 +27,6 @@ return ['SalesAnalysis' => [
|
|||
'ProfitPY' => 'Profit PY',
|
||||
'ProfitA' => 'Profit A',
|
||||
'DiffPY' => 'Δ PY',
|
||||
'Data' => 'Data',
|
||||
'Actual' => 'Actual',
|
||||
'Segment' => 'Segment',
|
||||
'Section' => 'Section',
|
||||
|
|
@ -57,11 +55,9 @@ return ['SalesAnalysis' => [
|
|||
'Data' => 'Data',
|
||||
'Domestic' => 'Domestic',
|
||||
'Export' => 'Export',
|
||||
'Month' => 'Month',
|
||||
'Current' => 'Current',
|
||||
'Analyze' => 'Analyze',
|
||||
'Regions' => 'Regions',
|
||||
'Total' => 'Total',
|
||||
'Type' => 'Type',
|
||||
'Year' => 'Year',
|
||||
]];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user