close #2923 Enhancement: Missing document item description import/export excel
This commit is contained in:
		@@ -22,6 +22,7 @@ class BillItems extends Export
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $model->bill_number = $document->document_number;
 | 
					        $model->bill_number = $document->document_number;
 | 
				
			||||||
        $model->item_name = $model->item->name;
 | 
					        $model->item_name = $model->item->name;
 | 
				
			||||||
 | 
					        $model->item_description = $model->item->description;
 | 
				
			||||||
        $model->item_type = $model->item->type;
 | 
					        $model->item_type = $model->item->type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return parent::map($model);
 | 
					        return parent::map($model);
 | 
				
			||||||
@@ -32,7 +33,7 @@ class BillItems extends Export
 | 
				
			|||||||
        return [
 | 
					        return [
 | 
				
			||||||
            'bill_number',
 | 
					            'bill_number',
 | 
				
			||||||
            'item_name',
 | 
					            'item_name',
 | 
				
			||||||
            'item_type',
 | 
					            'item_description',
 | 
				
			||||||
            'quantity',
 | 
					            'quantity',
 | 
				
			||||||
            'price',
 | 
					            'price',
 | 
				
			||||||
            'total',
 | 
					            'total',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ class InvoiceItems extends Export
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $model->invoice_number = $document->document_number;
 | 
					        $model->invoice_number = $document->document_number;
 | 
				
			||||||
        $model->item_name = $model->item->name;
 | 
					        $model->item_name = $model->item->name;
 | 
				
			||||||
 | 
					        $model->item_description = $model->item->description;
 | 
				
			||||||
        $model->item_type = $model->item->type;
 | 
					        $model->item_type = $model->item->type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return parent::map($model);
 | 
					        return parent::map($model);
 | 
				
			||||||
@@ -32,6 +33,7 @@ class InvoiceItems extends Export
 | 
				
			|||||||
        return [
 | 
					        return [
 | 
				
			||||||
            'invoice_number',
 | 
					            'invoice_number',
 | 
				
			||||||
            'item_name',
 | 
					            'item_name',
 | 
				
			||||||
 | 
					            'item_description',
 | 
				
			||||||
            'item_type',
 | 
					            'item_type',
 | 
				
			||||||
            'quantity',
 | 
					            'quantity',
 | 
				
			||||||
            'price',
 | 
					            'price',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,8 @@ class BillItems extends Import
 | 
				
			|||||||
            $row['name'] = $row['item_name'];
 | 
					            $row['name'] = $row['item_name'];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $row['description'] = !empty($row['item_description']) ? $row['item_description'] : '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $row['tax'] = (double) $row['tax'];
 | 
					        $row['tax'] = (double) $row['tax'];
 | 
				
			||||||
        $row['tax_id'] = 0;
 | 
					        $row['tax_id'] = 0;
 | 
				
			||||||
        $row['type'] = Document::BILL_TYPE;
 | 
					        $row['type'] = Document::BILL_TYPE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,12 +28,14 @@ class InvoiceItems extends Import
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $row['document_id'] = (int) Document::invoice()->number($row['invoice_number'])->pluck('id')->first();
 | 
					        $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['item_id'] = $this->getItemIdFromName($row);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $row['name'] = $row['item_name'];
 | 
					            $row['name'] = $row['item_name'];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $row['description'] = !empty($row['item_description']) ? $row['item_description'] : '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $row['tax'] = (double) $row['tax'];
 | 
					        $row['tax'] = (double) $row['tax'];
 | 
				
			||||||
        $row['tax_id'] = 0;
 | 
					        $row['tax_id'] = 0;
 | 
				
			||||||
        $row['type'] = Document::INVOICE_TYPE;
 | 
					        $row['type'] = Document::INVOICE_TYPE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -332,6 +332,7 @@ trait Import
 | 
				
			|||||||
            'company_id'        => company_id(),
 | 
					            'company_id'        => company_id(),
 | 
				
			||||||
            'type'              => $row['item_type'],
 | 
					            'type'              => $row['item_type'],
 | 
				
			||||||
            'name'              => $row['item_name'],
 | 
					            '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),
 | 
					            '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),
 | 
					            'purchase_price'    => !empty($row['purchase_price']) ? $row['purchase_price'] : (!empty($row['price']) ? $row['price'] : 0),
 | 
				
			||||||
            'enabled'           => 1,
 | 
					            'enabled'           => 1,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user