Minor fixes

This commit is contained in:
David Bomba 2024-04-20 10:58:29 +10:00
parent ecad93afff
commit 45f378eb9d
5 changed files with 22 additions and 4 deletions

View File

@ -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();

View File

@ -392,7 +392,7 @@ class PaymentEmailEngine extends BaseEmailEngine
$invoice_list = '<br><br>';
foreach ($this->payment->invoices as $invoice) {
$invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} ".Number::formatMoney($invoice->pivot->amount, $this->client).'<br>';
$invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} ".Number::formatMoney($invoice->pivot->amount, $this->client).'\n';
}
return $invoice_list;

View File

@ -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)

View File

@ -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')];

View File

@ -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',