updates to M3 module
This commit is contained in:
@@ -14,33 +14,20 @@ class M3DeliveryController extends Controller
|
||||
{
|
||||
|
||||
public static function index(Request $request) {
|
||||
|
||||
$power_user = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
|
||||
->select('R428PWRUSR','R428US','R428CO','R428PL','R428WH')
|
||||
->where('R428US','=',strtoUpper(m3_user()))
|
||||
->first();
|
||||
$co = $power_user->R428CO;
|
||||
$plant = $power_user->R428PL;
|
||||
$whs = $power_user->R428WH;
|
||||
$ICM664M = DB::connection(config('m3.connection', 'pgsql'))->select("select * from ICM664M
|
||||
where AVCO='$co' and AVPLANT='$plant' and AVWHS='$whs'");
|
||||
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->select("select * from IC670M where WDCO='$co' and WDPL='$plant' and WDWHS='$whs'");
|
||||
$shipvia = DB::connection(config('m3.connection', 'pgsql'))->select("select AXCODE, AXDESC from ICM319M order by 1");
|
||||
#646 where AXCO='$co' and AXWHS='$whs' and AXPLANT='$plant'
|
||||
$connection = config('m3.connection', 'pgsql');
|
||||
$power_user = (object) ['R428PWRUSR'=>'N','R428US'=>strtoUpper(m3_user()),'R428CO'=>'','R428PL'=>'','R428WH'=>''];
|
||||
if (\Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')) {
|
||||
$power_user = DB::connection($connection)->table('icm428m')->select('R428PWRUSR','R428US','R428CO','R428PL','R428WH')
|
||||
->where('R428US',strtoUpper(m3_user()))->first() ?? $power_user;
|
||||
}
|
||||
$co=$power_user->R428CO; $plant=$power_user->R428PL; $whs=$power_user->R428WH;
|
||||
$ICM664M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm664m')
|
||||
? DB::connection($connection)->table('icm664m')->where('AVCO',$co)->where('AVPLANT',$plant)->where('AVWHS',$whs)->get() : collect();
|
||||
$IC670M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('ic670m')
|
||||
? DB::connection($connection)->table('ic670m')->where('WDCO',$co)->where('WDPL',$plant)->where('WDWHS',$whs)->get() : collect();
|
||||
$shipvia = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm319m')
|
||||
? DB::connection($connection)->table('icm319m')->select('AXCODE','AXDESC')->orderBy('AXCODE')->get() : collect();
|
||||
return view('m3::liberty-theme.pages.M3Delivery', compact('ICM664M','IC670M','power_user','shipvia'));
|
||||
|
||||
// AVCO AVCO CHARACTER 3 No ' ' Division
|
||||
// AVWHS AVWHS CHARACTER 3 No ' ' Warehouse
|
||||
// AVPLANT AVPLANT CHARACTER 3 No ' ' Plant
|
||||
// AVDELMETH AVDELMETH CHARACTER 4 No ' ' Delivery method
|
||||
// AVSHPVIA AVSHPVIA CHARACTER 4 No ' ' Sentinel ship via
|
||||
// AVSHSRT AVSHSRT CHARACTER 6 No ' ' Sentinel route
|
||||
// AVSHORCL AVSHORCL CHARACTER 3 No ' ' Sentinel intl code
|
||||
// AVSPR1A01 AVSPR1A01 CHARACTER 1 No ' ' Spare field 1A 01
|
||||
// AVSPR1A02 AVSPR1A02 CHARACTER 1 No ' ' Spare field 1A 02
|
||||
// AVSPR10A01 AVSPR10A01 CHARACTER 10 No ' ' Spare field 10A 1
|
||||
// AVSPR15A01 AVSPR15A01 CHARACTER 15 No ' ' Spare field 15A 1
|
||||
// AVSPR30A01 AVSPR30A01 CHARACTER 30 No ' ' Spare field 30A 1
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user