diff --git a/app/Http/Controllers/ClientPortal/QuoteController.php b/app/Http/Controllers/ClientPortal/QuoteController.php
index 93dabdbdc907..52c5ccf58416 100644
--- a/app/Http/Controllers/ClientPortal/QuoteController.php
+++ b/app/Http/Controllers/ClientPortal/QuoteController.php
@@ -178,6 +178,9 @@ class QuoteController extends Controller
->where('client_id', auth()->guard('contact')->user()->client->id)
->where('company_id', auth()->guard('contact')->user()->client->company_id)
->whereIn('status_id', [Quote::STATUS_DRAFT, Quote::STATUS_SENT])
+ ->where(function ($q){
+ $q->whereNull('due_date')->orWhere('due_date', '>=', now());
+ })
->withTrashed()
->get();
diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php
index ed5510dd73d6..32613b80f192 100644
--- a/app/Mail/Engine/PaymentEmailEngine.php
+++ b/app/Mail/Engine/PaymentEmailEngine.php
@@ -392,7 +392,7 @@ class PaymentEmailEngine extends BaseEmailEngine
$invoice_list = '
';
foreach ($this->payment->invoices as $invoice) {
- $invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} ".Number::formatMoney($invoice->pivot->amount, $this->client).'
';
+ $invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} ".Number::formatMoney($invoice->pivot->amount, $this->client).'\n';
}
return $invoice_list;
diff --git a/app/Services/EDocument/Standards/RoEInvoice.php b/app/Services/EDocument/Standards/RoEInvoice.php
index 9d58e0431efb..553ecca6f552 100644
--- a/app/Services/EDocument/Standards/RoEInvoice.php
+++ b/app/Services/EDocument/Standards/RoEInvoice.php
@@ -205,6 +205,9 @@ class RoEInvoice extends AbstractService
} elseif (!empty($item->tax_name3)) {
$taxName = $item->tax_name3;
}
+ else {
+ $taxName = '';
+ }
}
$supplier_party = $this->createParty($company, $companyVatNr, $coEmail, $coPhone, $companyIdn, $coFullName, 'company', $taxName);
@@ -238,6 +241,8 @@ class RoEInvoice extends AbstractService
$taxRatePercent = $item->tax_rate2;
} elseif (!empty($item->tax_rate3)) {
$taxRatePercent = $item->tax_rate3;
+ }else {
+ $taxRatePercent = 0;
}
if (!empty($item->tax_name1)) {
@@ -246,6 +251,8 @@ class RoEInvoice extends AbstractService
$taxNameScheme = $item->tax_name2;
} elseif (!empty($item->tax_name3)) {
$taxNameScheme = $item->tax_name3;
+ } else {
+ $taxNameScheme = '';
}
$invoicing_data = $this->invoice->calc();
@@ -270,7 +277,7 @@ class RoEInvoice extends AbstractService
return $ubl_invoice;
}
- private function createParty($company, $vatNr, $eMail, $phone, $idNr, $fullName, $compType, $taxNameScheme)
+ private function createParty($company, $vatNr, $eMail, $phone, $idNr, $fullName, $compType, $taxNameScheme = '')
{
$party = new Party();
$party->setPartyIdentification(preg_replace('/^RO/', '', $vatNr));
@@ -352,7 +359,15 @@ class RoEInvoice extends AbstractService
->setId($this->resolveTaxCode($item->tax_id ?? 1))
->setPercent($item->tax_rate3)
->setTaxScheme(((new TaxScheme())->setId(($item->tax_name3 === 'TVA') ? 'VAT' : $item->tax_name3)));
+ }else {
+
+ $classifiedTaxCategory = (new ClassifiedTaxCategory())
+ ->setId($this->resolveTaxCode($item->tax_id ?? 8))
+ ->setPercent(0)
+ ->setTaxScheme(((new TaxScheme())->setId(($item->tax_name3 === 'TVA') ? 'VAT' : $item->tax_name3)));
+
}
+
$invoiceLine = (new InvoiceLine())
->setId($index + 1)
->setInvoicedQuantity($item->quantity)
diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php
index 1495d341f0fa..226f82490222 100644
--- a/app/Utils/HtmlEngine.php
+++ b/app/Utils/HtmlEngine.php
@@ -323,7 +323,7 @@ class HtmlEngine
$data['$portal_url'] = ['value' => $this->invitation->getPortalLink(), 'label' => ''];
$data['$entity_number'] = &$data['$number'];
- $data['$invoice.discount'] = ['value' => Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ($this->entity->is_amount_discount) ? ctrans('texts.discount') : ctrans('texts.discount').' '.$this->entity->discount.'%'];
+ $data['$invoice.discount'] = ['value' => Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ($this->entity->is_amount_discount) ? ctrans('texts.discount') : ctrans('texts.discount').' '.(float)$this->entity->discount.'%'];
$data['$discount'] = &$data['$invoice.discount'];
$data['$subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')];
$data['$gross_subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getGrossSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')];
diff --git a/lang/en/texts.php b/lang/en/texts.php
index 8d406b4238ef..e542e667e9d4 100644
--- a/lang/en/texts.php
+++ b/lang/en/texts.php
@@ -4170,7 +4170,7 @@ $lang = array(
'one_time_purchases' => 'One time purchases',
'recurring_purchases' => 'Recurring purchases',
'you_might_be_interested_in_following' => 'You might be interested in the following',
- 'quotes_with_status_sent_can_be_approved' => 'Only quotes with "Sent" status can be approved.',
+ 'quotes_with_status_sent_can_be_approved' => 'Only quotes with "Sent" status can be approved. Expired quotes cannot be approved.',
'no_quotes_available_for_download' => 'No quotes available for download.',
'copyright' => 'Copyright',
'user_created_user' => ':user created :created_user at :time',