mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
add breaks into switcher
This commit is contained in:
parent
31bfb83875
commit
f1ee1cdb9f
@ -161,20 +161,12 @@ class InvoiceItemSum
|
|||||||
->sumLineItem()
|
->sumLineItem()
|
||||||
->setDiscount()
|
->setDiscount()
|
||||||
->calcTaxes()
|
->calcTaxes()
|
||||||
->roundLineItem()
|
|
||||||
->push();
|
->push();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function roundLineItem(): self
|
|
||||||
{
|
|
||||||
$this->item->line_total = round($this->item->line_total, $this->currency->precision);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function shouldCalculateTax(): self
|
private function shouldCalculateTax(): self
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -165,7 +165,6 @@ class InvoiceSum
|
|||||||
{
|
{
|
||||||
if (! isset($this->invoice->id) && isset($this->invoice->partial)) {
|
if (! isset($this->invoice->id) && isset($this->invoice->partial)) {
|
||||||
$this->invoice->partial = max(0, min(Number::roundValue($this->invoice->partial, 2), $this->invoice->balance));
|
$this->invoice->partial = max(0, min(Number::roundValue($this->invoice->partial, 2), $this->invoice->balance));
|
||||||
// $this->invoice->partial = max(0, min($this->formatValue($this->invoice->partial, 2), $this->invoice->balance));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -302,7 +302,7 @@ class ProfitLoss
|
|||||||
$tax_amount += ($amount_payment_paid / $invoice->amount) * $invoice->total_taxes;
|
$tax_amount += ($amount_payment_paid / $invoice->amount) * $invoice->total_taxes;
|
||||||
$tax_amount_converted += (($amount_payment_paid / $invoice->amount) * $invoice->total_taxes) / $payment->exchange_rate;
|
$tax_amount_converted += (($amount_payment_paid / $invoice->amount) * $invoice->total_taxes) / $payment->exchange_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pivot->paymentable_type == 'credits') {
|
if ($pivot->paymentable_type == 'credits') {
|
||||||
@ -595,52 +595,50 @@ class ProfitLoss
|
|||||||
case 'all':
|
case 'all':
|
||||||
$this->start_date = now()->subYears(50);
|
$this->start_date = now()->subYears(50);
|
||||||
$this->end_date = now();
|
$this->end_date = now();
|
||||||
// return $query;
|
break;
|
||||||
// no break
|
|
||||||
case 'last7':
|
case 'last7':
|
||||||
$this->start_date = now()->subDays(7);
|
$this->start_date = now()->subDays(7);
|
||||||
$this->end_date = now();
|
$this->end_date = now();
|
||||||
// return $query->whereBetween($this->date_key, [now()->subDays(7), now()])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
case 'last30':
|
case 'last30':
|
||||||
$this->start_date = now()->subDays(30);
|
$this->start_date = now()->subDays(30);
|
||||||
$this->end_date = now();
|
$this->end_date = now();
|
||||||
// return $query->whereBetween($this->date_key, [now()->subDays(30), now()])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
case 'this_month':
|
case 'this_month':
|
||||||
$this->start_date = now()->startOfMonth();
|
$this->start_date = now()->startOfMonth();
|
||||||
$this->end_date = now();
|
$this->end_date = now();
|
||||||
//return $query->whereBetween($this->date_key, [now()->startOfMonth(), now()])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
case 'last_month':
|
case 'last_month':
|
||||||
$this->start_date = now()->startOfMonth()->subMonth();
|
$this->start_date = now()->startOfMonth()->subMonth();
|
||||||
$this->end_date = now()->startOfMonth()->subMonth()->endOfMonth();
|
$this->end_date = now()->startOfMonth()->subMonth()->endOfMonth();
|
||||||
//return $query->whereBetween($this->date_key, [now()->startOfMonth()->subMonth(), now()->startOfMonth()->subMonth()->endOfMonth()])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
case 'this_quarter':
|
case 'this_quarter':
|
||||||
$this->start_date = (new \Carbon\Carbon('-3 months'))->firstOfQuarter();
|
$this->start_date = (new \Carbon\Carbon('-3 months'))->firstOfQuarter();
|
||||||
$this->end_date = (new \Carbon\Carbon('-3 months'))->lastOfQuarter();
|
$this->end_date = (new \Carbon\Carbon('-3 months'))->lastOfQuarter();
|
||||||
//return $query->whereBetween($this->date_key, [(new \Carbon\Carbon('-3 months'))->firstOfQuarter(), (new \Carbon\Carbon('-3 months'))->lastOfQuarter()])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
case 'last_quarter':
|
case 'last_quarter':
|
||||||
$this->start_date = (new \Carbon\Carbon('-6 months'))->firstOfQuarter();
|
$this->start_date = (new \Carbon\Carbon('-6 months'))->firstOfQuarter();
|
||||||
$this->end_date = (new \Carbon\Carbon('-6 months'))->lastOfQuarter();
|
$this->end_date = (new \Carbon\Carbon('-6 months'))->lastOfQuarter();
|
||||||
//return $query->whereBetween($this->date_key, [(new \Carbon\Carbon('-6 months'))->firstOfQuarter(), (new \Carbon\Carbon('-6 months'))->lastOfQuarter()])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
case 'this_year':
|
case 'this_year':
|
||||||
$this->start_date = now()->startOfYear();
|
$this->start_date = now()->startOfYear();
|
||||||
$this->end_date = now();
|
$this->end_date = now();
|
||||||
//return $query->whereBetween($this->date_key, [now()->startOfYear(), now()])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
case 'custom':
|
case 'custom':
|
||||||
$this->start_date = $custom_start_date;
|
$this->start_date = $custom_start_date;
|
||||||
$this->end_date = $custom_end_date;
|
$this->end_date = $custom_end_date;
|
||||||
//return $query->whereBetween($this->date_key, [$custom_start_date, $custom_end_date])->orderBy($this->date_key, 'ASC');
|
break;
|
||||||
// no break
|
|
||||||
default:
|
default:
|
||||||
$this->start_date = now()->startOfYear();
|
$this->start_date = now()->startOfYear();
|
||||||
$this->end_date = now();
|
$this->end_date = now();
|
||||||
// return $query->whereBetween($this->date_key, [now()->startOfYear(), now()])->orderBy($this->date_key, 'ASC');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user