commit 6fd2d2f179c65ec2a23518d1c3e4f9b14130372a Author: MaxBUhe Date: Mon Apr 20 10:54:56 2020 +0200 #9641 adding pdfdocument files; add dynamic oxbillnr diff --git a/Application/views/tpl/deliverynote.tpl b/Application/views/tpl/deliverynote.tpl new file mode 100644 index 0000000..a102a1b --- /dev/null +++ b/Application/views/tpl/deliverynote.tpl @@ -0,0 +1,295 @@ +[{assign var=currency value=$order->getOrderCurrency()}] + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
[{$shop->oxshops__oxname->value}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_GESCHAEFTSFUEHRER"}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_BANKVERBINDUNG"}]
[{$shop->oxshops__oxstreet->value}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_COURT"}] [{$shop->oxshops__oxcourt->value}][{$shop->oxshops__oxbankname->value}]
[{$shop->oxshops__oxzip->value}][{$shop->oxshops__oxcity->value}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_HRBNR"}][{$shop->oxshops__oxhrbnr->value}][{oxmultilang ident="ORDER_OVERVIEW_PDF_ACCOUNTNR"}][{$shop->oxshops__oxibannumber->value}]
[{$shop->oxshops__oxcountry->value}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_USTID"}][{$shop->oxshops__oxvatnumber->value}][{oxmultilang ident="ORDER_OVERVIEW_PDF_BANKCODE"}][{$shop->oxshops__oxbiccode->value}]
+ + + + + + + +
[{$shop->oxshops__oxurl->value}]
[{$shop->oxshops__oxinfoemail->value}]
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_GET_IN_CONTACT"}]
[{$shop->oxshops__oxname->value}] - [{$shop->oxshops__oxstreet->value}] - [{$shop->oxshops__oxzip->value}] [{$shop->oxshops__oxcity->value}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_TELEFON"}][{$shop->oxshops__oxtelefon->value}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_FAX"}][{$shop->oxshops__oxtelefax->value}]
[{$order->oxorder__oxbillcompany->value}][{$shop->oxshops__oxinfoemail->value}]
[{$order->oxorder__oxbillfname->value}] [{$order->oxorder__oxbilllname->value}]
[{$order->oxorder__oxbillstreet->value}] [{$order->oxorder__oxbillstreetnr->value}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_BANKVERBINDUNG"}]
[{$order->oxorder__oxbillzip}] [{$order->oxorder__oxbillcity->value}][{$shop->oxshops__oxbankname->value}]
+ + + + + +
[{$shop->oxshops__oxcountry->value}][{oxmultilang ident="ORDER_OVERVIEW_PDF_ACCOUNTNR"}][{$shop->oxshops__oxibannumber->value}]
+ + + + + + + + + + + + + + + + + + + + + + + + + +
[{oxmultilang ident="ORDER_OVERVIEW_PDF_BANKCODE_HEADER"}][{$shop->oxshops__oxbiccode->value}]
 
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILLNR"}][{$order->oxorder__oxbillnr->value}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERNR"}][{$order->oxorder__oxordernr->value}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_CUSTOMERNR"}] [{$user->oxuser__oxcustnr->value}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_DATE"}][{$order->oxorder__oxbilldate->value|date_format:"%d. %m. %Y"}]
[{oxmultilang ident="ORDER_OVERVIEW_PDF_ORDERSINCERELY"}][{$order->oxorder__oxorderdate->value|date_format:"%d. %m. %Y"}][{oxmultilang ident="ORDER_OVERVIEW_PDF_ORDERSAT"}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_USTIDNR"}][{$shop->oxshops__oxvatnumber->value}]
+ + + + + + + + + + + + + + + + + + + + + +[{foreach from=$order->getOrderArticles(true) item=oOrderArticle}] + + + + + + + + +[{/foreach}] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [{foreach from=$order->getVats() key=VatKey item=oVat}] + + + + + + + + + [{/foreach}] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_AMOUNT"}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ARTNR"}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_DESCRIPTION"}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_USTPERCENTAGE"}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_UNITPRICE"}][{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_TOTALPRICE"}]
[{ $oOrderArticle->oxorderarticles__oxamount->value }][{ $oOrderArticle->oxorderarticles__oxartnum->value }][{ $oOrderArticle->oxorderarticles__oxtitle->getRawValue() }] [{ $oOrderArticle->oxorderarticles__oxselvariant->getRawValue() }][{ $oOrderArticle->oxorderarticles__oxvat->value }][{$oOrderArticle->getBrutPriceFormated()}] [{$currency->name}][{$oOrderArticle->getTotalBrutPriceFormated()}] [{$currency->name}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_SUMBRUTTO"}][{$order->getFormattedTotalBrutSum()}] [{$currency->name}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_DISCOUNT"}][{$order->getFormattedDiscount()}] [{$currency->name}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_SUMNETTO"}][{$order->getFormattedTotalNetSum()}] [{$currency->name}]
 [{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_TAX"}] [{$VatKey}] [{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_PERCENTAGE"}] [{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_TAXPERCVALUE"}][{$lang->formatCurrency($oVat, $currency)}] [{$currency->name}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_DELIVERY"}][{$order->getFormattedeliveryCost()}] [{$currency->name}]
 [{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_TAX"}][{$lang->formatCurrency($oVat, $currency)}] [{$currency->name}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_ORDERBILL_TOTALSUMBRUT"}][{$order->getFormattedTotalOrderSum()}] [{$currency->name}]
+ + + + + + + +
 
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_USED_PAYMENTMETHOD"}][{$payment->oxpayments__oxdesc->value}]
[{oxmultilang ident="D3_ORDER_OVERVIEW_PDF_USED_GREETINGSORDER"}]
 
[{oxmultilang ident="ORDER_OVERVIEW_PDF_GREETINGS_AUFTRAG_1"}]
[{oxmultilang ident="ORDER_OVERVIEW_PDF_GREETINGS_AUFTRAG_2"}]
+
+ +[{* +[{include file="d3tplheader.tpl" title="DD_ORDER_CUST_HEADING"|oxmultilangassign|cat:" #"|cat:"0815" style=""}] + +[{block name="email_html_order_cust_orderemail"}] +

+ [{oxcontent ident="oxuserorderemail"}] +

+[{/block}] + +[{block name="email_html_order_cust_address"}] + + + + + + + + + + + + + + + + + +
[{oxmultilang ident="PRODUCT"}][{oxmultilang ident="UNIT_PRICE"}][{oxmultilang ident="QUANTITY"}][{oxmultilang ident="VAT"}][{oxmultilang ident="TOTAL"}]
[{oxmultilang ident="PRODUCT"}][{oxmultilang ident="UNIT_PRICE"}][{oxmultilang ident="QUANTITY"}][{oxmultilang ident="VAT"}][{oxmultilang ident="TOTAL"}]
+[{/block}] + +++[{$order->getFieldData('oxordernr')}]++ +*}] \ No newline at end of file diff --git a/Modules/Application/Model/d3_Order_PdfDocuments.php b/Modules/Application/Model/d3_Order_PdfDocuments.php new file mode 100644 index 0000000..8117a47 --- /dev/null +++ b/Modules/Application/Model/d3_Order_PdfDocuments.php @@ -0,0 +1,89 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Modules\Application\Model; + +use OxidEsales\EshopCommunity\Application\Model\User; +use OxidEsales\EshopCommunity\Application\Model\Payment; +use OxidEsales\Eshop\Core\Registry; +use Spipu\Html2Pdf\Exception\Html2PdfException; +use Spipu\Html2Pdf\Html2Pdf; + +class d3_Order_PdfDocuments extends d3_Order_PdfDocuments_parent +{ + /** + * @param string $sFilename + * @param int $iSelLang + * @param string $target + * @throws Html2PdfException + */ + public function genPdf($sFilename, $iSelLang = 0, $target = 'I') + { + self::$_blIsAdmin = false; + + $oSmarty = Registry::getUtilsView()->getSmarty(); + $oSmarty->assign('oConfig', Registry::getSession()->getConfig()); + $oSmarty->assign('oViewConf', Registry::getSession()->getConfig()->getActiveView()->getViewConfig()); + $oSmarty->assign('order', $this); + $oSmarty->assign('shop', Registry::getSession()->getConfig()->getActiveShop()); + $oSmarty->assign('lang', Registry::getLang()); + + $oUser= oxNew(User::Class); + $oUser->load($this->oxorder__oxuserid->value); + $oSmarty->assign('user', $oUser); + + $oPayment= oxNew(Payment::class); + $oPayment->load($this->oxorder__oxpaymenttype->value); + $oSmarty->assign('payment', $oPayment); + + //in eigene Funktion auslagern// + $blIsNewOrder = 0; + // setting invoice number + if (!$this->oxorder__oxbillnr->value) { + $this->oxorder__oxbillnr->setValue($this->getNextBillNum()); + $blIsNewOrder = 1; + } + // setting invoice date + if ($this->oxorder__oxbilldate->value == '0000-00-00') { + $this->oxorder__oxbilldate->setValue(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')))); + $blIsNewOrder = 1; + } + // saving order if new number or date + if ($blIsNewOrder) { + $this->save(); + } + + switch (Registry::getRequest()->getRequestParameter('pdftype')) { + case ('dnote'): + case ('dnote_without_logo'): + $sContent = $oSmarty->fetch($this->getDeliveryNoteTemplate()); + break; + default: + $sContent = $oSmarty->fetch($this->getDeliveryNoteTemplate()); + } + + + $oPdf = oxNew(Html2Pdf::class, 'P', 'A4', 'de'); + $oPdf->writeHTML($sContent); + $oPdf->output($sFilename, $target); + } + + public function getDeliveryNoteTemplate() + { + return 'd3deliverynote.tpl'; + } +} \ No newline at end of file