58 lines
2.1 KiB
PHP
58 lines
2.1 KiB
PHP
<?php
|
|
namespace Modules\M3\Http\Controllers;
|
|
|
|
use DB;
|
|
use Config;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
class MFOrdersController extends Controller
|
|
{
|
|
|
|
public static function index(Request $request)
|
|
{
|
|
$MF = isset($request->id) ? trim($request->id) : "";
|
|
|
|
// dd("MFOrders ".$MF);
|
|
# Get Users from ICM428M
|
|
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
|
|
->select('R428US','R428CO', 'R428WH', 'R428PL')
|
|
->where('R428US','=',strtoUpper(m3_user()))
|
|
->first();
|
|
$user = $ICM428M->R428US;
|
|
$co = $ICM428M->R428CO;
|
|
$whs = $ICM428M->R428WH;
|
|
$plant = $ICM428M->R428PL;
|
|
|
|
# ICM705M1 Statement
|
|
$sqlstmt = "select APMANIFEST,APDOCKDOOR,APCARRIER,APTRUCKIDT,APSPARE1,APLDSTRU,APLDSTRD,APLDSTRT,
|
|
APLDCLOU,APLDCLOD,APLDCLOT,APCO,APWHS,APPLT,APSPARE2,APLDCLOZ
|
|
from ICM705M1
|
|
where APMANIFEST = $MF and APCO='$co' and APWHS='$whs' and APPLT='$plant' limit 1";
|
|
|
|
$ICM705M1 = DB::connection(config('m3.connection', 'pgsql'))->select($sqlstmt);
|
|
// dump($ICM705M1);
|
|
$carrier = isset($ICM705M1[0]->APCARRIER) ? trim($ICM705M1[0]->APCARRIER) : "";
|
|
|
|
if ($MF!='') {
|
|
$status_ICM688M1_array = Config::get('arrays.status_ICM688M1_array');
|
|
|
|
$sqlstmt = "SELECT AYCO,AYPLANT,AYMACPKR,AYONO,A4SHSHNM,A4PICKSTS,AYSPR15A01,SUM(AYLNWGHT) AS TOTWEIGHT,COUNT(*) AS BOXPAL FROM ICM695M1
|
|
LEFT JOIN ICM688M1 ON AYCO=A4CO AND AYPLANT=A4PLANT AND AYMACPKR=A4MACPKR
|
|
WHERE AYAPRF1551= $MF and AYCO='$co' and AYWHS='$whs' and AYPLANT='$plant'
|
|
GROUP BY AYCO,AYPLANT,AYMACPKR,AYONO,A4SHSHNM,A4PICKSTS,AYSPR15A01";
|
|
|
|
$ICM695M1 = DB::connection(config('m3.connection', 'pgsql'))->select($sqlstmt);
|
|
// dump($ICM695M1);
|
|
|
|
return view('m3::liberty-theme.pages.MFOrders', compact( 'ICM695M1', 'status_ICM688M1_array', 'MF', 'carrier')
|
|
);
|
|
}
|
|
else{
|
|
abort(404, 'Manifest Not Found');
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|