mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on UBL
This commit is contained in:
parent
861bbbb7d9
commit
8ebc601a30
@ -3,7 +3,7 @@
|
|||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use App\Jobs\Job;
|
use App\Jobs\Job;
|
||||||
use Sabre\Xml\Service;
|
use CleverIt\UBL\Invoice\Generator;
|
||||||
use CleverIt\UBL\Invoice\Invoice;
|
use CleverIt\UBL\Invoice\Invoice;
|
||||||
use CleverIt\UBL\Invoice\Party;
|
use CleverIt\UBL\Invoice\Party;
|
||||||
use CleverIt\UBL\Invoice\Address;
|
use CleverIt\UBL\Invoice\Address;
|
||||||
@ -25,13 +25,6 @@ class ConvertInvoiceToUbl extends Job
|
|||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$xmlService = new Service();
|
|
||||||
$xmlService->namespaceMap = [
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2' => '',
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc',
|
|
||||||
'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac'
|
|
||||||
];
|
|
||||||
|
|
||||||
$invoice = $this->invoice;
|
$invoice = $this->invoice;
|
||||||
$account = $invoice->account;
|
$account = $invoice->account;
|
||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
@ -64,7 +57,7 @@ class ConvertInvoiceToUbl extends Job
|
|||||||
$taxtotal = new TaxTotal();
|
$taxtotal = new TaxTotal();
|
||||||
$taxAmount1 = $taxAmount2 = 0;
|
$taxAmount1 = $taxAmount2 = 0;
|
||||||
|
|
||||||
if ($item->tax_name1 || $item->tax_rate1) {
|
if ($item->tax_name1 || floatval($item->tax_rate1)) {
|
||||||
$taxAmount1 = $invoice->taxAmount($taxable, $invoice->tax_rate1);
|
$taxAmount1 = $invoice->taxAmount($taxable, $invoice->tax_rate1);
|
||||||
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
||||||
->setTaxAmount($taxAmount1)
|
->setTaxAmount($taxAmount1)
|
||||||
@ -75,7 +68,7 @@ class ConvertInvoiceToUbl extends Job
|
|||||||
->setPercent($item->tax_rate1)));
|
->setPercent($item->tax_rate1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item->tax_name2 || $item->tax_rate2) {
|
if ($item->tax_name2 || floatval($item->tax_rate2)) {
|
||||||
$itemTaxAmount2 = $invoice->taxAmount($taxable, $invoice->tax_rate2);
|
$itemTaxAmount2 = $invoice->taxAmount($taxable, $invoice->tax_rate2);
|
||||||
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
||||||
->setTaxAmount($taxAmount2)
|
->setTaxAmount($taxAmount2)
|
||||||
@ -95,9 +88,7 @@ class ConvertInvoiceToUbl extends Job
|
|||||||
->setTaxExclusiveAmount($taxable)
|
->setTaxExclusiveAmount($taxable)
|
||||||
->setPayableAmount($invoice->balance));
|
->setPayableAmount($invoice->balance));
|
||||||
|
|
||||||
return $xmlService->write('Invoice', [
|
return Generator::invoice($ublInvoice, $invoice->client->getCurrencyCode());
|
||||||
$ublInvoice
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createParty($company, $user)
|
public function createParty($company, $user)
|
||||||
@ -141,7 +132,7 @@ class ConvertInvoiceToUbl extends Job
|
|||||||
$taxtotal = new TaxTotal();
|
$taxtotal = new TaxTotal();
|
||||||
$itemTaxAmount1 = $itemTaxAmount2 = 0;
|
$itemTaxAmount1 = $itemTaxAmount2 = 0;
|
||||||
|
|
||||||
if ($item->tax_name1 || $item->tax_rate1) {
|
if ($item->tax_name1 || floatval($item->tax_rate1)) {
|
||||||
$itemTaxAmount1 = $invoice->taxAmount($taxable, $item->tax_rate1);
|
$itemTaxAmount1 = $invoice->taxAmount($taxable, $item->tax_rate1);
|
||||||
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
||||||
->setTaxAmount($itemTaxAmount1)
|
->setTaxAmount($itemTaxAmount1)
|
||||||
@ -152,7 +143,7 @@ class ConvertInvoiceToUbl extends Job
|
|||||||
->setPercent($item->tax_rate1)));
|
->setPercent($item->tax_rate1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item->tax_name2 || $item->tax_rate2) {
|
if ($item->tax_name2 || floatval($item->tax_rate2)) {
|
||||||
$itemTaxAmount2 = $invoice->taxAmount($taxable, $item->tax_rate2);
|
$itemTaxAmount2 = $invoice->taxAmount($taxable, $item->tax_rate2);
|
||||||
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
$taxtotal->addTaxSubTotal((new TaxSubTotal())
|
||||||
->setTaxAmount($itemTaxAmount2)
|
->setTaxAmount($itemTaxAmount2)
|
||||||
|
@ -2649,7 +2649,6 @@ $LANG = array(
|
|||||||
'signature_on_pdf_help' => 'Show the client signature on the invoice/quote PDF.',
|
'signature_on_pdf_help' => 'Show the client signature on the invoice/quote PDF.',
|
||||||
'expired_white_label' => 'The white label license has expired',
|
'expired_white_label' => 'The white label license has expired',
|
||||||
'return_to_login' => 'Return to Login',
|
'return_to_login' => 'Return to Login',
|
||||||
'beta' => 'Beta',
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
])) : false) !!}
|
])) : false) !!}
|
||||||
|
|
||||||
{!! Former::checkbox('ubl_email_attachment')
|
{!! Former::checkbox('ubl_email_attachment')
|
||||||
->text(trans('texts.enable') . ' [' . trans('texts.beta') . ']')
|
->text(trans('texts.enable'))
|
||||||
->value(1) !!}
|
->value(1) !!}
|
||||||
|
|
||||||
{!! Former::checkbox('document_email_attachment')
|
{!! Former::checkbox('document_email_attachment')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user