Added invoice in transit exporter #134
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user