mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add gross line and subtotals
This commit is contained in:
parent
33c05b1ad0
commit
618027dcd8
@ -654,6 +654,7 @@ class CompanySettings extends BaseSettings
|
||||
'$product.discount',
|
||||
'$product.tax',
|
||||
'$product.line_total',
|
||||
'$product.gross_line_total',
|
||||
],
|
||||
'task_columns' =>[
|
||||
'$task.service',
|
||||
@ -663,9 +664,11 @@ class CompanySettings extends BaseSettings
|
||||
'$task.discount',
|
||||
'$task.tax',
|
||||
'$task.line_total',
|
||||
'$task.gross_line_total',
|
||||
],
|
||||
'total_columns' => [
|
||||
'$net_subtotal',
|
||||
'$gross_subtotal',
|
||||
'$subtotal',
|
||||
'$discount',
|
||||
'$custom_surcharge1',
|
||||
|
@ -150,7 +150,6 @@ class InvoiceItemSum
|
||||
|
||||
if($item_tax_rate3_total != 0)
|
||||
$this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total);
|
||||
|
||||
|
||||
$this->setTotalTaxes($this->formatValue($item_tax, $this->currency->precision));
|
||||
|
||||
@ -223,7 +222,7 @@ class InvoiceItemSum
|
||||
|
||||
public function getGrossSubTotal()
|
||||
{
|
||||
return $this->gross_line_total;
|
||||
return $this->gross_sub_total;
|
||||
}
|
||||
|
||||
public function setSubTotal($value)
|
||||
@ -281,6 +280,7 @@ 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);
|
||||
|
@ -199,6 +199,11 @@ class InvoiceItemSumInclusive
|
||||
return $this->sub_total;
|
||||
}
|
||||
|
||||
public function getGrossSubTotal()
|
||||
{
|
||||
return $this->sub_total;
|
||||
}
|
||||
|
||||
public function setSubTotal($value)
|
||||
{
|
||||
$this->sub_total = $value;
|
||||
|
@ -381,6 +381,7 @@ class HtmlEngine
|
||||
$data['$product.tax_name2'] = ['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.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
||||
$data['$product.description'] = ['value' => '', 'label' => ctrans('texts.description')];
|
||||
$data['$product.unit_cost'] = ['value' => '', 'label' => ctrans('texts.unit_cost')];
|
||||
$data['$product.product1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'product1')];
|
||||
@ -400,6 +401,7 @@ class HtmlEngine
|
||||
$data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||
$data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||
$data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
||||
$data['$task.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
|
||||
$data['$task.service'] = ['value' => '', 'label' => ctrans('texts.service')];
|
||||
$data['$task.task1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'task1')];
|
||||
$data['$task.task2'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'task2')];
|
||||
|
@ -311,6 +311,7 @@ trait MakesInvoiceValues
|
||||
$data[$key][$table_type.'.cost'] = Number::formatMoney($item->cost, $this->client);
|
||||
|
||||
$data[$key][$table_type.'.line_total'] = Number::formatMoney($item->line_total, $this->client);
|
||||
$data[$key][$table_type.'.gross_line_total'] = Number::formatMoney($item->gross_line_total, $this->client);
|
||||
|
||||
if (isset($item->discount) && $item->discount > 0) {
|
||||
if ($item->is_amount_discount) {
|
||||
|
@ -123,6 +123,7 @@ class InvoiceTest extends TestCase
|
||||
$this->invoice_calc->build();
|
||||
|
||||
$this->assertEquals($this->invoice_calc->getSubTotal(), 20);
|
||||
// $this->assertEquals($this->invoice_calc->getGrossSubTotal(), 22);
|
||||
//$this->assertEquals($this->invoice_calc->getTotal(), 21.5);
|
||||
//$this->assertEquals($this->invoice_calc->getBalance(), 21.5);
|
||||
//$this->assertEquals($this->invoice_calc->getTotalTaxes(), 1.5);
|
||||
@ -216,6 +217,7 @@ class InvoiceTest extends TestCase
|
||||
$this->invoice_calc->build();
|
||||
|
||||
$this->assertEquals($this->invoice_calc->getSubTotal(), 20);
|
||||
$this->assertEquals($this->invoice_calc->getGrossSubTotal(), 22);
|
||||
//$this->assertEquals($this->invoice_calc->getTotal(), 26);
|
||||
//$this->assertEquals($this->invoice_calc->getBalance(), 26);
|
||||
//$this->assertEquals($this->invoice_calc->getTotalTaxes(), 4);
|
||||
|
Loading…
x
Reference in New Issue
Block a user