mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on gateway fees
This commit is contained in:
parent
d105943bf3
commit
e0b05abac3
@ -28,8 +28,8 @@ trait ChargesFees
|
|||||||
if ($settings->fee_percent) {
|
if ($settings->fee_percent) {
|
||||||
// prevent charging taxes twice on the surcharge
|
// prevent charging taxes twice on the surcharge
|
||||||
$amount = $this->amount;
|
$amount = $this->amount;
|
||||||
$taxField = $account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? 'custom_invoice_taxes1' : 'custom_invoice_taxes1';
|
$taxField = $account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? 'custom_taxes1' : 'custom_taxes1';
|
||||||
if ($account->$taxField) {
|
if ($this->$taxField) {
|
||||||
$taxAmount = 0;
|
$taxAmount = 0;
|
||||||
foreach ($this->getTaxes() as $key => $tax) {
|
foreach ($this->getTaxes() as $key => $tax) {
|
||||||
$taxAmount += $tax['amount'];
|
$taxAmount += $tax['amount'];
|
||||||
|
@ -336,6 +336,8 @@ class InvoiceRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
$invoice = $account->createInvoice($entityType, $data['client_id']);
|
$invoice = $account->createInvoice($entityType, $data['client_id']);
|
||||||
$invoice->invoice_date = date_create()->format('Y-m-d');
|
$invoice->invoice_date = date_create()->format('Y-m-d');
|
||||||
|
$invoice->custom_taxes1 = $account->custom_invoice_taxes1 ?: false;
|
||||||
|
$invoice->custom_taxes2 = $account->custom_invoice_taxes2 ?: false;
|
||||||
if (isset($data['has_tasks']) && filter_var($data['has_tasks'], FILTER_VALIDATE_BOOLEAN)) {
|
if (isset($data['has_tasks']) && filter_var($data['has_tasks'], FILTER_VALIDATE_BOOLEAN)) {
|
||||||
$invoice->has_tasks = true;
|
$invoice->has_tasks = true;
|
||||||
}
|
}
|
||||||
@ -512,15 +514,9 @@ class InvoiceRepository extends BaseRepository
|
|||||||
|
|
||||||
if (isset($data['custom_value1'])) {
|
if (isset($data['custom_value1'])) {
|
||||||
$invoice->custom_value1 = round($data['custom_value1'], 2);
|
$invoice->custom_value1 = round($data['custom_value1'], 2);
|
||||||
if ($isNew) {
|
|
||||||
$invoice->custom_taxes1 = $account->custom_invoice_taxes1 ?: false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isset($data['custom_value2'])) {
|
if (isset($data['custom_value2'])) {
|
||||||
$invoice->custom_value2 = round($data['custom_value2'], 2);
|
$invoice->custom_value2 = round($data['custom_value2'], 2);
|
||||||
if ($isNew) {
|
|
||||||
$invoice->custom_taxes2 = $account->custom_invoice_taxes2 ?: false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['custom_text_value1'])) {
|
if (isset($data['custom_text_value1'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user