document Instanceof PurchaseOrder) ? $this->document->vendor : $this->document->client; App::setLocale($$settings_entity->locale()); /* Set customized translations _NOW_ */ $t->replace(Ninja::transformTranslations($this->document->client->getMergedSettings())); $e_document_type = $settings_entity->getSetting('e_invoice_type') ? $settings_entity->getSetting('e_invoice_type') : "XInvoice_3_0"; $e_quote_type = $settings_entity->getSetting('e_quote_type') ? $settings_entity->getSetting('e_quote_type') : "OrderX_Extended"; if ($this->document instanceof Invoice){ switch ($e_document_type) { case "EN16931": case "XInvoice_3_0": case "XInvoice_2_3": case "XInvoice_2_2": case "XInvoice_2_1": case "XInvoice_2_0": case "XInvoice_1_0": case "XInvoice-Extended": case "XInvoice-BasicWL": case "XInvoice-Basic": $zugferd = (new ZugferdEDokument($this->document))->run(); return $this->returnObject ? $zugferd->xdocument : $zugferd->getXml(); case "Facturae_3.2": case "Facturae_3.2.1": case "Facturae_3.2.2": return (new FacturaEInvoice($this->document, str_replace("Facturae_", "", $e_document_type)))->run(); default: $zugferd = (new ZugferdEDokument($this->document))->run(); return $this->returnObject ? $zugferd : $zugferd->getXml(); } } elseif ($this->document instanceof Quote){ switch ($e_quote_type){ case "OrderX_Basic": case "OrderX_Comfort": case "OrderX_Extended": $orderx = (new OrderXDocument($this->document))->run(); return $this->returnObject ? $orderx->orderxdocument : $orderx->getXml(); default: $orderx = (new OrderXDocument($this->document))->run(); return $this->returnObject ? $orderx->orderxdocument : $orderx->getXml(); } } elseif ($this->document instanceof PurchaseOrder){ switch ($e_quote_type){ case "OrderX_Basic": case "OrderX_Comfort": case "OrderX_Extended": $orderx = (new OrderXDocument($this->document))->run(); return $this->returnObject ? $orderx->orderxdocument : $orderx->getXml(); default: $orderx = (new OrderXDocument($this->document))->run(); return $this->returnObject ? $orderx->orderxdocument : $orderx->getXml(); } } elseif ($this->document instanceof Credit) { switch ($e_document_type) { case "EN16931": case "XInvoice_3_0": case "XInvoice_2_3": case "XInvoice_2_2": case "XInvoice_2_1": case "XInvoice_2_0": case "XInvoice_1_0": case "XInvoice-Extended": case "XInvoice-BasicWL": case "XInvoice-Basic": $zugferd = (new ZugferdEDokument($this->document))->run(); return $this->returnObject ? $zugferd->xdocument : $zugferd->getXml(); default: $zugferd = (new ZugferdEDokument($this->document))->run(); return $this->returnObject ? $zugferd : $zugferd->getXml(); } } else{ return ""; } } }