{!! Form::open(['url' => action([\App\Http\Controllers\TransactionPaymentController::class, 'postPayContactDue']), 'method' => 'post', 'id' => 'pay_contact_due_form', 'files' => true ]) !!} {!! Form::hidden("contact_id", $contact_details->contact_id); !!} {!! Form::hidden("due_payment_type", $due_payment_type); !!}

@lang( 'purchase.add_payment' )

@if($due_payment_type == 'purchase')
@lang('purchase.supplier'): {{ $contact_details->name }}
@lang('business.business'): {{ $contact_details->supplier_business_name }}

@lang('report.total_purchase'): {{ $contact_details->total_purchase }}
@lang('contact.total_paid'): {{ $contact_details->total_paid }}
@lang('contact.total_purchase_due'): {{ $contact_details->total_purchase - $contact_details->total_paid }}
@if(!empty($contact_details->opening_balance) || $contact_details->opening_balance != '0.00') @lang('lang_v1.opening_balance'): {{ $contact_details->opening_balance }}
@lang('lang_v1.opening_balance_due'): {{ $ob_due }} @endif
@elseif($due_payment_type == 'purchase_return')
@lang('purchase.supplier'): {{ $contact_details->name }}
@lang('business.business'): {{ $contact_details->supplier_business_name }}

@lang('lang_v1.total_purchase_return'): {{ $contact_details->total_purchase_return }}
@lang('lang_v1.total_purchase_return_paid'): {{ $contact_details->total_return_paid }}
@lang('lang_v1.total_purchase_return_due'): {{ $contact_details->total_purchase_return - $contact_details->total_return_paid }}
@elseif(in_array($due_payment_type, ['sell']))
@lang('sale.customer_name'): {{ $contact_details->name }}


@lang('report.total_sell'): {{ $contact_details->total_invoice }}
@lang('contact.total_paid'): {{ $contact_details->total_paid }}
@lang('contact.total_sale_due'): {{ $contact_details->total_invoice - $contact_details->total_paid }}
@if(!empty($contact_details->opening_balance) || $contact_details->opening_balance != '0.00') @lang('lang_v1.opening_balance'): {{ $contact_details->opening_balance }}
@lang('lang_v1.opening_balance_due'): {{ $ob_due }} @endif
@elseif(in_array($due_payment_type, ['sell_return']))
@lang('sale.customer_name'): {{ $contact_details->name }}


@lang('lang_v1.total_sell_return'): {{ $contact_details->total_sell_return }}
@lang('lang_v1.total_sell_return_paid'): {{ $contact_details->total_return_paid }}
@lang('lang_v1.total_sell_return_due'): {{ $contact_details->total_sell_return - $contact_details->total_return_paid }}
@endif
@if(config('constants.show_payment_type_on_contact_pay') && ($due_payment_type == 'purchase' || $due_payment_type == 'sell')) @php $reverse_payment_types = []; if($due_payment_type == 'purchase') { $reverse_payment_types = [ 0 => __('lang_v1.pay_to_supplier'), 1 => __('lang_v1.receive_from_supplier') ]; } else if($due_payment_type == 'sell') { $reverse_payment_types = [ 0 => __('lang_v1.receive_from_customer'), 1 => __('lang_v1.pay_to_customer') ]; } @endphp
{!! Form::label("is_reverse" , __('lang_v1.payment_type') . ':') !!} {!! Form::select("is_reverse", $reverse_payment_types, 0, ['class' => 'form-control select2', 'style' => 'width:100%;']); !!}
@endif
{!! Form::label("method" , __('purchase.payment_method') . ':*') !!}
{!! Form::select("method", $payment_types, $payment_line->method, ['class' => 'form-control select2 payment_types_dropdown', 'required', 'style' => 'width:100%;']); !!}
{!! Form::label("paid_on" , __('lang_v1.paid_on') . ':*') !!}
{!! Form::text('paid_on', @format_datetime($payment_line->paid_on), ['class' => 'form-control', 'readonly', 'required']); !!}
{!! Form::label("amount" , __('sale.amount') . ':*') !!}
@if(in_array($due_payment_type, ['sell_return', 'purchase_return'])) {!! Form::text("amount", @num_format($payment_line->amount), ['class' => 'form-control input_number payment_amount', 'required', 'placeholder' => __('sale.amount'), 'data-rule-max-value' => $payment_line->amount, 'data-msg-max-value' => __('lang_v1.max_amount_to_be_paid_is', ['amount' => $amount_formated])]); !!} @else {!! Form::text("amount", @num_format($payment_line->amount), ['class' => 'form-control input_number payment_amount', 'required', 'placeholder' => __('sale.amount')]); !!} @endif
@php $pos_settings = !empty(session()->get('business.pos_settings')) ? json_decode(session()->get('business.pos_settings'), true) : []; $enable_cash_denomination_for_payment_methods = !empty($pos_settings['enable_cash_denomination_for_payment_methods']) ? $pos_settings['enable_cash_denomination_for_payment_methods'] : []; @endphp @if(!empty($pos_settings['enable_cash_denomination_on']) && $pos_settings['enable_cash_denomination_on'] == 'all_screens')

@lang( 'lang_v1.cash_denominations' ) @if(!empty($pos_settings['cash_denominations'])) @foreach(explode(',', $pos_settings['cash_denominations']) as $dnm) @endforeach
@lang('lang_v1.denomination')   @lang('lang_v1.count')   @lang('sale.subtotal')
{{$dnm}} X {!! Form::number("denominations[$dnm]", null, ['class' => 'form-control cash_denomination input-sm', 'min' => 0, 'data-denomination' => $dnm, 'style' => 'width: 100px; margin:auto;' ]); !!} = 0
@lang('sale.total') 0

@lang('lang_v1.cash_denomination_error')

@else

@lang('lang_v1.denomination_add_help_text')

@endif
@endif
{!! Form::label('document', __('purchase.attach_document') . ':') !!} {!! Form::file('document', ['accept' => implode(',', array_keys(config('constants.document_upload_mimes_types')))]); !!}

@includeIf('components.document_help_text')

@if(!empty($accounts))
{!! Form::label("account_id" , __('lang_v1.payment_account') . ':') !!}
{!! Form::select("account_id", $accounts, !empty($payment_line->account_id) ? $payment_line->account_id : '' , ['class' => 'form-control select2', 'id' => "account_id", 'style' => 'width:100%;']); !!}
@endif
@include('transaction_payment.payment_type_details')
{!! Form::label("note", __('lang_v1.payment_note') . ':') !!} {!! Form::textarea("note", $payment_line->note, ['class' => 'form-control', 'rows' => 3]); !!}
{!! Form::close() !!}