mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 22:24:36 -04:00
item tax amounts
This commit is contained in:
parent
14569d2d79
commit
d0178d22ae
@ -45,6 +45,8 @@ class InvoiceItem
|
|||||||
|
|
||||||
public $gross_line_total = 0;
|
public $gross_line_total = 0;
|
||||||
|
|
||||||
|
public $gross_tax_total = 0;
|
||||||
|
|
||||||
public $date = '';
|
public $date = '';
|
||||||
|
|
||||||
public $custom_value1 = '';
|
public $custom_value1 = '';
|
||||||
@ -75,6 +77,7 @@ class InvoiceItem
|
|||||||
'sort_id' => 'string',
|
'sort_id' => 'string',
|
||||||
'line_total' => 'float',
|
'line_total' => 'float',
|
||||||
'gross_line_total' => 'float',
|
'gross_line_total' => 'float',
|
||||||
|
'gross_tax_total' => 'float',
|
||||||
'date' => 'string',
|
'date' => 'string',
|
||||||
'custom_value1' => 'string',
|
'custom_value1' => 'string',
|
||||||
'custom_value2' => 'string',
|
'custom_value2' => 'string',
|
||||||
|
@ -30,6 +30,8 @@ class InvoiceItemSum
|
|||||||
|
|
||||||
private $gross_line_total;
|
private $gross_line_total;
|
||||||
|
|
||||||
|
private $gross_tax_total;
|
||||||
|
|
||||||
private $currency;
|
private $currency;
|
||||||
|
|
||||||
private $total_taxes;
|
private $total_taxes;
|
||||||
@ -111,14 +113,10 @@ class InvoiceItemSum
|
|||||||
$this->setLineTotal($this->getLineTotal() - $this->formatValue($this->item->discount, $this->currency->precision));
|
$this->setLineTotal($this->getLineTotal() - $this->formatValue($this->item->discount, $this->currency->precision));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/*Test 16-08-2021*/
|
|
||||||
$discount = ($this->item->line_total * ($this->item->discount / 100));
|
$discount = ($this->item->line_total * ($this->item->discount / 100));
|
||||||
|
|
||||||
$this->setLineTotal($this->formatValue(($this->getLineTotal() - $discount), $this->currency->precision));
|
$this->setLineTotal($this->formatValue(($this->getLineTotal() - $discount), $this->currency->precision));
|
||||||
/*Test 16-08-2021*/
|
|
||||||
|
|
||||||
//replaces the following
|
|
||||||
|
|
||||||
// $this->setLineTotal($this->getLineTotal() - $this->formatValue(round($this->item->line_total * ($this->item->discount / 100), 2), $this->currency->precision));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
||||||
@ -160,6 +158,8 @@ class InvoiceItemSum
|
|||||||
|
|
||||||
$this->item->gross_line_total = $this->getLineTotal() + $item_tax;
|
$this->item->gross_line_total = $this->getLineTotal() + $item_tax;
|
||||||
|
|
||||||
|
$this->item->gross_tax_total = $item_tax;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ class InvoiceItemSumInclusive
|
|||||||
|
|
||||||
private $tax_collection;
|
private $tax_collection;
|
||||||
|
|
||||||
|
private $gross_tax_total;
|
||||||
|
|
||||||
public function __construct($invoice)
|
public function __construct($invoice)
|
||||||
{
|
{
|
||||||
$this->tax_collection = collect([]);
|
$this->tax_collection = collect([]);
|
||||||
@ -144,6 +146,8 @@ class InvoiceItemSumInclusive
|
|||||||
$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->item->gross_tax_total = $this->formatValue($item_tax, $this->currency->precision);
|
||||||
|
|
||||||
$this->setTotalTaxes($this->formatValue($item_tax, $this->currency->precision));
|
$this->setTotalTaxes($this->formatValue($item_tax, $this->currency->precision));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -485,6 +485,7 @@ class HtmlEngine
|
|||||||
$data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
$data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
$data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
$data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
||||||
$data['$product.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.gross_line_total')];
|
$data['$product.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.gross_line_total')];
|
||||||
|
$data['$product.gross_tax_total'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
$data['$product.description'] = ['value' => '', 'label' => ctrans('texts.description')];
|
$data['$product.description'] = ['value' => '', 'label' => ctrans('texts.description')];
|
||||||
$data['$product.unit_cost'] = ['value' => '', 'label' => ctrans('texts.unit_cost')];
|
$data['$product.unit_cost'] = ['value' => '', 'label' => ctrans('texts.unit_cost')];
|
||||||
$data['$product.product1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'product1')];
|
$data['$product.product1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'product1')];
|
||||||
|
@ -161,8 +161,6 @@ trait MakesInvoiceValues
|
|||||||
|
|
||||||
if (strlen($user_columns) > 1) {
|
if (strlen($user_columns) > 1) {
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
// $tmp = str_replace(array_keys($data), array_values($data), $user_columns);
|
|
||||||
// $tmp = str_replace(array_keys($item), array_values($item), $tmp);
|
|
||||||
$tmp = strtr($user_columns, $data);
|
$tmp = strtr($user_columns, $data);
|
||||||
$tmp = strtr($tmp, $item);
|
$tmp = strtr($tmp, $item);
|
||||||
|
|
||||||
@ -178,8 +176,6 @@ trait MakesInvoiceValues
|
|||||||
$table_row .= '</tr>';
|
$table_row .= '</tr>';
|
||||||
|
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
// $tmp = str_replace(array_keys($item), array_values($item), $table_row);
|
|
||||||
// $tmp = str_replace(array_keys($data), array_values($data), $tmp);
|
|
||||||
$tmp = strtr($table_row, $item);
|
$tmp = strtr($table_row, $item);
|
||||||
$tmp = strtr($tmp, $data);
|
$tmp = strtr($tmp, $data);
|
||||||
|
|
||||||
@ -210,11 +206,13 @@ trait MakesInvoiceValues
|
|||||||
'tax_name1',
|
'tax_name1',
|
||||||
'tax_name2',
|
'tax_name2',
|
||||||
'tax_name3',
|
'tax_name3',
|
||||||
|
'gross_tax_total',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'tax',
|
'tax',
|
||||||
'tax',
|
'tax',
|
||||||
'tax',
|
'tax',
|
||||||
|
'tax',
|
||||||
],
|
],
|
||||||
$columns
|
$columns
|
||||||
);
|
);
|
||||||
@ -329,6 +327,12 @@ trait MakesInvoiceValues
|
|||||||
$data[$key][$table_type.'.gross_line_total'] = '';
|
$data[$key][$table_type.'.gross_line_total'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property_exists($item, 'gross_tax_total')) {
|
||||||
|
$data[$key][$table_type.'.gross_tax_total'] = ($item->gross_tax_total == 0) ? '' : Number::formatMoney($item->gross_tax_total, $entity);
|
||||||
|
} else {
|
||||||
|
$data[$key][$table_type.'.gross_tax_total'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($item->discount) && $item->discount > 0) {
|
if (isset($item->discount) && $item->discount > 0) {
|
||||||
if ($item->is_amount_discount) {
|
if ($item->is_amount_discount) {
|
||||||
$data[$key][$table_type.'.discount'] = Number::formatMoney($item->discount, $entity);
|
$data[$key][$table_type.'.discount'] = Number::formatMoney($item->discount, $entity);
|
||||||
|
@ -355,6 +355,7 @@ class VendorHtmlEngine
|
|||||||
$data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
$data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
$data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
$data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
||||||
$data['$product.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.gross_line_total')];
|
$data['$product.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.gross_line_total')];
|
||||||
|
$data['$product.gross_tax_total'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
$data['$product.description'] = ['value' => '', 'label' => ctrans('texts.description')];
|
$data['$product.description'] = ['value' => '', 'label' => ctrans('texts.description')];
|
||||||
$data['$product.unit_cost'] = ['value' => '', 'label' => ctrans('texts.unit_cost')];
|
$data['$product.unit_cost'] = ['value' => '', 'label' => ctrans('texts.unit_cost')];
|
||||||
$data['$product.product1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'product1')];
|
$data['$product.product1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'product1')];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user