M3 Security Fixes for Pass 34
This commit is contained in:
@@ -10,22 +10,23 @@ use Str;
|
||||
class execSummaryController extends Controller
|
||||
{
|
||||
private const WAREHOUSE_IN_CLAUSE = "' and a5whs in (";
|
||||
|
||||
public static function index(Request $request)
|
||||
{
|
||||
$IC670M = collect();
|
||||
$WHDDA = '';
|
||||
$COMPANY = '110';
|
||||
$PLANT = '144';
|
||||
$WHS = '322';
|
||||
$iC670M = collect();
|
||||
$wHDDA = '';
|
||||
$cOMPANY = '110';
|
||||
$pLANT = '144';
|
||||
$wHS = '322';
|
||||
|
||||
try {
|
||||
// Ajax Call
|
||||
if ($request->ajax()) {
|
||||
$WHDDA = isset($request->WHDDA) ? $request->WHDDA : [];
|
||||
$WHArr = [];
|
||||
foreach ($WHDDA as $key => $WHDDAV) {
|
||||
$CO = substr($WHDDAV, 0, 3);
|
||||
$WHArr[] = substr($WHDDAV, 6, 3);
|
||||
$wHDDA = isset($request->WHDDA) ? $request->WHDDA : [];
|
||||
$wHArr = [];
|
||||
foreach ($wHDDA as $key => $WHDDAV) {
|
||||
$cO = substr($WHDDAV, 0, 3);
|
||||
$wHArr[] = substr($WHDDAV, 6, 3);
|
||||
}
|
||||
|
||||
$reportPeriod = isset($request->reportPeriod) ? $request->reportPeriod : ''; // monthly , quarter , year , daily
|
||||
@@ -34,7 +35,7 @@ class execSummaryController extends Controller
|
||||
$checkWeight = isset($request->checkWeight) ? $request->checkWeight : ''; // on
|
||||
$checkLines = isset($request->checkLines) ? $request->checkLines : ''; // on
|
||||
|
||||
if (count($WHArr) > 0 && $CO != '' && $reportPeriod != '') {
|
||||
if (count($wHArr) > 0 && $cO != '' && $reportPeriod != '') {
|
||||
switch ($reportPeriod) {
|
||||
case 'year':
|
||||
// Set Dates based on reportPeriod type
|
||||
@@ -50,7 +51,7 @@ class execSummaryController extends Controller
|
||||
(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) . ')
|
||||
) 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 ';
|
||||
@@ -70,7 +71,7 @@ class execSummaryController extends Controller
|
||||
(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 . self::WAREHOUSE_IN_CLAUSE . implode(',', $WHArr) . ")
|
||||
) and a5co='" . $cO . self::WAREHOUSE_IN_CLAUSE . implode(',', $wHArr) . ")
|
||||
)
|
||||
select substr(ayapr8N002,3,2) ||'-' || 'Q' || EXTRACT(QUARTER FROM TO_DATE(CAST(ayapr8n002 AS TEXT),'YYYYMMDD')) 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
|
||||
@@ -92,7 +93,7 @@ class execSummaryController extends Controller
|
||||
(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 . self::WAREHOUSE_IN_CLAUSE . implode(',', $WHArr) . ")
|
||||
) and a5co='" . $cO . self::WAREHOUSE_IN_CLAUSE . 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
|
||||
@@ -114,7 +115,7 @@ class execSummaryController extends Controller
|
||||
(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 . self::WAREHOUSE_IN_CLAUSE . implode(',', $WHArr) . ')
|
||||
) and a5co='" . $cO . self::WAREHOUSE_IN_CLAUSE . 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
|
||||
@@ -139,28 +140,28 @@ class execSummaryController extends Controller
|
||||
}
|
||||
|
||||
// Init Page
|
||||
$SHUSER = m3_user() !== '' ? Str::upper(trim(m3_user())) : '';
|
||||
if ($SHUSER != '') {
|
||||
$sHUSER = m3_user() !== '' ? Str::upper(trim(m3_user())) : '';
|
||||
if ($sHUSER != '') {
|
||||
// Get User CO & WH from Table ICM428M
|
||||
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
|
||||
$iCM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
|
||||
->select('R428US', 'R428CO', 'R428WH', 'R428PL')
|
||||
->where('R428US', '=', $SHUSER)
|
||||
->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
|
||||
$WHS = isset($ICM428M->R428WH) ? $ICM428M->R428WH : '322'; // WareHouse
|
||||
$r428US = isset($iCM428M->R428US) ? $iCM428M->R428US : ''; // User
|
||||
$cOMPANY = isset($iCM428M->R428CO) ? $iCM428M->R428CO : '110'; // Company
|
||||
$pLANT = isset($iCM428M->R428PL) ? $iCM428M->R428PL : '144'; // Plant
|
||||
$wHS = isset($iCM428M->R428WH) ? $iCM428M->R428WH : '322'; // WareHouse
|
||||
}
|
||||
$WHDDA = $COMPANY . $PLANT . $WHS;
|
||||
// dump($WHDDA);
|
||||
$wHDDA = $cOMPANY . $pLANT . $wHS;
|
||||
// dump($wHDDA);
|
||||
// Warehouse Table
|
||||
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
|
||||
$iC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
|
||||
} catch (\Throwable $th) {
|
||||
Log::error($th);
|
||||
}
|
||||
|
||||
return view('m3::liberty-theme.pages.execSummary', compact('IC670M', 'WHDDA'));
|
||||
return view('m3::liberty-theme.pages.execSummary', ['IC670M' => $iC670M, 'WHDDA' => $wHDDA]);
|
||||
// ,'ICM688M2',,'COMPANY','PLANT','WHS','reportDate'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user