Improvements for activity exports
This commit is contained in:
parent
3175a3e636
commit
aea9aa1da3
|
|
@ -16,8 +16,6 @@ use App\Libraries\MultiDB;
|
|||
use App\Models\Activity;
|
||||
use App\Models\Company;
|
||||
use App\Models\DateFormat;
|
||||
use App\Models\Task;
|
||||
use App\Transformers\ActivityTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
|
@ -36,6 +34,7 @@ class ActivityExport extends BaseExport
|
|||
'date' => 'date',
|
||||
'activity' => 'activity',
|
||||
'address' => 'address',
|
||||
'notes' => 'notes',
|
||||
];
|
||||
|
||||
public function __construct(Company $company, array $input)
|
||||
|
|
@ -72,7 +71,7 @@ class ActivityExport extends BaseExport
|
|||
Carbon::parse($activity->created_at)->format($this->date_format),
|
||||
ctrans("texts.activity_{$activity->activity_type_id}", [
|
||||
'payment_amount' => $activity->payment ? $activity->payment->amount : '',
|
||||
'adjustment' => $activity->payment ? $activity->payment->refunded : '',
|
||||
'adjustment' => $activity->getPaymentAdjustment($activity->payment),
|
||||
'client' => $activity->client ? $activity->client->present()->name() : '',
|
||||
'contact' => $activity->contact ? $activity->contact->present()->name() : '',
|
||||
'quote' => $activity->quote ? $activity->quote->number : '',
|
||||
|
|
@ -90,6 +89,7 @@ class ActivityExport extends BaseExport
|
|||
'recurring_expense' => $activity->recurring_expense ? $activity->recurring_expense->number : '',
|
||||
]),
|
||||
$activity->ip,
|
||||
$activity->notes,
|
||||
];
|
||||
|
||||
}
|
||||
|
|
@ -116,6 +116,10 @@ class ActivityExport extends BaseExport
|
|||
|
||||
$query = $this->addDateRange($query, 'activities');
|
||||
|
||||
if ($this->input['activity_type_id'] ?? false) {
|
||||
$query->where('activity_type_id', $this->input['activity_type_id']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ class Activity extends StaticModel
|
|||
return $translation;
|
||||
}
|
||||
|
||||
private function getPaymentAdjustment(?\App\Models\Payment $payment): string
|
||||
public function getPaymentAdjustment(?\App\Models\Payment $payment): string
|
||||
{
|
||||
if(!$payment)
|
||||
return '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue