updates to M3 module

This commit is contained in:
Mark Gregory
2026-09-16 16:46:15 +01:00
parent 13a7e804af
commit ce06aa9fac
20 changed files with 191 additions and 203 deletions
@@ -14,24 +14,19 @@ class palletQtyController extends Controller
{
public static function index(Request $request) {
#$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
#$power_user = DB::connection(config('m3.connection', 'pgsql'))->select("select R428PWRUSR, R428CO, R428PL, R428WH from ICM428M where R428US='".strtoUpper(m3_user())."'");
$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;
$ICM709M = DB::connection(config('m3.connection', 'pgsql'))->table('icm709m')
->where('AT9CO','=',$co)
->where('AT9PLT','=',$plant)
->where('AT9WHS','=',$whs)
->get();
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->select("select * from IC670M where WDCO='$co' and WDPL='$plant' and WDWHS='$whs'");
$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;
$ICM709M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm709m')
? DB::connection($connection)->table('icm709m')->where('AT9CO',$co)->where('AT9PLT',$plant)->where('AT9WHS',$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();
return view('m3::liberty-theme.pages.palletQty', compact('ICM709M','IC670M','power_user'));
}
//