diff --git a/app/Entities/Projects/Project.php b/app/Entities/Projects/Project.php index c5563c3..7e63c5c 100755 --- a/app/Entities/Projects/Project.php +++ b/app/Entities/Projects/Project.php @@ -2,6 +2,7 @@ namespace App\Entities\Projects; +use App\Entities\Invoices\Invoice; use App\Entities\Payments\Payment; use App\Entities\Projects\ProjectPresenter; use App\Entities\Projects\Task; @@ -43,6 +44,11 @@ class Project extends Model { return $this->hasMany(Subscription::class); } + public function invoices() + { + return $this->hasMany(Invoice::class); + } + public function payments() { return $this->hasMany(Payment::class)->orderBy('date','desc'); diff --git a/app/Http/Controllers/Projects/InvoicesController.php b/app/Http/Controllers/Projects/InvoicesController.php new file mode 100644 index 0000000..97e5d1e --- /dev/null +++ b/app/Http/Controllers/Projects/InvoicesController.php @@ -0,0 +1,15 @@ + 'List Dokumen', 'features' => 'Daftar Item Pekerjaan', 'cost_proposal' => 'Pengajuan Biaya', + 'invoices' => 'List Invoice', // Actions 'features_export_html' => 'Export HTML', diff --git a/resources/views/projects/invoices.blade.php b/resources/views/projects/invoices.blade.php new file mode 100755 index 0000000..9b9288a --- /dev/null +++ b/resources/views/projects/invoices.blade.php @@ -0,0 +1,58 @@ +@extends('layouts.app') + +@section('title', trans('project.invoices') . ' | ' . $project->name) + +@section('content') +@include('projects.partials.breadcrumb', ['title' => trans('project.invoices')]) + +
| {{ trans('app.table_no') }} | +{{ trans('invoice.number') }} | +{{ trans('app.date') }} | +{{ trans('invoice.customer') }} | +{{ trans('invoice.amount') }} | +{{ trans('app.action') }} | + + + @forelse($project->invoices as $key => $invoice) +
|---|---|---|---|---|---|
| {{ 1 + $key }} | +{{ $invoice->number }} | +{{ $invoice->created_at->format('Y-m-d') }} | +{{ $project->customer->name }} | +{{ formatRp($invoice->amount) }} | ++ {!! html_link_to_route('invoices.show', '', [$invoice->number], ['class' => 'btn btn-info btn-xs','icon' => 'search','title' => 'Lihat ' . trans('invoice.show')]) !!} + {!! html_link_to_route('invoices.pdf', '', [$invoice->number], ['class' => 'btn btn-default btn-xs','icon' => 'print','title' => trans('invoice.print'), 'target' => '_blank']) !!} + | +
| {{ trans('invoice.empty') }} | |||||
| {{ trans('app.total') }} | +{{ formatRp($project->invoices->sum('amount')) }} | ++ | |||