Report table column order changed and Added passing invoice name without extension while import to check status on database

This commit is contained in:
dhanabalan
2025-05-20 09:31:34 +05:30
parent b4116c7492
commit 1af5a7d0b6

View File

@@ -204,68 +204,76 @@ class InvoiceValidationResource extends Resource
->sortable(),
Tables\Columns\TextColumn::make('invoice_number')
->label('Invoice Number')
->alignCenter()
->sortable(), //->searchable()
Tables\Columns\TextColumn::make('stickerMaster.item.code')
->label('Material Code')
->label('Item Code')
->alignCenter()
->sortable(), //->searchable()
Tables\Columns\TextColumn::make('serial_number')
->label('Serial Number')
->alignCenter()
->sortable(), //->searchable()
Tables\Columns\TextColumn::make('motor_scanned_status')
->label('Motor Scanned Status')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('pump_scanned_status')
->label('Pump Scanned Status')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('scanned_status_set')
->label('Pump Set Scanned Status')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('capacitor_scanned_status')
->label('Capacitor Scanned Status')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('scanned_status')
->label('Scanned Status')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('panel_box_supplier')
->label('Panel Box Supplier')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('panel_box_serial_number')
->label('Panel Box Serial Number')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('load_rate')
->label('Load Rate')
->numeric()
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('upload_status')
->label('Upload Status')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('batch_number')
->label('Batch Number')
->sortable(),
->alignCenter(),
Tables\Columns\TextColumn::make('quantity')
->label('Quantity')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('operator_id')
->label('Operator ID')
->sortable(),
->label('Quantity')
->alignCenter()
->numeric(),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->dateTime()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('operator_id')
->label('Operator ID')
->alignCenter()
->sortable(),
])
->headerActions([
@@ -316,6 +324,8 @@ class InvoiceValidationResource extends Resource
// Get original filename
$originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
// Store manually using storeAs to keep original name
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
// uploads/temp/3RA0018735.xlsx
@@ -323,8 +333,8 @@ class InvoiceValidationResource extends Resource
$fullPath = Storage::disk('local')->path($path);
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
$totQuan = InvoiceValidation::where('invoice_number', $originalName)->where('plant_id', $plantId)->count();
$scanSQuan = InvoiceValidation::where('invoice_number', $originalName)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('plant_id', $plantId)->count();
$scanSQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
if($totQuan == $scanSQuan && $totQuan > 0)
{
@@ -594,12 +604,14 @@ class InvoiceValidationResource extends Resource
// Get original filename
$originalName = $uploadedFile->getClientOriginalName();
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local');
$fullPath = Storage::disk('local')->path($path);
$totQuan = InvoiceValidation::where('invoice_number', $originalName)->where('plant_id', $plantId)->count();
$scanMQuan = InvoiceValidation::where('invoice_number', $originalName)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('plant_id', $plantId)->count();
$scanMQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
if($totQuan == $scanMQuan && $totQuan > 0)
{