m3 Security Fixes
This commit is contained in:
@@ -27,7 +27,7 @@ class execSummaryLineController extends Controller
|
||||
}
|
||||
|
||||
$reportPeriod = isset($request->reportPeriod) ? $request->reportPeriod : ''; # monthly , quarter , year , daily
|
||||
# Current
|
||||
# Current
|
||||
$checkSales = isset($request->checkSales) ? $request->checkSales : ''; # on
|
||||
$checkWeight = isset($request->checkWeight) ? $request->checkWeight : ''; # on
|
||||
$checkLines = isset($request->checkLines) ? $request->checkLines : ''; # on
|
||||
@@ -43,14 +43,14 @@ class execSummaryLineController extends Controller
|
||||
$toreportDate = $lastDay->modify('last day of December')->format('Ymd');
|
||||
|
||||
# Build SQL
|
||||
$selectContent = "with tempfile as (
|
||||
$selectContent = "with tempfile as (
|
||||
select a5rsvqty,a5packed,a5slunpr*a5packed as dollars,a5lnwght,a5whs,
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
) and a5co='".$CO."' and a5whs in(".implode(",", $WHArr).")
|
||||
)
|
||||
select substr(ayapr8N002,1,4) as years,count(*) as lines,sum(a5rsvqty) as reserveqty,sum(a5packed) as packed,sum(a5lnwght*a5packed/a5rsvqty) as weight,sum(dollars) as dollars,a5whs as whs from tempfile
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
) and a5co='".$CO."' and a5whs in(".implode(",", $WHArr).")
|
||||
)
|
||||
select substr(ayapr8N002,1,4) as years,count(*) as lines,sum(a5rsvqty) as reserveqty,sum(a5packed) as packed,sum(a5lnwght*a5packed/a5rsvqty) as weight,sum(dollars) as dollars,a5whs as whs from tempfile
|
||||
group by substr(ayapr8N002,1,4),a5whs order by 1 ";
|
||||
|
||||
$execSummaryResLY = [];
|
||||
@@ -64,28 +64,28 @@ class execSummaryLineController extends Controller
|
||||
$lastDay = isset($request->TOREPORTDATE) ? \DateTime::createFromFormat('Y-m', trim($request->TOREPORTDATE)) : '';
|
||||
$toreportDate = $lastDay->modify('last day of December')->format('Ymd');
|
||||
# Build SQL
|
||||
$selectContent = "with tempfile as (
|
||||
$selectContent = "with tempfile as (
|
||||
select a5rsvqty,a5packed,a5slunpr*a5packed as dollars,a5lnwght,a5whs,
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
) and a5co='".$CO."' and a5whs in (".implode(",", $WHArr).")
|
||||
)
|
||||
)
|
||||
select 'Q' || EXTRACT(QUARTER FROM TO_DATE(CAST(ayapr8n002 AS TEXT),'YYYYMMDD')) ||'-' || substr(ayapr8N002,3,2) as years,count(*) as lines,
|
||||
sum(a5rsvqty) as reserveqty, sum(a5packed) as packed,sum (a5lnwght*a5packed/a5rsvqty) as weight,sum(dollars) as dollars, a5whs as whs
|
||||
from tempfile
|
||||
from tempfile
|
||||
group by 'Q' || EXTRACT(QUARTER FROM TO_DATE(CAST(ayapr8n002 AS TEXT),'YYYYMMDD')) ||'-' || substr(ayapr8N002,3,2),a5whs order by 1 ";
|
||||
|
||||
$execSummaryResLY = [];
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'monthly':
|
||||
# Set Dates based on reportPeriod type
|
||||
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : null;
|
||||
|
||||
|
||||
$lastDay = (clone $firstDay);
|
||||
$reportDate = $firstDay->modify('-11 months')->modify('first day of this month')->format('Ymd'); //
|
||||
$reportDate = $firstDay->modify('-11 months')->modify('first day of this month')->format('Ymd'); //
|
||||
$toreportDate = $lastDay ? $lastDay->modify('last day of this month')->format('Ymd') : '';
|
||||
# Last Year Dates
|
||||
// Same period, but for Last Year (LY)
|
||||
@@ -93,32 +93,32 @@ class execSummaryLineController extends Controller
|
||||
$toreportDateLY = (clone $lastDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
|
||||
|
||||
# Build SQL
|
||||
$selectContent = "with tempfile as (
|
||||
$selectContent = "with tempfile as (
|
||||
select a5rsvqty,a5packed,a5slunpr*a5packed as dollars,a5lnwght,a5whs,
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
) and a5co='".$CO."' and a5whs in (".implode(",", $WHArr).")
|
||||
)
|
||||
)
|
||||
select substr(ayapr8N002,1,4) || '-' || substr(ayapr8N002,5,2) as years,count(*) as lines,sum(a5rsvqty) as reserveqty,sum(a5packed) as packed,
|
||||
sum(a5lnwght*a5packed/a5rsvqty) as weight,sum(dollars) as dollars, a5whs as whs
|
||||
from tempfile
|
||||
from tempfile
|
||||
group by substr(ayapr8N002,1,4) || '-' || substr(ayapr8N002,5,2),a5whs order by 1 ";
|
||||
|
||||
$selectContentLY = "with tempfile as (
|
||||
$selectContentLY = "with tempfile as (
|
||||
select a5rsvqty,a5packed,a5slunpr*a5packed as dollars,a5lnwght,a5whs,
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDateLY and ayapr8N002<=$toreportDateLY )
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDateLY and ayapr8N002<=$toreportDateLY )
|
||||
) and a5co='".$CO."' and a5whs in (".implode(",", $WHArr).")
|
||||
)
|
||||
)
|
||||
select substr(ayapr8N002,1,4) || '-' || substr(ayapr8N002,5,2) as years,count(*) as lines,sum(a5rsvqty) as reserveqty,sum(a5packed) as packed,
|
||||
sum(a5lnwght*a5packed/a5rsvqty) as weight,sum(dollars) as dollars, a5whs as whs
|
||||
from tempfile
|
||||
from tempfile
|
||||
group by substr(ayapr8N002,1,4) || '-' || substr(ayapr8N002,5,2),a5whs order by 1 ";
|
||||
|
||||
$execSummaryResLY = DB::connection(config('m3.connection', 'pgsql'))->select($selectContentLY);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'custom':
|
||||
@@ -132,28 +132,28 @@ class execSummaryLineController extends Controller
|
||||
$toreportDateLY = (clone $firstDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
|
||||
|
||||
# Build SQL
|
||||
$selectContent = "with tempfile as (
|
||||
$selectContent = "with tempfile as (
|
||||
select a5rsvqty,a5packed,a5slunpr*a5packed as dollars,a5lnwght,a5whs,
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDate and ayapr8N002<=$toreportDate )
|
||||
) and a5co='".$CO."' and a5whs in (".implode(",", $WHArr).")
|
||||
)
|
||||
)
|
||||
select substr(ayapr8N002,7,2) as years,count(*) as lines,sum(a5rsvqty) as reserveqty,sum(a5packed) as packed,
|
||||
sum(a5lnwght*a5packed/a5rsvqty) as weight, sum(dollars) as dollars, a5whs as whs
|
||||
from tempfile
|
||||
from tempfile
|
||||
group by substr(ayapr8N002,7,2),a5whs order by 1 ";
|
||||
|
||||
$selectContentLY = "with tempfile as (
|
||||
$selectContentLY = "with tempfile as (
|
||||
select a5rsvqty,a5packed,a5slunpr*a5packed as dollars,a5lnwght,a5whs,
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDateLY and ayapr8N002<=$toreportDateLY )
|
||||
(select max(ayapr8N002) as ayapr8N002 from icm695m1 where a5macpkr=aymacpkr fetch first 1 rows only)
|
||||
from icm688m2 where a5macpkr in (
|
||||
select distinct aymacpkr from icm695m1 where (AYSTATUS in ('Z','z') and ayapr8N002>=$reportDateLY and ayapr8N002<=$toreportDateLY )
|
||||
) and a5co='".$CO."' and a5whs in (".implode(",", $WHArr).")
|
||||
)
|
||||
)
|
||||
select substr(ayapr8N002,7,2) as years,count(*) as lines,sum(a5rsvqty) as reserveqty,sum(a5packed) as packed,
|
||||
sum(a5lnwght*a5packed/a5rsvqty) as weight, sum(dollars) as dollars, a5whs as whs
|
||||
from tempfile
|
||||
from tempfile
|
||||
group by substr(ayapr8N002,7,2),a5whs order by 1 ";
|
||||
|
||||
$execSummaryResLY = DB::connection(config('m3.connection', 'pgsql'))->select($selectContentLY);
|
||||
@@ -184,7 +184,7 @@ class execSummaryLineController extends Controller
|
||||
->select('R428US','R428CO', 'R428WH','R428PL')
|
||||
->where('R428US','=',$SHUSER)
|
||||
->first();
|
||||
|
||||
|
||||
$R428US = isset($ICM428M->R428US) ? $ICM428M->R428US : ''; # User
|
||||
$COMPANY = isset($ICM428M->R428CO) ? $ICM428M->R428CO : '110'; # Company
|
||||
$PLANT = isset($ICM428M->R428PL) ? $ICM428M->R428PL : '144'; # Plant
|
||||
@@ -197,7 +197,7 @@ class execSummaryLineController extends Controller
|
||||
}
|
||||
catch (\Throwable $th) {
|
||||
Log::error($th);
|
||||
}
|
||||
}
|
||||
|
||||
return view('m3::liberty-theme.pages.execSummaryLine',compact('IC670M','WHDDA'));
|
||||
// ,'ICM688M2',,'COMPANY','PLANT','WHS','reportDate'
|
||||
|
||||
Reference in New Issue
Block a user