Browse Source

Merge pull request #26 from nafiesl/tax-id-setting

NPWP (tax_id) setting dan tampilkan di print out invoice - closes #23
pull/29/head
Nafies Luthfi 7 years ago
committed by GitHub
parent
commit
4fcdb38c52
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/Http/Controllers/Users/AgencyController.php
  2. 1
      resources/lang/de/agency.php
  3. 1
      resources/lang/en/agency.php
  4. 1
      resources/lang/id/agency.php
  5. 36
      resources/views/invoices/pdf.blade.php
  6. 7
      resources/views/users/agency/edit.blade.php
  7. 1
      resources/views/users/agency/show.blade.php
  8. 5
      tests/Feature/AgencyProfileTest.php

2
app/Http/Controllers/Users/AgencyController.php

@ -47,6 +47,7 @@ class AgencyController extends Controller
'address' => 'required|string|max:255', 'address' => 'required|string|max:255',
'city' => 'required|string|max:100', 'city' => 'required|string|max:100',
'phone' => 'required|string|max:255', 'phone' => 'required|string|max:255',
'tax_id' => 'nullable|string|max:255',
]); ]);
Option::set('agency_name', request('name')); Option::set('agency_name', request('name'));
@ -56,6 +57,7 @@ class AgencyController extends Controller
Option::set('agency_address', request('address')); Option::set('agency_address', request('address'));
Option::set('agency_city', request('city')); Option::set('agency_city', request('city'));
Option::set('agency_phone', request('phone')); Option::set('agency_phone', request('phone'));
Option::set('agency_tax_id', request('tax_id'));
flash(__('agency.updated'), 'success'); flash(__('agency.updated'), 'success');

1
resources/lang/de/agency.php

@ -22,4 +22,5 @@ return [
'address' => 'Agentur Adresse', 'address' => 'Agentur Adresse',
'phone' => 'Agentur Telefon', 'phone' => 'Agentur Telefon',
'logo' => 'Agentur Logo', 'logo' => 'Agentur Logo',
'tax_id' => 'Tax ID Number',
]; ];

1
resources/lang/en/agency.php

@ -22,4 +22,5 @@ return [
'address' => 'Agency Address', 'address' => 'Agency Address',
'phone' => 'Agency Phone', 'phone' => 'Agency Phone',
'logo' => 'Agency Logo', 'logo' => 'Agency Logo',
'tax_id' => 'Tax ID Number',
]; ];

1
resources/lang/id/agency.php

@ -22,4 +22,5 @@ return [
'address' => 'Alamat Agensi', 'address' => 'Alamat Agensi',
'phone' => 'Telp. Agensi', 'phone' => 'Telp. Agensi',
'logo' => 'Logo Agensi', 'logo' => 'Logo Agensi',
'tax_id' => 'NPWP',
]; ];

36
resources/views/invoices/pdf.blade.php

@ -59,14 +59,14 @@
</div> </div>
</td> </td>
<td style="width:270px; text-align: center;"> <td style="width:270px; text-align: center;">
<h3 style="margin: 3px 0; font-size: 24px">{{ trans('invoice.invoice') }}</h3>
<div style="margin: 5px">{{ trans('invoice.number') }} : INV-{{ $invoice->number }}</div>
<div>{{ trans('app.date') }} : {{ dateId($invoice->date) }}</div>
<h3 style="margin: 3px 0; font-size: 24px">{{ __('invoice.invoice') }}</h3>
<div style="margin: 5px">{{ __('invoice.number') }} : INV-{{ $invoice->number }}</div>
<div>{{ __('app.date') }} : {{ dateId($invoice->date) }}</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<h4 style="margin: 3px 0;">{{ trans('app.to') }} :</h4>
<h4 style="margin: 3px 0;">{{ __('app.to') }} :</h4>
@php @php
$customer = $invoice->project->customer; $customer = $invoice->project->customer;
@endphp @endphp
@ -75,7 +75,7 @@
<p style="max-width: 250px;font-size: 14px">{!! nl2br($customer->address) !!}</p> <p style="max-width: 250px;font-size: 14px">{!! nl2br($customer->address) !!}</p>
@endif @endif
@if ($customer->phone) @if ($customer->phone)
<p>{{ trans('contact.phone') }} : {{ $customer->phone }}</p>
<p>{{ __('contact.phone') }} : {{ $customer->phone }}</p>
@endif @endif
@if ($customer->website) @if ($customer->website)
<p>{{ $customer->website }}</p> <p>{{ $customer->website }}</p>
@ -86,20 +86,24 @@
</td> </td>
<td class="text-center text-top"> <td class="text-center text-top">
@if ($invoice->due_date) @if ($invoice->due_date)
<h4 style="margin: 30px 3px 0;">{{ trans('invoice.due_date') }}</h4>
<p>{{ dateId($invoice->due_date) }}</p>
<h4 style="margin: 30px 3px 0;">{{ __('invoice.due_date') }}</h4>
<p>{{ dateId($invoice->due_date) }}</p>
@endif
@if ($taxId = Option::get('agency_tax_id'))
<h4 style="margin: 30px 3px 0;">{{ __('agency.tax_id') }}</h4>
<p>{{ $taxId }}</p>
@endif @endif
</td> </td>
</tr> </tr>
<tr><td colspan="3">{{ trans('invoice.items') }} :</td></tr>
<tr><td colspan="3">{{ __('invoice.items') }} :</td></tr>
<tr> <tr>
<td colspan="3"> <td colspan="3">
<table border="1" class="receipt-table" style="width: 100%;font-size: 14px"> <table border="1" class="receipt-table" style="width: 100%;font-size: 14px">
<thead style="background-color: #FFC800"> <thead style="background-color: #FFC800">
<tr> <tr>
<th width="5%">{{ trans('app.table_no') }}</th>
<th width="70%" class="text-left">{{ trans('invoice.item_description') }}</th>
<th width="25%">{{ trans('invoice.item_amount') }}</th>
<th width="5%">{{ __('app.table_no') }}</th>
<th width="70%" class="text-left">{{ __('invoice.item_description') }}</th>
<th width="25%">{{ __('invoice.item_amount') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -130,7 +134,7 @@
</tr> </tr>
@endif @endif
<tr> <tr>
<th colspan="2" class="text-right">{{ trans('app.total') }}</th>
<th colspan="2" class="text-right">{{ __('app.total') }}</th>
<th colspan="2" class="text-right">{{ formatRp($invoice->amount) }}</th> <th colspan="2" class="text-right">{{ formatRp($invoice->amount) }}</th>
</tr> </tr>
</tbody> </tbody>
@ -138,7 +142,7 @@
</td> </td>
</tr> </tr>
<tr style="vertical-align: top;"> <tr style="vertical-align: top;">
<td style="padding-top: 20px;">{{ trans('payment.words_amount') }} : </td>
<td style="padding-top: 20px;">{{ __('payment.words_amount') }} : </td>
<td colspan="2" style="font-weight: bold; padding-top: 20px"> <td colspan="2" style="font-weight: bold; padding-top: 20px">
{{ ucwords(Terbilang::make($invoice->amount)) }} {{ Option::get('money_sign_in_word', 'Rupiah') }} {{ ucwords(Terbilang::make($invoice->amount)) }} {{ Option::get('money_sign_in_word', 'Rupiah') }}
</td> </td>
@ -158,9 +162,9 @@
@foreach ($bankAccounts as $key => $bankAccount) @foreach ($bankAccounts as $key => $bankAccount)
@php $bankAccount = (object) $bankAccount; @endphp @php $bankAccount = (object) $bankAccount; @endphp
<table style="border: 1px solid #ccc;width: 330px"> <table style="border: 1px solid #ccc;width: 330px">
<tr><td style="width: 100px">{{ trans('bank_account.name') }}</td><td>: <strong>{{ $bankAccount->name }}</strong></td></tr>
<tr><td>{{ trans('bank_account.number') }}</td><td>: <strong>{{ $bankAccount->number }}</strong></td></tr>
<tr><td>{{ trans('bank_account.account_name') }}</td><td>: <strong>{{ $bankAccount->account_name }}</strong></td></tr>
<tr><td style="width: 100px">{{ __('bank_account.name') }}</td><td>: <strong>{{ $bankAccount->name }}</strong></td></tr>
<tr><td>{{ __('bank_account.number') }}</td><td>: <strong>{{ $bankAccount->number }}</strong></td></tr>
<tr><td>{{ __('bank_account.account_name') }}</td><td>: <strong>{{ $bankAccount->account_name }}</strong></td></tr>
</table> </table>
@if ($key == count($bankAccounts)) <br> @endif @if ($key == count($bankAccounts)) <br> @endif
@endforeach @endforeach

7
resources/views/users/agency/edit.blade.php

@ -21,8 +21,11 @@
<div class="col-md-6">{!! FormField::text('phone', ['value' => Option::get('agency_phone')]) !!}</div> <div class="col-md-6">{!! FormField::text('phone', ['value' => Option::get('agency_phone')]) !!}</div>
</div> </div>
{!! FormField::textarea('address', ['value' => Option::get('agency_address')]) !!} {!! FormField::textarea('address', ['value' => Option::get('agency_address')]) !!}
{!! FormField::text('city', ['value' => Option::get('agency_city')]) !!}
{!! FormField::text('website', ['value' => Option::get('agency_website')]) !!}
<div class="row">
<div class="col-md-6">{!! FormField::text('city', ['value' => Option::get('agency_city')]) !!}</div>
<div class="col-md-6">{!! FormField::text('website', ['value' => Option::get('agency_website')]) !!}</div>
</div>
{!! FormField::text('tax_id', ['label' => __('agency.tax_id'), 'value' => Option::get('agency_tax_id')]) !!}
</div> </div>
{{ Form::close() }} {{ Form::close() }}
<div class="col-md-3 text-center"> <div class="col-md-3 text-center">

1
resources/views/users/agency/show.blade.php

@ -28,6 +28,7 @@
<tr><th>{{ trans('address.address') }}</th><td>{!! nl2br(Option::get('agency_address')) !!}</td></tr> <tr><th>{{ trans('address.address') }}</th><td>{!! nl2br(Option::get('agency_address')) !!}</td></tr>
<tr><th>{{ trans('address.city') }}</th><td>{{ Option::get('agency_city') }}</td></tr> <tr><th>{{ trans('address.city') }}</th><td>{{ Option::get('agency_city') }}</td></tr>
<tr><th>{{ trans('contact.website') }}</th><td>{{ Option::get('agency_website') }}</td></tr> <tr><th>{{ trans('contact.website') }}</th><td>{{ Option::get('agency_website') }}</td></tr>
<tr><th>{{ trans('agency.tax_id') }}</th><td>{{ Option::get('agency_tax_id') }}</td></tr>
</table> </table>
</div> </div>
</div> </div>

5
tests/Feature/AgencyProfileTest.php

@ -36,6 +36,7 @@ class AgencyProfileTest extends TestCase
'phone' => '081234567890', 'phone' => '081234567890',
'city' => 'Jakarta', 'city' => 'Jakarta',
'website' => 'https://example.com', 'website' => 'https://example.com',
'tax_id' => '14.817.xxx.x-xxx.000',
]); ]);
$this->see(trans('agency.updated')); $this->see(trans('agency.updated'));
@ -69,6 +70,10 @@ class AgencyProfileTest extends TestCase
'key' => 'agency_tagline', 'key' => 'agency_tagline',
'value' => 'Tagline agensi saya', 'value' => 'Tagline agensi saya',
]); ]);
$this->seeInDatabase('site_options', [
'key' => 'agency_tax_id',
'value' => '14.817.xxx.x-xxx.000',
]);
} }
/** @test */ /** @test */

Loading…
Cancel
Save