mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Support taxing the fee
This commit is contained in:
parent
daec25fe79
commit
0c3db5a8e4
@ -1190,10 +1190,12 @@ class AccountController extends BaseController
|
||||
$account->auto_bill_on_due_date = boolval(Input::get('auto_bill_on_due_date'));
|
||||
$account->gateway_fee_location = Input::get('gateway_fee_location') ?: null;
|
||||
|
||||
/*
|
||||
if ($account->gateway_fee_location) {
|
||||
$taxField = $account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? 'custom_invoice_taxes1' : 'custom_invoice_taxes1';
|
||||
$account->$taxField = false;
|
||||
}
|
||||
*/
|
||||
|
||||
$account->save();
|
||||
|
||||
|
@ -26,7 +26,18 @@ trait ChargesFees
|
||||
}
|
||||
|
||||
if ($settings->fee_percent) {
|
||||
$fee += $this->amount * $settings->fee_percent / 100;
|
||||
// prevent charging taxes twice on the surcharge
|
||||
$amount = $this->getRequestedAmount();
|
||||
$taxField = $account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? 'custom_invoice_taxes1' : 'custom_invoice_taxes1';
|
||||
if ($account->$taxField) {
|
||||
$taxAmount = 0;
|
||||
foreach ($this->getTaxes() as $key => $tax) {
|
||||
$taxAmount += $tax['amount'] - $tax['paid'];
|
||||
}
|
||||
$amount -= $taxAmount;
|
||||
}
|
||||
|
||||
$fee += $amount * $settings->fee_percent / 100;
|
||||
}
|
||||
|
||||
if ($account->gateway_fee_location == FEE_LOCATION_ITEM && $includeTax) {
|
||||
|
@ -238,7 +238,7 @@
|
||||
->label(trans('texts.field_label'))
|
||||
->placeholder($account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? trans('texts.surcharge') : ' ')
|
||||
->addGroupClass('pad-checkbox')
|
||||
->append($account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? false :
|
||||
->append($account->gateway_fee_location == FEE_LOCATION_CHARGE1 && false ? false :
|
||||
Former::checkbox('custom_invoice_taxes1')
|
||||
->value(1)
|
||||
->raw() . trans('texts.charge_taxes')) !!}
|
||||
@ -247,7 +247,7 @@
|
||||
->label(trans('texts.field_label'))
|
||||
->placeholder($account->gateway_fee_location == FEE_LOCATION_CHARGE2 ? trans('texts.surcharge') : ' ')
|
||||
->addGroupClass('pad-checkbox')
|
||||
->append($account->gateway_fee_location == FEE_LOCATION_CHARGE2 ? false :
|
||||
->append($account->gateway_fee_location == FEE_LOCATION_CHARGE2 && false ? false :
|
||||
Former::checkbox('custom_invoice_taxes2')
|
||||
->value(1)
|
||||
->raw() . trans('texts.charge_taxes'))
|
||||
|
Loading…
Reference in New Issue
Block a user