diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 6c461f1ec7c3..fa5e777e500e 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -109,14 +109,14 @@ class Invoice extends EntityModel implements BalanceAffecting 'po_number', 'invoice_date', 'due_date', - 'amount', 'paid', - 'notes', 'terms', - 'product', - 'quantity', - 'tax1', - 'tax2', + 'item_product', + 'item_notes', + 'item_quantity', + 'item_cost', + 'item_tax1', + 'item_tax2', ]; } @@ -127,17 +127,17 @@ class Invoice extends EntityModel implements BalanceAffecting { return [ 'number^po' => 'invoice_number', - 'amount' => 'amount', 'client|organization' => 'name', 'paid^date' => 'paid', 'invoice date|create date' => 'invoice_date', 'po number' => 'po_number', 'due date' => 'due_date', 'terms' => 'terms', - 'notes' => 'notes', - 'product|item' => 'product', - 'quantity|qty' => 'quantity', - 'tax' => 'tax1', + 'product|item' => 'item_product', + 'notes' => 'item_notes', + 'quantity|qty' => 'item_quantity', + 'amount|cost' => 'item_cost', + 'tax' => 'item_tax1', ]; } diff --git a/app/Ninja/Import/CSV/InvoiceTransformer.php b/app/Ninja/Import/CSV/InvoiceTransformer.php index 6d8f2e414888..da9f2d87a652 100644 --- a/app/Ninja/Import/CSV/InvoiceTransformer.php +++ b/app/Ninja/Import/CSV/InvoiceTransformer.php @@ -37,14 +37,14 @@ class InvoiceTransformer extends BaseTransformer 'due_date_sql' => $this->getDate($data, 'due_date'), 'invoice_items' => [ [ - 'product_key' => $this->getString($data, 'product'), - 'notes' => $this->getString($data, 'notes') ?: $this->getProduct($data, 'product', 'notes', ''), - 'cost' => $this->getFloat($data, 'amount') ?: $this->getProduct($data, 'product', 'cost', 0), - 'qty' => $this->getFloat($data, 'quantity') ?: 1, - 'tax_name1' => $this->getTaxName($this->getString($data, 'tax1')), - 'tax_rate1' => $this->getTaxRate($this->getString($data, 'tax1')), - 'tax_name2' => $this->getTaxName($this->getString($data, 'tax2')), - 'tax_rate2' => $this->getTaxRate($this->getString($data, 'tax2')), + 'product_key' => $this->getString($data, 'item_product'), + 'notes' => $this->getString($data, 'item_notes') ?: $this->getProduct($data, 'item_product', 'notes', ''), + 'cost' => $this->getFloat($data, 'item_notes') ?: $this->getProduct($data, 'item_product', 'cost', 0), + 'qty' => $this->getFloat($data, 'item_quantity') ?: 1, + 'tax_name1' => $this->getTaxName($this->getString($data, 'item_tax1')), + 'tax_rate1' => $this->getTaxRate($this->getString($data, 'item_tax1')), + 'tax_name2' => $this->getTaxName($this->getString($data, 'item_tax2')), + 'tax_rate2' => $this->getTaxRate($this->getString($data, 'item_tax2')), ], ], ]; diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index 0e299e123134..53433b7ee72c 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -632,8 +632,6 @@ class ImportService private function getCsvData($fileName) { - require_once app_path().'/Includes/parsecsv.lib.php'; - $this->checkForFile($fileName); $data = array_map('str_getcsv', file($fileName)); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index e9d27ce5a9cd..7cfa98a1797b 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2405,6 +2405,13 @@ $LANG = array( 'currency' => 'Currency', 'ofx_help' => 'In most cases the default values should work, if you\'re unable to connect it may help to adjust the settings.', + 'item_product' => 'Item Product', + 'item_notes' => 'Item Notes', + 'item_cost' => 'Item Cost', + 'item_quantity' => 'Item Quantity', + 'item_tax_rate' => 'Item Tax Rate', + 'item_tax_name' => 'Item Tax Name', + ); return $LANG; diff --git a/resources/views/export/invoices.blade.php b/resources/views/export/invoices.blade.php index 0f3436629669..65a417036e94 100644 --- a/resources/views/export/invoices.blade.php +++ b/resources/views/export/invoices.blade.php @@ -25,7 +25,24 @@ @if ($account->custom_invoice_text_label2) {{ $account->custom_invoice_text_label2 }} @endif - {{ trans('texts.product') }} + {{ trans('texts.item_product') }} + {{ trans('texts.item_notes') }} + @if ($account->custom_invoice_item_label1) + {{ $account->custom_invoice_item_label1 }} + @endif + @if ($account->custom_invoice_item_label2) + {{ $account->custom_invoice_item_label2 }} + @endif + {{ trans('texts.item_cost') }} + {{ trans('texts.item_quantity') }} + @if ($account->invoice_item_taxes) + {{ trans('texts.item_tax_name') }} + {{ trans('texts.item_tax_rate') }} + @if ($account->enable_second_tax_rate) + {{ trans('texts.item_tax_name') }} + {{ trans('texts.item_tax_rate') }} + @endif + @endif @foreach ($invoices as $invoice) @@ -58,6 +75,24 @@ @if ($account->custom_invoice_label2) {{ $invoice->custom_text_value2 }} @endif + {{ $item->product_key }} + {{ $item->notes }} + @if ($account->custom_invoice_item_label1) + {{ $item->custom_value1 }} + @endif + @if ($account->custom_invoice_item_label2) + {{ $item->custom_value2 }} + @endif + {{ $item->cost }} + {{ $item->qty }} + @if ($account->invoice_item_taxes) + {{ $item->tax_name1 }} + {{ $item->tax_rate1 }} + @if ($account->enable_second_tax_rate) + {{ $item->tax_name2 }} + {{ $item->tax_rate2 }} + @endif + @endif @endforeach @endif