diff --git a/app/Models/AccountGatewaySettings.php b/app/Models/AccountGatewaySettings.php
index e8061bf8f140..a9ced94e8597 100644
--- a/app/Models/AccountGatewaySettings.php
+++ b/app/Models/AccountGatewaySettings.php
@@ -49,6 +49,11 @@ class AccountGatewaySettings extends EntityModel
return floatval($this->fee_amount) || floatval($this->fee_percent);
}
+ public function hasTaxes()
+ {
+ return floatval($this->fee_tax_rate1) || floatval($this->fee_tax_rate1);
+ }
+
public function feesToString()
{
$parts = [];
@@ -61,10 +66,6 @@ class AccountGatewaySettings extends EntityModel
$parts[] = (floor($this->fee_percent * 1000) / 1000) . '%';
}
- if ($this->fee_location == FEE_LOCATION_ITEM && (floatval($this->fee_tax_rate1) || floatval($this->fee_tax_rate1))) {
- $parts[] = trans('texts.tax');
- }
-
return join(' + ', $parts);
}
}
diff --git a/app/Ninja/Datatables/AccountGatewayDatatable.php b/app/Ninja/Datatables/AccountGatewayDatatable.php
index 0289915f4e9b..518980ee2a1d 100644
--- a/app/Ninja/Datatables/AccountGatewayDatatable.php
+++ b/app/Ninja/Datatables/AccountGatewayDatatable.php
@@ -97,7 +97,7 @@ class AccountGatewayDatatable extends EntityDatatable
[
'fees',
function ($model) {
- if (! $model->gateway_fee_location) {
+ if (! $feeLocation = $model->gateway_fee_location) {
return trans('texts.fees_disabled');
}
@@ -118,6 +118,17 @@ class AccountGatewayDatatable extends EntityDatatable
$html .= $gatewayType->name . ' — ';
}
$html .= $accountGatewaySettings->feesToString();
+
+ if ($feeLocation == FEE_LOCATION_ITEM) {
+ if ($accountGatewaySettings->hasTaxes()) {
+ $html .= ' + ' . trans('texts.tax');
+ }
+ } else {
+ $field = ($feeLocation == FEE_LOCATION_CHARGE1 ? 'custom_invoice_taxes1' : 'custom_invoice_taxes1');
+ if (\Auth::user()->account->$field) {
+ $html .= ' + ' . trans('texts.tax');
+ }
+ }
};
return $html ?: trans('texts.no_fees');
},
diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php
index f0291ae4addf..9a210c6c9e47 100644
--- a/resources/lang/en/texts.php
+++ b/resources/lang/en/texts.php
@@ -2401,7 +2401,7 @@ $LANG = array(
'fees' => 'Fees',
'fee' => 'Fee',
'set_limits_fees' => 'Set :gateway_type Limits/Fees',
- 'fees_tax_help' => 'Enable line item taxes to set fee tax rates.',
+ 'fees_tax_help' => 'Enable line item taxes to set the fee tax rates.',
'fees_sample' => 'The fee for a :amount invoice would be :total.',
'discount_sample' => 'The discount for a :amount invoice would be :total.',
'no_fees' => 'No Fees',
@@ -2410,12 +2410,14 @@ $LANG = array(
'location' => 'Location',
'line_item' => 'Line Item',
'surcharge' => 'Surcharge',
- 'first_surcharge' => 'Enabled - Use first surcharge',
- 'second_surcharge' => 'Enabled - Use second surcharge',
+ 'location_first_surcharge' => 'Enabled - First surcharge',
+ 'location_second_surcharge' => 'Enabled - Second surcharge',
+ 'location_line_item' => 'Enabled - Line item',
'online_payment_surcharge' => 'Online Payment Surcharge',
'gateway_fees' => 'Gateway Fees',
'fees_disabled' => 'Fees are disabled',
- 'gateway_fees_help' => 'Automatically add an online payment surcharge [partial payments are not supported].',
+ //'gateway_fees_help' => 'Automatically add an online payment surcharge [partial payments are not supported].',
+ 'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.
Use \'Line item\' to support partial payments.',
'gateway' => 'Gateway',
);
diff --git a/resources/views/accounts/payments.blade.php b/resources/views/accounts/payments.blade.php
index 1749901f7102..198b7115c5fb 100644
--- a/resources/views/accounts/payments.blade.php
+++ b/resources/views/accounts/payments.blade.php
@@ -27,9 +27,9 @@
{!! Former::select('gateway_fee_location')
->addOption(trans('texts.disabled'), '')
- ->addOption(trans('texts.first_surcharge') . ($account->custom_invoice_label1 ? ' | ' . $account->custom_invoice_label1 : ''), FEE_LOCATION_CHARGE1)
- ->addOption(trans('texts.second_surcharge') . ($account->custom_invoice_label2 ? ' | ' . $account->custom_invoice_label2 : '' ), FEE_LOCATION_CHARGE2)
- //->addOption(trans('texts.line_item'), FEE_LOCATION_ITEM)
+ ->addOption(trans('texts.location_first_surcharge') . ($account->custom_invoice_label1 ? ' | ' . $account->custom_invoice_label1 : ''), FEE_LOCATION_CHARGE1)
+ ->addOption(trans('texts.location_second_surcharge') . ($account->custom_invoice_label2 ? ' | ' . $account->custom_invoice_label2 : '' ), FEE_LOCATION_CHARGE2)
+ ->addOption(trans('texts.location_line_item'), FEE_LOCATION_ITEM)
->help('gateway_fees_help')
->label('gateway_fees')!!}
@@ -164,14 +164,15 @@
{!! Former::text('fee_tax_rate1') !!}
{!! Former::text('fee_tax_name2') !!}
{!! Former::text('fee_tax_rate2') !!}
+
+
+