Fixed document transaction create missing document totals issue solved..
This commit is contained in:
parent
2d825b24f1
commit
ab2325d43c
|
|
@ -55,12 +55,12 @@ class DocumentTransactions extends Controller
|
|||
$document->{$document_total->code} = $document_total->amount;
|
||||
}
|
||||
|
||||
$total = money($document->total, $currency->code)->format();
|
||||
$total = money($document?->total ?? 0, $currency->code)->format();
|
||||
|
||||
$document->grand_total = money($total, $currency->code, false)->getAmount();
|
||||
|
||||
if (! empty($paid)) {
|
||||
$document->grand_total = round($document->total - $paid, $currency->precision);
|
||||
$document->grand_total = round($document?->total ?? 0 - $paid, $currency->precision);
|
||||
}
|
||||
|
||||
$amount = $document->grand_total;
|
||||
|
|
@ -163,12 +163,12 @@ class DocumentTransactions extends Controller
|
|||
$document->{$document_total->code} = $document_total->amount;
|
||||
}
|
||||
|
||||
$total = money($document->total, $currency->code)->format();
|
||||
$total = money($document?->total ?? 0, $currency->code)->format();
|
||||
|
||||
$document->grand_total = money($total, $currency->code, false)->getAmount();
|
||||
|
||||
if (! empty($paid)) {
|
||||
$document->grand_total = round($document->total - $paid, $currency->precision);
|
||||
$document->grand_total = round($document?->total ?? 0 - $paid, $currency->precision);
|
||||
}
|
||||
|
||||
$document->paid_at = $transaction->paid_at;
|
||||
|
|
|
|||
|
|
@ -94,16 +94,26 @@
|
|||
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
@if ($document->totals->count())
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
@else
|
||||
<x-tooltip message="{{ trans('invoices.messages.totals_required', ['type' => $type]) }}" placement="top">
|
||||
<x-button disabled="disabled" id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}" class="text-purple mt-1" override="class">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
</x-tooltip>
|
||||
@endif
|
||||
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
|
|
|
|||
|
|
@ -77,16 +77,26 @@
|
|||
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
@if ($document->totals->count())
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
@else
|
||||
<x-tooltip message="{{ trans('invoices.messages.totals_required', ['type' => $type]) }}" placement="top">
|
||||
<x-button disabled="disabled" id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}" class="text-purple mt-1" override="class">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
</x-tooltip>
|
||||
@endif
|
||||
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue