Updated item code validations and warning messages on import
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
This commit is contained in:
@@ -624,9 +624,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! $validRowsFound) {
|
||||||
|
|
||||||
if (! $validRowsFound) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Serial Invoice')
|
->title('Invalid Serial Invoice')
|
||||||
->danger() // This makes the notification red to indicate an error
|
->danger() // This makes the notification red to indicate an error
|
||||||
@@ -641,9 +639,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
$uniqueCodes = array_unique($materialCodes);
|
$uniqueCodes = array_unique($materialCodes);
|
||||||
|
|
||||||
$matchedItems = StickerMaster::with('item')
|
$matchedItems = StickerMaster::with('item')->where('plant_id', $plantId)
|
||||||
->whereHas('item', function ($query) use ($uniqueCodes) {
|
->whereHas('item', function ($query) use ($uniqueCodes, $plantId) {
|
||||||
$query->whereIn('code', $uniqueCodes);
|
$query->whereIn('code', $uniqueCodes)->where('plant_id', $plantId);
|
||||||
})
|
})
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -654,7 +652,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if (! empty($missingCodes)) {
|
if (! empty($missingCodes)) {
|
||||||
$missingCount = count($missingCodes);
|
$missingCount = count($missingCodes);
|
||||||
|
|
||||||
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in database." : 'The following item codes are not found in database:<br>'.implode(', ', $missingCodes);
|
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in sticker master." : 'The following item codes are not found in sticker master:<br>'.implode(', ', $missingCodes);
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Item Codes')
|
->title('Unknown Item Codes')
|
||||||
@@ -678,7 +676,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if (count($invalidCodes) > 10) {
|
if (count($invalidCodes) > 10) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid item codes found')
|
->title('Invalid item codes found')
|
||||||
->body(''.count($invalidCodes).'item codes found have material type.')
|
->body(''.count($invalidCodes).' item codes have material type.')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
@@ -920,9 +918,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! empty($uniqueaplhaMat)) {
|
||||||
|
|
||||||
if (! empty($uniqueaplhaMat)) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Material Quantity')
|
->title('Invalid Material Quantity')
|
||||||
->body('The following item codes material quantity must be a numeric values :<br>'.implode(', ', $uniqueaplhaMat))
|
->body('The following item codes material quantity must be a numeric values :<br>'.implode(', ', $uniqueaplhaMat))
|
||||||
@@ -934,9 +930,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! empty($uniqueZeroMat)) {
|
||||||
|
|
||||||
if (! empty($uniqueZeroMat)) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Material Quantity')
|
->title('Invalid Material Quantity')
|
||||||
->body('The following item codes material quantity should be greater than 0:<br>'.implode(', ', $uniqueZeroMat))
|
->body('The following item codes material quantity should be greater than 0:<br>'.implode(', ', $uniqueZeroMat))
|
||||||
@@ -948,9 +942,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! empty($uniqueEmptyMat)) {
|
||||||
|
|
||||||
if (! empty($uniqueEmptyMat)) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Missing Material Quantity')
|
->title('Missing Material Quantity')
|
||||||
->body("The following item codes doesn't have valid material quantity:<br>".implode(', ', $uniqueEmptyMat))
|
->body("The following item codes doesn't have valid material quantity:<br>".implode(', ', $uniqueEmptyMat))
|
||||||
@@ -962,9 +954,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! $validRowsFound) {
|
||||||
|
|
||||||
if (! $validRowsFound) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Material Invoice')
|
->title('Invalid Material Invoice')
|
||||||
->danger() // This makes the notification red to indicate an error
|
->danger() // This makes the notification red to indicate an error
|
||||||
@@ -980,9 +970,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
$uniqueCodes = array_unique($materialCodes);
|
$uniqueCodes = array_unique($materialCodes);
|
||||||
|
|
||||||
$matchedItems = StickerMaster::with('item')
|
$matchedItems = StickerMaster::with('item')->where('plant_id', $plantId)
|
||||||
->whereHas('item', function ($query) use ($uniqueCodes) {
|
->whereHas('item', function ($query) use ($uniqueCodes, $plantId) {
|
||||||
$query->whereIn('code', $uniqueCodes);
|
$query->whereIn('code', $uniqueCodes)->where('plant_id', $plantId);
|
||||||
})
|
})
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -993,9 +983,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if (! empty($missingCodes)) {
|
if (! empty($missingCodes)) {
|
||||||
$missingCount = count($missingCodes);
|
$missingCount = count($missingCodes);
|
||||||
|
|
||||||
$message = $missingCount > 10
|
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in sticker master." : 'The following item codes are not found in sticker master:<br>'.implode(', ', $missingCodes);
|
||||||
? "'$missingCount' Item Codes are not found in sticker master."
|
|
||||||
: 'Item Codes are not found in sticker master:<br>'.implode(', ', $missingCodes);
|
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Item Codes')
|
->title('Unknown Item Codes')
|
||||||
@@ -1019,7 +1007,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
$invalidCodes = array_unique($invalidCodes);
|
$invalidCodes = array_unique($invalidCodes);
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid item codes found')
|
->title('Invalid item codes found')
|
||||||
->body(''.count($invalidCodes).'invalid item codes found have serial number.')
|
->body(''.count($invalidCodes).' item codes have serial type.')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user