Notes
Notes - notes.io |
namespace AppExports;
use IlluminateSupportCollection;
use MaatwebsiteExcelConcernsFromCollection;
use MaatwebsiteExcelConcernsWithHeadings;
use MaatwebsiteExcelConcernsWithMapping;
use MaatwebsiteExcelConcernsShouldAutoSize;
use MaatwebsiteExcelConcernsWithChunkReading;
class SpectrumInventoryExport implements
FromCollection,
WithHeadings,
WithMapping,
ShouldAutoSize,
WithChunkReading
{
protected Collection $data;
public function __construct(array $resultArray)
{
// Reindex array (VERY IMPORTANT for Excel)
$this->data = collect(array_values($resultArray));
}
/**
* Source data
*/
public function collection(): Collection
{
return $this->data;
}
/**
* Excel column headings (EXACT, CLEAN, PROFESSIONAL)
*/
public function headings(): array
{
return [
'Company Code',
'Item Code',
'Item Description',
'Item Category',
'Phase Code',
'Cost Type',
'Default Cost Category',
'ABC Class',
'EDP Part Number',
'Vendor Part Number',
'Primary Vendor',
'Alternate Vendor',
'Purchase Unit Of Measure',
'Sell Unit Of Measure',
'Unit Of Measure Conversion',
'Unit Weight',
'Standard Cost',
'Price List 1',
'Price List 2',
'Price List 3',
'Price List 4',
'Price List 5',
'Price Per Factor',
'Markup Price',
'Status Discontinue Flag',
'Date Discontinued',
];
}
/**
* Row mapping (NULL SAFE, TYPE SAFE)
*/
public function map($row): array
{
return [
$row['Company_Code'] ?? '',
$row['Item_Code'] ?? '',
$row['Item_Description'] ?? '',
$row['Item_Category'] ?? '',
$row['Phase_Code'] ?? '',
$row['Cost_Type'] ?? '',
$row['Default_Cost_Category'] ?? '',
$row['ABC_Class'] ?? '',
$row['EDP_Part_Number'] ?? '',
$row['Vendor_Part_Number'] ?? '',
$row['Primary_Vendor'] ?? '',
$row['Alternate_Vendor'] ?? '',
$row['Purchase_Unit_Of_Measure1'] ?? '',
$row['Sell_Unit_Of_Measure2'] ?? '',
(float) ($row['Unit_Of_Measure_Conversion'] ?? 0),
(float) ($row['Unit_Weight'] ?? 0),
(float) ($row['Standard_Cost'] ?? 0),
(float) ($row['Price_List1'] ?? 0),
(float) ($row['Price_List2'] ?? 0),
(float) ($row['Price_List3'] ?? 0),
(float) ($row['Price_List4'] ?? 0),
(float) ($row['Price_List5'] ?? 0),
(float) ($row['Price_Per_Factor'] ?? 0),
(float) ($row['Markup_Price'] ?? 0),
$row['Status_Discontinue_Flag'] ?? '',
!empty($row['Date_Discontinued'])
? date('Y-m-d', strtotime($row['Date_Discontinued']))
: '',
];
}
/**
* Chunk size for large Spectrum data
*/
public function chunkSize(): int
{
return 1000;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
