diff --git a/app/Helpers/Invoice/InvoiceItemSum.php b/app/Helpers/Invoice/InvoiceItemSum.php index 78917770e954..fe5c075b99ac 100644 --- a/app/Helpers/Invoice/InvoiceItemSum.php +++ b/app/Helpers/Invoice/InvoiceItemSum.php @@ -161,20 +161,12 @@ class InvoiceItemSum ->sumLineItem() ->setDiscount() ->calcTaxes() - ->roundLineItem() ->push(); } return $this; } - private function roundLineItem(): self - { - $this->item->line_total = round($this->item->line_total, $this->currency->precision); - - return $this; - } - private function shouldCalculateTax(): self { diff --git a/app/Helpers/Invoice/InvoiceSum.php b/app/Helpers/Invoice/InvoiceSum.php index a56e52478f31..16687aed0298 100644 --- a/app/Helpers/Invoice/InvoiceSum.php +++ b/app/Helpers/Invoice/InvoiceSum.php @@ -165,7 +165,6 @@ class InvoiceSum { 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($this->formatValue($this->invoice->partial, 2), $this->invoice->balance)); } return $this; diff --git a/app/Services/Report/ProfitLoss.php b/app/Services/Report/ProfitLoss.php index b6b8ab223ddd..26d4f188ab7f 100644 --- a/app/Services/Report/ProfitLoss.php +++ b/app/Services/Report/ProfitLoss.php @@ -302,7 +302,7 @@ class ProfitLoss $tax_amount += ($amount_payment_paid / $invoice->amount) * $invoice->total_taxes; $tax_amount_converted += (($amount_payment_paid / $invoice->amount) * $invoice->total_taxes) / $payment->exchange_rate; } - + } if ($pivot->paymentable_type == 'credits') { @@ -595,52 +595,50 @@ class ProfitLoss case 'all': $this->start_date = now()->subYears(50); $this->end_date = now(); - // return $query; - // no break + break; + case 'last7': $this->start_date = now()->subDays(7); $this->end_date = now(); - // return $query->whereBetween($this->date_key, [now()->subDays(7), now()])->orderBy($this->date_key, 'ASC'); - // no break + break; + case 'last30': $this->start_date = now()->subDays(30); $this->end_date = now(); - // return $query->whereBetween($this->date_key, [now()->subDays(30), now()])->orderBy($this->date_key, 'ASC'); - // no break + break; + case 'this_month': $this->start_date = now()->startOfMonth(); $this->end_date = now(); - //return $query->whereBetween($this->date_key, [now()->startOfMonth(), now()])->orderBy($this->date_key, 'ASC'); - // no break + break; + case 'last_month': $this->start_date = now()->startOfMonth()->subMonth(); $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'); - // no break + break; + case 'this_quarter': $this->start_date = (new \Carbon\Carbon('-3 months'))->firstOfQuarter(); $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'); - // no break + break; + case 'last_quarter': $this->start_date = (new \Carbon\Carbon('-6 months'))->firstOfQuarter(); $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'); - // no break + break; + case 'this_year': $this->start_date = now()->startOfYear(); $this->end_date = now(); - //return $query->whereBetween($this->date_key, [now()->startOfYear(), now()])->orderBy($this->date_key, 'ASC'); - // no break + break; + case 'custom': $this->start_date = $custom_start_date; $this->end_date = $custom_end_date; - //return $query->whereBetween($this->date_key, [$custom_start_date, $custom_end_date])->orderBy($this->date_key, 'ASC'); - // no break + break; default: $this->start_date = now()->startOfYear(); $this->end_date = now(); - // return $query->whereBetween($this->date_key, [now()->startOfYear(), now()])->orderBy($this->date_key, 'ASC'); } return $this;