improved document import
This commit is contained in:
		@@ -11,7 +11,7 @@ class Transactions extends Export implements WithColumnFormatting
 | 
			
		||||
{
 | 
			
		||||
    public function collection()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::with('account', 'bill', 'category', 'contact', 'invoice')->usingSearchString(request('search'));
 | 
			
		||||
        $model = Model::with('account', 'category', 'contact', 'document')->usingSearchString(request('search'));
 | 
			
		||||
 | 
			
		||||
        if (!empty($this->ids)) {
 | 
			
		||||
            $model->whereIn('id', (array) $this->ids);
 | 
			
		||||
@@ -25,12 +25,7 @@ class Transactions extends Export implements WithColumnFormatting
 | 
			
		||||
        $model->account_name = $model->account->name;
 | 
			
		||||
        $model->contact_email = $model->contact->email;
 | 
			
		||||
        $model->category_name = $model->category->name;
 | 
			
		||||
 | 
			
		||||
        if ($model->type == 'income') {
 | 
			
		||||
            $model->invoice_bill_number = $model->invoice->document_number ?? 0;
 | 
			
		||||
        } else {
 | 
			
		||||
            $model->invoice_bill_number = $model->bill->document_number ?? 0;
 | 
			
		||||
        }
 | 
			
		||||
        $model->invoice_bill_number = $model->document->document_number ?? 0;
 | 
			
		||||
 | 
			
		||||
        return parent::map($model);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user