mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-18 23:42:25 +02:00
Fix for UBL invoices
This commit is contained in:
parent
26c1799043
commit
b66a9b2a33
@ -57,22 +57,17 @@ class ConvertInvoiceToUbl extends Job
|
||||
|
||||
$ublInvoice->setInvoiceLines($invoiceLines);
|
||||
|
||||
if ($invoice->hasTaxes()) {
|
||||
$taxtotal = new TaxTotal();
|
||||
$taxAmount1 = $taxAmount2 = 0;
|
||||
$taxtotal = new TaxTotal();
|
||||
$taxAmount1 = $taxAmount2 = 0;
|
||||
|
||||
if ($invoice->tax_name1 || floatval($invoice->tax_rate1)) {
|
||||
$taxAmount1 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate1, $invoice->tax_name1);
|
||||
}
|
||||
|
||||
if ($invoice->tax_name2 || floatval($invoice->tax_rate2)) {
|
||||
$taxAmount2 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate2, $invoice->tax_name2);
|
||||
}
|
||||
|
||||
$taxtotal->setTaxAmount($taxAmount1 + $taxAmount2);
|
||||
$ublInvoice->setTaxTotal($taxtotal);
|
||||
$taxAmount1 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate1, $invoice->tax_name1);
|
||||
if ($invoice->tax_name2 || floatval($invoice->tax_rate2)) {
|
||||
$taxAmount2 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate2, $invoice->tax_name2);
|
||||
}
|
||||
|
||||
$taxtotal->setTaxAmount($taxAmount1 + $taxAmount2);
|
||||
$ublInvoice->setTaxTotal($taxtotal);
|
||||
|
||||
$ublInvoice->setLegalMonetaryTotal((new LegalMonetaryTotal())
|
||||
//->setLineExtensionAmount()
|
||||
->setTaxExclusiveAmount($taxable)
|
||||
@ -118,22 +113,17 @@ class ConvertInvoiceToUbl extends Job
|
||||
->setDescription($item->description));
|
||||
//->setSellersItemIdentification("1ABCD"));
|
||||
|
||||
if ($item->hasTaxes()) {
|
||||
$taxtotal = new TaxTotal();
|
||||
$itemTaxAmount1 = $itemTaxAmount2 = 0;
|
||||
$taxtotal = new TaxTotal();
|
||||
$itemTaxAmount1 = $itemTaxAmount2 = 0;
|
||||
|
||||
if ($item->tax_name1 || floatval($item->tax_rate1)) {
|
||||
$itemTaxAmount1 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate1, $item->tax_name1);
|
||||
}
|
||||
|
||||
if ($item->tax_name2 || floatval($item->tax_rate2)) {
|
||||
$itemTaxAmount2 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate2, $item->tax_name2);
|
||||
}
|
||||
|
||||
$taxtotal->setTaxAmount($itemTaxAmount1 + $itemTaxAmount2);
|
||||
$invoiceLine->setTaxTotal($taxtotal);
|
||||
$itemTaxAmount1 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate1, $item->tax_name1);
|
||||
if ($item->tax_name2 || floatval($item->tax_rate2)) {
|
||||
$itemTaxAmount2 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate2, $item->tax_name2);
|
||||
}
|
||||
|
||||
$taxtotal->setTaxAmount($itemTaxAmount1 + $itemTaxAmount2);
|
||||
$invoiceLine->setTaxTotal($taxtotal);
|
||||
|
||||
return $invoiceLine;
|
||||
}
|
||||
|
||||
|
@ -127,10 +127,10 @@ class Mailer
|
||||
|
||||
// Handle invoice attachments
|
||||
if (! empty($data['pdfString']) && ! empty($data['pdfFileName'])) {
|
||||
$attachments[] = PostmarkAttachment::fromRawData($document['pdfString'], $document['pdfFileName']);
|
||||
$attachments[] = PostmarkAttachment::fromRawData($data['pdfString'], $data['pdfFileName']);
|
||||
}
|
||||
if (! empty($data['ublString']) && ! empty($data['ublFileName'])) {
|
||||
$attachments[] = PostmarkAttachment::fromRawData($document['ublString'], $document['ublFileName']);
|
||||
$attachments[] = PostmarkAttachment::fromRawData($data['ublString'], $data['ublFileName']);
|
||||
}
|
||||
if (! empty($data['documents'])) {
|
||||
foreach ($data['documents'] as $document) {
|
||||
|
@ -86,7 +86,7 @@
|
||||
defaultDate: '{{ date('Y-m-d') }}',
|
||||
eventLimit: true,
|
||||
events: {
|
||||
url: '{{ url('/calendar_events') }}',
|
||||
url: '{{ url('/reports/calendar_events') }}',
|
||||
type: 'GET',
|
||||
data: function() {
|
||||
return {
|
||||
|
@ -7,7 +7,7 @@
|
||||
</a>
|
||||
@elseif ($option == 'reports')
|
||||
<a type="button" class="btn btn-default btn-sm pull-right" title="{{ trans('texts.calendar') }}"
|
||||
href="{{ url('/calendar') }}">
|
||||
href="{{ url('/reports/calendar') }}">
|
||||
<i class="fa fa-calendar" style="width:20px"></i>
|
||||
</a>
|
||||
@elseif (Auth::user()->can('create', $option) || Auth::user()->can('create', substr($option, 0, -1)))
|
||||
|
@ -43,7 +43,7 @@
|
||||
->appendIcon(Icon::create('envelope')) !!}
|
||||
@endif
|
||||
{!! Button::normal(trans('texts.calendar'))
|
||||
->asLinkTo(url('/calendar'))
|
||||
->asLinkTo(url('/reports/calendar'))
|
||||
->appendIcon(Icon::create('calendar')) !!}
|
||||
@stop
|
||||
|
||||
|
@ -283,8 +283,8 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
|
||||
|
||||
Route::get('reports', 'ReportController@showReports');
|
||||
Route::post('reports', 'ReportController@showReports');
|
||||
Route::get('calendar', 'CalendarController@showCalendar');
|
||||
Route::get('calendar_events', 'CalendarController@loadEvents');
|
||||
Route::get('reports/calendar', 'CalendarController@showCalendar');
|
||||
Route::get('reports/calendar_events', 'CalendarController@loadEvents');
|
||||
Route::get('reports/emails', 'ReportController@showEmailReport');
|
||||
Route::get('reports/emails_report/{start_date}/{end_date}', 'ReportController@loadEmailReport');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user