Merge branch 'develop' of github.com:invoiceninja/invoiceninja into develop

This commit is contained in:
Hillel Coren 2017-11-19 15:43:36 +02:00
commit 3736bafd40
22 changed files with 232 additions and 38 deletions

View File

@ -451,6 +451,9 @@ if (! defined('APP_NAME')) {
define('FILTER_INVOICE_DATE', 'invoice_date'); define('FILTER_INVOICE_DATE', 'invoice_date');
define('FILTER_PAYMENT_DATE', 'payment_date'); define('FILTER_PAYMENT_DATE', 'payment_date');
define('ADDRESS_BILLING', 'billing_address');
define('ADDRESS_SHIPPING', 'shipping_address');
define('SOCIAL_GOOGLE', 'Google'); define('SOCIAL_GOOGLE', 'Google');
define('SOCIAL_FACEBOOK', 'Facebook'); define('SOCIAL_FACEBOOK', 'Facebook');
define('SOCIAL_GITHUB', 'GitHub'); define('SOCIAL_GITHUB', 'GitHub');

View File

@ -170,7 +170,7 @@ class ExportController extends BaseController
if ($request->input('include') === 'all' || $request->input('clients')) { if ($request->input('include') === 'all' || $request->input('clients')) {
$data['clients'] = Client::scope() $data['clients'] = Client::scope()
->with('user', 'contacts', 'country', 'currency') ->with('user', 'contacts', 'country', 'currency', 'shipping_country')
->withArchived() ->withArchived()
->get(); ->get();
} }

View File

@ -100,6 +100,7 @@ class ReportController extends BaseController
'invoice_status' => request()->invoice_status, 'invoice_status' => request()->invoice_status,
'group_dates_by' => request()->group_dates_by, 'group_dates_by' => request()->group_dates_by,
'document_filter' => request()->document_filter, 'document_filter' => request()->document_filter,
'currency_type' => request()->currency_type,
'export_format' => $format, 'export_format' => $format,
]; ];
$report = new $reportClass($startDate, $endDate, $isExport, $options); $report = new $reportClass($startDate, $endDate, $isExport, $options);

View File

@ -459,6 +459,11 @@ class Utils
public static function parseFloat($value) public static function parseFloat($value)
{ {
// check for comma as decimal separator
if (preg_match('/,[\d]{1,2}$/', $value)) {
$value = str_replace(',', '.', $value);
}
$value = preg_replace('/[^0-9\.\-]/', '', $value); $value = preg_replace('/[^0-9\.\-]/', '', $value);
return floatval($value); return floatval($value);

View File

@ -53,6 +53,12 @@ class Client extends EntityModel
'quote_number_counter', 'quote_number_counter',
'public_notes', 'public_notes',
'task_rate', 'task_rate',
'shipping_address1',
'shipping_address2',
'shipping_city',
'shipping_state',
'shipping_postal_code',
'shipping_country_id',
]; ];
@ -179,6 +185,14 @@ class Client extends EntityModel
return $this->belongsTo('App\Models\Country'); return $this->belongsTo('App\Models\Country');
} }
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function shipping_country()
{
return $this->belongsTo('App\Models\Country');
}
/** /**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */

View File

@ -91,7 +91,13 @@ class PaymentDatatable extends EntityDatatable
[ [
'amount', 'amount',
function ($model) { function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id); $amount = Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
if ($model->exchange_currency_id && $model->exchange_rate != 1) {
$amount .= ' | ' . Utils::formatMoney($model->amount * $model->exchange_rate, $model->exchange_currency_id, $model->country_id);
}
return $amount;
}, },
], ],
[ [

View File

@ -11,6 +11,11 @@ class ClientPresenter extends EntityPresenter
return $this->entity->country ? $this->entity->country->name : ''; return $this->entity->country ? $this->entity->country->name : '';
} }
public function shipping_country()
{
return $this->entity->shipping_country ? $this->entity->shipping_country->name : '';
}
public function balance() public function balance()
{ {
$client = $this->entity; $client = $this->entity;
@ -51,6 +56,49 @@ class ClientPresenter extends EntityPresenter
return sprintf('%s: %s %s', trans('texts.payment_terms'), trans('texts.payment_terms_net'), $client->defaultDaysDue()); return sprintf('%s: %s %s', trans('texts.payment_terms'), trans('texts.payment_terms_net'), $client->defaultDaysDue());
} }
public function address($addressType = ADDRESS_BILLING)
{
$str = '';
$prefix = $addressType == ADDRESS_BILLING ? '' : 'shipping_';
$client = $this->entity;
if ($address1 = $client->{$prefix . 'address1'}) {
$str .= e($address1) . '<br/>';
}
if ($address2 = $client->{$prefix . 'address2'}) {
$str .= e($address2) . '<br/>';
}
if ($cityState = $this->getCityState($addressType)) {
$str .= e($cityState) . '<br/>';
}
if ($country = $client->{$prefix . 'country'}) {
$str .= e($country->name) . '<br/>';
}
if ($str) {
$str = '<b>' . trans('texts.' . $addressType) . '</b><br/>' . $str;
}
return $str;
}
/**
* @return string
*/
public function getCityState($addressType = ADDRESS_BILLING)
{
$client = $this->entity;
$prefix = $addressType == ADDRESS_BILLING ? '' : 'shipping_';
$swap = $client->{$prefix . 'country'} && $client->{$prefix . 'country'}->swap_postal_code;
$city = e($client->{$prefix . 'city'});
$state = e($client->{$prefix . 'state'});
$postalCode = e($client->{$prefix . 'post_code'});
return Utils::cityStateZip($city, $state, $postalCode, $swap);
}
/** /**
* @return string * @return string
*/ */

View File

@ -38,7 +38,8 @@ class ExpenseReport extends AbstractReport
$zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.expense_documents'))); $zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.expense_documents')));
foreach ($expenses->get() as $expense) { foreach ($expenses->get() as $expense) {
foreach ($expense->documents as $document) { foreach ($expense->documents as $document) {
$name = sprintf('%s_%s_%s_%s', date('Y-m-d'), trans('texts.expense'), $expense->public_id, $document->name); $expenseId = str_pad($expense->public_id, $account->invoice_number_padding, '0', STR_PAD_LEFT);
$name = sprintf('%s_%s_%s_%s', date('Y-m-d'), trans('texts.expense'), $expenseId, $document->name);
$name = str_replace(' ', '_', $name); $name = str_replace(' ', '_', $name);
$zip->add_file($name, $document->getRaw()); $zip->add_file($name, $document->getRaw());
} }

View File

@ -4,6 +4,7 @@ namespace App\Ninja\Reports;
use App\Models\Payment; use App\Models\Payment;
use Auth; use Auth;
use Utils;
class PaymentReport extends AbstractReport class PaymentReport extends AbstractReport
{ {
@ -20,6 +21,7 @@ class PaymentReport extends AbstractReport
public function run() public function run()
{ {
$account = Auth::user()->account; $account = Auth::user()->account;
$currencyType = $this->options['currency_type'];
$invoiceMap = []; $invoiceMap = [];
$payments = Payment::scope() $payments = Payment::scope()
@ -39,22 +41,36 @@ class PaymentReport extends AbstractReport
foreach ($payments->get() as $payment) { foreach ($payments->get() as $payment) {
$invoice = $payment->invoice; $invoice = $payment->invoice;
$client = $payment->client; $client = $payment->client;
$amount = $payment->getCompletedAmount();
if ($currencyType == 'converted') {
$amount *= $payment->exchange_rate;
$this->addToTotals($payment->exchange_currency_id, 'paid', $amount);
$amount = Utils::formatMoney($amount, $payment->exchange_currency_id);
} else {
$this->addToTotals($client->currency_id, 'paid', $amount);
$amount = $account->formatMoney($amount, $client);
}
$this->data[] = [ $this->data[] = [
$this->isExport ? $client->getDisplayName() : $client->present()->link, $this->isExport ? $client->getDisplayName() : $client->present()->link,
$this->isExport ? $invoice->invoice_number : $invoice->present()->link, $this->isExport ? $invoice->invoice_number : $invoice->present()->link,
$invoice->present()->invoice_date, $invoice->present()->invoice_date,
$account->formatMoney($invoice->amount, $client), $account->formatMoney($invoice->amount, $client),
$payment->present()->payment_date, $payment->present()->payment_date,
$account->formatMoney($payment->getCompletedAmount(), $client), $amount,
$payment->present()->method, $payment->present()->method,
]; ];
if (! isset($invoiceMap[$invoice->id])) { if (! isset($invoiceMap[$invoice->id])) {
$this->addToTotals($client->currency_id, 'amount', $invoice->amount);
$invoiceMap[$invoice->id] = true; $invoiceMap[$invoice->id] = true;
}
$this->addToTotals($client->currency_id, 'paid', $payment->getCompletedAmount()); if ($currencyType == 'converted') {
$this->addToTotals($payment->exchange_currency_id, 'amount', $invoice->amount * $payment->exchange_rate);
} else {
$this->addToTotals($client->currency_id, 'amount', $invoice->amount);
}
}
} }
} }
} }

View File

@ -511,6 +511,8 @@ class InvoiceRepository extends BaseRepository
$invoice->invoice_footer = ''; $invoice->invoice_footer = '';
} }
$invoice->public_notes = isset($data['public_notes']) ? trim($data['public_notes']) : '';
// process date variables if not recurring // process date variables if not recurring
if (! $invoice->is_recurring) { if (! $invoice->is_recurring) {
$invoice->terms = Utils::processVariables($invoice->terms); $invoice->terms = Utils::processVariables($invoice->terms);

View File

@ -64,6 +64,8 @@ class PaymentRepository extends BaseRepository
'payments.routing_number', 'payments.routing_number',
'payments.bank_name', 'payments.bank_name',
'payments.private_notes', 'payments.private_notes',
'payments.exchange_rate',
'payments.exchange_currency_id',
'invoices.is_deleted as invoice_is_deleted', 'invoices.is_deleted as invoice_is_deleted',
'gateways.name as gateway_name', 'gateways.name as gateway_name',
'gateways.id as gateway_id', 'gateways.id as gateway_id',
@ -187,7 +189,7 @@ class PaymentRepository extends BaseRepository
$payment->payment_date = date('Y-m-d'); $payment->payment_date = date('Y-m-d');
} }
$payment->fill(request()->all()); $payment->fill($input);
if (! $publicId) { if (! $publicId) {
$clientId = $input['client_id']; $clientId = $input['client_id'];

View File

@ -38,6 +38,12 @@ class ClientTransformer extends EntityTransformer
* @SWG\Property(property="id_number", type="string", example="123456") * @SWG\Property(property="id_number", type="string", example="123456")
* @SWG\Property(property="language_id", type="integer", example=1) * @SWG\Property(property="language_id", type="integer", example=1)
* @SWG\Property(property="task_rate", type="number", format="float", example=10) * @SWG\Property(property="task_rate", type="number", format="float", example=10)
* @SWG\Property(property="shipping_address1", type="string", example="10 Main St.")
* @SWG\Property(property="shipping_address2", type="string", example="1st Floor")
* @SWG\Property(property="shipping_city", type="string", example="New York")
* @SWG\Property(property="shipping_state", type="string", example="NY")
* @SWG\Property(property="shipping_postal_code", type="string", example=10010)
* @SWG\Property(property="shipping_country_id", type="integer", example=840)
*/ */
protected $defaultIncludes = [ protected $defaultIncludes = [
'contacts', 'contacts',
@ -137,6 +143,12 @@ class ClientTransformer extends EntityTransformer
'invoice_number_counter' => (int) $client->invoice_number_counter, 'invoice_number_counter' => (int) $client->invoice_number_counter,
'quote_number_counter' => (int) $client->quote_number_counter, 'quote_number_counter' => (int) $client->quote_number_counter,
'task_rate' => (float) $client->task_rate, 'task_rate' => (float) $client->task_rate,
'shipping_address1' => $client->shipping_address1,
'shipping_address2' => $client->shipping_address2,
'shipping_city' => $client->shipping_city,
'shipping_state' => $client->shipping_state,
'shipping_postal_code' => $client->shipping_postal_code,
'shipping_country_id' => (int) $client->shipping_country_id,
]); ]);
} }
} }

View File

@ -60,6 +60,8 @@ class PaymentTransformer extends EntityTransformer
'invoice_id' => (int) ($this->invoice ? $this->invoice->public_id : $payment->invoice->public_id), 'invoice_id' => (int) ($this->invoice ? $this->invoice->public_id : $payment->invoice->public_id),
'invoice_number' => $this->invoice ? $this->invoice->invoice_number : $payment->invoice->invoice_number, 'invoice_number' => $this->invoice ? $this->invoice->invoice_number : $payment->invoice->invoice_number,
'private_notes' => $payment->private_notes, 'private_notes' => $payment->private_notes,
'exchange_rate' => (float) $payment->exchange_rate,
'exchange_currency_id' => (int) $payment->exchange_currency_id,
]); ]);
} }
} }

View File

@ -26,6 +26,18 @@ class AddSubdomainToLookups extends Migration
$table->decimal('exchange_rate', 13, 4)->default(1)->change(); $table->decimal('exchange_rate', 13, 4)->default(1)->change();
}); });
Schema::table('clients', function ($table) {
$table->string('shipping_address1')->nullable();
$table->string('shipping_address2')->nullable();
$table->string('shipping_city')->nullable();
$table->string('shipping_state')->nullable();
$table->string('shipping_postal_code')->nullable();
$table->unsignedInteger('shipping_country_id')->nullable();
});
Schema::table('clients', function ($table) {
$table->foreign('shipping_country_id')->references('id')->on('currencies');
});
} }
/** /**
@ -43,5 +55,15 @@ class AddSubdomainToLookups extends Migration
$table->dropColumn('exchange_rate'); $table->dropColumn('exchange_rate');
$table->dropColumn('exchange_currency_id'); $table->dropColumn('exchange_currency_id');
}); });
Schema::table('clients', function ($table) {
$table->dropForeign('clients_shipping_country_id_foreign');
$table->dropColumn('shipping_address1');
$table->dropColumn('shipping_address2');
$table->dropColumn('shipping_city');
$table->dropColumn('shipping_state');
$table->dropColumn('shipping_postal_code');
$table->dropColumn('shipping_country_id');
});
} }
} }

View File

@ -2524,6 +2524,22 @@ $LANG = array(
'your_password_reset_link' => 'Your Password Reset Link', 'your_password_reset_link' => 'Your Password Reset Link',
'subdomain_taken' => 'The subdomain is already in use', 'subdomain_taken' => 'The subdomain is already in use',
'client_login' => 'Client Login', 'client_login' => 'Client Login',
'converted_amount' => 'Converted Amount',
'default' => 'Default',
'shipping_address' => 'Shipping Address',
'bllling_address' => 'Billing Address',
'billing_address1' => 'Billing Street',
'billing_address2' => 'Billing Apt/Suite',
'billing_city' => 'Billing City',
'billing_state' => 'Billing State/Province',
'billing_postal_code' => 'Billing Postal Code',
'billing_country' => 'Billing Country',
'shipping_address1' => 'Shipping Street',
'shipping_address2' => 'Shipping Apt/Suite',
'shipping_city' => 'Shipping City',
'shipping_state' => 'Shipping State/Province',
'shipping_postal_code' => 'Shipping Postal Code',
'shipping_country' => 'Shipping Country',
); );

View File

@ -68,19 +68,42 @@
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.address') !!}</h3> <h3 class="panel-title">{!! trans('texts.address') !!}</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{!! Former::text('address1') !!} <div role="tabpanel">
{!! Former::text('address2') !!} <ul class="nav nav-tabs" role="tablist" style="border: none">
{!! Former::text('city') !!} <li role="presentation" class="active">
{!! Former::text('state') !!} <a href="#billing_address" aria-controls="billing_address" role="tab" data-toggle="tab">{{ trans('texts.billing_address') }}</a>
{!! Former::text('postal_code') !!} </li>
{!! Former::select('country_id')->addOption('','') <li role="presentation">
->fromQuery($countries, 'name', 'id') !!} <a href="#shipping_address" aria-controls="shipping_address" role="tab" data-toggle="tab">{{ trans('texts.shipping_address') }}</a>
</li>
</ul>
</div>
<div class="tab-content" style="padding-top:24px;">
<div role="tabpanel" class="tab-pane active" id="billing_address">
{!! Former::text('address1') !!}
{!! Former::text('address2') !!}
{!! Former::text('city') !!}
{!! Former::text('state') !!}
{!! Former::text('postal_code') !!}
{!! Former::select('country_id')->addOption('','')
->fromQuery($countries, 'name', 'id') !!}
</div>
<div role="tabpanel" class="tab-pane" id="shipping_address">
{!! Former::text('shipping_address1')->label('address1') !!}
{!! Former::text('shipping_address2')->label('address2') !!}
{!! Former::text('shipping_city')->label('city') !!}
{!! Former::text('shipping_state')->label('state') !!}
{!! Former::text('shipping_postal_code')->label('postal_code') !!}
{!! Former::select('shipping_country_id')->addOption('','')
->fromQuery($countries, 'name', 'id')->label('country_id') !!}
</div>
</div>
</div> </div>
</div> </div>
@ -233,7 +256,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('#country_id').combobox(); $('#country_id, #shipping_country_id').combobox();
}); });
function ContactModel(data) { function ContactModel(data) {

View File

@ -98,18 +98,8 @@
<p><i class="fa fa-vat-number" style="width: 20px"></i>{{ trans('texts.vat_number').': '.$client->vat_number }}</p> <p><i class="fa fa-vat-number" style="width: 20px"></i>{{ trans('texts.vat_number').': '.$client->vat_number }}</p>
@endif @endif
@if ($client->address1) {!! $client->present()->address(ADDRESS_BILLING) !!}
{{ $client->address1 }}<br/> {!! $client->present()->address(ADDRESS_SHIPPING) !!}
@endif
@if ($client->address2)
{{ $client->address2 }}<br/>
@endif
@if ($client->getCityState())
{{ $client->getCityState() }}<br/>
@endif
@if ($client->country)
{{ $client->country->name }}<br/>
@endif
<br/> <br/>

View File

@ -5,12 +5,18 @@
@endif @endif
<td>{{ trans('texts.balance') }}</td> <td>{{ trans('texts.balance') }}</td>
<td>{{ trans('texts.paid_to_date') }}</td> <td>{{ trans('texts.paid_to_date') }}</td>
<td>{{ trans('texts.address1') }}</td> <td>{{ trans('texts.billing_address1') }}</td>
<td>{{ trans('texts.address2') }}</td> <td>{{ trans('texts.billing_address2') }}</td>
<td>{{ trans('texts.city') }}</td> <td>{{ trans('texts.billing_city') }}</td>
<td>{{ trans('texts.state') }}</td> <td>{{ trans('texts.billing_state') }}</td>
<td>{{ trans('texts.postal_code') }}</td> <td>{{ trans('texts.billing_postal_code') }}</td>
<td>{{ trans('texts.country') }}</td> <td>{{ trans('texts.billing_country') }}</td>
<td>{{ trans('texts.shipping_address1') }}</td>
<td>{{ trans('texts.shipping_address2') }}</td>
<td>{{ trans('texts.shipping_city') }}</td>
<td>{{ trans('texts.shipping_state') }}</td>
<td>{{ trans('texts.shipping_postal_code') }}</td>
<td>{{ trans('texts.shipping_country') }}</td>
<td>{{ trans('texts.id_number') }}</td> <td>{{ trans('texts.id_number') }}</td>
<td>{{ trans('texts.vat_number') }}</td> <td>{{ trans('texts.vat_number') }}</td>
<td>{{ trans('texts.website') }}</td> <td>{{ trans('texts.website') }}</td>
@ -50,6 +56,12 @@
<td>{{ $client->state }}</td> <td>{{ $client->state }}</td>
<td>{{ $client->postal_code }}</td> <td>{{ $client->postal_code }}</td>
<td>{{ $client->present()->country }}</td> <td>{{ $client->present()->country }}</td>
<td>{{ $client->shipping_address1 }}</td>
<td>{{ $client->shipping_address2 }}</td>
<td>{{ $client->shipping_city }}</td>
<td>{{ $client->shipping_state }}</td>
<td>{{ $client->shipping_postal_code }}</td>
<td>{{ $client->present()->shipping_country }}</td>
<td>{{ $client->id_number }}</td> <td>{{ $client->id_number }}</td>
<td>{{ $client->vat_number }}</td> <td>{{ $client->vat_number }}</td>
<td>{{ $client->website }}</td> <td>{{ $client->website }}</td>

View File

@ -9,6 +9,7 @@
<td>{{ trans('texts.method') }}</td> <td>{{ trans('texts.method') }}</td>
<td>{{ trans('texts.transaction_reference') }}</td> <td>{{ trans('texts.transaction_reference') }}</td>
<td>{{ trans('texts.private_notes') }}</td> <td>{{ trans('texts.private_notes') }}</td>
<td>{{ trans('texts.converted_amount') }}</td>
</tr> </tr>
@foreach ($payments as $payment) @foreach ($payments as $payment)
@ -24,6 +25,7 @@
<td>{{ $payment->present()->method }}</td> <td>{{ $payment->present()->method }}</td>
<td>{{ $payment->transaction_reference }}</td> <td>{{ $payment->transaction_reference }}</td>
<td>{{ $payment->private_notes }}</td> <td>{{ $payment->private_notes }}</td>
<td>{{ Utils::formatMoney($payment->amount * $payment->exchange_rate, $payment->exchange_currency_id) }}</td>
</tr> </tr>
@endif @endif
@endforeach @endforeach

View File

@ -27,8 +27,18 @@
@endif @endif
NINJA.parseFloat = function(str) { NINJA.parseFloat = function(str) {
if (!str) return ''; if (! str) {
str = (str+'').replace(/[^0-9\.\-]/g, ''); return '';
} else {
str = str + '';
}
// check for comma as decimal separator
if (str.match(/,[\d]{1,2}$/)) {
str = str.replace(',', '.');
}
str = str.replace(/[^0-9\.\-]/g, '');
return window.parseFloat(str); return window.parseFloat(str);
} }

View File

@ -90,7 +90,7 @@
{!! Former::text('exchange_rate') {!! Former::text('exchange_rate')
->data_bind("value: exchange_rate, enable: enableExchangeRate, valueUpdate: 'afterkeydown'") !!} ->data_bind("value: exchange_rate, enable: enableExchangeRate, valueUpdate: 'afterkeydown'") !!}
{!! Former::text('') {!! Former::text('')
->label(trans('texts.amount')) ->label(trans('texts.converted_amount'))
->data_bind("value: convertedAmount, enable: enableExchangeRate") ->data_bind("value: convertedAmount, enable: enableExchangeRate")
->append('<span data-bind="html: exchangeCurrencyCode"></span>') !!} ->append('<span data-bind="html: exchangeCurrencyCode"></span>') !!}
</div> </div>

View File

@ -141,6 +141,12 @@
->addOption(trans('texts.payment_date'), FILTER_PAYMENT_DATE) !!} ->addOption(trans('texts.payment_date'), FILTER_PAYMENT_DATE) !!}
</div> </div>
<div id="currencyType" style="display:none">
{!! Former::select('currency_type')->label(trans('texts.currency'))
->addOption(trans('texts.default'), 'default')
->addOption(trans('texts.converted'), 'converted') !!}
</div>
<div id="invoiceOrExpenseField" style="display:none"> <div id="invoiceOrExpenseField" style="display:none">
{!! Former::select('document_filter')->label('filter') {!! Former::select('document_filter')->label('filter')
->addOption(trans('texts.all'), '') ->addOption(trans('texts.all'), '')
@ -283,6 +289,7 @@
$('#dateField').toggle(val == '{{ ENTITY_TAX_RATE }}'); $('#dateField').toggle(val == '{{ ENTITY_TAX_RATE }}');
$('#statusField').toggle(val == '{{ ENTITY_INVOICE }}' || val == '{{ ENTITY_PRODUCT }}'); $('#statusField').toggle(val == '{{ ENTITY_INVOICE }}' || val == '{{ ENTITY_PRODUCT }}');
$('#invoiceOrExpenseField').toggle(val == '{{ ENTITY_DOCUMENT }}'); $('#invoiceOrExpenseField').toggle(val == '{{ ENTITY_DOCUMENT }}');
$('#currencyType').toggle(val == '{{ ENTITY_PAYMENT }}');
} }
function setDocumentZipShown() { function setDocumentZipShown() {