84 lines
5.4 KiB
PHP
84 lines
5.4 KiB
PHP
@extends('layouts.app')
|
|
@section('title', __('accounting::lang.installments'))
|
|
@section('content')
|
|
@include('accounting::layouts.nav')
|
|
<section class="content-header"><h1>@lang('accounting::lang.installments')</h1></section>
|
|
<section class="content">
|
|
@if($eligibleSells->count() > 0)
|
|
<div class="box box-info">
|
|
<div class="box-header"><h3 class="box-title">@lang('accounting::lang.eligible_sell_invoices')</h3></div>
|
|
<div class="box-body table-responsive">
|
|
<table class="table table-bordered">
|
|
<thead><tr><th>@lang('sale.invoice_no')</th><th>@lang('sale.amount')</th><th>@lang('sale.status')</th><th>@lang('accounting::lang.installment_count')</th><th>@lang('messages.action')</th></tr></thead>
|
|
<tbody>
|
|
@foreach($eligibleSells as $sell)
|
|
<tr>
|
|
<td>{{ $sell->invoice_no }}</td>
|
|
<td>@format_currency($sell->final_total)</td>
|
|
<td>{{ $sell->payment_status }}</td>
|
|
<td>
|
|
<form action="{{ route('accounting.createInstallmentFromSell', $sell->id) }}" method="POST" class="form-inline">
|
|
@csrf
|
|
<input type="number" name="installment_count" class="form-control input-sm" value="{{ max(2, (int)$sell->pay_term_number) }}" min="2" style="width:80px">
|
|
<button class="btn btn-xs btn-primary">@lang('accounting::lang.create_installment_plan')</button>
|
|
</form>
|
|
</td>
|
|
<td><a href="{{ action([\App\Http\Controllers\SellController::class, 'show'], $sell->id) }}" class="btn btn-xs btn-default">@lang('messages.view')</a></td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="box box-primary">
|
|
<form action="{{ url('accounting/installments') }}" method="POST" class="box-body">
|
|
@csrf
|
|
<div class="row">
|
|
<div class="col-md-2"><input name="transaction_id" class="form-control" placeholder="@lang('accounting::lang.transaction_id')" required></div>
|
|
<div class="col-md-2"><input name="principal_amount" type="number" step="0.01" class="form-control" placeholder="@lang('accounting::lang.principal_amount')" required></div>
|
|
<div class="col-md-2"><input name="installment_count" type="number" class="form-control" placeholder="@lang('accounting::lang.installment_count')" required></div>
|
|
<div class="col-md-2"><input name="start_date" type="date" class="form-control" required></div>
|
|
<div class="col-md-2">{!! Form::select('frequency', ['monthly'=>__('accounting::lang.monthly'),'quarterly'=>__('accounting::lang.quarterly'),'weekly'=>__('accounting::lang.weekly')], 'monthly', ['class'=>'form-control']) !!}</div>
|
|
<div class="col-md-2"><button class="btn btn-primary">@lang('messages.save')</button></div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@foreach($plans as $plan)
|
|
<div class="box box-default">
|
|
<div class="box-header"><h4>#{{ $plan->id }} - @lang('sale.invoice_no'): {{ $plan->transaction_id }} - @format_currency($plan->principal_amount) ({{ $plan->status }})</h4></div>
|
|
<div class="box-body table-responsive">
|
|
<table class="table table-bordered table-condensed">
|
|
<thead><tr><th>#</th><th>@lang('accounting::lang.due_date')</th><th>@lang('sale.amount')</th><th>@lang('accounting::lang.penalty')</th><th>@lang('sale.status')</th><th>@lang('messages.action')</th></tr></thead>
|
|
<tbody>
|
|
@foreach($plan->schedule as $item)
|
|
@php $due = $installmentService->totalDue($item); @endphp
|
|
<tr>
|
|
<td>{{ $item->installment_number }}</td>
|
|
<td>{{ $item->due_date }}</td>
|
|
<td>@format_currency($item->amount)</td>
|
|
<td>@format_currency($item->penalty_amount)</td>
|
|
<td>{{ $item->status }}</td>
|
|
<td>
|
|
@if(!in_array($item->status, ['paid']) && $due > 0)
|
|
<form action="{{ route('accounting.payInstallment', $item->id) }}" method="POST" class="form-inline">
|
|
@csrf
|
|
<input type="hidden" name="amount" value="{{ $due }}">
|
|
{!! Form::select('debit_account_id', $accounts, null, ['class'=>'form-control input-sm','required','placeholder'=>__('accounting::lang.debit')]) !!}
|
|
{!! Form::select('credit_account_id', $accounts, null, ['class'=>'form-control input-sm','required','placeholder'=>__('accounting::lang.credit')]) !!}
|
|
<button class="btn btn-xs btn-success">@lang('accounting::lang.pay')</button>
|
|
</form>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
{{ $plans->links() }}
|
|
</section>
|
|
@endsection
|