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

View File

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

View File

@ -36,23 +36,23 @@ trait Taxer
public function exclusiveTax($tax_rate, $item) 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) 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) 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; $time = $timeEnd - $timeStart;
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time); Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
if($count > 50) // if($count > 50)
Log::info($queries); // Log::info($queries);
} }
} }