close #2923 Enhancement: Missing document item description import/export excel

This commit is contained in:
Cüneyt Şentürk 2023-03-09 16:45:20 +03:00
parent a1da29d908
commit dfda25562a
5 changed files with 10 additions and 2 deletions

View File

@ -22,6 +22,7 @@ class BillItems extends Export
$model->bill_number = $document->document_number;
$model->item_name = $model->item->name;
$model->item_description = $model->item->description;
$model->item_type = $model->item->type;
return parent::map($model);
@ -32,7 +33,7 @@ class BillItems extends Export
return [
'bill_number',
'item_name',
'item_type',
'item_description',
'quantity',
'price',
'total',

View File

@ -22,6 +22,7 @@ class InvoiceItems extends Export
$model->invoice_number = $document->document_number;
$model->item_name = $model->item->name;
$model->item_description = $model->item->description;
$model->item_type = $model->item->type;
return parent::map($model);
@ -32,6 +33,7 @@ class InvoiceItems extends Export
return [
'invoice_number',
'item_name',
'item_description',
'item_type',
'quantity',
'price',

View File

@ -34,6 +34,8 @@ class BillItems extends Import
$row['name'] = $row['item_name'];
}
$row['description'] = !empty($row['item_description']) ? $row['item_description'] : '';
$row['tax'] = (double) $row['tax'];
$row['tax_id'] = 0;
$row['type'] = Document::BILL_TYPE;

View File

@ -28,12 +28,14 @@ class InvoiceItems extends Import
$row['document_id'] = (int) Document::invoice()->number($row['invoice_number'])->pluck('id')->first();
if (empty($row['item_id']) && !empty($row['item_name'])) {
if (empty($row['item_id']) && ! empty($row['item_name'])) {
$row['item_id'] = $this->getItemIdFromName($row);
$row['name'] = $row['item_name'];
}
$row['description'] = !empty($row['item_description']) ? $row['item_description'] : '';
$row['tax'] = (double) $row['tax'];
$row['tax_id'] = 0;
$row['type'] = Document::INVOICE_TYPE;

View File

@ -332,6 +332,7 @@ trait Import
'company_id' => company_id(),
'type' => $row['item_type'],
'name' => $row['item_name'],
'description' => !empty($row['item_description']) ? $row['item_description'] : null,
'sale_price' => !empty($row['sale_price']) ? $row['sale_price'] : (!empty($row['price']) ? $row['price'] : 0),
'purchase_price' => !empty($row['purchase_price']) ? $row['purchase_price'] : (!empty($row['price']) ? $row['price'] : 0),
'enabled' => 1,