Compare commits
63 Commits
renovate/t
...
f00fc8b4d7
| Author | SHA1 | Date | |
|---|---|---|---|
| f00fc8b4d7 | |||
|
|
aec52493f5 | ||
| 73eb79a8d0 | |||
|
|
71dad18036 | ||
| 5856fe64c1 | |||
|
|
cc59f4548c | ||
| 4615e45c74 | |||
|
|
7f20aa1c99 | ||
| 486b94bb79 | |||
|
|
abd639e73f | ||
| 71eda460bd | |||
|
|
a8c144ae5b | ||
| 938f9b9fdf | |||
|
|
e130e35f40 | ||
| 648551c619 | |||
|
|
0d3163165d | ||
| 308e68b79a | |||
|
|
0ec98d2f9f | ||
| 5b9cb33a63 | |||
|
|
fdd9dbbfb2 | ||
| 8b57518408 | |||
|
|
723c3c1ebf | ||
| 4b68133bf1 | |||
|
|
24b4c14aaf | ||
| a52fc9580a | |||
|
|
6cde9fc570 | ||
|
|
ab1daa57e2 | ||
| 94819ccc4f | |||
|
|
f0141c4f7e | ||
| 6e51b9fba8 | |||
|
|
3bcc351fa6 | ||
| 0a66526a63 | |||
|
|
ea16763f33 | ||
| 0398cd5262 | |||
|
|
94193d6a47 | ||
| cca6fbe428 | |||
|
|
f4c89037f2 | ||
| 633c8c89ca | |||
|
|
e2bb41d1d7 | ||
| 543ab7f44f | |||
|
|
c180e098a3 | ||
| 09aeff2b96 | |||
|
|
b2a06caff0 | ||
| 2f3973f6af | |||
|
|
bc1d3190d4 | ||
| 7f76a604a3 | |||
|
|
0490516836 | ||
| 837ac47120 | |||
|
|
8d05164215 | ||
| e6fb2c1bae | |||
|
|
f38cc70537 | ||
| a687b8af3b | |||
|
|
5dd212422c | ||
| cd45e6658a | |||
|
|
574e244e2f | ||
| 0b221c5eae | |||
|
|
9d8388c221 | ||
| 8c062505c9 | |||
|
|
87fd2df0f4 | ||
| 9411d0b33b | |||
|
|
7d5e02f491 | ||
| ab3a2047bb | |||
|
|
810c40b81b |
@@ -13,21 +13,40 @@ class CharacteristicValueExporter extends Exporter
|
|||||||
|
|
||||||
public static function getColumns(): array
|
public static function getColumns(): array
|
||||||
{
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
return [
|
return [
|
||||||
ExportColumn::make('id')
|
ExportColumn::make('no')
|
||||||
->label('ID'),
|
->label('NO')
|
||||||
ExportColumn::make('plant.name'),
|
->state(function ($record) use (&$rowNumber) {
|
||||||
ExportColumn::make('line.name'),
|
// Increment and return the row number
|
||||||
ExportColumn::make('item.id'),
|
return ++$rowNumber;
|
||||||
ExportColumn::make('machine.name'),
|
}),
|
||||||
ExportColumn::make('process_order'),
|
ExportColumn::make('plant.code')
|
||||||
ExportColumn::make('coil_number'),
|
->label('PLANT CODE'),
|
||||||
ExportColumn::make('status'),
|
ExportColumn::make('line.name')
|
||||||
ExportColumn::make('created_at'),
|
->label('LINE NAME'),
|
||||||
ExportColumn::make('updated_at'),
|
ExportColumn::make('item.code')
|
||||||
ExportColumn::make('created_by'),
|
->label('ITEM CODE'),
|
||||||
ExportColumn::make('updated_by'),
|
ExportColumn::make('machine.name')
|
||||||
ExportColumn::make('deleted_at'),
|
->label('WORK CENTER'),
|
||||||
|
ExportColumn::make('process_order')
|
||||||
|
->label('PROCESS ORDER'),
|
||||||
|
ExportColumn::make('coil_number')
|
||||||
|
->label('COIL NUMBER'),
|
||||||
|
ExportColumn::make('status')
|
||||||
|
->label('STATUS'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
ExportColumn::make('created_by')
|
||||||
|
->label('CREATED BY'),
|
||||||
|
ExportColumn::make('updated_by')
|
||||||
|
->label('UPDATED BY'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->enabledByDefault(false)
|
||||||
|
->label('DELETED AT'),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
59
app/Filament/Exports/InvoiceInTransitExporter.php
Normal file
59
app/Filament/Exports/InvoiceInTransitExporter.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\InvoiceInTransit;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class InvoiceInTransitExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = InvoiceInTransit::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ExportColumn::make('id')
|
||||||
|
->label('ID'),
|
||||||
|
ExportColumn::make('plant.name'),
|
||||||
|
ExportColumn::make('receiving_plant'),
|
||||||
|
ExportColumn::make('receiving_plant_name'),
|
||||||
|
ExportColumn::make('invoice_number'),
|
||||||
|
ExportColumn::make('invoice_date'),
|
||||||
|
ExportColumn::make('item_code'),
|
||||||
|
ExportColumn::make('description'),
|
||||||
|
ExportColumn::make('quantity'),
|
||||||
|
ExportColumn::make('transport_name'),
|
||||||
|
ExportColumn::make('lr_bl_aw_number'),
|
||||||
|
ExportColumn::make('lr_bl_aw_date'),
|
||||||
|
ExportColumn::make('pending_days'),
|
||||||
|
ExportColumn::make('obd_number'),
|
||||||
|
ExportColumn::make('obd_date'),
|
||||||
|
ExportColumn::make('shipment_weight'),
|
||||||
|
ExportColumn::make('unit_price'),
|
||||||
|
ExportColumn::make('net_value'),
|
||||||
|
ExportColumn::make('total_item_amount'),
|
||||||
|
ExportColumn::make('tax_amount'),
|
||||||
|
ExportColumn::make('transport_mode'),
|
||||||
|
ExportColumn::make('vehicle_number'),
|
||||||
|
ExportColumn::make('e_waybill_number'),
|
||||||
|
ExportColumn::make('created_at'),
|
||||||
|
ExportColumn::make('updated_at'),
|
||||||
|
ExportColumn::make('created_by'),
|
||||||
|
ExportColumn::make('updated_by'),
|
||||||
|
ExportColumn::make('deleted_at'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your invoice in transit export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
57
app/Filament/Exports/InvoiceMasterExporter.php
Normal file
57
app/Filament/Exports/InvoiceMasterExporter.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\InvoiceMaster;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class InvoiceMasterExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = InvoiceMaster::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
|
return [
|
||||||
|
ExportColumn::make('no')
|
||||||
|
->label('NO')
|
||||||
|
->state(function ($record) use (&$rowNumber) {
|
||||||
|
// Increment and return the row number
|
||||||
|
return ++$rowNumber;
|
||||||
|
}),
|
||||||
|
ExportColumn::make('receiving_plant')
|
||||||
|
->label('Receiving Plant'),
|
||||||
|
ExportColumn::make('receiving_plant_name')
|
||||||
|
->label('Receiving Plant Name'),
|
||||||
|
ExportColumn::make('transit_days')
|
||||||
|
->label('Transit Days'),
|
||||||
|
ExportColumn::make('transport_name')
|
||||||
|
->label('Transport Name'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('Created At'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('Updated At'),
|
||||||
|
ExportColumn::make('created_by')
|
||||||
|
->label('Created By'),
|
||||||
|
ExportColumn::make('updated_by')
|
||||||
|
->label('Updated By'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->label('Deleted At')
|
||||||
|
->enabledByDefault(false),
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your invoice master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,14 +24,16 @@ class InvoiceValidationExporter extends Exporter
|
|||||||
// Increment and return the row number
|
// Increment and return the row number
|
||||||
return ++$rowNumber;
|
return ++$rowNumber;
|
||||||
}),
|
}),
|
||||||
ExportColumn::make('plant.name')
|
ExportColumn::make('plant.code')
|
||||||
->label('PLANT'),
|
->label('PLANT CODE'),
|
||||||
ExportColumn::make('invoice_number')
|
ExportColumn::make('invoice_number')
|
||||||
->label('INVOICE NUMBER'),
|
->label('INVOICE NUMBER'),
|
||||||
ExportColumn::make('serial_number')
|
ExportColumn::make('serial_number')
|
||||||
->label('SERIAL NUMBER'),
|
->label('SERIAL NUMBER'),
|
||||||
ExportColumn::make('stickerMaster.item.code')
|
ExportColumn::make('stickerMaster.item.code')
|
||||||
->label('ITEM CODE'),
|
->label('ITEM CODE'),
|
||||||
|
ExportColumn::make('stickerMaster.item.description')
|
||||||
|
->label('ITEM DESCRIPTION'),
|
||||||
ExportColumn::make('motor_scanned_status')
|
ExportColumn::make('motor_scanned_status')
|
||||||
->label('MOTOR SCANNED STATUS'),
|
->label('MOTOR SCANNED STATUS'),
|
||||||
ExportColumn::make('pump_scanned_status')
|
ExportColumn::make('pump_scanned_status')
|
||||||
|
|||||||
@@ -3,9 +3,16 @@
|
|||||||
namespace App\Filament\Imports;
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
use App\Models\CharacteristicValue;
|
use App\Models\CharacteristicValue;
|
||||||
|
use App\Models\Item;
|
||||||
|
use App\Models\Line;
|
||||||
|
use App\Models\Machine;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use App\Models\ProcessOrder;
|
||||||
|
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
use Filament\Actions\Imports\Importer;
|
use Filament\Actions\Imports\Importer;
|
||||||
use Filament\Actions\Imports\Models\Import;
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
use Str;
|
||||||
|
|
||||||
class CharacteristicValueImporter extends Importer
|
class CharacteristicValueImporter extends Importer
|
||||||
{
|
{
|
||||||
@@ -16,25 +23,52 @@ class CharacteristicValueImporter extends Importer
|
|||||||
return [
|
return [
|
||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Plant Code')
|
||||||
|
->example('1000')
|
||||||
|
->label('Plant Code')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('line')
|
ImportColumn::make('line')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Line Name')
|
||||||
|
->example('4 inch pump line')
|
||||||
|
->label('Line Name')
|
||||||
|
->relationship(resolveUsing: 'name')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('item')
|
ImportColumn::make('item')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Item Code')
|
||||||
|
->example('123456')
|
||||||
|
->label('Item Code')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('machine')
|
ImportColumn::make('machine')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Work Center')
|
||||||
|
->example('RMGS09745')
|
||||||
|
->label('Work Center')
|
||||||
|
->relationship(resolveUsing: 'work_center')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('process_order'),
|
ImportColumn::make('process_order')
|
||||||
ImportColumn::make('coil_number'),
|
->requiredMapping()
|
||||||
ImportColumn::make('status'),
|
->exampleHeader('Process Order')
|
||||||
ImportColumn::make('created_by'),
|
->example('23455256352')
|
||||||
ImportColumn::make('updated_by'),
|
->label('Process Order'),
|
||||||
|
ImportColumn::make('coil_number')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Coil Number')
|
||||||
|
->example('0')
|
||||||
|
->label('Coil Number'),
|
||||||
|
ImportColumn::make('status')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Status')
|
||||||
|
->example('Ok')
|
||||||
|
->label('Status'),
|
||||||
|
ImportColumn::make('created_by')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Created By')
|
||||||
|
->example('RAW01234')
|
||||||
|
->label('Created By'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +79,172 @@ class CharacteristicValueImporter extends Importer
|
|||||||
// 'email' => $this->data['email'],
|
// 'email' => $this->data['email'],
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
return new CharacteristicValue();
|
$warnMsg = [];
|
||||||
|
$plantId = null;
|
||||||
|
$itemId = null;
|
||||||
|
$LineId = null;
|
||||||
|
$machineId = null;
|
||||||
|
$itemAgainstPlant = null;
|
||||||
|
|
||||||
|
$plantCode = $this->data['plant'];
|
||||||
|
$processOrder = trim($this->data['process_order'] ?? '');
|
||||||
|
$iCode = trim($this->data['item']);
|
||||||
|
$workCenter = trim($this->data['machine']);
|
||||||
|
$lineName = trim($this->data['line']);
|
||||||
|
$status = trim($this->data['status']);
|
||||||
|
$createdBy = trim($this->data['created_by']);
|
||||||
|
$coilNo = trim($this->data['coil_number']);
|
||||||
|
|
||||||
|
if ($plantCode == null || $plantCode == '') {
|
||||||
|
$warnMsg[] = 'Plant code cannot be empty';
|
||||||
|
} elseif ($iCode == null || $iCode == '') {
|
||||||
|
$warnMsg[] = 'Process Order cannot be empty';
|
||||||
|
} elseif ($workCenter == null || $workCenter == '') {
|
||||||
|
$warnMsg[] = 'Work center cannot be empty';
|
||||||
|
} elseif ($lineName == null || $lineName == '') {
|
||||||
|
$warnMsg[] = 'Line cannot be empty';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
|
||||||
|
$warnMsg[] = 'Invalid plant code found';
|
||||||
|
} else {
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
|
if (! $plant) {
|
||||||
|
$warnMsg[] = 'Plant not found';
|
||||||
|
} else {
|
||||||
|
$plantId = $plant->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||||
|
$warnMsg[] = 'Invalid item code found';
|
||||||
|
} else {
|
||||||
|
$itemCode = Item::where('code', $iCode)->first();
|
||||||
|
if (! $itemCode) {
|
||||||
|
$warnMsg[] = 'Item code not found';
|
||||||
|
} else {
|
||||||
|
if ($plantId) {
|
||||||
|
$itemAgainstPlant = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||||
|
if (! $itemAgainstPlant) {
|
||||||
|
$warnMsg[] = 'Item code not found for the given plant';
|
||||||
|
} else {
|
||||||
|
$itemId = $itemAgainstPlant->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$lineExists = Line::where('name', $lineName)->first();
|
||||||
|
if (! $lineExists) {
|
||||||
|
$warnMsg[] = 'Line name not found';
|
||||||
|
} else {
|
||||||
|
if ($plantId) {
|
||||||
|
$lineAgainstPlant = Line::where('name', $lineName)->where('plant_id', $plantId)->first();
|
||||||
|
if (! $lineAgainstPlant) {
|
||||||
|
$warnMsg[] = 'Line name not found for the given plant';
|
||||||
|
} else {
|
||||||
|
$LineId = $lineAgainstPlant->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$workCenterExist = Machine::where('work_center', $workCenter)->first();
|
||||||
|
if (! $workCenterExist) {
|
||||||
|
$warnMsg[] = 'Work Center not found';
|
||||||
|
}
|
||||||
|
|
||||||
|
// $workCenterAgainstPlant = Machine::where('work_center', $workCenter)
|
||||||
|
// ->where('plant_id', $plantId)
|
||||||
|
// ->first();
|
||||||
|
|
||||||
|
// if (!$workCenterAgainstPlant) {
|
||||||
|
// $warnMsg[] = 'Work center not found for the given plant';
|
||||||
|
// } else {
|
||||||
|
// $MachineId = $workCenterAgainstPlant->id;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ($plantId != null && $LineId != null) {
|
||||||
|
$machineAgaPlantLine = Machine::where('plant_id', $plantId)
|
||||||
|
->where('line_id', $LineId)
|
||||||
|
->where('work_center', $workCenter)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (! $machineAgaPlantLine) {
|
||||||
|
$warnMsg[] = 'Work center not found for the given plant and line';
|
||||||
|
} else {
|
||||||
|
$machineId = $machineAgaPlantLine->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($processOrder == null || $processOrder == '') {
|
||||||
|
$warnMsg[] = 'Process Order cannot be empty';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($coilNo == null || $coilNo == '') {
|
||||||
|
$warnMsg[] = 'Coil No cannot be empty';
|
||||||
|
} elseif (! is_numeric($coilNo)) {
|
||||||
|
$warnMsg[] = 'Coil number should contain only numeric values!';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status == null || $status == '' || ! $status) {
|
||||||
|
$warnMsg[] = 'Status cannot be empty';
|
||||||
|
} elseif (! in_array($status, ['Ok', 'NotOk'], true)) {
|
||||||
|
$warnMsg[] = "Status must be either 'Ok' or 'NotOk'!";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||||
|
$warnMsg[] = 'Created By cannot be empty';
|
||||||
|
}
|
||||||
|
|
||||||
|
// $existing = CharacteristicValue::where('plant_id', $plantId)
|
||||||
|
// ->where('process_order', $processOrder)
|
||||||
|
// ->where('coil_number', $coilNo)
|
||||||
|
// ->first();
|
||||||
|
|
||||||
|
// if ($existing) {
|
||||||
|
// $warnMsg[] = "Process order '{$processOrder}' with coil number '{$coilNo}' already exist for the plant code '{$plantCode}'!";
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ($plantId && $processOrder) {
|
||||||
|
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||||
|
->where('process_order', $processOrder)
|
||||||
|
->where('coil_number', $coilNo)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($existing) {
|
||||||
|
$warnMsg[] = "Coil number '{$coilNo}' already exists for Plant '{$plantCode}' and Process Order '{$processOrder}'.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($plant && $itemCode && $processOrder != '') {
|
||||||
|
|
||||||
|
$existingOrder = ProcessOrder::where('plant_id', $plant->id)
|
||||||
|
->where('process_order', $processOrder)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($existingOrder && $existingOrder->item_id !== ($itemCode->id ?? null)) {
|
||||||
|
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($warnMsg)) {
|
||||||
|
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||||
|
}
|
||||||
|
|
||||||
|
return CharacteristicValue::create([
|
||||||
|
'plant_id' => $plantId,
|
||||||
|
'item_id' => $itemId,
|
||||||
|
'line_id' => $LineId,
|
||||||
|
'machine_id' => $machineId,
|
||||||
|
'process_order' => trim($this->data['process_order']),
|
||||||
|
'coil_number' => trim($this->data['coil_number']),
|
||||||
|
'status' => trim($this->data['status']),
|
||||||
|
'created_by' => trim($this->data['created_by']),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// return null;
|
||||||
|
|
||||||
|
// return new CharacteristicValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
|||||||
@@ -641,322 +641,322 @@ class StickerReprint extends Page implements HasForms
|
|||||||
|
|
||||||
// ********************************
|
// ********************************
|
||||||
|
|
||||||
$exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
// $exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||||
->where('shift_id', $this->sId)
|
// ->where('shift_id', $this->sId)
|
||||||
->where('line_id', $this->lId)
|
// ->where('line_id', $this->lId)
|
||||||
->whereDate('created_at', today())
|
// ->whereDate('created_at', today())
|
||||||
->latest()
|
// ->latest()
|
||||||
->exists();
|
// ->exists();
|
||||||
|
|
||||||
if ($exists)
|
// if ($exists)
|
||||||
{
|
// {
|
||||||
$currentDate = date('Y-m-d');
|
|
||||||
|
|
||||||
$shiftId = Shift::where('id', $this->sId)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
|
||||||
$hRs = (int) $hRs;
|
|
||||||
//$miNs = (int) $miNs;-*/
|
|
||||||
|
|
||||||
$totalMinutes = $hRs * 60 + $miNs;
|
|
||||||
|
|
||||||
$from_dt = $currentDate . ' ' . $shiftId->start_time;
|
|
||||||
|
|
||||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
|
||||||
|
|
||||||
$currentDateTime = date('Y-m-d H:i:s');
|
|
||||||
|
|
||||||
// Check if current date time is within the range
|
|
||||||
if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
|
||||||
//echo "Choosed a valid shift...";
|
|
||||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id'=> $this->pId,
|
|
||||||
'block_name'=> $this->bId,
|
|
||||||
'shift_id'=> $this->sId,
|
|
||||||
'line_id'=> $this->lId,
|
|
||||||
'item_id'=> null,
|
|
||||||
'serial_number'=> null,
|
|
||||||
'success_msg'=> null,
|
|
||||||
'production_order'=> $this->prodOrder,
|
|
||||||
'sap_msg_status' => null,
|
|
||||||
'sap_msg_description' => null,
|
|
||||||
'operator_id'=> $operatorName,
|
|
||||||
'recent_qr' => $this->recQr,
|
|
||||||
]);
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid Shift')
|
|
||||||
->body("Please select a valid shift.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id'=> $this->pId,
|
|
||||||
'block_name'=> $this->bId,
|
|
||||||
'shift_id'=> $this->sId,
|
|
||||||
'line_id'=> $this->lId,
|
|
||||||
'item_id'=> null,
|
|
||||||
'serial_number'=> null,
|
|
||||||
'success_msg'=> null,
|
|
||||||
'production_order'=> $this->prodOrder,
|
|
||||||
'sap_msg_status' => null,
|
|
||||||
'sap_msg_description' => null,
|
|
||||||
'operator_id'=> $operatorName,
|
|
||||||
'recent_qr' => $this->recQr,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
|
||||||
->where('shift_id', $this->sId)
|
|
||||||
->where('line_id', $this->lId)
|
|
||||||
->whereDate('created_at', Carbon::yesterday())
|
|
||||||
->latest()
|
|
||||||
->exists();
|
|
||||||
|
|
||||||
if ($existShifts) //if ($existShifts->count() > 0)
|
|
||||||
{ // record exist on yesterday
|
|
||||||
// $currentDate = date('Y-m-d');
|
// $currentDate = date('Y-m-d');
|
||||||
$yesterday = date('Y-m-d', strtotime('-1 days'));
|
|
||||||
|
|
||||||
$shiftId = Shift::where('id', $this->sId)
|
// $shiftId = Shift::where('id', $this->sId)
|
||||||
->first();
|
// ->first();
|
||||||
|
|
||||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||||
$hRs = (int) $hRs;
|
// $hRs = (int) $hRs;
|
||||||
// $miNs = (int) $miNs;-*/
|
// //$miNs = (int) $miNs;-*/
|
||||||
|
|
||||||
$totalMinutes = $hRs * 60 + $miNs;
|
// $totalMinutes = $hRs * 60 + $miNs;
|
||||||
|
|
||||||
$from_dt = $yesterday . ' ' . $shiftId->start_time;
|
// $from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||||
|
|
||||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||||
|
|
||||||
$currentDateTime = date('Y-m-d H:i:s');
|
// $currentDateTime = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
// Check if current date time is within the range
|
// // Check if current date time is within the range
|
||||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
// if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
||||||
$this->form->fill([
|
// //echo "Choosed a valid shift...";
|
||||||
'plant_id'=> $this->pId,
|
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
'block_name'=> $this->bId,
|
|
||||||
'shift_id'=> $this->sId,
|
|
||||||
'line_id'=> $this->lId,
|
|
||||||
'item_id'=> null,
|
|
||||||
'serial_number'=> null,
|
|
||||||
'success_msg'=> null,
|
|
||||||
'production_order'=> $this->prodOrder,
|
|
||||||
'sap_msg_status' => null,
|
|
||||||
'sap_msg_description' => null,
|
|
||||||
'operator_id'=> $operatorName,
|
|
||||||
'recent_qr' => $this->recQr,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$currentDate = date('Y-m-d');
|
|
||||||
|
|
||||||
$shiftId = Shift::where('id', $this->sId)
|
// $this->form->fill([
|
||||||
->first();
|
// 'plant_id'=> $this->pId,
|
||||||
|
// 'block_name'=> $this->bId,
|
||||||
|
// 'shift_id'=> $this->sId,
|
||||||
|
// 'line_id'=> $this->lId,
|
||||||
|
// 'item_id'=> null,
|
||||||
|
// 'serial_number'=> null,
|
||||||
|
// 'success_msg'=> null,
|
||||||
|
// 'production_order'=> $this->prodOrder,
|
||||||
|
// 'sap_msg_status' => null,
|
||||||
|
// 'sap_msg_description' => null,
|
||||||
|
// 'operator_id'=> $operatorName,
|
||||||
|
// 'recent_qr' => $this->recQr,
|
||||||
|
// ]);
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid Shift')
|
||||||
|
// ->body("Please select a valid shift.")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $this->form->fill([
|
||||||
|
// 'plant_id'=> $this->pId,
|
||||||
|
// 'block_name'=> $this->bId,
|
||||||
|
// 'shift_id'=> $this->sId,
|
||||||
|
// 'line_id'=> $this->lId,
|
||||||
|
// 'item_id'=> null,
|
||||||
|
// 'serial_number'=> null,
|
||||||
|
// 'success_msg'=> null,
|
||||||
|
// 'production_order'=> $this->prodOrder,
|
||||||
|
// 'sap_msg_status' => null,
|
||||||
|
// 'sap_msg_description' => null,
|
||||||
|
// 'operator_id'=> $operatorName,
|
||||||
|
// 'recent_qr' => $this->recQr,
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||||
|
// ->where('shift_id', $this->sId)
|
||||||
|
// ->where('line_id', $this->lId)
|
||||||
|
// ->whereDate('created_at', Carbon::yesterday())
|
||||||
|
// ->latest()
|
||||||
|
// ->exists();
|
||||||
|
|
||||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
// if ($existShifts) //if ($existShifts->count() > 0)
|
||||||
$hRs = (int) $hRs;
|
// { // record exist on yesterday
|
||||||
// $miNs = (int) $miNs;-*/
|
// //$currentDate = date('Y-m-d');
|
||||||
|
// $yesterday = date('Y-m-d', strtotime('-1 days'));
|
||||||
|
|
||||||
$totalMinutes = $hRs * 60 + $miNs;
|
// $shiftId = Shift::where('id', $this->sId)
|
||||||
|
// ->first();
|
||||||
|
|
||||||
$from_dt = $currentDate . ' ' . $shiftId->start_time;
|
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||||
|
// $hRs = (int) $hRs;
|
||||||
|
// // $miNs = (int) $miNs;-*/
|
||||||
|
|
||||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
// $totalMinutes = $hRs * 60 + $miNs;
|
||||||
|
|
||||||
$currentDateTime = date('Y-m-d H:i:s');
|
// $from_dt = $yesterday . ' ' . $shiftId->start_time;
|
||||||
|
|
||||||
// Check if current date time is within the range
|
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
|
||||||
//echo "Choosed a valid shift...";
|
|
||||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
|
|
||||||
$this->form->fill([
|
// $currentDateTime = date('Y-m-d H:i:s');
|
||||||
'plant_id'=> $this->pId,
|
|
||||||
'block_name'=> $this->bId,
|
|
||||||
'shift_id'=> $this->sId,
|
|
||||||
'line_id'=> $this->lId,
|
|
||||||
'item_id'=> null,
|
|
||||||
'serial_number'=> null,
|
|
||||||
'success_msg'=> null,
|
|
||||||
'production_order'=> $this->prodOrder,
|
|
||||||
'sap_msg_status' => null,
|
|
||||||
'sap_msg_description' => null,
|
|
||||||
'operator_id'=> $operatorName,
|
|
||||||
'recent_qr' => $this->recQr,
|
|
||||||
]);
|
|
||||||
Notification::make()
|
|
||||||
->title('Plan Not Found')
|
|
||||||
->body("Please set production plan first.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//echo "Choosed a valid shift...";
|
|
||||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id'=> $this->pId,
|
|
||||||
'block_name'=> $this->bId,
|
|
||||||
'shift_id'=> $this->sId,
|
|
||||||
'line_id'=> $this->lId,
|
|
||||||
'item_id'=> null,
|
|
||||||
'serial_number'=> null,
|
|
||||||
'success_msg'=> null,
|
|
||||||
'production_order'=> $this->prodOrder,
|
|
||||||
'sap_msg_status' => null,
|
|
||||||
'sap_msg_description' => null,
|
|
||||||
'operator_id'=> $operatorName,
|
|
||||||
'recent_qr' => $this->recQr,
|
|
||||||
]);
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid Shift')
|
|
||||||
->body("Please select a valid shift.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // record not exist on yesterday
|
|
||||||
|
|
||||||
|
// // Check if current date time is within the range
|
||||||
|
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||||
|
// $this->form->fill([
|
||||||
|
// 'plant_id'=> $this->pId,
|
||||||
|
// 'block_name'=> $this->bId,
|
||||||
|
// 'shift_id'=> $this->sId,
|
||||||
|
// 'line_id'=> $this->lId,
|
||||||
|
// 'item_id'=> null,
|
||||||
|
// 'serial_number'=> null,
|
||||||
|
// 'success_msg'=> null,
|
||||||
|
// 'production_order'=> $this->prodOrder,
|
||||||
|
// 'sap_msg_status' => null,
|
||||||
|
// 'sap_msg_description' => null,
|
||||||
|
// 'operator_id'=> $operatorName,
|
||||||
|
// 'recent_qr' => $this->recQr,
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
// $currentDate = date('Y-m-d');
|
// $currentDate = date('Y-m-d');
|
||||||
$yesterday = date('Y-m-d', strtotime('-1 days'));
|
|
||||||
|
|
||||||
$shiftId = Shift::where('id', $this->sId)
|
// $shiftId = Shift::where('id', $this->sId)
|
||||||
->first();
|
// ->first();
|
||||||
|
|
||||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||||
$hRs = (int) $hRs;
|
// $hRs = (int) $hRs;
|
||||||
// $miNs = (int) $miNs;-*/
|
// // $miNs = (int) $miNs;-*/
|
||||||
|
|
||||||
$totalMinutes = $hRs * 60 + $miNs;
|
// $totalMinutes = $hRs * 60 + $miNs;
|
||||||
|
|
||||||
$from_dt = $yesterday . ' ' . $shiftId->start_time;
|
// $from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||||
|
|
||||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||||
|
|
||||||
$currentDateTime = date('Y-m-d H:i:s');
|
// $currentDateTime = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
// Check if current date time is within the range
|
// // Check if current date time is within the range
|
||||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||||
//echo "Choosed a valid shift...";
|
// //echo "Choosed a valid shift...";
|
||||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Plan Not Found')
|
// ->title('Plan Not Found')
|
||||||
->body("Please set production plan first.")
|
// ->body("Please set production plan first.")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
$currentDate = date('Y-m-d');
|
// //echo "Choosed a valid shift...";
|
||||||
|
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
|
||||||
$shiftId = Shift::where('id', $this->sId)
|
// $this->form->fill([
|
||||||
->first();
|
// 'plant_id'=> $this->pId,
|
||||||
|
// 'block_name'=> $this->bId,
|
||||||
|
// 'shift_id'=> $this->sId,
|
||||||
|
// 'line_id'=> $this->lId,
|
||||||
|
// 'item_id'=> null,
|
||||||
|
// 'serial_number'=> null,
|
||||||
|
// 'success_msg'=> null,
|
||||||
|
// 'production_order'=> $this->prodOrder,
|
||||||
|
// 'sap_msg_status' => null,
|
||||||
|
// 'sap_msg_description' => null,
|
||||||
|
// 'operator_id'=> $operatorName,
|
||||||
|
// 'recent_qr' => $this->recQr,
|
||||||
|
// ]);
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid Shift')
|
||||||
|
// ->body("Please select a valid shift.")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// { // record not exist on yesterday
|
||||||
|
|
||||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
// //$currentDate = date('Y-m-d');
|
||||||
$hRs = (int) $hRs;
|
// $yesterday = date('Y-m-d', strtotime('-1 days'));
|
||||||
// $miNs = (int) $miNs;-*/
|
|
||||||
|
|
||||||
$totalMinutes = $hRs * 60 + $miNs;
|
// $shiftId = Shift::where('id', $this->sId)
|
||||||
|
// ->first();
|
||||||
|
|
||||||
$from_dt = $currentDate . ' ' . $shiftId->start_time;
|
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||||
|
// $hRs = (int) $hRs;
|
||||||
|
// // $miNs = (int) $miNs;-*/
|
||||||
|
|
||||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
// $totalMinutes = $hRs * 60 + $miNs;
|
||||||
|
|
||||||
$currentDateTime = date('Y-m-d H:i:s');
|
// $from_dt = $yesterday . ' ' . $shiftId->start_time;
|
||||||
|
|
||||||
// Check if current date time is within the range
|
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
|
||||||
//echo "Choosed a valid shift...";
|
|
||||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
|
|
||||||
$this->form->fill([
|
// $currentDateTime = date('Y-m-d H:i:s');
|
||||||
'plant_id'=> $this->pId,
|
|
||||||
'block_name'=> $this->bId,
|
|
||||||
'shift_id'=> $this->sId,
|
|
||||||
'line_id'=> $this->lId,
|
|
||||||
'item_id'=> null,
|
|
||||||
'serial_number'=> null,
|
|
||||||
'success_msg'=> null,
|
|
||||||
'production_order'=> $this->prodOrder,
|
|
||||||
'sap_msg_status' => null,
|
|
||||||
'sap_msg_description' => null,
|
|
||||||
'operator_id'=> $operatorName,
|
|
||||||
'recent_qr' => $this->recQr,
|
|
||||||
]);
|
|
||||||
Notification::make()
|
|
||||||
->title('Plan Not Found')
|
|
||||||
->body("Please set production plan first.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//echo "Choosed a valid shift...";
|
|
||||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
|
||||||
|
|
||||||
$this->form->fill([
|
// // Check if current date time is within the range
|
||||||
'plant_id'=> $this->pId,
|
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||||
'block_name'=> $this->bId,
|
// //echo "Choosed a valid shift...";
|
||||||
'shift_id'=> $this->sId,
|
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
'line_id'=> $this->lId,
|
|
||||||
'item_id'=> null,
|
// $this->form->fill([
|
||||||
'serial_number'=> null,
|
// 'plant_id'=> $this->pId,
|
||||||
'success_msg'=> null,
|
// 'block_name'=> $this->bId,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'shift_id'=> $this->sId,
|
||||||
'sap_msg_status' => null,
|
// 'line_id'=> $this->lId,
|
||||||
'sap_msg_description' => null,
|
// 'item_id'=> null,
|
||||||
'operator_id'=> $operatorName,
|
// 'serial_number'=> null,
|
||||||
'recent_qr' => $this->recQr,
|
// 'success_msg'=> null,
|
||||||
]);
|
// 'production_order'=> $this->prodOrder,
|
||||||
Notification::make()
|
// 'sap_msg_status' => null,
|
||||||
->title('Invalid Shift')
|
// 'sap_msg_description' => null,
|
||||||
->body("Please select a valid shift.")
|
// 'operator_id'=> $operatorName,
|
||||||
->danger()
|
// 'recent_qr' => $this->recQr,
|
||||||
->send();
|
// ]);
|
||||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
// Notification::make()
|
||||||
return;
|
// ->title('Plan Not Found')
|
||||||
}
|
// ->body("Please set production plan first.")
|
||||||
}
|
// ->danger()
|
||||||
}
|
// ->send();
|
||||||
}
|
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $currentDate = date('Y-m-d');
|
||||||
|
|
||||||
|
// $shiftId = Shift::where('id', $this->sId)
|
||||||
|
// ->first();
|
||||||
|
|
||||||
|
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||||
|
// $hRs = (int) $hRs;
|
||||||
|
// // $miNs = (int) $miNs;-*/
|
||||||
|
|
||||||
|
// $totalMinutes = $hRs * 60 + $miNs;
|
||||||
|
|
||||||
|
// $from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||||
|
|
||||||
|
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||||
|
|
||||||
|
// $currentDateTime = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
// // Check if current date time is within the range
|
||||||
|
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||||
|
// //echo "Choosed a valid shift...";
|
||||||
|
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
|
||||||
|
// $this->form->fill([
|
||||||
|
// 'plant_id'=> $this->pId,
|
||||||
|
// 'block_name'=> $this->bId,
|
||||||
|
// 'shift_id'=> $this->sId,
|
||||||
|
// 'line_id'=> $this->lId,
|
||||||
|
// 'item_id'=> null,
|
||||||
|
// 'serial_number'=> null,
|
||||||
|
// 'success_msg'=> null,
|
||||||
|
// 'production_order'=> $this->prodOrder,
|
||||||
|
// 'sap_msg_status' => null,
|
||||||
|
// 'sap_msg_description' => null,
|
||||||
|
// 'operator_id'=> $operatorName,
|
||||||
|
// 'recent_qr' => $this->recQr,
|
||||||
|
// ]);
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Plan Not Found')
|
||||||
|
// ->body("Please set production plan first.")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //echo "Choosed a valid shift...";
|
||||||
|
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
|
||||||
|
// $this->form->fill([
|
||||||
|
// 'plant_id'=> $this->pId,
|
||||||
|
// 'block_name'=> $this->bId,
|
||||||
|
// 'shift_id'=> $this->sId,
|
||||||
|
// 'line_id'=> $this->lId,
|
||||||
|
// 'item_id'=> null,
|
||||||
|
// 'serial_number'=> null,
|
||||||
|
// 'success_msg'=> null,
|
||||||
|
// 'production_order'=> $this->prodOrder,
|
||||||
|
// 'sap_msg_status' => null,
|
||||||
|
// 'sap_msg_description' => null,
|
||||||
|
// 'operator_id'=> $operatorName,
|
||||||
|
// 'recent_qr' => $this->recQr,
|
||||||
|
// ]);
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid Shift')
|
||||||
|
// ->body("Please select a valid shift.")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// ********************************
|
// ********************************
|
||||||
|
|
||||||
@@ -1155,12 +1155,27 @@ class StickerReprint extends Page implements HasForms
|
|||||||
// Only search when all parent IDs are selected
|
// Only search when all parent IDs are selected
|
||||||
$parts = explode('|', $formQRData);
|
$parts = explode('|', $formQRData);
|
||||||
$itemCode = trim($parts[0]);
|
$itemCode = trim($parts[0]);
|
||||||
|
|
||||||
|
|
||||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||||
|
|
||||||
// Remove slash and everything after it
|
// // Remove slash and everything after it
|
||||||
|
// if ($serialNumberRaw != null) {
|
||||||
|
// $serialNumber = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||||
|
// $serialNumber = trim($serialNumber);
|
||||||
|
// } else {
|
||||||
|
// $serialNumber = null;
|
||||||
|
// }
|
||||||
if ($serialNumberRaw != null) {
|
if ($serialNumberRaw != null) {
|
||||||
$serialNumber = preg_replace('/\/.*/', '', $serialNumberRaw);
|
if (strpos($serialNumberRaw, '/') !== false) {
|
||||||
|
$serialNumber = strstr($serialNumberRaw, '/', true); // gets text before slash
|
||||||
|
} else {
|
||||||
|
$serialNumber = $serialNumberRaw; // keep original
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$serialNumber = trim($serialNumber);
|
$serialNumber = trim($serialNumber);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$serialNumber = null;
|
$serialNumber = null;
|
||||||
}
|
}
|
||||||
@@ -1269,86 +1284,86 @@ class StickerReprint extends Page implements HasForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$line = Line::find($this->lId);
|
//$line = Line::find($this->lId);
|
||||||
$lineName = $line ? $line->name : null;
|
//$lineName = $line ? $line->name : null;
|
||||||
|
|
||||||
$categoryName = (Str::length($item->category) > 0) ? $item->category : "";
|
// $categoryName = (Str::length($item->category) > 0) ? $item->category : "";
|
||||||
|
|
||||||
if ($categoryName == 'Submersible Motor')
|
// if ($categoryName == 'Submersible Motor')
|
||||||
{
|
// {
|
||||||
if ($lineName != '6 inch motor line')
|
// if ($lineName != '6 inch motor line')
|
||||||
{
|
// {
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Invalid Line Found')
|
// ->title('Invalid Line Found')
|
||||||
->body("Choose '6 inch motor line' to proceed..!")
|
// ->body("Choose '6 inch motor line' to proceed..!")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if ($categoryName == 'Submersible Pump')
|
// else if ($categoryName == 'Submersible Pump')
|
||||||
{
|
// {
|
||||||
if ($lineName != '6 inch pump line')
|
// if ($lineName != '6 inch pump line')
|
||||||
{
|
// {
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Invalid Line Found')
|
// ->title('Invalid Line Found')
|
||||||
->body("Choose '6 inch pump line' to proceed..!")
|
// ->body("Choose '6 inch pump line' to proceed..!")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Invalid Category Found')
|
// ->title('Invalid Category Found')
|
||||||
->body("Set proper category to proceed..!")
|
// ->body("Set proper category to proceed..!")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($this->succId == null) {
|
if ($this->succId == null) {
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
@@ -1383,6 +1398,33 @@ class StickerReprint extends Page implements HasForms
|
|||||||
$itemCode = trim($parts[0]);
|
$itemCode = trim($parts[0]);
|
||||||
$this->sNoId = isset($parts[1]) ? trim($parts[1]) : null;
|
$this->sNoId = isset($parts[1]) ? trim($parts[1]) : null;
|
||||||
|
|
||||||
|
$originalQR = $this->qrData;
|
||||||
|
|
||||||
|
if (strpos($originalQR, '/') != false)
|
||||||
|
{
|
||||||
|
// Allowed endings
|
||||||
|
$allowed = ['/m', '/M', '/p', '/P', '/m|', '/M|', '/p|', '/P|'];
|
||||||
|
|
||||||
|
$foundValidEnding = false;
|
||||||
|
|
||||||
|
foreach ($allowed as $end) {
|
||||||
|
if (str_ends_with($originalQR, $end)) {
|
||||||
|
$foundValidEnding = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$foundValidEnding) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid QR Code')
|
||||||
|
->body("Invalid QR format: '$originalQR'")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->sNoId != null) {
|
if ($this->sNoId != null) {
|
||||||
$this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw);
|
$this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||||
$this->sNoId = trim($this->sNoId);
|
$this->sNoId = trim($this->sNoId);
|
||||||
@@ -1390,7 +1432,7 @@ class StickerReprint extends Page implements HasForms
|
|||||||
$this->sNoId = null;
|
$this->sNoId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
//$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
||||||
|
|
||||||
ProductionQuantity::create([
|
ProductionQuantity::create([
|
||||||
'plant_id'=> $this->pId,
|
'plant_id'=> $this->pId,
|
||||||
@@ -1406,7 +1448,6 @@ class StickerReprint extends Page implements HasForms
|
|||||||
|
|
||||||
// after success insertion
|
// after success insertion
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
|
|
||||||
'plant_id'=> $this->pId,
|
'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
'shift_id'=> $this->sId,
|
||||||
@@ -1429,7 +1470,7 @@ class StickerReprint extends Page implements HasForms
|
|||||||
->duration(1000)
|
->duration(1000)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$url = route('download-qr1-pdf', ['palletNo' => $this->qrData]);
|
$url = route('download-qr1-pdf', ['palletNo' => urlencode($originalQR)]);
|
||||||
$this->js(<<<JS
|
$this->js(<<<JS
|
||||||
window.dispatchEvent(new CustomEvent('open-pdf', {
|
window.dispatchEvent(new CustomEvent('open-pdf', {
|
||||||
detail: {
|
detail: {
|
||||||
|
|||||||
@@ -184,6 +184,10 @@ class CharacteristicValueResource extends Resource
|
|||||||
->hint(fn ($get) => $get('coilNumberError') ? $get('coilNumberError') : null)
|
->hint(fn ($get) => $get('coilNumberError') ? $get('coilNumberError') : null)
|
||||||
->hintColor('danger')
|
->hintColor('danger')
|
||||||
->required(),
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('observed_value')
|
||||||
|
->label('Observed Value')
|
||||||
|
->reactive()
|
||||||
|
->required(),
|
||||||
Forms\Components\Select::make('status')
|
Forms\Components\Select::make('status')
|
||||||
->label('Status')
|
->label('Status')
|
||||||
->options([
|
->options([
|
||||||
@@ -244,6 +248,11 @@ class CharacteristicValueResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('observed_value')
|
||||||
|
->label('Observed value')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('status')
|
Tables\Columns\TextColumn::make('status')
|
||||||
->label('Status')
|
->label('Status')
|
||||||
->searchable()
|
->searchable()
|
||||||
|
|||||||
613
app/Filament/Resources/InvoiceInTransitResource.php
Normal file
613
app/Filament/Resources/InvoiceInTransitResource.php
Normal file
@@ -0,0 +1,613 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Exports\InvoiceInTransitExporter;
|
||||||
|
use App\Filament\Resources\InvoiceInTransitResource\Pages;
|
||||||
|
use App\Filament\Resources\InvoiceInTransitResource\RelationManagers;
|
||||||
|
use App\Models\InvoiceInTransit;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Filament\Forms\Components\FileUpload;
|
||||||
|
use Storage;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Shared\Date as ExcelDate;
|
||||||
|
|
||||||
|
class InvoiceInTransitResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = InvoiceInTransit::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Invoice Transit';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Forms\Components\Select::make('plant_id')
|
||||||
|
->relationship('plant', 'name')
|
||||||
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('receiving_plant')
|
||||||
|
->label('Receiving Plant'),
|
||||||
|
Forms\Components\TextInput::make('receiving_plant_name')
|
||||||
|
->label('Receiving Plant Name'),
|
||||||
|
Forms\Components\TextInput::make('invoice_number')
|
||||||
|
->label('Invoice Number'),
|
||||||
|
Forms\Components\TextInput::make('invoice_date')
|
||||||
|
->label('Invoice Date'),
|
||||||
|
Forms\Components\TextInput::make('item_code')
|
||||||
|
->label('Item Code'),
|
||||||
|
Forms\Components\TextInput::make('description')
|
||||||
|
->label('Description'),
|
||||||
|
Forms\Components\TextInput::make('quantity')
|
||||||
|
->label('Quantity')
|
||||||
|
->numeric()
|
||||||
|
->default(null),
|
||||||
|
Forms\Components\TextInput::make('transport_name')
|
||||||
|
->label('Transport Name'),
|
||||||
|
Forms\Components\TextInput::make('lr_bl_aw_number')
|
||||||
|
->label('LR/BL/AW Number'),
|
||||||
|
Forms\Components\TextInput::make('lr_bl_aw_date')
|
||||||
|
->label('LR/BL/AW Date'),
|
||||||
|
Forms\Components\TextInput::make('pending_days')
|
||||||
|
->label('Pending Days'),
|
||||||
|
Forms\Components\TextInput::make('obd_number')
|
||||||
|
->label('OBD Number'),
|
||||||
|
Forms\Components\TextInput::make('obd_date')
|
||||||
|
->label('OBD Date'),
|
||||||
|
Forms\Components\TextInput::make('shipment_weight')
|
||||||
|
->label('Shipment Weight'),
|
||||||
|
Forms\Components\TextInput::make('unit_price')
|
||||||
|
->label('Unit Price'),
|
||||||
|
Forms\Components\TextInput::make('net_value')
|
||||||
|
->label('Net value'),
|
||||||
|
Forms\Components\TextInput::make('total_item_amount')
|
||||||
|
->label('Total Item Amount'),
|
||||||
|
Forms\Components\TextInput::make('tax_amount')
|
||||||
|
->label('Tax Amount'),
|
||||||
|
Forms\Components\TextInput::make('transport_mode')
|
||||||
|
->label('Transport Mode'),
|
||||||
|
Forms\Components\TextInput::make('vehicle_number')
|
||||||
|
->label('Vehicle Number'),
|
||||||
|
Forms\Components\TextInput::make('e_waybill_number')
|
||||||
|
->label('E Way Bill Number'),
|
||||||
|
Forms\Components\Hidden::make('created_by')
|
||||||
|
->label('Created By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
Forms\Components\Hidden::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
Tables\Columns\TextColumn::make('No.')
|
||||||
|
->label('No.')
|
||||||
|
->alignCenter()
|
||||||
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
|
$paginator = $livewire->getTableRecords();
|
||||||
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
|
|
||||||
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
|
}),
|
||||||
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
|
->label('Plant')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('receiving_plant')
|
||||||
|
->label('Receiving Plant')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('receiving_plant_name')
|
||||||
|
->label('Receiving Plant Name')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('invoice_number')
|
||||||
|
->label('Invoice Number')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('invoice_date')
|
||||||
|
->label('Invoice Date')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('item_code')
|
||||||
|
->label('Item Code')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('description')
|
||||||
|
->label('Description')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('quantity')
|
||||||
|
->label('Quantity')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('transport_name')
|
||||||
|
->label('Transport Name')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('lr_bl_aw_number')
|
||||||
|
->label('LR/BL/AW Number')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('lr_bl_aw_date')
|
||||||
|
->label('LR/BL/AW Date')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('pending_days')
|
||||||
|
->label('Pending Days')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('obd_number')
|
||||||
|
->label('OBD Number')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('obd_date')
|
||||||
|
->label('OBD Date')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('shipment_weight')
|
||||||
|
->label('Shipment Weight')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('unit_price')
|
||||||
|
->label('Unit Price')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('net_value')
|
||||||
|
->label('Net value')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('total_item_amount')
|
||||||
|
->label('Total Item Amount')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('tax_amount')
|
||||||
|
->label('Tax Amount')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('transport_mode')
|
||||||
|
->label('Transport Mode')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('vehicle_number')
|
||||||
|
->label('Vehicle Number')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('e_waybill_number')
|
||||||
|
->label('E Way Bill Number')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
Tables\Filters\TrashedFilter::make(),
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\ViewAction::make(),
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
Tables\Actions\Action::make('Import Invoice In Transit')
|
||||||
|
->label('Import Invoice In Transit')
|
||||||
|
->form([
|
||||||
|
FileUpload::make('invoice_in_transit_file')
|
||||||
|
->label('Import Invoice In Transit')
|
||||||
|
->preserveFilenames()
|
||||||
|
->storeFiles(false)
|
||||||
|
->reactive()
|
||||||
|
->required()
|
||||||
|
->disk('local')
|
||||||
|
->directory('uploads/temp'),
|
||||||
|
])
|
||||||
|
->action(function (array $data) {
|
||||||
|
$uploadedFile = $data['invoice_in_transit_file'];
|
||||||
|
|
||||||
|
$disk = Storage::disk('local');
|
||||||
|
|
||||||
|
$user = Filament::auth()->user();
|
||||||
|
|
||||||
|
$operatorName = $user->name;
|
||||||
|
|
||||||
|
// Get original filename
|
||||||
|
$originalName = $uploadedFile->getClientOriginalName();
|
||||||
|
|
||||||
|
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
|
||||||
|
|
||||||
|
$fullPath = Storage::disk('local')->path($path);
|
||||||
|
|
||||||
|
if ($fullPath && file_exists($fullPath))
|
||||||
|
{
|
||||||
|
$rows = Excel::toArray(null, $fullPath)[0];
|
||||||
|
|
||||||
|
if ((count($rows) - 1) <= 0) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Records Not Found')
|
||||||
|
->body("Import the valid 'Invoice Master Data' file to proceed..!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
if ($disk->exists($path)) {
|
||||||
|
$disk->delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$invalidPlantCode = [];
|
||||||
|
$invalidPlantCo = [];
|
||||||
|
$invalidPlaCoFound = [];
|
||||||
|
$invalidRecPlant = [];
|
||||||
|
$invalidRecPlantName = [];
|
||||||
|
$invalidInvNo = [];
|
||||||
|
$invalidInvDt = [];
|
||||||
|
$invalidICode = [];
|
||||||
|
$invalidDesc = [];
|
||||||
|
$invalidQty = [];
|
||||||
|
$invalidTransportName = [];
|
||||||
|
$invalidLRBLAWNo = [];
|
||||||
|
$invalidLRBLAWDt = [];
|
||||||
|
$invalidPenDay = [];
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
if ($index == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$plantCode = trim($row[0]);
|
||||||
|
$receivingPlant = trim($row[2]);
|
||||||
|
$receivingPlantName = trim($row[3]);
|
||||||
|
$invoiceNo = trim($row[4]);
|
||||||
|
$invoiceDt = trim($row[5]);
|
||||||
|
$itemCode = trim($row[6]);
|
||||||
|
$des = trim($row[7]);
|
||||||
|
$quantity = trim($row[8]);
|
||||||
|
$transportName = trim($row[9]);
|
||||||
|
$LRBAWNo = trim($row[10]);
|
||||||
|
$LRBAWDt = trim($row[11]);
|
||||||
|
$pendingDays = trim($row[12]);
|
||||||
|
|
||||||
|
if (empty($plantCode)) {
|
||||||
|
$invalidPlantCode[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($receivingPlant)) {
|
||||||
|
$invalidRecPlant[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($receivingPlantName)) {
|
||||||
|
$invalidRecPlantName[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($invoiceNo)) {
|
||||||
|
$invalidInvNo[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($invoiceDt)) {
|
||||||
|
$invalidInvDt[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($itemCode)) {
|
||||||
|
$invalidICode[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($des)) {
|
||||||
|
$invalidDesc[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($quantity)) {
|
||||||
|
$invalidQty[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($transportName)) {
|
||||||
|
$invalidTransportName[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($LRBAWNo)) {
|
||||||
|
$invalidLRBLAWNo[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($LRBAWDt)) {
|
||||||
|
$invalidLRBLAWDt[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($pendingDays)) {
|
||||||
|
$invalidPenDay[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($plantCode) < 4) {
|
||||||
|
$invalidPlantCo[] = $plantCode;
|
||||||
|
} elseif (! Plant::where('code', $plantCode)->first()) {
|
||||||
|
$invalidPlaCoFound[] = $plantCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
|
|
||||||
|
//$plantId = $plant->id;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($invalidPlantCode) || ! empty($invalidRecPlant) || ! empty($invalidRecPlantName) || ! empty($invalidInvNo) || ! empty($invalidInvDt) || ! empty($invalidICode) || ! empty($invalidDesc) || ! empty($invalidQty) || ($invalidTransportName) || ! empty($invalidLRBLAWNo) || ! empty($invalidLRBLAWDt) || ! empty($invalidPenDay)) {
|
||||||
|
$errorMsg = '';
|
||||||
|
|
||||||
|
if (! empty($invalidPlantCode)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidPlantCode).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidRecPlant)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidRecPlant).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidRecPlantName)) {
|
||||||
|
$errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidRecPlantName).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidInvNo)) {
|
||||||
|
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidInvNo).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidInvDt)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidInvDt).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidICode)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidICode).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidDesc)) {
|
||||||
|
$errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidDesc).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidQty)) {
|
||||||
|
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidQty).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidTransportName)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidTransportName).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidLRBLAWNo)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidLRBLAWNo).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidLRBLAWDt)) {
|
||||||
|
$errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidLRBLAWDt).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidPenDay)) {
|
||||||
|
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidPenDay).'<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Missing Mandatory Fields')
|
||||||
|
->body($errorMsg)
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
if ($disk->exists($path)) {
|
||||||
|
$disk->delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($invalidPlantCo)) {
|
||||||
|
$invalidPlantCode = array_unique($invalidPlantCo);
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid Plant Codes')
|
||||||
|
->body('The following plant codes should contain minimum 4 digits:<br>'.implode(', ', $invalidPlantCode))
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
if ($disk->exists($path)) {
|
||||||
|
$disk->delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($invalidPlaCoFound)) {
|
||||||
|
$invalidPlaCoFound = array_unique($invalidPlaCoFound);
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid Plant Codes')
|
||||||
|
->body('The following plant codes not found in plants:<br>'.implode(', ', $invalidPlaCoFound))
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
if ($disk->exists($path)) {
|
||||||
|
$disk->delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($rows as $index => $row)
|
||||||
|
{
|
||||||
|
if ($index == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$plantCode = trim($row[0]);
|
||||||
|
$receivingPlant = trim($row[2]);
|
||||||
|
$receivingPlantName = trim($row[3]);
|
||||||
|
$invoiceNo = trim($row[4]);
|
||||||
|
$invoiceDt = trim($row[5]);
|
||||||
|
$itemCode = trim($row[6]);
|
||||||
|
$des = trim($row[7]);
|
||||||
|
$quantity = trim($row[8]);
|
||||||
|
$transportName = trim($row[9]);
|
||||||
|
$LRBAWNo = trim($row[10]);
|
||||||
|
$LRBAWDt = trim($row[11]);
|
||||||
|
$pendingDays = trim($row[12]);
|
||||||
|
$OBDNumber = trim($row[13]);
|
||||||
|
$OBDDate = trim($row[14]);
|
||||||
|
$ShipmentWeight = trim($row[15]);
|
||||||
|
$UnitPrice = trim($row[16]);
|
||||||
|
$NetValue = trim($row[17]);
|
||||||
|
$TotalItemAmount = trim($row[18]);
|
||||||
|
$TaxAmount = trim($row[19]);
|
||||||
|
$TransportMode = trim($row[20]);
|
||||||
|
$VehicleNumber = trim($row[21]);
|
||||||
|
$EWayBillNumber = trim($row[22]);
|
||||||
|
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
|
if (! $plant) {
|
||||||
|
throw new \Exception("Invalid plant code : '{$plantCode}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($invoiceDt))
|
||||||
|
{
|
||||||
|
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $invoiceDt)) {
|
||||||
|
[$day, $month, $year] = preg_split('/[-\/]/', $invoiceDt);
|
||||||
|
$formattedDate = "{$year}-{$month}-{$day}";
|
||||||
|
} elseif (is_numeric($invoiceDt)) {
|
||||||
|
$formattedDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($invoiceDt)->format('Y-m-d');
|
||||||
|
} else {
|
||||||
|
$formattedDate = date('Y-m-d', strtotime($invoiceDt));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$formattedDate = null;
|
||||||
|
}
|
||||||
|
if (! empty($LRBAWDt))
|
||||||
|
{
|
||||||
|
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $LRBAWDt)) {
|
||||||
|
[$day, $month, $year] = preg_split('/[-\/]/', $LRBAWDt);
|
||||||
|
$formattedDt = "{$year}-{$month}-{$day}";
|
||||||
|
} elseif (is_numeric($LRBAWDt)) {
|
||||||
|
$formattedDt = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($LRBAWDt)->format('Y-m-d');
|
||||||
|
} else {
|
||||||
|
$formattedDt = date('Y-m-d', strtotime($LRBAWDt));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$formattedDt = null;
|
||||||
|
}
|
||||||
|
if (! empty($OBDDate))
|
||||||
|
{
|
||||||
|
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $OBDDate)) {
|
||||||
|
[$day, $month, $year] = preg_split('/[-\/]/', $OBDDate);
|
||||||
|
$formattedDate = "{$year}-{$month}-{$day}";
|
||||||
|
} elseif (is_numeric($OBDDate)) {
|
||||||
|
$formatted = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($OBDDate)->format('Y-m-d');
|
||||||
|
} else {
|
||||||
|
$formatted = date('Y-m-d', strtotime($OBDDate));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$formatted = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$inserted = InvoiceInTransit::create([
|
||||||
|
'plant_id' => $plant->id,
|
||||||
|
'receiving_plant' => $receivingPlant,
|
||||||
|
'receiving_plant_name' => $receivingPlantName,
|
||||||
|
'invoice_number' => $invoiceNo,
|
||||||
|
'invoice_date' => $formattedDate,
|
||||||
|
'item_code' => $itemCode,
|
||||||
|
'description' => $des,
|
||||||
|
'quantity' => $quantity,
|
||||||
|
'transport_name' => $transportName,
|
||||||
|
'lr_bl_aw_number' => $LRBAWNo,
|
||||||
|
'lr_bl_aw_date' => $formattedDt,
|
||||||
|
'pending_days' => $pendingDays,
|
||||||
|
'obd_number' => $OBDNumber,
|
||||||
|
'obd_date' => $formatted,
|
||||||
|
'shipment_weight' => $ShipmentWeight,
|
||||||
|
'unit_price' => $UnitPrice,
|
||||||
|
'net_value' => $NetValue,
|
||||||
|
'total_item_amount' => $TotalItemAmount,
|
||||||
|
'tax_amount' => $TaxAmount,
|
||||||
|
'transport_mode' => $TransportMode,
|
||||||
|
'vehicle_number' => $VehicleNumber,
|
||||||
|
'e_waybill_number' => $EWayBillNumber,
|
||||||
|
'created_at' => now(),
|
||||||
|
'created_by' => $operatorName,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if ($inserted) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Upload Success')
|
||||||
|
->body('Invoice in transit uploaded successfully!')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Notification::make()
|
||||||
|
->title('Insertion Failed')
|
||||||
|
->body('Invoice in transit upload failed!')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view import invoice in transit');
|
||||||
|
}),
|
||||||
|
ExportAction::make()
|
||||||
|
->label('Export Invoice In Transit')
|
||||||
|
->color('warning')
|
||||||
|
->exporter(InvoiceInTransitExporter::class)
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view export invoice master');
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListInvoiceInTransits::route('/'),
|
||||||
|
'create' => Pages\CreateInvoiceInTransit::route('/create'),
|
||||||
|
'view' => Pages\ViewInvoiceInTransit::route('/{record}'),
|
||||||
|
'edit' => Pages\EditInvoiceInTransit::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getEloquentQuery(): Builder
|
||||||
|
{
|
||||||
|
return parent::getEloquentQuery()
|
||||||
|
->withoutGlobalScopes([
|
||||||
|
SoftDeletingScope::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceInTransitResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceInTransitResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateInvoiceInTransit extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceInTransitResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceInTransitResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceInTransitResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditInvoiceInTransit extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceInTransitResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\ViewAction::make(),
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
Actions\ForceDeleteAction::make(),
|
||||||
|
Actions\RestoreAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceInTransitResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceInTransitResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListInvoiceInTransits extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceInTransitResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceInTransitResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceInTransitResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
|
||||||
|
class ViewInvoiceInTransit extends ViewRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceInTransitResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\EditAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
301
app/Filament/Resources/InvoiceMasterResource.php
Normal file
301
app/Filament/Resources/InvoiceMasterResource.php
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Exports\InvoiceMasterExporter;
|
||||||
|
use App\Filament\Resources\InvoiceMasterResource\Pages;
|
||||||
|
use App\Filament\Resources\InvoiceMasterResource\RelationManagers;
|
||||||
|
use App\Models\InvoiceMaster;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Storage;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Filament\Forms\Components\FileUpload;
|
||||||
|
|
||||||
|
class InvoiceMasterResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = InvoiceMaster::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Invoice Transit';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Forms\Components\TextInput::make('receiving_plant')
|
||||||
|
->label('Receiving Plant'),
|
||||||
|
Forms\Components\TextInput::make('receiving_plant_name')
|
||||||
|
->label('Receiving Plant Name'),
|
||||||
|
Forms\Components\TextInput::make('transit_days')
|
||||||
|
->label('Transit Days'),
|
||||||
|
Forms\Components\TextInput::make('transport_name')
|
||||||
|
->label('Transport Name'),
|
||||||
|
Forms\Components\Hidden::make('created_by')
|
||||||
|
->label('Created By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
Forms\Components\Hidden::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
Tables\Columns\TextColumn::make('No.')
|
||||||
|
->label('No.')
|
||||||
|
->alignCenter()
|
||||||
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
|
$paginator = $livewire->getTableRecords();
|
||||||
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
|
|
||||||
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
|
}),
|
||||||
|
Tables\Columns\TextColumn::make('receiving_plant')
|
||||||
|
->label('Receiving Plant')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('receiving_plant_name')
|
||||||
|
->label('Receiving Plant Name')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('transit_days')
|
||||||
|
->label('Transit Days')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('transport_name')
|
||||||
|
->label('Transport Name')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->label('Created At')
|
||||||
|
->alignCenter()
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
|
->label('Updated At')
|
||||||
|
->alignCenter()
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
|
->label('Deleted At')
|
||||||
|
->alignCenter()
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
Tables\Filters\TrashedFilter::make(),
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\ViewAction::make(),
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
Tables\Actions\Action::make('Import Invoice Master')
|
||||||
|
->label('Import Invoice Master')
|
||||||
|
->form([
|
||||||
|
FileUpload::make('invoice_master_file')
|
||||||
|
->label('Import Invoice Master')
|
||||||
|
->preserveFilenames()
|
||||||
|
->storeFiles(false)
|
||||||
|
->reactive()
|
||||||
|
->required()
|
||||||
|
->disk('local')
|
||||||
|
->directory('uploads/temp'),
|
||||||
|
])
|
||||||
|
->action(function (array $data) {
|
||||||
|
$uploadedFile = $data['invoice_master_file'];
|
||||||
|
|
||||||
|
$disk = Storage::disk('local');
|
||||||
|
|
||||||
|
$user = Filament::auth()->user();
|
||||||
|
|
||||||
|
$operatorName = $user->name;
|
||||||
|
|
||||||
|
// Get original filename
|
||||||
|
$originalName = $uploadedFile->getClientOriginalName();
|
||||||
|
|
||||||
|
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
|
||||||
|
|
||||||
|
$fullPath = Storage::disk('local')->path($path);
|
||||||
|
|
||||||
|
if ($fullPath && file_exists($fullPath))
|
||||||
|
{
|
||||||
|
$rows = Excel::toArray(null, $fullPath)[0];
|
||||||
|
|
||||||
|
if ((count($rows) - 1) <= 0) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Records Not Found')
|
||||||
|
->body("Import the valid 'Invoice Master Data' file to proceed..!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
if ($disk->exists($path)) {
|
||||||
|
$disk->delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$invalidReceivePlant = [];
|
||||||
|
$invalidReceivePlantName = [];
|
||||||
|
$invalidTransitDays = [];
|
||||||
|
$invalidTransportName = [];
|
||||||
|
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
if ($index == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$receivingPlant = trim($row[0]);
|
||||||
|
$receivingPlantName = trim($row[1]);
|
||||||
|
$transitDays = trim($row[2]);
|
||||||
|
$transportName = trim($row[3]);
|
||||||
|
|
||||||
|
if (empty($receivingPlant)) {
|
||||||
|
$invalidReceivePlant[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($receivingPlantName)) {
|
||||||
|
$invalidReceivePlantName[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($transitDays)) {
|
||||||
|
$invalidTransitDays[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
if (empty($transportName)) {
|
||||||
|
$invalidTransportName[] = "Row {$index}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($invalidReceivePlant) || ! empty($invalidReceivePlantName) || ! empty($invalidTransitDays) || ! empty($invalidTransportName)) {
|
||||||
|
$errorMsg = '';
|
||||||
|
|
||||||
|
if (! empty($invalidReceivePlant)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidReceivePlant).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidReceivePlantName)) {
|
||||||
|
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidReceivePlantName).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidTransitDays)) {
|
||||||
|
$errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidTransitDays).'<br>';
|
||||||
|
}
|
||||||
|
if (! empty($invalidTransportName)) {
|
||||||
|
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidTransportName).'<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Missing Mandatory Fields')
|
||||||
|
->body($errorMsg)
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
if ($disk->exists($path)) {
|
||||||
|
$disk->delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($rows as $index => $row)
|
||||||
|
{
|
||||||
|
if ($index == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$receivingPlant = trim($row[0]);
|
||||||
|
$receivingPlantName = trim($row[1]);
|
||||||
|
$transitDays = trim($row[2]);
|
||||||
|
$transportName = trim($row[3]);
|
||||||
|
|
||||||
|
$inserted = InvoiceMaster::create([
|
||||||
|
'receiving_plant' => $receivingPlant,
|
||||||
|
'receiving_plant_name' => $receivingPlantName,
|
||||||
|
'transit_days' => $transitDays,
|
||||||
|
'transport_name' => $transportName,
|
||||||
|
'created_at' => now(),
|
||||||
|
'created_by' => $operatorName,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if ($inserted) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Upload Success')
|
||||||
|
->body('Invoice master uploaded successfully!')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Notification::make()
|
||||||
|
->title('Insertion Failed')
|
||||||
|
->body('Invoice master upload failed!')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view import invoice master');
|
||||||
|
}),
|
||||||
|
ExportAction::make()
|
||||||
|
->label('Export Invoice Master')
|
||||||
|
->color('warning')
|
||||||
|
->exporter(InvoiceMasterExporter::class)
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view export invoice master');
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListInvoiceMasters::route('/'),
|
||||||
|
'create' => Pages\CreateInvoiceMaster::route('/create'),
|
||||||
|
'view' => Pages\ViewInvoiceMaster::route('/{record}'),
|
||||||
|
'edit' => Pages\EditInvoiceMaster::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getEloquentQuery(): Builder
|
||||||
|
{
|
||||||
|
return parent::getEloquentQuery()
|
||||||
|
->withoutGlobalScopes([
|
||||||
|
SoftDeletingScope::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceMasterResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateInvoiceMaster extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceMasterResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceMasterResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditInvoiceMaster extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceMasterResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\ViewAction::make(),
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
Actions\ForceDeleteAction::make(),
|
||||||
|
Actions\RestoreAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceMasterResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListInvoiceMasters extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceMasterResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InvoiceMasterResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InvoiceMasterResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
|
||||||
|
class ViewInvoiceMaster extends ViewRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InvoiceMasterResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\EditAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,12 +10,8 @@ use App\Models\InvoiceValidation;
|
|||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Auth;
|
|
||||||
use Filament\Actions\Action as FilamentActionsAction;
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Components\Actions\Action as ActionsAction;
|
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
use Filament\Forms\Components\FileUpload;
|
use Filament\Forms\Components\FileUpload;
|
||||||
use Filament\Forms\Components\Radio;
|
use Filament\Forms\Components\Radio;
|
||||||
@@ -23,25 +19,23 @@ use Filament\Forms\Components\Section;
|
|||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\ToggleButtons;
|
use Filament\Forms\Components\ToggleButtons;
|
||||||
|
use Filament\Forms\Components\View;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Forms\Get;
|
use Filament\Forms\Get;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Tables\Actions\Action;
|
use Filament\Tables\Actions\Action;
|
||||||
use Filament\Tables\Actions\ExportAction;
|
use Filament\Tables\Actions\ExportAction;
|
||||||
use Filament\Tables\Filters\Filter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Filament\Tables\Table;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Livewire\Livewire;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Str;
|
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Filament\Forms\Components\View;
|
use Livewire\Livewire;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Str;
|
||||||
|
|
||||||
class InvoiceValidationResource extends Resource
|
class InvoiceValidationResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -53,8 +47,6 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
public $invoiceNumber;
|
public $invoiceNumber;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
@@ -74,6 +66,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->default(function () {
|
->default(function () {
|
||||||
@@ -91,10 +84,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
$set('total_quantity', null);
|
$set('total_quantity', null);
|
||||||
$set('scanned_quantity', null);
|
$set('scanned_quantity', null);
|
||||||
$set('ivPlantError', 'Please select a plant first.');
|
$set('ivPlantError', 'Please select a plant first.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$set('ivPlantError', null);
|
$set('ivPlantError', null);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -178,18 +170,17 @@ class InvoiceValidationResource extends Resource
|
|||||||
->reactive()
|
->reactive()
|
||||||
->hidden(fn (callable $get) => ($get('invoice_number') == null || $get('update_invoice') == '0') || ! empty($get('serial_number')))
|
->hidden(fn (callable $get) => ($get('invoice_number') == null || $get('update_invoice') == '0') || ! empty($get('serial_number')))
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
if (!$get('plant_id'))
|
if (! $get('plant_id')) {
|
||||||
{
|
|
||||||
$set('update_invoice', null);
|
$set('update_invoice', null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($get('update_invoice') == "1")
|
if ($get('update_invoice') == '1') {
|
||||||
{
|
|
||||||
$totQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->where('plant_id', $get('plant_id'))->count();
|
$totQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->where('plant_id', $get('plant_id'))->count();
|
||||||
if ($totQuan <= 0)
|
if ($totQuan <= 0) {
|
||||||
{
|
|
||||||
$set('update_invoice', null);
|
$set('update_invoice', null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,19 +188,16 @@ class InvoiceValidationResource extends Resource
|
|||||||
$scanMQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $get('plant_id'))->count();
|
$scanMQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $get('plant_id'))->count();
|
||||||
$scanSQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->where('scanned_status', 'Scanned')->where('plant_id', $get('plant_id'))->count();
|
$scanSQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->where('scanned_status', 'Scanned')->where('plant_id', $get('plant_id'))->count();
|
||||||
|
|
||||||
if ($totMQuan > 0)
|
if ($totMQuan > 0) {
|
||||||
{
|
if ($totQuan == $scanMQuan) {
|
||||||
if ($totQuan == $scanMQuan)
|
|
||||||
{
|
|
||||||
$set('update_invoice', null);
|
$set('update_invoice', null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if ($totQuan == $scanSQuan) {
|
||||||
{
|
|
||||||
if ($totQuan == $scanSQuan)
|
|
||||||
{
|
|
||||||
$set('update_invoice', null);
|
$set('update_invoice', null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,7 +212,6 @@ class InvoiceValidationResource extends Resource
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
@@ -240,6 +227,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
$paginator = $livewire->getTableRecords();
|
$paginator = $livewire->getTableRecords();
|
||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
|
|
||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
}),
|
}),
|
||||||
Tables\Columns\TextColumn::make('invoice_number')
|
Tables\Columns\TextColumn::make('invoice_number')
|
||||||
@@ -250,6 +238,11 @@ class InvoiceValidationResource extends Resource
|
|||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(), // ->searchable()
|
->sortable(), // ->searchable()
|
||||||
|
Tables\Columns\TextColumn::make('stickerMaster.item.description')
|
||||||
|
->label('Item Description')
|
||||||
|
->alignCenter()
|
||||||
|
->sortable() // ->searchable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('serial_number')
|
Tables\Columns\TextColumn::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -269,6 +262,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('scanned_status')
|
Tables\Columns\TextColumn::make('scanned_status')
|
||||||
->label('Scanned Status')
|
->label('Scanned Status')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
|
// Tables\Columns\TextColumn::make('stickerMaster.panel_box_code')
|
||||||
|
// ->label('Panel Box Code')
|
||||||
|
// ->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||||
->label('Panel Box Supplier')
|
->label('Panel Box Supplier')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
@@ -335,6 +331,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
// ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
// ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
@@ -378,42 +375,37 @@ class InvoiceValidationResource extends Resource
|
|||||||
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
|
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
|
||||||
|
|
||||||
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->count();
|
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->count();
|
||||||
if ($totQuan > 0)
|
if ($totQuan > 0) {
|
||||||
{
|
|
||||||
$scanSQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->count();
|
$scanSQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->count();
|
||||||
if ($totQuan == $scanSQuan)
|
if ($totQuan == $scanSQuan) {
|
||||||
{
|
|
||||||
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||||
$plantName = $invoiceFirst ? (String)$invoiceFirst->plant->name : null;
|
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Serial invoice number : '$originalNameOnly' already completed the scanning process for plant : '$plantName'.")
|
->title("Serial invoice number : '$originalNameOnly' already completed the scanning process for plant : '$plantName'.")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
if ($disk->exists($path))
|
if ($disk->exists($path)) {
|
||||||
{
|
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||||
// $plantCode = $invoiceFirst ? (String)$invoiceFirst->plant->code : null;
|
// $plantCode = $invoiceFirst ? (String)$invoiceFirst->plant->code : null;
|
||||||
$plantName = $invoiceFirst ? (String)$invoiceFirst->plant->name : null;
|
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||||
$invoicePlantId = $invoiceFirst->plant_id;
|
$invoicePlantId = $invoiceFirst->plant_id;
|
||||||
if ($plantId != $invoicePlantId)
|
if ($plantId != $invoicePlantId) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Serial invoice number : '$originalNameOnly' already exists for plant : '$plantName'.<br>Choose the valid 'Plant' to proceed!")
|
->title("Serial invoice number : '$originalNameOnly' already exists for plant : '$plantName'.<br>Choose the valid 'Plant' to proceed!")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
if ($disk->exists($path))
|
if ($disk->exists($path)) {
|
||||||
{
|
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -422,26 +414,23 @@ class InvoiceValidationResource extends Resource
|
|||||||
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->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();
|
$scanSQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
|
||||||
|
|
||||||
if ($totQuan > 0 && $totQuan == $scanSQuan)
|
if ($totQuan > 0 && $totQuan == $scanSQuan) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Serial invoice already completed the scanning process for selected plant.')
|
->title('Serial invoice already completed the scanning process for selected plant.')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
if ($disk->exists($path))
|
if ($disk->exists($path)) {
|
||||||
{
|
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fullPath && file_exists($fullPath))
|
if ($fullPath && file_exists($fullPath)) {
|
||||||
{
|
|
||||||
$rows = Excel::toArray(null, $fullPath)[0];
|
$rows = Excel::toArray(null, $fullPath)[0];
|
||||||
|
|
||||||
if ((count($rows) - 1) <= 0)
|
if ((count($rows) - 1) <= 0) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Records Not Found')
|
->title('Records Not Found')
|
||||||
->body("Import the valid 'Serial Invoice' file to proceed..!")
|
->body("Import the valid 'Serial Invoice' file to proceed..!")
|
||||||
@@ -451,6 +440,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,9 +452,10 @@ class InvoiceValidationResource extends Resource
|
|||||||
$seenSerialNumbers = [];
|
$seenSerialNumbers = [];
|
||||||
$validRowsFound = false;
|
$validRowsFound = false;
|
||||||
|
|
||||||
foreach ($rows as $index => $row)
|
foreach ($rows as $index => $row) {
|
||||||
{
|
if ($index == 0) {
|
||||||
if ($index == 0) continue; // Skip header
|
continue;
|
||||||
|
} // Skip header
|
||||||
|
|
||||||
$materialCode = trim($row[0]);
|
$materialCode = trim($row[0]);
|
||||||
$serialNumber = trim($row[1]);
|
$serialNumber = trim($row[1]);
|
||||||
@@ -473,24 +464,16 @@ class InvoiceValidationResource extends Resource
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($materialCode))
|
if (! empty($materialCode)) {
|
||||||
{
|
if (Str::length($materialCode) < 6 || ! ctype_alnum($materialCode)) {
|
||||||
if (Str::length($materialCode) < 6 || !ctype_alnum($materialCode))
|
|
||||||
{
|
|
||||||
$invalidMatCodes[] = $materialCode;
|
$invalidMatCodes[] = $materialCode;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (empty($serialNumber)) {
|
if (empty($serialNumber)) {
|
||||||
$missingSerials[] = $materialCode;
|
$missingSerials[] = $materialCode;
|
||||||
|
|
||||||
}
|
} elseif (Str::length($serialNumber) < 9 || ! ctype_alnum($serialNumber)) {
|
||||||
else if (Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
|
|
||||||
{
|
|
||||||
$invalidSerialCodes[] = $serialNumber;
|
$invalidSerialCodes[] = $serialNumber;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (in_array($serialNumber, $seenSerialNumbers)) {
|
if (in_array($serialNumber, $seenSerialNumbers)) {
|
||||||
$duplicateSerials[] = $serialNumber;
|
$duplicateSerials[] = $serialNumber;
|
||||||
} else {
|
} else {
|
||||||
@@ -500,9 +483,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -524,9 +505,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! empty($uniqueMissingSerials)) {
|
||||||
else if (!empty($uniqueMissingSerials)) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Missing Serial Numbers')
|
->title('Missing Serial Numbers')
|
||||||
->body("The following item codes doesn't have valid serial number:<br>".implode(', ', $uniqueMissingSerials))
|
->body("The following item codes doesn't have valid serial number:<br>".implode(', ', $uniqueMissingSerials))
|
||||||
@@ -535,9 +516,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! empty($uniqueSerialCodes)) {
|
||||||
else if (!empty($uniqueSerialCodes)) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Serial Number')
|
->title('Invalid Serial Number')
|
||||||
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>'.implode(', ', $uniqueSerialCodes))
|
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>'.implode(', ', $uniqueSerialCodes))
|
||||||
@@ -546,9 +527,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! empty($duplicateSerialCodes)) {
|
||||||
else if (!empty($duplicateSerialCodes)) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Duplicate Serial Numbers')
|
->title('Duplicate Serial Numbers')
|
||||||
->body('The following serial numbers are already exist in imported excel:<br>'.implode(', ', $duplicateSerialCodes))
|
->body('The following serial numbers are already exist in imported excel:<br>'.implode(', ', $duplicateSerialCodes))
|
||||||
@@ -557,6 +538,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,6 +551,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,8 +567,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
||||||
|
|
||||||
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 database." : 'The following item codes are not found in database:<br>'.implode(', ', $missingCodes);
|
||||||
@@ -599,6 +581,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,8 +591,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
->pluck('item.code')
|
->pluck('item.code')
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
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 found have material type.')
|
||||||
@@ -619,10 +601,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (count($invalidCodes) > 0) {
|
||||||
else if (count($invalidCodes) > 0)
|
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid item codes found')
|
->title('Invalid item codes found')
|
||||||
->body('Material invoice Item Codes found : '.implode(', ', $invalidCodes))
|
->body('Material invoice Item Codes found : '.implode(', ', $invalidCodes))
|
||||||
@@ -632,10 +613,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Save full file path to session
|
// Save full file path to session
|
||||||
session(['uploaded_invoice_path' => $fullPath]);
|
session(['uploaded_invoice_path' => $fullPath]);
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -656,6 +636,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
// ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
// ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
@@ -695,42 +676,37 @@ class InvoiceValidationResource extends Resource
|
|||||||
$fullPath = Storage::disk('local')->path($path);
|
$fullPath = Storage::disk('local')->path($path);
|
||||||
|
|
||||||
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->count();
|
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->count();
|
||||||
if ($totQuan > 0)
|
if ($totQuan > 0) {
|
||||||
{
|
|
||||||
$scanMQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->whereNotNull('serial_number')->where('serial_number', '!=', '')->count();
|
$scanMQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->whereNotNull('serial_number')->where('serial_number', '!=', '')->count();
|
||||||
if ($totQuan == $scanMQuan)
|
if ($totQuan == $scanMQuan) {
|
||||||
{
|
|
||||||
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||||
$plantName = $invoiceFirst ? (String)$invoiceFirst->plant->name : null;
|
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Material invoice number : '$originalNameOnly' already completed the scanning process for plant : '$plantName'.")
|
->title("Material invoice number : '$originalNameOnly' already completed the scanning process for plant : '$plantName'.")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
if ($disk->exists($path))
|
if ($disk->exists($path)) {
|
||||||
{
|
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
$invoiceFirst = InvoiceValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||||
// $plantCode = $invoiceFirst ? (String)$invoiceFirst->plant->code : null;
|
// $plantCode = $invoiceFirst ? (String)$invoiceFirst->plant->code : null;
|
||||||
$plantName = $invoiceFirst ? (String)$invoiceFirst->plant->name : null;
|
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||||
$invoicePlantId = $invoiceFirst->plant_id;
|
$invoicePlantId = $invoiceFirst->plant_id;
|
||||||
if ($plantId != $invoicePlantId)
|
if ($plantId != $invoicePlantId) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Material invoice number : '$originalNameOnly' already exists for plant : '$plantName'.<br>Choose the valid 'Plant' to proceed!")
|
->title("Material invoice number : '$originalNameOnly' already exists for plant : '$plantName'.<br>Choose the valid 'Plant' to proceed!")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
if ($disk->exists($path))
|
if ($disk->exists($path)) {
|
||||||
{
|
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -739,8 +715,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->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();
|
$scanMQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
|
||||||
|
|
||||||
if ($totQuan > 0 && $totQuan == $scanMQuan)
|
if ($totQuan > 0 && $totQuan == $scanMQuan) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Material invoice already completed the scanning process for selected plant.')
|
->title('Material invoice already completed the scanning process for selected plant.')
|
||||||
->danger()
|
->danger()
|
||||||
@@ -748,15 +723,14 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fullPath && file_exists($fullPath))
|
if ($fullPath && file_exists($fullPath)) {
|
||||||
{
|
|
||||||
$rows = Excel::toArray(null, $fullPath)[0];
|
$rows = Excel::toArray(null, $fullPath)[0];
|
||||||
|
|
||||||
if ((count($rows) - 1) <= 0)
|
if ((count($rows) - 1) <= 0) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Records Not Found')
|
->title('Records Not Found')
|
||||||
->body("Import the valid 'Material Invoice' file to proceed..!")
|
->body("Import the valid 'Material Invoice' file to proceed..!")
|
||||||
@@ -766,6 +740,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,9 +751,10 @@ class InvoiceValidationResource extends Resource
|
|||||||
$invalidMaterialQuan = [];
|
$invalidMaterialQuan = [];
|
||||||
$validRowsFound = false;
|
$validRowsFound = false;
|
||||||
|
|
||||||
foreach ($rows as $index => $row)
|
foreach ($rows as $index => $row) {
|
||||||
{
|
if ($index == 0) {
|
||||||
if ($index == 0) continue; // Skip header
|
continue;
|
||||||
|
} // Skip header
|
||||||
|
|
||||||
$materialCode = trim($row[0]);
|
$materialCode = trim($row[0]);
|
||||||
$materialQuantity = trim($row[1]);
|
$materialQuantity = trim($row[1]);
|
||||||
@@ -788,33 +764,21 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($materialCode)) {
|
if (! empty($materialCode)) {
|
||||||
if (Str::length($materialCode) < 6 || !ctype_alnum($materialCode))
|
if (Str::length($materialCode) < 6 || ! ctype_alnum($materialCode)) {
|
||||||
{
|
|
||||||
$invalidMatCodes[] = $materialCode;
|
$invalidMatCodes[] = $materialCode;
|
||||||
}
|
} else {
|
||||||
else
|
if ($materialQuantity == 0) {
|
||||||
{
|
|
||||||
if ($materialQuantity == 0)
|
|
||||||
{
|
|
||||||
$invalidMaterialQuan[] = $materialCode;
|
$invalidMaterialQuan[] = $materialCode;
|
||||||
}
|
} elseif (empty($materialQuantity)) {
|
||||||
else if (empty($materialQuantity))
|
|
||||||
{
|
|
||||||
$missingQuantities[] = $materialCode;
|
$missingQuantities[] = $materialCode;
|
||||||
}
|
} elseif (! is_numeric($materialQuantity)) {
|
||||||
else if (!is_numeric($materialQuantity))
|
|
||||||
{
|
|
||||||
$invalidMatQuan[] = $materialCode;
|
$invalidMatQuan[] = $materialCode;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$materialCodes[] = $materialCode;
|
$materialCodes[] = $materialCode;
|
||||||
$validRowsFound = true;
|
$validRowsFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -834,32 +798,35 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! 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))
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! 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))
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,6 +840,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,6 +854,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -901,8 +870,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
||||||
|
|
||||||
if (!empty($missingCodes))
|
if (! empty($missingCodes)) {
|
||||||
{
|
|
||||||
$missingCount = count($missingCodes);
|
$missingCount = count($missingCodes);
|
||||||
|
|
||||||
$message = $missingCount > 10
|
$message = $missingCount > 10
|
||||||
@@ -918,6 +886,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -926,8 +895,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
->pluck('item.code')
|
->pluck('item.code')
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
if (count($invalidCodes) > 10)
|
if (count($invalidCodes) > 10) {
|
||||||
{
|
|
||||||
$invalidCodes = array_unique($invalidCodes);
|
$invalidCodes = array_unique($invalidCodes);
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid item codes found')
|
->title('Invalid item codes found')
|
||||||
@@ -938,10 +906,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (count($invalidCodes) > 0) {
|
||||||
else if (count($invalidCodes) > 0)
|
|
||||||
{
|
|
||||||
$invalidCodes = array_unique($invalidCodes);
|
$invalidCodes = array_unique($invalidCodes);
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid item codes found')
|
->title('Invalid item codes found')
|
||||||
@@ -952,6 +919,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($disk->exists($path)) {
|
if ($disk->exists($path)) {
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,24 +927,22 @@ class InvoiceValidationResource extends Resource
|
|||||||
$zeroQtyCodes = [];
|
$zeroQtyCodes = [];
|
||||||
$notDivisibleCodes = [];
|
$notDivisibleCodes = [];
|
||||||
|
|
||||||
foreach ($matchedItems as $sticker)
|
foreach ($matchedItems as $sticker) {
|
||||||
{
|
|
||||||
$code = $sticker->item->code;
|
$code = $sticker->item->code;
|
||||||
$materialType = $sticker->material_type;
|
$materialType = $sticker->material_type;
|
||||||
|
|
||||||
if ($materialType == 2)
|
if ($materialType == 2) {
|
||||||
{
|
|
||||||
$bundleQty = $sticker->bundle_quantity ?? 0;
|
$bundleQty = $sticker->bundle_quantity ?? 0;
|
||||||
$totalExcelQty = 0;
|
$totalExcelQty = 0;
|
||||||
|
|
||||||
foreach ($rows as $index => $row)
|
foreach ($rows as $index => $row) {
|
||||||
{
|
if ($index == 0) {
|
||||||
if ($index == 0) continue; // Skip header
|
continue;
|
||||||
|
} // Skip header
|
||||||
|
|
||||||
$excelCode = trim($row[0]);
|
$excelCode = trim($row[0]);
|
||||||
$excelMatQty = trim($row[1]);
|
$excelMatQty = trim($row[1]);
|
||||||
|
|
||||||
|
|
||||||
if ($excelCode == $code && is_numeric($excelMatQty)) {
|
if ($excelCode == $code && is_numeric($excelMatQty)) {
|
||||||
$totalExcelQty += $excelMatQty; // Sum up the quantities
|
$totalExcelQty += $excelMatQty; // Sum up the quantities
|
||||||
}
|
}
|
||||||
@@ -993,7 +959,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
$showValidationNotification = function (array $codes, string $message) {
|
$showValidationNotification = function (array $codes, string $message) {
|
||||||
if (count($codes) == 0) return;
|
if (count($codes) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$uniqueCodes = array_unique($codes);
|
$uniqueCodes = array_unique($codes);
|
||||||
$codeList = implode(', ', $uniqueCodes);
|
$codeList = implode(', ', $uniqueCodes);
|
||||||
@@ -1009,19 +977,17 @@ class InvoiceValidationResource extends Resource
|
|||||||
$zeroQtyCodes = array_unique($zeroQtyCodes);
|
$zeroQtyCodes = array_unique($zeroQtyCodes);
|
||||||
$notDivisibleCodes = array_unique($notDivisibleCodes);
|
$notDivisibleCodes = array_unique($notDivisibleCodes);
|
||||||
|
|
||||||
$showValidationNotification($nonNumericQtyCodes, "The following item codes contains invalid bundle quantity:");
|
$showValidationNotification($nonNumericQtyCodes, 'The following item codes contains invalid bundle quantity:');
|
||||||
$showValidationNotification($zeroQtyCodes, "The following item codes quantity should be greater than '0':");
|
$showValidationNotification($zeroQtyCodes, "The following item codes quantity should be greater than '0':");
|
||||||
$showValidationNotification($notDivisibleCodes, "The following item codes quantity is not divisible by bundle quantity.");
|
$showValidationNotification($notDivisibleCodes, 'The following item codes quantity is not divisible by bundle quantity.');
|
||||||
|
|
||||||
if ($nonNumericQtyCodes || $zeroQtyCodes || $notDivisibleCodes) {
|
if ($nonNumericQtyCodes || $zeroQtyCodes || $notDivisibleCodes) {
|
||||||
if ($disk->exists($path))
|
if ($disk->exists($path)) {
|
||||||
{
|
|
||||||
$disk->delete($path);
|
$disk->delete($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Save full file path to session
|
// Save full file path to session
|
||||||
session(['uploaded_material_invoice' => $fullPath]);
|
session(['uploaded_material_invoice' => $fullPath]);
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -1052,11 +1018,50 @@ class InvoiceValidationResource extends Resource
|
|||||||
Radio::make('invoice_type')
|
Radio::make('invoice_type')
|
||||||
->label('Type ?')
|
->label('Type ?')
|
||||||
->boolean()
|
->boolean()
|
||||||
->options([
|
// ->options([
|
||||||
|
// 'Serial' => 'Serial',
|
||||||
|
// 'Material' => 'Material',
|
||||||
|
// ])
|
||||||
|
->options(function () {
|
||||||
|
$userRights = Filament::auth()->user();
|
||||||
|
$hasBoth = ($userRights->hasRole(['Super Admin', 'Sales Employee', 'Sales Supervisor Hub', 'Sales Manager']) ?? null);
|
||||||
|
|
||||||
|
$hasSerial = ($userRights->hasRole(['Sales Supervisor 1', 'Sales Supervisor Inventory', 'Sales Employee Inventory']) ?? null);
|
||||||
|
|
||||||
|
$hasMaterial = $userRights->hasRole('Sales Supervisor 2') ?? null;
|
||||||
|
|
||||||
|
$retRes = [
|
||||||
'Serial' => 'Serial',
|
'Serial' => 'Serial',
|
||||||
'Material' => 'Material'
|
'Material' => 'Material',
|
||||||
])
|
];
|
||||||
->default('Serial')
|
|
||||||
|
if ($hasBoth) {
|
||||||
|
return $retRes;
|
||||||
|
} elseif ($hasSerial) {
|
||||||
|
return ['Serial' => 'Serial'];
|
||||||
|
} elseif ($hasMaterial) {
|
||||||
|
return ['Material' => 'Material'];
|
||||||
|
} else {
|
||||||
|
return ['Serial' => 'Serial']; // return [];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// ->default('Serial')
|
||||||
|
->default(function () {
|
||||||
|
$userRights = Filament::auth()->user();
|
||||||
|
$hasBoth = ($userRights->hasRole(['Super Admin', 'Sales Employee', 'Sales Supervisor Hub', 'Sales Manager']) ?? null);
|
||||||
|
|
||||||
|
$hasSerial = ($userRights->hasRole(['Sales Supervisor 1', 'Sales Supervisor Inventory', 'Sales Employee Inventory']) ?? null);
|
||||||
|
|
||||||
|
$hasMaterial = $userRights->hasRole('Sales Supervisor 2') ?? null;
|
||||||
|
|
||||||
|
if ($hasBoth || $hasSerial) {
|
||||||
|
return 'Serial';
|
||||||
|
} elseif ($hasMaterial) {
|
||||||
|
return 'Material';
|
||||||
|
} else {
|
||||||
|
return 'Serial'; // return [];
|
||||||
|
}
|
||||||
|
})
|
||||||
->inlineLabel(false)
|
->inlineLabel(false)
|
||||||
->inline(),
|
->inline(),
|
||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
@@ -1067,6 +1072,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
// })
|
// })
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -1085,6 +1091,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
->nullable()
|
->nullable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$pId = $get('Plant');
|
$pId = $get('Plant');
|
||||||
|
|
||||||
// if (empty($pId)) {
|
// if (empty($pId)) {
|
||||||
// return [];
|
// return [];
|
||||||
// }
|
// }
|
||||||
@@ -1111,12 +1118,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
->nullable()
|
->nullable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (!$plantId)
|
if (! $plantId) {
|
||||||
{
|
|
||||||
return InvoiceValidation::whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
return InvoiceValidation::whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return InvoiceValidation::where('plant_id', $plantId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
return InvoiceValidation::where('plant_id', $plantId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1136,13 +1140,13 @@ class InvoiceValidationResource extends Resource
|
|||||||
->query(function ($query, array $data) {
|
->query(function ($query, array $data) {
|
||||||
// Hide all records initially if no filters are applied
|
// Hide all records initially if no filters are applied
|
||||||
if (empty($data['invoice_type']) || (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
|
if (empty($data['invoice_type']) || (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
|
||||||
if (empty($data['invoice_type']))
|
if (empty($data['invoice_type'])) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Please, choose invoice type to filter.')
|
->title('Please, choose invoice type to filter.')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query->whereRaw('1 = 0');
|
return $query->whereRaw('1 = 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1154,7 +1158,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
$query->whereNotNull('scanned_status')->where('scanned_status', '!=', '');
|
$query->whereNotNull('scanned_status')->where('scanned_status', '!=', '');
|
||||||
} elseif ($data['scanned_status'] == 'Pending') {
|
} elseif ($data['scanned_status'] == 'Pending') {
|
||||||
// $query->whereNull('scanned_status')->orWhere('scanned_status', '');
|
// $query->whereNull('scanned_status')->orWhere('scanned_status', '');
|
||||||
$query->where(function ($query) use ($data) {
|
$query->where(function ($query) {
|
||||||
// if (empty($data['scanned_status']) || $data['scanned_status'] == 'Pending') {
|
// if (empty($data['scanned_status']) || $data['scanned_status'] == 'Pending') {
|
||||||
$query->whereNull('scanned_status')->orWhere('scanned_status', '!=', 'Scanned');
|
$query->whereNull('scanned_status')->orWhere('scanned_status', '!=', 'Scanned');
|
||||||
// }
|
// }
|
||||||
@@ -1168,7 +1172,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
if ($data['scanned_status'] == 'Scanned') {
|
if ($data['scanned_status'] == 'Scanned') {
|
||||||
$query->whereNotNull('serial_number')->where('serial_number', '!=', '');
|
$query->whereNotNull('serial_number')->where('serial_number', '!=', '');
|
||||||
} elseif ($data['scanned_status'] == 'Pending') {
|
} elseif ($data['scanned_status'] == 'Pending') {
|
||||||
$query->where(function ($query) use ($data) {
|
$query->where(function ($query) {
|
||||||
$query->whereNull('serial_number')->orWhere('serial_number', '=', '');
|
$query->whereNull('serial_number')->orWhere('serial_number', '=', '');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1246,7 +1250,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $indicators;
|
return $indicators;
|
||||||
})
|
}),
|
||||||
])
|
])
|
||||||
->filtersFormMaxHeight('280px')
|
->filtersFormMaxHeight('280px')
|
||||||
->actions([
|
->actions([
|
||||||
@@ -1258,7 +1262,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
Tables\Actions\DeleteBulkAction::make(),
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
FilamentExportBulkAction::make('export')
|
FilamentExportBulkAction::make('export'),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
public bool $showCapacitorInput = false;
|
public bool $showCapacitorInput = false;
|
||||||
|
|
||||||
public $excel_file;
|
public $excel_file;
|
||||||
|
public $mInvoiceNo;
|
||||||
|
|
||||||
public function getFormActions(): array
|
public function getFormActions(): array
|
||||||
{
|
{
|
||||||
@@ -103,6 +104,8 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
{
|
{
|
||||||
$invoiceNumber = trim($invoiceNumber);
|
$invoiceNumber = trim($invoiceNumber);
|
||||||
|
|
||||||
|
$parts = explode('.', $invoiceNumber);
|
||||||
|
|
||||||
$this->showCapacitorInput = false;
|
$this->showCapacitorInput = false;
|
||||||
|
|
||||||
$user = Filament::auth()->user();
|
$user = Filament::auth()->user();
|
||||||
@@ -118,6 +121,62 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// ..GET SERIAL INVOICE API
|
// ..GET SERIAL INVOICE API
|
||||||
|
|
||||||
|
if(strlen($invoiceNumber) > 15)
|
||||||
|
{
|
||||||
|
|
||||||
|
$payloadJson = base64_decode(strtr($parts[1], '-_', '+/'));
|
||||||
|
|
||||||
|
if (empty($payloadJson)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid payload for scanned qr code.')
|
||||||
|
->danger()
|
||||||
|
->seconds(1)
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$payload = json_decode($payloadJson, true);
|
||||||
|
|
||||||
|
|
||||||
|
if (!isset($payload['data'])) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid payload for scanned qr code.')
|
||||||
|
->info()
|
||||||
|
->seconds(1)
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$documentData = $payload['data'];
|
||||||
|
|
||||||
|
if($documentData == '' || $documentData == ''){
|
||||||
|
Notification::make()
|
||||||
|
->title('Invalid payload for scanned qr code.')
|
||||||
|
->info()
|
||||||
|
->seconds(1)
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract DocNo
|
||||||
|
preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches);
|
||||||
|
|
||||||
|
if (!isset($matches[1])) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Invoice number not found.')
|
||||||
|
->info()
|
||||||
|
->seconds(1)
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($matches[1])) {
|
||||||
|
$invoiceNumber = $matches[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//dd($invoiceNumber);
|
||||||
|
|
||||||
// ..
|
// ..
|
||||||
|
|
||||||
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
||||||
@@ -2742,19 +2801,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
// $mailData = $this->getMail();
|
|
||||||
// $mPlantName = $mailData['plant_name'];
|
|
||||||
// $emails = $mailData['emails'];
|
|
||||||
// $mInvoiceType = 'Material';
|
|
||||||
|
|
||||||
// if (! empty($emails)) {
|
|
||||||
// Mail::to($emails)->send(
|
|
||||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotValidMaterialType')
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -2784,19 +2830,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
// $mailData = $this->getMail();
|
|
||||||
// $mPlantName = $mailData['plant_name'];
|
|
||||||
// $emails = $mailData['emails'];
|
|
||||||
// $mInvoiceType = 'Material';
|
|
||||||
|
|
||||||
// if (! empty($emails)) {
|
|
||||||
// Mail::to($emails)->send(
|
|
||||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotInvoice')
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -2825,19 +2858,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
// $mailData = $this->getMail();
|
|
||||||
// $mPlantName = $mailData['plant_name'];
|
|
||||||
// $emails = $mailData['emails'];
|
|
||||||
// $mInvoiceType = 'Material';
|
|
||||||
|
|
||||||
// if (! empty($emails)) {
|
|
||||||
// Mail::to($emails)->send(
|
|
||||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'Item')
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -3381,19 +3401,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playNotificationSound');
|
$this->dispatch('playNotificationSound');
|
||||||
|
|
||||||
// $mInvoiceType = 'Serial';
|
|
||||||
// $mailData = $this->getMail();
|
|
||||||
// $mPlantName = $mailData['plant_name'];
|
|
||||||
// $emails = $mailData['emails'];
|
|
||||||
|
|
||||||
// if (! empty($emails)) {
|
|
||||||
// Mail::to($emails)->send(
|
|
||||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
$filename = $invoiceNumber.'.xlsx';
|
$filename = $invoiceNumber.'.xlsx';
|
||||||
$directory = 'uploads/temp';
|
$directory = 'uploads/temp';
|
||||||
$disk = Storage::disk('local');
|
$disk = Storage::disk('local');
|
||||||
@@ -3511,20 +3518,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
$this->dispatch('playNotificationSound');
|
$this->dispatch('playNotificationSound');
|
||||||
|
|
||||||
// $mInvoiceType = 'Serial';
|
|
||||||
// $mailData = $this->getMail();
|
|
||||||
// $mPlantName = $mailData['plant_name'];
|
|
||||||
// $emails = $mailData['emails'];
|
|
||||||
|
|
||||||
// if (! empty($emails)) {
|
|
||||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
|
||||||
// Mail::to($emails)->send(
|
|
||||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
$filename = $invoiceNumber.'.xlsx';
|
$filename = $invoiceNumber.'.xlsx';
|
||||||
$directory = 'uploads/temp';
|
$directory = 'uploads/temp';
|
||||||
$disk = Storage::disk('local');
|
$disk = Storage::disk('local');
|
||||||
@@ -3584,22 +3577,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
// $mInvoiceType = 'Serial';
|
|
||||||
// $mailData = $this->getMail();
|
|
||||||
// $mPlantName = $mailData['plant_name'];
|
|
||||||
// $emails = $mailData['emails'];
|
|
||||||
|
|
||||||
// $mUserName = Filament::auth()->user()->name;
|
|
||||||
|
|
||||||
// if (! empty($emails)) {
|
|
||||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
|
||||||
// Mail::to($emails)->send(
|
|
||||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, $mUserName, 'DuplicateCapacitorQR')
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ use Filament\Forms\Components\Select;
|
|||||||
use App\Models\Line;
|
use App\Models\Line;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
|
// use App\Models\PalletValidation;
|
||||||
|
// use Dom\Text;
|
||||||
|
|
||||||
class ProcessOrderResource extends Resource
|
class ProcessOrderResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -81,7 +83,7 @@ class ProcessOrderResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return \App\Models\Item::where('plant_id', $plantId)->pluck('code', 'id');
|
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
@@ -90,20 +92,23 @@ class ProcessOrderResource extends Resource
|
|||||||
|
|
||||||
if ($plantId && $itemId) {
|
if ($plantId && $itemId) {
|
||||||
// Get the item code using item_id
|
// Get the item code using item_id
|
||||||
$itemCode = \App\Models\Item::where('id', $itemId)->value('code');
|
$itemCode = Item::where('id', $itemId)->value('code');
|
||||||
|
|
||||||
if ($itemCode) {
|
if ($itemCode) {
|
||||||
// Now get the item description using plant_id + code
|
// Now get the item description using plant_id + code
|
||||||
$item = \App\Models\Item::where('plant_id', $plantId)
|
$item = Item::where('plant_id', $plantId)
|
||||||
->where('code', $itemCode)
|
->where('code', $itemCode)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$set('item_description', $item?->description);
|
$set('item_description', $item?->description);
|
||||||
|
$set('item_uom', $item?->uom);
|
||||||
} else {
|
} else {
|
||||||
$set('item_description', null);
|
$set('item_description', null);
|
||||||
|
$set('item_uom', null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$set('item_description', null);
|
$set('item_description', null);
|
||||||
|
$set('item_uom', null);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->required(),
|
->required(),
|
||||||
@@ -115,7 +120,7 @@ class ProcessOrderResource extends Resource
|
|||||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||||
$itemId = $get('item_id');
|
$itemId = $get('item_id');
|
||||||
if ($get('id')) {
|
if ($get('id')) {
|
||||||
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
|
$item = Item::where('id', $itemId)->first()?->description;
|
||||||
if ($item) {
|
if ($item) {
|
||||||
$set('item_description', $item);
|
$set('item_description', $item);
|
||||||
} else {
|
} else {
|
||||||
@@ -124,6 +129,22 @@ class ProcessOrderResource extends Resource
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('item_uom')
|
||||||
|
->label('UOM')
|
||||||
|
->required()
|
||||||
|
->reactive()
|
||||||
|
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||||
|
$itemId = $get('item_id');
|
||||||
|
if ($get('id')) {
|
||||||
|
$item = Item::where('id', $itemId)->first()?->uom;
|
||||||
|
if ($item) {
|
||||||
|
$set('item_uom', $item);
|
||||||
|
} else {
|
||||||
|
$set('item_uom', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('id')
|
Forms\Components\TextInput::make('id')
|
||||||
->hidden()
|
->hidden()
|
||||||
->readOnly(),
|
->readOnly(),
|
||||||
@@ -450,7 +471,6 @@ class ProcessOrderResource extends Resource
|
|||||||
$paginator = $livewire->getTableRecords();
|
$paginator = $livewire->getTableRecords();
|
||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
|
|
||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
}),
|
}),
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
@@ -468,6 +488,11 @@ class ProcessOrderResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('item.uom')
|
||||||
|
->label('Uom')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('process_order')
|
Tables\Columns\TextColumn::make('process_order')
|
||||||
->label('Process Order')
|
->label('Process Order')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -529,7 +554,6 @@ class ProcessOrderResource extends Resource
|
|||||||
// Tables\Filters\TrashedFilter::make(),
|
// Tables\Filters\TrashedFilter::make(),
|
||||||
// ])
|
// ])
|
||||||
->filters([
|
->filters([
|
||||||
|
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
Filter::make('advanced_filters')
|
||||||
->label('Advanced Filters')
|
->label('Advanced Filters')
|
||||||
@@ -548,10 +572,17 @@ class ProcessOrderResource extends Resource
|
|||||||
Select::make('Item')
|
Select::make('Item')
|
||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
if(empty($plantId)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||||
|
|
||||||
|
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
@@ -611,8 +642,6 @@ class ProcessOrderResource extends Resource
|
|||||||
if (!empty($data['created_to'])) {
|
if (!empty($data['created_to'])) {
|
||||||
$query->where('created_at', '<=', $data['created_to']);
|
$query->where('created_at', '<=', $data['created_to']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//$query->orderBy('created_at', 'asc');
|
//$query->orderBy('created_at', 'asc');
|
||||||
})
|
})
|
||||||
->indicateUsing(function (array $data) {
|
->indicateUsing(function (array $data) {
|
||||||
@@ -662,6 +691,130 @@ class ProcessOrderResource extends Resource
|
|||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
|
Tables\Actions\Action::make('reprint_process')
|
||||||
|
->label('Re-Print Process Order')
|
||||||
|
->form([
|
||||||
|
Forms\Components\Section::make()
|
||||||
|
->schema([
|
||||||
|
Forms\Components\Select::make('plant')
|
||||||
|
->label('Select Plant')
|
||||||
|
// ->options(Plant::pluck('name', 'id')->toArray())
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
|
})
|
||||||
|
->required()
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Item', null);
|
||||||
|
$set('process_order', null);
|
||||||
|
$set('coil_number', null);
|
||||||
|
$set('received_quantity', null);
|
||||||
|
$set('machine_name', null);
|
||||||
|
}),
|
||||||
|
Select::make('Item')
|
||||||
|
->label('Item Code')
|
||||||
|
->nullable()
|
||||||
|
->required()
|
||||||
|
->searchable()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('plant');
|
||||||
|
|
||||||
|
if(empty($plantId)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||||
|
|
||||||
|
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||||
|
})
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('process_order', null);
|
||||||
|
$set('coil_number', null);
|
||||||
|
$set('received_quantity', null);
|
||||||
|
$set('machine_name', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('process_order')
|
||||||
|
->label('Process Order')
|
||||||
|
->required()
|
||||||
|
->placeholder('Enter Process Order')
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('coil_number', null);
|
||||||
|
$set('received_quantity', null);
|
||||||
|
$set('machine_name', null);
|
||||||
|
}),
|
||||||
|
Select::make('coil_number')
|
||||||
|
->label('Coil Number')
|
||||||
|
->nullable()
|
||||||
|
->required()
|
||||||
|
->searchable()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('plant');
|
||||||
|
$itemId = $get('Item');
|
||||||
|
$processOrder = $get('process_order');
|
||||||
|
|
||||||
|
if(empty($plantId) || empty($itemId) || empty($processOrder)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ProcessOrder::where('plant_id', $plantId)
|
||||||
|
->where('item_id', $itemId)
|
||||||
|
->where('process_order', $processOrder)
|
||||||
|
->pluck('coil_number', 'coil_number');
|
||||||
|
|
||||||
|
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||||
|
})
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$plantId = $get('plant');
|
||||||
|
$itemId = $get('Item');
|
||||||
|
$processOrder = $get('process_order');
|
||||||
|
|
||||||
|
if(!$plantId || !$itemId || !$processOrder || !$state) {
|
||||||
|
$set('received_quantity', null);
|
||||||
|
$set('machine_name', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$processOrderData = ProcessOrder::where('plant_id', $plantId)
|
||||||
|
->where('item_id', $itemId)
|
||||||
|
->where('process_order', $processOrder)
|
||||||
|
->where('coil_number', $state)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$set('received_quantity', $processOrderData?->received_quantity);
|
||||||
|
$set('machine_name', $processOrderData?->machine_name);
|
||||||
|
}),
|
||||||
|
TextInput::make('received_quantity')
|
||||||
|
->label('Received Quantity')
|
||||||
|
->readOnly(),
|
||||||
|
|
||||||
|
TextInput::make('machine_name')
|
||||||
|
->label('Machine ID')
|
||||||
|
->readOnly(),
|
||||||
|
])
|
||||||
|
->columns(['default' => 1, 'sm' => 3]),
|
||||||
|
])
|
||||||
|
// ->action(function (array $data) {
|
||||||
|
// $selectedPalletNumber = $data['pallet_list'];
|
||||||
|
// return redirect()->route('download-reprint-qr-pdf', ['palletNo' => $selectedPalletNumber]);
|
||||||
|
// })
|
||||||
|
->action(function (array $data) {
|
||||||
|
$username = Filament::auth()->user()->name;
|
||||||
|
return redirect()->route('download-reprint-process-pdf', [
|
||||||
|
'plant' => $data['plant'],
|
||||||
|
'item' => $data['Item'],
|
||||||
|
'process_order' => $data['process_order'],
|
||||||
|
'coil_number' => $data['coil_number'],
|
||||||
|
'name' => $username,
|
||||||
|
]);
|
||||||
|
})
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view reprint process order');
|
||||||
|
}),
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
->label('Import Process Order')
|
->label('Import Process Order')
|
||||||
->color('warning')
|
->color('warning')
|
||||||
|
|||||||
@@ -606,7 +606,8 @@ class CharacteristicsController extends Controller
|
|||||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||||
'expected_time' => $char['expected_time'] ?? null,
|
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||||
|
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||||
'updated_by' => $userName ?? null,
|
'updated_by' => $userName ?? null,
|
||||||
];
|
];
|
||||||
} elseif ($char['motor_pump_pumpset_status'] == '2') {
|
} elseif ($char['motor_pump_pumpset_status'] == '2') {
|
||||||
@@ -623,7 +624,7 @@ class CharacteristicsController extends Controller
|
|||||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||||
'expected_time' => $char['expected_time'] ?? null,
|
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||||
'updated_by' => $userName ?? null,
|
'updated_by' => $userName ?? null,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
@@ -639,7 +640,7 @@ class CharacteristicsController extends Controller
|
|||||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||||
'expected_time' => $char['expected_time'] ?? null,
|
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||||
'updated_by' => $userName ?? null,
|
'updated_by' => $userName ?? null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -657,7 +658,7 @@ class CharacteristicsController extends Controller
|
|||||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||||
'expected_time' => $char['expected_time'] ?? null,
|
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||||
'updated_by' => $userName ?? null,
|
'updated_by' => $userName ?? null,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
@@ -673,7 +674,7 @@ class CharacteristicsController extends Controller
|
|||||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||||
'expected_time' => $char['expected_time'] ?? null,
|
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||||
'updated_by' => $userName ?? null,
|
'updated_by' => $userName ?? null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -694,7 +695,8 @@ class CharacteristicsController extends Controller
|
|||||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||||
'expected_time' => $char['expected_time'] ?? null,
|
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||||
|
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||||
'updated_by' => $userName ?? null,
|
'updated_by' => $userName ?? null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -709,8 +711,15 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
$updatedRows += $affected;
|
$updatedRows += $affected;
|
||||||
} else {
|
} else {
|
||||||
|
$curStat = ClassCharacteristic::where('plant_id', $plantId)
|
||||||
|
->where('machine_id', $machineId)
|
||||||
|
->where('gernr', $serialNumber)
|
||||||
|
->where('item_id', $itemId)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$manStat = ($curStat->man_marked_status == null || $curStat->man_marked_status == '' || $curStat->man_marked_status == '0') ? 0 : (int) $curStat->man_marked_status;
|
||||||
$values = [
|
$values = [
|
||||||
'man_marked_status' => $char['man_marked_status'] ?? null,
|
'man_marked_status' => (string) ($manStat + 1),
|
||||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||||
@@ -849,9 +858,7 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
$machineId = $machine->id;
|
$machineId = $machine->id;
|
||||||
|
|
||||||
$availFields = [
|
$availFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'motor_expected_time', 'pump_expected_time'];
|
||||||
'class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_logo_ce', 'zmm_codeclass', 'zmm_colour', 'zmm_logo_cp', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_logo_nsf', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'pump_marked_status', 'motor_pump_pumpset_status', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time',
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($itemCode != '' && $itemCode != null && $itemCode && Str::length($itemCode) > 0) {
|
if ($itemCode != '' && $itemCode != null && $itemCode && Str::length($itemCode) > 0) {
|
||||||
$existingJob = ClassCharacteristic::where('plant_id', $plantId)
|
$existingJob = ClassCharacteristic::where('plant_id', $plantId)
|
||||||
@@ -937,7 +944,7 @@ class CharacteristicsController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$col = ['marked_by', 'man_marked_by'];
|
$col = ['marked_by', 'man_marked_by', 'motor_marked_by', 'pump_marked_by'];
|
||||||
$missingUsers = [];
|
$missingUsers = [];
|
||||||
$missingUsersPlant = [];
|
$missingUsersPlant = [];
|
||||||
$missingUsersRight = [];
|
$missingUsersRight = [];
|
||||||
@@ -1042,6 +1049,8 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
$insertData['marked_by'] = ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null;
|
$insertData['marked_by'] = ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null;
|
||||||
$insertData['man_marked_by'] = ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null;
|
$insertData['man_marked_by'] = ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null;
|
||||||
|
$insertData['motor_marked_by'] = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null;
|
||||||
|
$insertData['pump_marked_by'] = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null;
|
||||||
|
|
||||||
$existing = ClassCharacteristic::where('plant_id', $plantId)
|
$existing = ClassCharacteristic::where('plant_id', $plantId)
|
||||||
->where('item_id', $itemId)
|
->where('item_id', $itemId)
|
||||||
@@ -1121,7 +1130,7 @@ class CharacteristicsController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$hasNewSno = true;
|
$hasNewSno = true;
|
||||||
|
|
||||||
$col = ['marked_by', 'man_marked_by'];
|
$col = ['marked_by', 'man_marked_by', 'motor_marked_by', 'pump_marked_by'];
|
||||||
$missingUsers = [];
|
$missingUsers = [];
|
||||||
$missingUsersPlant = [];
|
$missingUsersPlant = [];
|
||||||
$missingUsersRight = [];
|
$missingUsersRight = [];
|
||||||
@@ -1213,9 +1222,7 @@ class CharacteristicsController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$masterFields = [
|
$masterFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf'];
|
||||||
'class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name',
|
|
||||||
];
|
|
||||||
|
|
||||||
$isInsertOrUpdate = false;
|
$isInsertOrUpdate = false;
|
||||||
|
|
||||||
@@ -1278,6 +1285,8 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
$insertData['marked_by'] = ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null;
|
$insertData['marked_by'] = ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null;
|
||||||
$insertData['man_marked_by'] = ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null;
|
$insertData['man_marked_by'] = ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null;
|
||||||
|
$insertData['motor_marked_by'] = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null;
|
||||||
|
$insertData['pump_marked_by'] = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null;
|
||||||
|
|
||||||
$existing = ClassCharacteristic::where('plant_id', $plantId)
|
$existing = ClassCharacteristic::where('plant_id', $plantId)
|
||||||
->where('item_id', $itemId)
|
->where('item_id', $itemId)
|
||||||
@@ -1470,9 +1479,9 @@ class CharacteristicsController extends Controller
|
|||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time'];
|
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'motor_expected_time', 'pump_expected_time'];
|
||||||
|
|
||||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name'];
|
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf'];
|
||||||
|
|
||||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
@@ -1639,7 +1648,7 @@ class CharacteristicsController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($serialExists->mark_status != 'Marked' && $serialExists->mark_status != 'marked') {
|
if ($serialExists->mark_status != 'Marked' && $serialExists->motor_marked_status != 'Marked' && $serialExists->pump_marked_status != 'Marked') {
|
||||||
// "Serial number '{$serialNumber}' is not marked yet.<br>Please proceed with marking first.";
|
// "Serial number '{$serialNumber}' is not marked yet.<br>Please proceed with marking first.";
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -1859,9 +1868,9 @@ class CharacteristicsController extends Controller
|
|||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','expected_time'];
|
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','motor_expected_time','pump_expected_time'];
|
||||||
|
|
||||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_laser_name'];
|
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf'];
|
||||||
|
|
||||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
@@ -2090,7 +2099,7 @@ class CharacteristicsController extends Controller
|
|||||||
// ], 404);
|
// ], 404);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','expected_time'];
|
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','motor_expected_time','pump_expected_time'];
|
||||||
|
|
||||||
// $characteristicsColumns = ['class','arbid','gamng','lmnga','zz1_cn_bill_ord','zmm_amps','zmm_brand','zmm_degreeofprotection','zmm_delivery','zmm_dir_rot','zmm_discharge','zmm_discharge_max','zmm_discharge_min','zmm_duty','zmm_eff_motor','zmm_eff_pump','zmm_frequency','zmm_head','zmm_heading','zmm_head_max','zmm_head_minimum','zmm_idx_eff_mtr','zmm_idx_eff_pump','zmm_kvacode','zmm_maxambtemp','zmm_mincoolingflow','zmm_motorseries','zmm_motor_model','zmm_outlet','zmm_phase','zmm_pressure','zmm_pumpflowtype','zmm_pumpseries','zmm_pump_model','zmm_ratedpower','zmm_region','zmm_servicefactor','zmm_servicefactormaximumamps','zmm_speed','zmm_suction','zmm_suctionxdelivery','zmm_supplysource','zmm_temperature','zmm_thrustload','zmm_volts','zmm_wire','zmm_package','zmm_pvarrayrating','zmm_isi','zmm_isimotor','zmm_isipump','zmm_isipumpset','zmm_pumpset_model','zmm_stages','zmm_headrange','zmm_overall_efficiency','zmm_connection','zmm_min_bore_size','zmm_isireference','zmm_category','zmm_submergence','zmm_capacitorstart','zmm_capacitorrun','zmm_inch','zmm_motor_type','zmm_dismantle_direction','zmm_eff_ovrall','zmm_bodymoc','zmm_rotormoc','zmm_dlwl','zmm_inputpower','zmm_imp_od','zmm_ambtemp','zmm_de','zmm_dischargerange','zmm_efficiency_class','zmm_framesize','zmm_impellerdiameter','zmm_insulationclass','zmm_maxflow','zmm_minhead','zmm_mtrlofconst','zmm_nde','zmm_powerfactor','zmm_tagno','zmm_year','zmm_laser_name'];
|
// $characteristicsColumns = ['class','arbid','gamng','lmnga','zz1_cn_bill_ord','zmm_amps','zmm_brand','zmm_degreeofprotection','zmm_delivery','zmm_dir_rot','zmm_discharge','zmm_discharge_max','zmm_discharge_min','zmm_duty','zmm_eff_motor','zmm_eff_pump','zmm_frequency','zmm_head','zmm_heading','zmm_head_max','zmm_head_minimum','zmm_idx_eff_mtr','zmm_idx_eff_pump','zmm_kvacode','zmm_maxambtemp','zmm_mincoolingflow','zmm_motorseries','zmm_motor_model','zmm_outlet','zmm_phase','zmm_pressure','zmm_pumpflowtype','zmm_pumpseries','zmm_pump_model','zmm_ratedpower','zmm_region','zmm_servicefactor','zmm_servicefactormaximumamps','zmm_speed','zmm_suction','zmm_suctionxdelivery','zmm_supplysource','zmm_temperature','zmm_thrustload','zmm_volts','zmm_wire','zmm_package','zmm_pvarrayrating','zmm_isi','zmm_isimotor','zmm_isipump','zmm_isipumpset','zmm_pumpset_model','zmm_stages','zmm_headrange','zmm_overall_efficiency','zmm_connection','zmm_min_bore_size','zmm_isireference','zmm_category','zmm_submergence','zmm_capacitorstart','zmm_capacitorrun','zmm_inch','zmm_motor_type','zmm_dismantle_direction','zmm_eff_ovrall','zmm_bodymoc','zmm_rotormoc','zmm_dlwl','zmm_inputpower','zmm_imp_od','zmm_ambtemp','zmm_de','zmm_dischargerange','zmm_efficiency_class','zmm_framesize','zmm_impellerdiameter','zmm_insulationclass','zmm_maxflow','zmm_minhead','zmm_mtrlofconst','zmm_nde','zmm_powerfactor','zmm_tagno','zmm_year','zmm_laser_name'];
|
||||||
|
|
||||||
@@ -2124,6 +2133,8 @@ class CharacteristicsController extends Controller
|
|||||||
'MOTOR_MACHINE_NAME' => $serialExists->motor_machine_name ?? '',
|
'MOTOR_MACHINE_NAME' => $serialExists->motor_machine_name ?? '',
|
||||||
'PUMP_MACHINE_NAME' => $serialExists->pump_machine_name ?? '',
|
'PUMP_MACHINE_NAME' => $serialExists->pump_machine_name ?? '',
|
||||||
'PUMPSET_MACHINE_NAME' => $serialExists->pumpset_machine_name ?? '',
|
'PUMPSET_MACHINE_NAME' => $serialExists->pumpset_machine_name ?? '',
|
||||||
|
'MOTOR_EXPECTED_TIME' => $serialExists->motor_expected_time ?? '',
|
||||||
|
'PUMP_EXPECTED_TIME' => $serialExists->pump_expected_time ?? '',
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2407,6 +2418,7 @@ class CharacteristicsController extends Controller
|
|||||||
$processOrder = $data['process_order'] ?? '';
|
$processOrder = $data['process_order'] ?? '';
|
||||||
$coilNo = $data['coil_number'] ?? '';
|
$coilNo = $data['coil_number'] ?? '';
|
||||||
$status = $data['status'] ?? '';
|
$status = $data['status'] ?? '';
|
||||||
|
$obsValue = $data['observed_value'] ?? '';
|
||||||
$createdBy = $data['created_by'] ?? '';
|
$createdBy = $data['created_by'] ?? '';
|
||||||
|
|
||||||
if ($processOrder == null || $processOrder == '' || ! $processOrder) {
|
if ($processOrder == null || $processOrder == '' || ! $processOrder) {
|
||||||
@@ -2445,6 +2457,13 @@ class CharacteristicsController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($obsValue == null || $obsValue == '' || ! $obsValue) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Observed value can't be empty!",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -2484,6 +2503,7 @@ class CharacteristicsController extends Controller
|
|||||||
'process_order' => $processOrder,
|
'process_order' => $processOrder,
|
||||||
'coil_number' => $coilNo,
|
'coil_number' => $coilNo,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
|
'observed_value' => $obsValue,
|
||||||
'created_by' => $createdBy,
|
'created_by' => $createdBy,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,23 @@ class ProductionStickerReprintController extends Controller
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadQrPdf($palletNo)
|
// public function downloadQrPdf($palletNo)
|
||||||
|
// {
|
||||||
|
public function downloadQrPdf(Request $request)
|
||||||
{
|
{
|
||||||
|
// $palletNo = urldecode($palletNo);
|
||||||
|
$palletNo = urldecode($request->query('palletNo'));
|
||||||
|
|
||||||
|
if (!$palletNo) {
|
||||||
|
abort(400, 'palletNo is required');
|
||||||
|
}
|
||||||
|
|
||||||
$parts = explode('|', $palletNo);
|
$parts = explode('|', $palletNo);
|
||||||
$itemCode = trim($parts[0]);
|
$itemCode = trim($parts[0]);
|
||||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||||
|
|
||||||
|
// dd($serialNumberRaw);
|
||||||
|
|
||||||
if ($serialNumberRaw != null) {
|
if ($serialNumberRaw != null) {
|
||||||
$serial = preg_replace('/\/.*/', '', $serialNumberRaw);
|
$serial = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||||
$serial = trim($serial);
|
$serial = trim($serial);
|
||||||
@@ -50,6 +61,7 @@ class ProductionStickerReprintController extends Controller
|
|||||||
|
|
||||||
$productionOrder = $production->production_order ?? '';
|
$productionOrder = $production->production_order ?? '';
|
||||||
|
|
||||||
|
if(!preg_match('/\//', $palletNo)){
|
||||||
if ($item->category == 'Submersible Motor')
|
if ($item->category == 'Submersible Motor')
|
||||||
{
|
{
|
||||||
$copies = 1;
|
$copies = 1;
|
||||||
@@ -58,6 +70,33 @@ class ProductionStickerReprintController extends Controller
|
|||||||
{
|
{
|
||||||
$copies = 2;
|
$copies = 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if ($item->category == 'Submersible Motor')
|
||||||
|
// {
|
||||||
|
// $copies = 1;
|
||||||
|
// }
|
||||||
|
// elseif ($item->category == 'Submersible Pump')
|
||||||
|
// {
|
||||||
|
// $copies = 1;
|
||||||
|
// }
|
||||||
|
$copies = 1;
|
||||||
|
|
||||||
|
if ($serialNumberRaw) {
|
||||||
|
// Check if serial ends with /m or /M, optionally followed by |
|
||||||
|
if (preg_match('/\/[mM](\|)?$/', $serialNumberRaw)) {
|
||||||
|
$copies = 1;
|
||||||
|
}
|
||||||
|
// Check if serial ends with /p or /P, optionally followed by |
|
||||||
|
elseif (preg_match('/\/[pP](\|)?$/', $serialNumberRaw)) {
|
||||||
|
$copies = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// $palletNo = preg_replace('/\/.*/', '', $palletNo);
|
||||||
|
|
||||||
// 5. Generate QR Code (base64)
|
// 5. Generate QR Code (base64)
|
||||||
$qrCode = new QrCode($palletNo);
|
$qrCode = new QrCode($palletNo);
|
||||||
$output = new Output\Png();
|
$output = new Output\Png();
|
||||||
@@ -73,6 +112,8 @@ class ProductionStickerReprintController extends Controller
|
|||||||
'copies'=> $copies,
|
'copies'=> $copies,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class CharacteristicValue extends Model
|
|||||||
'process_order',
|
'process_order',
|
||||||
'coil_number',
|
'coil_number',
|
||||||
'status',
|
'status',
|
||||||
|
'observed_value',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
'created_by',
|
'created_by',
|
||||||
|
|||||||
46
app/Models/InvoiceInTransit.php
Normal file
46
app/Models/InvoiceInTransit.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class InvoiceInTransit extends Model
|
||||||
|
{
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
"plant_id",
|
||||||
|
"receiving_plant",
|
||||||
|
"receiving_plant_name",
|
||||||
|
"invoice_number",
|
||||||
|
"invoice_date",
|
||||||
|
"item_code",
|
||||||
|
"description",
|
||||||
|
"quantity",
|
||||||
|
"transport_name",
|
||||||
|
"lr_bl_aw_number",
|
||||||
|
"lr_bl_aw_date",
|
||||||
|
"pending_days",
|
||||||
|
"obd_number",
|
||||||
|
"obd_date",
|
||||||
|
"shipment_weight",
|
||||||
|
"unit_price",
|
||||||
|
"net_value",
|
||||||
|
"total_item_amount",
|
||||||
|
"tax_amount",
|
||||||
|
"transport_mode",
|
||||||
|
"vehicle_number",
|
||||||
|
"e_waybill_number",
|
||||||
|
"created_at",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"updated_at"
|
||||||
|
];
|
||||||
|
|
||||||
|
public function plant(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Plant::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
app/Models/InvoiceMaster.php
Normal file
22
app/Models/InvoiceMaster.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class InvoiceMaster extends Model
|
||||||
|
{
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
"receiving_plant",
|
||||||
|
"receiving_plant_name",
|
||||||
|
"transit_days",
|
||||||
|
"transport_name",
|
||||||
|
"created_at",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"updated_at"
|
||||||
|
];
|
||||||
|
}
|
||||||
106
app/Policies/InvoiceInTransitPolicy.php
Normal file
106
app/Policies/InvoiceInTransitPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\InvoiceInTransit;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class InvoiceInTransitPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, InvoiceInTransit $invoiceintransit): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, InvoiceInTransit $invoiceintransit): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, InvoiceInTransit $invoiceintransit): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, InvoiceInTransit $invoiceintransit): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, InvoiceInTransit $invoiceintransit): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, InvoiceInTransit $invoiceintransit): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete InvoiceInTransit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any InvoiceInTransit');
|
||||||
|
}
|
||||||
|
}
|
||||||
106
app/Policies/InvoiceMasterPolicy.php
Normal file
106
app/Policies/InvoiceMasterPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\InvoiceMaster;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class InvoiceMasterPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, InvoiceMaster $invoicemaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, InvoiceMaster $invoicemaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, InvoiceMaster $invoicemaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, InvoiceMaster $invoicemaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, InvoiceMaster $invoicemaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, InvoiceMaster $invoicemaster): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete InvoiceMaster');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any InvoiceMaster');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
DB::statement(<<<SQL
|
||||||
|
ALTER TABLE characteristic_values
|
||||||
|
ADD COLUMN observed_value NUMERIC(10,3);
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('characteristic_values', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$sql = <<<'SQL'
|
||||||
|
CREATE TABLE invoice_in_transits (
|
||||||
|
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||||
|
plant_id BIGINT NOT NULL,
|
||||||
|
|
||||||
|
receiving_plant TEXT DEFAULT NULL,
|
||||||
|
receiving_plant_name TEXT DEFAULT NULL,
|
||||||
|
invoice_number TEXT DEFAULT NULL,
|
||||||
|
invoice_date TEXT DEFAULT NULL,
|
||||||
|
item_code TEXT DEFAULT NULL,
|
||||||
|
description TEXT DEFAULT NULL,
|
||||||
|
quantity NUMERIC(10,3) DEFAULT NULL,
|
||||||
|
transport_name TEXT DEFAULT NULL,
|
||||||
|
lr_bl_aw_number TEXT DEFAULT NULL,
|
||||||
|
lr_bl_aw_date TEXT DEFAULT NULL,
|
||||||
|
pending_days TEXT DEFAULT NULL,
|
||||||
|
obd_number TEXT DEFAULT NULL,
|
||||||
|
obd_date TEXT DEFAULT NULL,
|
||||||
|
shipment_weight TEXT DEFAULT NULL,
|
||||||
|
unit_price TEXT DEFAULT NULL,
|
||||||
|
net_value TEXT DEFAULT NULL,
|
||||||
|
total_item_amount TEXT DEFAULT NULL,
|
||||||
|
tax_amount TEXT DEFAULT NULL,
|
||||||
|
transport_mode TEXT DEFAULT NULL,
|
||||||
|
vehicle_number TEXT DEFAULT NULL,
|
||||||
|
e_waybill_number TEXT DEFAULT NULL,
|
||||||
|
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
created_by TEXT DEFAULT NULL,
|
||||||
|
updated_by TEXT DEFAULT NULL,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||||
|
);
|
||||||
|
SQL;
|
||||||
|
DB::statement($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('invoice_in_transits');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$sql = <<<'SQL'
|
||||||
|
CREATE TABLE invoice_masters (
|
||||||
|
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||||
|
|
||||||
|
receiving_plant TEXT DEFAULT NULL,
|
||||||
|
receiving_plant_name TEXT DEFAULT NULL,
|
||||||
|
transit_days TEXT DEFAULT NULL,
|
||||||
|
transport_name TEXT DEFAULT NULL,
|
||||||
|
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
created_by TEXT DEFAULT NULL,
|
||||||
|
updated_by TEXT DEFAULT NULL,
|
||||||
|
deleted_at TIMESTAMP
|
||||||
|
);
|
||||||
|
SQL;
|
||||||
|
DB::statement($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('invoice_masters');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Hash;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class UserSeeder extends Seeder
|
class UserSeeder extends Seeder
|
||||||
@@ -17,20 +16,20 @@ class UserSeeder extends Seeder
|
|||||||
['email' => 'dhanabalan.saravanan@cripumps.com'],
|
['email' => 'dhanabalan.saravanan@cripumps.com'],
|
||||||
[
|
[
|
||||||
'name' => 'Dhanabalan S',
|
'name' => 'Dhanabalan S',
|
||||||
'password' => bcrypt('SdHaNa@123'),
|
'password' => bcrypt('SdHaNa$1997'),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
'created_at' => now()
|
'created_at' => now(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$user1->assignRole('Super Admin');
|
$user1->assignRole('Super Admin');
|
||||||
|
|
||||||
$user2 = User::updateOrCreate(
|
$user2 = User::updateOrCreate(
|
||||||
['email' => 'ranjith@cripumps.com'],
|
['email' => 'ranjith.bala@cripumps.com'],
|
||||||
[
|
[
|
||||||
'name' => 'Ranjith B',
|
'name' => 'Ranjith B',
|
||||||
'password' => bcrypt('Ranjii@5503'),
|
'password' => bcrypt('Ranjii$5503'),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
'created_at' => now()
|
'created_at' => now(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$user2->assignRole('Super Admin');
|
$user2->assignRole('Super Admin');
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'dow
|
|||||||
|
|
||||||
// Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
|
// Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
|
||||||
|
|
||||||
Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf');
|
//Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->where('palletNo', '.*')->name('download-qr1-pdf');
|
||||||
|
Route::get('/download-qr1-pdf', [ProductionStickerReprintController::class, 'downloadQrPdf'])
|
||||||
|
->name('download-qr1-pdf');
|
||||||
|
|
||||||
// Production Dashboard Controller
|
// Production Dashboard Controller
|
||||||
|
|
||||||
@@ -159,23 +161,23 @@ Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_m
|
|||||||
|
|
||||||
Route::post('laser/route/data', [CharacteristicsController::class, 'test']); // ->withoutMiddleware(VerifyCsrfToken::class)
|
Route::post('laser/route/data', [CharacteristicsController::class, 'test']); // ->withoutMiddleware(VerifyCsrfToken::class)
|
||||||
|
|
||||||
// //..Part Validation - Characteristics
|
// ..Part Validation - Characteristics
|
||||||
|
|
||||||
// // Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
// Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
||||||
|
|
||||||
// // //..Serial or job
|
// ..Serial or job
|
||||||
|
|
||||||
// // Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
// Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
||||||
|
|
||||||
// // Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
// Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
||||||
|
|
||||||
// // //..Job or Master - Characteristics
|
// ..Job or Master - Characteristics
|
||||||
|
|
||||||
// // Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
// Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||||
|
|
||||||
// // //..serial auto or manual
|
// ..serial auto or manual
|
||||||
|
|
||||||
// // Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
// Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||||
|
|
||||||
// ..Product Characteristics
|
// ..Product Characteristics
|
||||||
|
|
||||||
|
|||||||
@@ -9,14 +9,9 @@ Artisan::command('inspire', function () {
|
|||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
|
|
||||||
Artisan::command('auto:scheduler', function () {
|
Artisan::command('auto:scheduler', function () {
|
||||||
$this->call('custom:scheduler');
|
$this->call('custom:scheduler');
|
||||||
})->everyMinute();
|
})->everyMinute()->withoutOverlapping();
|
||||||
|
|
||||||
|
|
||||||
// Schedule::command('send:invoice-report');
|
|
||||||
// Schedule::command('send:production-report');
|
|
||||||
|
|
||||||
// app()->booted(function () {
|
// app()->booted(function () {
|
||||||
// $schedule = app(Schedule::class);
|
// $schedule = app(Schedule::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user