mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 07:34:34 -04:00
Fixes for expense reports
This commit is contained in:
parent
52e4931b68
commit
bb23241291
@ -259,10 +259,17 @@ class ExpenseExport extends BaseExport
|
|||||||
{
|
{
|
||||||
$precision = $expense->currency->precision ?? 2;
|
$precision = $expense->currency->precision ?? 2;
|
||||||
|
|
||||||
$entity['expense.net_amount'] = round($expense->amount, $precision);
|
|
||||||
|
|
||||||
if($expense->calculate_tax_by_amount) {
|
if($expense->calculate_tax_by_amount) {
|
||||||
|
|
||||||
$total_tax_amount = round($expense->tax_amount1 + $expense->tax_amount2 + $expense->tax_amount3, $precision);
|
$total_tax_amount = round($expense->tax_amount1 + $expense->tax_amount2 + $expense->tax_amount3, $precision);
|
||||||
|
|
||||||
|
if($expense->uses_inclusive_taxes) {
|
||||||
|
$entity['expense.net_amount'] = round($expense->amount, $precision) - $total_tax_amount;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$entity['expense.net_amount'] = round($expense->amount, $precision);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if($expense->uses_inclusive_taxes) {
|
if($expense->uses_inclusive_taxes) {
|
||||||
|
@ -261,7 +261,7 @@ class TaskRepository extends BaseRepository
|
|||||||
|
|
||||||
public function roundTimeLog(int $start_time, int $end_time): int
|
public function roundTimeLog(int $start_time, int $end_time): int
|
||||||
{
|
{
|
||||||
if($this->task_round_to_nearest == 1 || $end_time == 0) {
|
if(in_array($this->task_round_to_nearest, [0,1]) || $end_time == 0) {
|
||||||
return $end_time;
|
return $end_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +189,22 @@ class TaskApiTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testTaskDivisionByZero()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
"rate" => 0,
|
||||||
|
"time_log" => '[[1719350900,1719352700,"",true]]',
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->postJson("/api/v1/tasks", $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function testRequestRuleParsing()
|
public function testRequestRuleParsing()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user