458 lines
24 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
@extends('layouts.admin')
@section('title', trans_choice('general.bills', 1) . ': ' . $bill->bill_number)
@section('content')
2018-05-02 10:31:05 +03:00
@if (($recurring = $bill->recurring) && ($next = $recurring->next()))
2018-04-28 11:56:11 +03:00
<div class="callout callout-info">
<h4>{{ trans('recurring.recurring') }}</h4>
<p>{{ trans('recurring.message', [
'type' => mb_strtolower(trans_choice('general.bills', 1)),
2018-05-02 00:59:55 +03:00
'date' => $next->format($date_format)
2018-04-28 11:56:11 +03:00
]) }}
</p>
</div>
@endif
2018-10-29 15:36:23 +03:00
@if ($bill->status->code == 'draft')
<div class="callout callout-warning">
<p>{!! trans('invoices.messages.draft') !!}</p>
</div>
@endif
@if ($bill->status->code != 'paid')
<div class="row show-invoice">
<div class="col-md-12 no-padding-right">
<ul class="timeline">
<li>
<i class="fa fa-plus bg-blue"></i>
<div class="timeline-item">
2018-12-11 18:42:27 +03:00
<h3 class="timeline-header">{{ trans('bills.create_bill') }}</h3>
2018-10-29 15:36:23 +03:00
<div class="timeline-body">
{{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.created', ['date' => Date::parse($bill->created_at)->format($date_format)]) }}
<a href="{{ url('expenses/bills/' . $bill->id . '/edit') }}" class="btn btn-default btn-xs">
{{ trans('general.edit') }}
</a>
</div>
</div>
</li>
<li>
<i class="fa fa-envelope bg-orange"></i>
<div class="timeline-item">
2018-12-11 18:42:27 +03:00
<h3 class="timeline-header">{{ trans('bills.receive_bill') }}</h3>
2018-10-29 15:36:23 +03:00
<div class="timeline-body">
@if ($bill->status->code == 'draft')
{{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.receive.draft') }}
@permission('update-expenses-bills')
<a href="{{ url('expenses/bills/' . $bill->id . '/received') }}" class="btn btn-warning btn-xs">{{ trans('bills.mark_received') }}</a>
@endpermission
@else
{{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.receive.received', ['date' => Date::parse($bill->created_at)->format($date_format)]) }}
@endif
</div>
</div>
</li>
<li>
<i class="fa fa-money bg-green"></i>
<div class="timeline-item">
2018-12-11 18:42:27 +03:00
<h3 class="timeline-header">{{ trans('bills.make_payment') }}</h3>
2018-10-29 15:36:23 +03:00
<div class="timeline-body">
@if($bill->status->code != 'paid' && empty($bill->payments()->count()))
{{ trans_choice('general.statuses', 1) . ': ' . trans('bills.messages.status.paid.await') }}
@else
2018-10-29 15:41:48 +03:00
{{ trans_choice('general.statuses', 1) . ': ' . trans('general.partially_paid') }}
2018-10-29 15:36:23 +03:00
@endif
@if(empty($bill->payments()->count()) || (!empty($bill->payments()->count()) && $bill->paid != $bill->amount))
<a href="#" id="button-payment" class="btn btn-success btn-xs">{{ trans('bills.add_payment') }}</a>
@endif
</div>
</div>
</li>
</ul>
</div>
</div>
@endif
2017-09-14 22:21:00 +03:00
<div class="box box-success">
<div class="bill">
<div id="badge">
<div class="arrow-up"></div>
<div class="label {{ $bill->status->label }}">{{ trans('bills.status.' . $bill->status->code) }}</div>
<div class="arrow-right"></div>
</div>
2017-09-14 22:21:00 +03:00
<div class="row invoice-header">
<div class="col-xs-7">
@if (isset($bill->vendor->logo) && !empty($bill->vendor->logo->id))
<img src="{{ Storage::url($bill->vendor->logo->id) }}" class="invoice-logo" />
2017-09-14 22:21:00 +03:00
@else
<img src="{{ asset('public/img/company.png') }}" class="invoice-logo" />
2017-09-14 22:21:00 +03:00
@endif
</div>
<div class="col-xs-5 invoice-company">
<address>
<strong>{{ setting('general.company_name') }}</strong><br>
2017-12-04 14:46:11 +03:00
{!! nl2br(setting('general.company_address')) !!}<br>
2017-09-14 22:21:00 +03:00
@if (setting('general.company_tax_number'))
{{ trans('general.tax_number') }}: {{ setting('general.company_tax_number') }}<br>
@endif
<br>
@if (setting('general.company_phone'))
{{ setting('general.company_phone') }}<br>
@endif
{{ setting('general.company_email') }}
</address>
</div>
</div>
<div class="row">
<div class="col-xs-7">
{{ trans('bills.bill_from') }}
<address>
@stack('name_input_start')
2017-09-14 22:21:00 +03:00
<strong>{{ $bill->vendor_name }}</strong><br>
@stack('name_input_end')
@stack('address_input_start')
2017-12-04 14:46:11 +03:00
{!! nl2br($bill->vendor_address) !!}<br>
@stack('address_input_end')
@stack('tax_number_input_start')
2017-09-14 22:21:00 +03:00
@if ($bill->vendor_tax_number)
{{ trans('general.tax_number') }}: {{ $bill->vendor_tax_number }}<br>
@endif
@stack('tax_number_input_end')
2017-09-14 22:21:00 +03:00
<br>
@stack('phone_input_start')
2017-09-14 22:21:00 +03:00
@if ($bill->vendor_phone)
{{ $bill->vendor_phone }}<br>
@endif
@stack('phone_input_end')
@stack('email_start')
2017-09-14 22:21:00 +03:00
{{ $bill->vendor_email }}
@stack('email_input_end')
2017-09-14 22:21:00 +03:00
</address>
</div>
<div class="col-xs-5">
<div class="table-responsive">
<table class="table no-border">
<tbody>
@stack('bill_number_input_start')
<tr>
<th>{{ trans('bills.bill_number') }}:</th>
<td class="text-right">{{ $bill->bill_number }}</td>
</tr>
@stack('bill_number_input_end')
@stack('order_number_input_start')
@if ($bill->order_number)
<tr>
<th>{{ trans('bills.order_number') }}:</th>
<td class="text-right">{{ $bill->order_number }}</td>
</tr>
@endif
@stack('order_number_input_end')
@stack('billed_at_input_start')
<tr>
<th>{{ trans('bills.bill_date') }}:</th>
<td class="text-right">{{ Date::parse($bill->billed_at)->format($date_format) }}</td>
</tr>
@stack('billed_at_input_end')
@stack('due_at_input_start')
<tr>
<th>{{ trans('bills.payment_due') }}:</th>
<td class="text-right">{{ Date::parse($bill->due_at)->format($date_format) }}</td>
</tr>
@stack('due_at_input_end')
2017-09-14 22:21:00 +03:00
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 table-responsive">
<table class="table table-striped">
<tbody>
<tr>
@stack('actions_th_start')
@stack('actions_th_end')
@stack('name_th_start')
2017-09-14 22:21:00 +03:00
<th>{{ trans_choice('general.items', 1) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
2017-09-14 22:21:00 +03:00
<th class="text-center">{{ trans('bills.quantity') }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
2017-09-14 22:21:00 +03:00
<th class="text-right">{{ trans('bills.price') }}</th>
@stack('price_th_end')
@stack('taxes_th_start')
@stack('taxes_th_end')
@stack('total_th_start')
2017-09-14 22:21:00 +03:00
<th class="text-right">{{ trans('bills.total') }}</th>
@stack('total_th_end')
2017-09-14 22:21:00 +03:00
</tr>
@foreach($bill->items as $item)
<tr>
@stack('actions_td_start')
@stack('actions_td_end')
@stack('name_td_start')
2017-09-14 22:21:00 +03:00
<td>
{{ $item->name }}
@if ($item->sku)
<br><small>{{ trans('items.sku') }}: {{ $item->sku }}</small>
@endif
</td>
@stack('name_td_end')
@stack('quantity_td_start')
2017-09-14 22:21:00 +03:00
<td class="text-center">{{ $item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
2017-09-14 22:21:00 +03:00
<td class="text-right">@money($item->price, $bill->currency_code, true)</td>
@stack('price_td_end')
@stack('taxes_td_start')
@stack('taxes_td_end')
@stack('total_td_start')
<td class="text-right">@money($item->total, $bill->currency_code, true)</td>
@stack('total_td_end')
2017-09-14 22:21:00 +03:00
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-xs-7">
@stack('notes_input_start')
@if ($bill->notes)
<p class="lead">{{ trans_choice('general.notes', 2) }}:</p>
2017-09-14 22:21:00 +03:00
<p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
{{ $bill->notes }}
</p>
@endif
@stack('notes_input_end')
2017-09-14 22:21:00 +03:00
</div>
<div class="col-xs-5">
<div class="table-responsive">
<table class="table">
<tbody>
2018-04-16 19:01:29 +03:00
@foreach ($bill->totals as $total)
2017-10-13 18:41:17 +03:00
@if ($total->code != 'total')
@stack($total->code . '_td_start')
2018-04-17 16:40:52 +03:00
<tr>
2018-05-02 22:33:28 +03:00
<th>{{ trans($total->title) }}:</th>
2018-04-17 16:40:52 +03:00
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
</tr>
@stack($total->code . '_td_end')
@else
2017-10-13 18:41:17 +03:00
@if ($bill->paid)
<tr class="text-success">
<th>{{ trans('invoices.paid') }}:</th>
2017-11-27 01:41:51 +03:00
<td class="text-right">- @money($bill->paid, $bill->currency_code, true)</td>
</tr>
@endif
@stack('grand_total_td_start')
<tr>
2018-04-16 19:01:29 +03:00
<th>{{ trans($total->name) }}:</th>
2017-10-13 18:41:17 +03:00
<td class="text-right">@money($total->amount - $bill->paid, $bill->currency_code, true)</td>
</tr>
@stack('grand_total_td_end')
2017-09-14 22:21:00 +03:00
@endif
@endforeach
2017-09-14 22:21:00 +03:00
</tbody>
</table>
</div>
</div>
</div>
<div class="box-footer row no-print">
<div class="col-xs-12">
2018-10-27 17:57:40 +03:00
@if(!$bill->reconciled)
<a href="{{ url('expenses/bills/' . $bill->id . '/edit') }}" class="btn btn-default">
2017-09-14 22:21:00 +03:00
<i class="fa fa-pencil-square-o"></i>&nbsp; {{ trans('general.edit') }}
</a>
2018-10-27 17:57:40 +03:00
@endif
<a href="{{ url('expenses/bills/' . $bill->id . '/print') }}" target="_blank" class="btn btn-success">
2017-09-14 22:21:00 +03:00
<i class="fa fa-print"></i>&nbsp; {{ trans('general.print') }}
</a>
2017-11-07 05:11:03 +03:00
<div class="btn-group dropup">
2017-11-15 17:51:30 +03:00
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-circle-up"></i>&nbsp; {{ trans('general.more_actions') }}</button>
2017-11-07 05:11:03 +03:00
<ul class="dropdown-menu" role="menu">
@if($bill->status->code != 'paid')
2018-10-27 17:57:40 +03:00
@if(empty($bill->paid) || ($bill->paid != $bill->amount))
2017-11-07 05:11:03 +03:00
<li><a href="#" id="button-payment">{{ trans('bills.add_payment') }}</a></li>
2018-10-27 17:57:40 +03:00
@endif
2017-11-07 05:11:03 +03:00
@permission('update-expenses-bills')
2018-03-13 15:28:41 +03:00
@if($bill->bill_status_code == 'draft')
2017-11-07 05:11:03 +03:00
<li><a href="{{ url('expenses/bills/' . $bill->id . '/received') }}">{{ trans('bills.mark_received') }}</a></li>
2018-03-13 15:28:41 +03:00
@else
<li><a href="javascript:void(0);" class="disabled"><span class="text-disabled">{{ trans('bills.mark_received') }}</span></a></li>
@endif
2017-11-07 05:11:03 +03:00
@endpermission
<li class="divider"></li>
@endif
2017-11-07 05:11:03 +03:00
<li><a href="{{ url('expenses/bills/' . $bill->id . '/pdf') }}">{{ trans('bills.download_pdf') }}</a></li>
@permission('delete-expenses-bills')
2018-10-27 17:57:40 +03:00
@if(!$bill->reconciled)
<li class="divider"></li>
2017-11-07 05:11:03 +03:00
<li>{!! Form::deleteLink($bill, 'expenses/bills') !!}</li>
2018-10-27 17:57:40 +03:00
@endif
2017-11-07 05:11:03 +03:00
@endpermission
</ul>
</div>
2018-01-02 18:20:52 +03:00
@if($bill->attachment)
2019-02-02 14:02:26 +03:00
@php $file = $bill->attachment; @endphp
@include('partials.media.file')
2018-01-02 18:20:52 +03:00
@endif
2017-09-14 22:21:00 +03:00
</div>
</div>
</div>
</div>
2017-11-28 14:24:37 +07:00
<div class="row">
<div class="col-md-6 col-sm-12">
2017-11-28 14:24:37 +07:00
<div class="box box-default collapsed-box">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('bills.histories') }}</h3>
2017-09-14 22:21:00 +03:00
2017-11-28 14:24:37 +07:00
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
<!-- /.box-tools -->
2017-09-14 22:21:00 +03:00
</div>
2017-11-28 14:24:37 +07:00
<div class="box-body">
<div class="table-responsive">
<table class="table">
<thead>
2017-09-14 22:21:00 +03:00
<tr>
2017-11-28 14:24:37 +07:00
<th>{{ trans('general.date') }}</th>
<th>{{ trans_choice('general.statuses', 1) }}</th>
<th>{{ trans('general.description') }}</th>
2017-09-14 22:21:00 +03:00
</tr>
2017-11-28 14:24:37 +07:00
</thead>
<tbody>
@foreach($bill->histories as $history)
<tr>
2018-03-31 11:12:31 +03:00
<td>{{ Date::parse($history->created_at)->format($date_format) }}</td>
<td>{{ $history->status->name }}</td>
<td>{{ $history->description }}</td>
2017-11-28 14:24:37 +07:00
</tr>
@endforeach
</tbody>
</table>
</div>
2017-09-14 22:21:00 +03:00
</div>
</div>
</div>
<div class="col-md-6 col-sm-12">
2017-11-28 14:24:37 +07:00
<div class="box box-default collapsed-box">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('bills.payments') }}</h3>
2017-09-14 22:21:00 +03:00
2017-11-28 14:24:37 +07:00
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
<!-- /.box-tools -->
2017-09-14 22:21:00 +03:00
</div>
2017-11-28 14:24:37 +07:00
<div class="box-body">
<div class="table-responsive">
<table class="table">
<thead>
2017-09-14 22:21:00 +03:00
<tr>
2017-11-28 14:24:37 +07:00
<th>{{ trans('general.date') }}</th>
<th>{{ trans('general.amount') }}</th>
<th>{{ trans_choice('general.accounts', 1) }}</th>
<th style="width: 15%;">{{ trans('general.actions') }}</th>
2017-09-14 22:21:00 +03:00
</tr>
2017-11-28 14:24:37 +07:00
</thead>
<tbody>
@foreach($bill->payments as $payment)
<tr>
<td>{{ Date::parse($payment->paid_at)->format($date_format) }}</td>
<td>@money($payment->amount, $payment->currency_code, true)</td>
<td>{{ $payment->account->name }}</td>
<td>
2018-10-27 17:57:40 +03:00
@if ($payment->reconciled)
<button type="button" class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" title="{{ trans('reconciliations.reconciled') }}">
<i class="fa fa-check"></i>
</button>
@else
2017-11-28 14:24:37 +07:00
<a href="{{ url('expenses/bills/' . $payment->id) }}" class="btn btn-info btn-xs hidden"><i class="fa fa-eye" aria-hidden="true"></i> {{ trans('general.show') }}</a>
<a href="{{ url('expenses/bills/' . $payment->id . '/edit') }}" class="btn btn-primary btn-xs hidden"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {{ trans('general.edit') }}</a>
{!! Form::open([
'id' => 'bill-payment-' . $payment->id,
'method' => 'DELETE',
'url' => ['expenses/bills/payment', $payment->id],
'style' => 'display:inline'
]) !!}
{!! Form::button('<i class="fa fa-trash-o" aria-hidden="true"></i> ' . trans('general.delete'), array(
'type' => 'button',
'class' => 'btn btn-danger btn-xs',
'title' => trans('general.delete'),
'onclick' => 'confirmDelete("' . '#bill-payment-' . $payment->id . '", "' . trans_choice('general.payments', 2) . '", "' . trans('general.delete_confirm', ['name' => '<strong>' . Date::parse($payment->paid_at)->format($date_format) . ' - ' . money($payment->amount, $payment->currency_code, true) . ' - ' . $payment->account->name . '</strong>', 'type' => strtolower(trans_choice('general.revenues', 1))]) . '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
)) !!}
{!! Form::close() !!}
2018-10-27 17:57:40 +03:00
@endif
2017-11-28 14:24:37 +07:00
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
2017-09-14 22:21:00 +03:00
</div>
</div>
</div>
</div>
@endsection
2017-11-13 21:55:15 +03:00
@push('js')
2017-09-14 22:21:00 +03:00
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
@if (language()->getShortCode() != 'en')
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/locales/bootstrap-datepicker.' . language()->getShortCode() . '.js') }}"></script>
@endif
2017-09-14 22:21:00 +03:00
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
2017-11-13 21:55:15 +03:00
@endpush
2017-09-14 22:21:00 +03:00
2017-11-13 21:55:15 +03:00
@push('css')
2017-09-14 22:21:00 +03:00
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/datepicker/datepicker3.css') }}">
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
2017-11-13 21:55:15 +03:00
@endpush
2017-09-14 22:21:00 +03:00
2017-11-13 21:55:15 +03:00
@push('scripts')
2017-09-14 22:21:00 +03:00
<script type="text/javascript">
@permission('delete-common-uploads')
@if($bill->attachment)
$(document).on('click', '#remove-attachment', function (e) {
confirmDelete("#attachment-{!! $bill->attachment->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $bill->attachment->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
2017-09-14 22:21:00 +03:00
});
@endif
@endpermission
2017-09-14 22:21:00 +03:00
$(document).on('click', '#button-payment', function (e) {
$('#modal-add-payment').remove();
2017-09-14 22:21:00 +03:00
$.ajax({
url: '{{ url("modals/bills/" . $bill->id . "/payment/create") }}',
type: 'GET',
2017-09-14 22:21:00 +03:00
dataType: 'JSON',
success: function(json) {
if (json['success']) {
$('body').append(json['html']);
2017-09-14 22:21:00 +03:00
}
}
});
});
2017-09-14 22:21:00 +03:00
</script>
2017-11-13 21:55:15 +03:00
@endpush