@php $invoiceRawCurrency = $invoice->invoice->getRawOriginal('currency'); @endphp @if ($invoicePayment->id) {!! Form::model($invoicePayment, ['route' => ['admin.finances.payments.update', $invoicePayment, 'event' => isset($event) ? $event : request()->event, 'table_id' => @$table_id], 'method' => 'PUT']) !!} @else {!! Form::model($invoicePayment, ['route' => ['admin.finances.payments.store', 'event' => isset($event) ? $event : '', 'table_id' => @$table_id], 'method' => 'POST']) !!} @endif
{{-- @if(!$invoicePayment->id) --}} {{-- Company --}}
{{ Form::label('company_id', __('Client'), ['class' => 'col-form-label']) }} {!! Form::select('company_id', $companies ?? [], $selectedCompany ?? null, [ 'data-placeholder' => __('Select Client'), 'class' => 'form-select globalOfSelect2Remote dependent-select', 'data-url' => route('resource-select', ['groupedCompany', 'hasinv']), 'id' => 'payment-company-id', 'disabled' => isset($invoiceId) ])!!}
{{-- Contract --}}
{{ Form::label('contract_id', __('Contract'), ['class' => 'col-form-label']) }} {!! Form::select('contract_id', $contracts ?? [], $selectedContract ?? null, [ 'data-placeholder' => __('Select Contract'), 'class' => 'form-select globalOfSelect2Remote dependent-select', 'data-url' => route('resource-select', ['Contract', 'dependent' => 'company_id']), 'data-dependent_id' => 'payment-company-id', 'id' => 'payment-contract-id', 'disabled' => isset($invoiceId) ])!!}
{{-- invoice type --}}
{{ Form::label('invoice_type', __('Invoice Type'), ['class' => 'col-form-label']) }} {!! Form::select('invoice_type', ['Invoice' => 'Customer', 'AuthorityInvoice' => 'Tax Authority'], $invoice_type ?? null, [ 'class' => 'form-select globalOfSelect2 dependent-select', 'disabled' => isset($invoiceId), 'id' => 'payment-invoice-type', ]) !!}
{{-- invoice --}}
{{ Form::label('invoice_id', __('Invoice'), ['class' => 'col-form-label']) }} {!! Form::select('invoice_id', $invoiceId ?? [], $invoicePayment->payable->uuid ?? null, [ 'disabled' => $invoicePayment->id ? true : false, 'data-placeholder' => 'Select Invoice', 'data-allow-clear' => 'true', 'class' => 'form-select globalOfSelect2Remote', 'data-url' => route('resource-select', ['InvoiceOrAuthorityInvoice', 'dependent' => 'contract_id', 'notvoid' => '1']), 'data-dependent_id' => 'payment-contract-id', 'data-dependent_2' => 'payment-invoice-type', 'disabled' => isset($invoiceId), 'id' => 'payment-invoice-id', ])!!}
{{-- Unpaid Amount --}}
{{ Form::label('unpaid_amount', __('Total Balance'), ['class' => 'col-form-label']) }} {!! Form::number('unpaid_amount', isset($invoice) ? ($invoice->total - $invoice->paid_amount + ($invoicePayment->amount/($invoicePayment->conversion_rate ? $invoicePayment->conversion_rate : 1))) : null, ['class' => 'form-control', 'placeholder' => __('0.0'), 'disabled']) !!}
{{-- retentions amount --}}
{{ Form::label('retention_amount', __('Retention Amount'), ['class' => 'col-form-label']) }} {!! Form::number('retention_amount', null, ['class' => 'form-control', 'placeholder' => __('0.0'), 'disabled']) !!}
{{-- payable amoun --}}
{{ Form::label('payable_amount', __('Payable Amount'), ['class' => 'col-form-label']) }} {!! Form::number('payable_amount', isset($invoice) ? ($invoice->payableAmount() + ($invoicePayment->amount/($invoicePayment->conversion_rate ? $invoicePayment->conversion_rate : 1))) : null, ['class' => 'form-control', 'placeholder' => __('0.0'), 'disabled']) !!}
@if(($invoicePayableWht = ($invoice->payableWHT() + ($invoicePayment->type == 2 ? ($invoicePayment->amount/($invoicePayment->conversion_rate ? $invoicePayment->conversion_rate : 1)) : 0))) > 0) {{-- payable withholding tax --}}
{{ Form::label('payable_wht', __('Payable Withholding Tax'), ['class' => 'col-form-label']) }} {!! Form::number('payable_wht', $invoicePayableWht, ['class' => 'form-control', 'placeholder' => __('0.0'), 'disabled']) !!}
@endif @if(($invoicePayableRC = ($invoice->payableRC() + ($invoicePayment->type == 3 ? ($invoicePayment->amount/($invoicePayment->conversion_rate ? $invoicePayment->conversion_rate : 1)) : 0))) > 0) {{-- payable reverse charge --}}
{{ Form::label('payable_rc', __('Payable Reverse Charge'), ['class' => 'col-form-label']) }} {!! Form::number('payable_rc', $invoicePayableRC, ['class' => 'form-control', 'placeholder' => __('0.0'), 'disabled']) !!}
@endif {{-- @endif --}} {{-- Payment Type --}}
{{ Form::label('payment_type', __('Payment Type'), ['class' => 'col-form-label']) }} {!! Form::select('payment_type', ['wht' => 'Withholding Tax', 'rc' => 'Reverse Charge'], $invoicePayment->type == 2 ? 'wht' : 'rc', [ 'class' => 'form-select globalOfSelect2', 'id' => 'invoice-payment-type' ]) !!}
{{-- Account --}}
{{ Form::label('account_balance_id', __('Account'), ['class' => 'col-form-label']) }} {!! Form::select('account_balance_id', $selectedAccountBalance ?? [], @$invoicePayment->accountTransaction->account_balance_id ?? @array_keys($selectedAccountBalance ?? [])[0], [ 'class' => 'form-select globalOfSelect2Remote', 'data-url' => route('resource-select', ['AccountBalance', 'dependent' => 'invoice_id', 'dependent_2_col' => 'inv-type', 'dependent_3_col' => 'pay-type', 'mainInvoice' => $invoice->invoice->type]), 'data-dependent_id' => 'payment-invoice-id', 'data-dependent_2' => 'payment-invoice-type', 'data-dependent_3' => 'invoice-payment-type', 'data-placeholder' => __('Select Account'), 'data-allow-clear' => 'true' ]) !!}
{{-- vat_paid_amount --}}
{{ Form::label('vat_paid_amount', __('VAT Amount'), ['class' => 'col-form-label']) }} {!! Form::number('vat_paid_amount', null, ['class' => 'form-control', 'placeholder' => __('0.0')]) !!}
{{-- excluding_vat_paid_amount --}}
{{ Form::label('excluding_vat_paid_amount', __('Excluding VAT Amount'), ['class' => 'col-form-label']) }} {!! Form::number('excluding_vat_paid_amount', null, ['class' => 'form-control', 'placeholder' => __('0.0')]) !!}
{{-- conversion rate --}}
@if($invoice->invoice->isForeignCurrency() && ($used_conversion_rates = $invoice->payments->pluck('conversion_rate'))->count() > 0) @endif
1 {{ $invoice->invoice->getRawOriginal('currency') }} = {!! Form::number('conversion_rate', floatval($invoicePayment->conversion_rate), ['class' => 'form-control']) !!} {{ cCurrency()->getSymbol() }}
{{-- Currency --}}
{{ Form::label('currency', __('Currency'), ['class' => 'col-form-label']) }} {!! Form::select('currency', [cCurrency()->getSymbol() => cCurrency()->getSymbol(), $invoiceRawCurrency => $invoiceRawCurrency], $invoiceRawCurrency, [ 'class' => 'form-select', 'data-kt-select2' => 'true' ], [ cCurrency()->getSymbol() => ['data-is-base' => '1', 'data-symbol' => cCurrency()->getSymbol()], $invoiceRawCurrency => ['data-is-base' => '0', 'data-symbol' => $invoiceRawCurrency], ]) !!}
{{-- Amount --}}
{{ Form::label('amount', __('Amount'), ['class' => 'col-form-label']) }}
{!! Form::number('amount', $invoicePayment->amount/($invoicePayment->conversion_rate ? $invoicePayment->conversion_rate : 1), ['class' => 'form-control', 'placeholder' => __('0.0')]) !!} {{ $invoiceRawCurrency }}
{{-- Transaction Id --}}
{{ Form::label('transaction_id', __('Transaction Id'), ['class' => 'col-form-label']) }} {!! Form::text('transaction_id', null, ['class' => 'form-control', 'placeholder' => __('Transaction Id')]) !!}
{{-- payment date --}}
{{ Form::label('payment_date', __('Payment Date'), ['class' => 'col-form-label']) }} {!! Form::date('payment_date', $paymentDate ?? $invoicePayment->payment_date, ['class' => 'form-control flatpickr', 'placeholder' => __('Payment Date')]) !!}
{{-- Note --}}
{{ Form::label('note', __('Note'), ['class' => 'col-form-label']) }} {!! Form::textarea('note', null, ['class' => 'form-control', 'rows' => 4, 'placeholder' => __('Note')]) !!}
{!! Form::close() !!}