1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Working on Invoice Taxes

This commit is contained in:
David Bomba 2019-10-17 16:09:52 +11:00
parent 6fb9ba89ee
commit 85ba2091fc
4 changed files with 14 additions and 11 deletions

View File

@ -144,7 +144,9 @@ class InvoiceItemSum
if($item_tax_rate3_total > 0)
$this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total);
$this->setTotalTaxes($item_tax);
\Log::error($this->getTotalTaxes());
return $this;
}
@ -255,6 +257,7 @@ class InvoiceItemSum
if($item_tax_rate3_total > 0)
$this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total);
\Log::error($item_tax);
}
$this->setTotalTaxes($item_tax);

View File

@ -189,13 +189,13 @@ class InvoiceSum
{
$paid_to_date = $this->invoice->amount - $this->invoice->balance;
$this->invoice->balance = $this->getTotal() - $paid_to_date;
$this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision) - $paid_to_date;
}
else
$this->invoice->balance = $this->getTotal();
$this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
/* Set new calculated total */
$this->invoice->amount = $this->getTotal();
$this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
return $this;
}
@ -253,7 +253,7 @@ class InvoiceSum
return $value['key'] == $key;
})->sum('total');
$total_line_tax -= $this->discount($total_line_tax);
//$total_line_tax -= $this->discount($total_line_tax);
$this->tax_map[] = ['name' => $tax_name, 'total' => $total_line_tax];

View File

@ -36,23 +36,23 @@ trait Taxer
public function exclusiveTax($tax_rate, $item)
{
$tax_rate = $this->formatValue($tax_rate, $this->currency->precision);
$tax_rate = $this->formatValue($tax_rate, 4);
return $this->formatValue(($item->line_total * $tax_rate/100), $this->currency->precision);
return $this->formatValue(($item->line_total * $tax_rate/100), 4);
}
public function calcAmountLineTax($tax_rate, $amount)
{
return $this->formatValue(($amount * $tax_rate/100), $this->currency->precision);
return $this->formatValue(($amount * $tax_rate/100), 4);
}
public function inclusiveTax($tax_rate, $item)
{
$tax_rate = $this->formatValue($tax_rate, $this->currency->precision);
$tax_rate = $this->formatValue($tax_rate, 4);
return $this->formatValue(($item->line_total - ($item->line_total / (1+$tax_rate/100))) , $this->currency->precision);
return $this->formatValue(($item->line_total - ($item->line_total / (1+$tax_rate/100))) , 4);
}
}

View File

@ -49,8 +49,8 @@ class QueryLogging
$time = $timeEnd - $timeStart;
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
if($count > 50)
Log::info($queries);
// if($count > 50)
// Log::info($queries);
}
}