28 protected function _toCache( $sFunc, $aParams )
30 $oItem =
new stdClass();
31 $oItem->sFunc = $sFunc;
32 $oItem->aParams = $aParams;
33 $this->_aCache[] = $oItem;
43 public function run( $oPdf )
45 foreach ( $this->_aCache as $oItem ) {
47 switch ( count( $oItem->aParams ) ) {
52 $oPdf->$sFn( $oItem->aParams[0]);
55 $oPdf->$sFn( $oItem->aParams[0], $oItem->aParams[1] );
58 $oPdf->$sFn( $oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2]);
61 $oPdf->$sFn( $oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2], $oItem->aParams[3]);
77 public function line( $iLPos, $iLHeight, $iRPos, $iRHeight )
79 $this->
_toCache(
'Line', array( $iLPos, $iLHeight, $iRPos, $iRHeight ) );
91 public function text( $iLPos, $iLHeight, $sString )
93 $this->
_toCache(
'Text', array( $iLPos, $iLHeight, $sString ) );
105 public function font( $sType, $sWeight, $sSize )
107 $this->
_toCache(
'SetFont', array( $sType, $sWeight, $sSize ) );
119 foreach ( $this->_aCache as $key => $oItem ) {
120 switch ( $oItem->sFunc ) {
122 $this->_aCache[$key]->aParams[3] += $iDelta;
123 $this->_aCache[$key]->aParams[1] += $iDelta;
126 $this->_aCache[$key]->aParams[1] += $iDelta;
171 $this->_oData = $oData;
172 $this->_oPdf = $oPdf;
187 $this->
line( 15, $iStartPos + 1, 195, $iStartPos + 1 );
188 $sNetSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalnetsum->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
189 $this->
text( 45, $iStartPos + 4, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ALLPRICENETTO' ) );
190 $this->
text( 195 - $this->_oPdf->getStringWidth( $sNetSum ), $iStartPos + 4, $sNetSum );
194 foreach ( $this->_oData->getVats() as $iVat => $dVatPrice ) {
195 $iStartPos += 4 * $iCtr;
196 $sVATSum = $oLang->formatCurrency( $dVatPrice, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
197 $this->
text( 45, $iStartPos + 8, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$iVat.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
198 $this->
text( 195 - $this->_oPdf->getStringWidth( $sVATSum ), $iStartPos + 8, $sVATSum );
203 $sBrutPrice = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalbrutsum->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
204 $this->
text( 45, $iStartPos + 12, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ALLPRICEBRUTTO' ) );
205 $this->
text( 195 - $this->_oPdf->getStringWidth( $sBrutPrice ), $iStartPos + 12, $sBrutPrice );
209 $this->
line( 45, $iStartPos + 13, 195, $iStartPos + 13 );
225 $this->
line( 15, $iStartPos + 1, 195, $iStartPos + 1 );
227 if ( $this->_oData->isNettoMode() ) {
230 $sNetSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalnetsum->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
231 $this->
text( 45, $iStartPos + 4, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ALLPRICENETTO' ) );
232 $this->
text( 195 - $this->_oPdf->getStringWidth( $sNetSum ), $iStartPos + 4, $sNetSum );
235 $dDiscountVal = $this->_oData->oxorder__oxdiscount->value;
236 if ( $dDiscountVal > 0 ) {
239 $sDiscount = $oLang->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
240 $this->
text( 45, $iStartPos + 8, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_DISCOUNT' ) );
241 $this->
text( 195 - $this->_oPdf->getStringWidth( $sDiscount ), $iStartPos + 8, $sDiscount );
245 $this->
line( 45, $iStartPos + 8, 195, $iStartPos + 8 );
248 foreach ( $this->_oData->getVats() as $iVat => $dVatPrice ) {
249 $iStartPos += 4 * $iCtr;
250 $sVATSum = $oLang->formatCurrency( $dVatPrice, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
251 $this->
text( 45, $iStartPos + 12, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$iVat.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
252 $this->
text( 195 - $this->_oPdf->getStringWidth( $sVATSum ), $iStartPos + 12, $sVATSum );
258 $sBrutPrice = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalbrutsum->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
259 $this->
text( 45, $iStartPos + 12, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ALLPRICEBRUTTO' ) );
260 $this->
text( 195 - $this->_oPdf->getStringWidth( $sBrutPrice ), $iStartPos + 12, $sBrutPrice );
265 $sBrutPrice = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalbrutsum->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
266 $this->
text( 45, $iStartPos + 4, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ALLPRICEBRUTTO' ) );
267 $this->
text( 195 - $this->_oPdf->getStringWidth( $sBrutPrice ), $iStartPos + 4, $sBrutPrice );
270 $this->
line( 45, $iStartPos + 5, 195, $iStartPos + 5 );
273 $dDiscountVal = $this->_oData->oxorder__oxdiscount->value;
274 if ( $dDiscountVal > 0 ) {
277 $sDiscount = $oLang->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
278 $this->
text( 45, $iStartPos + 8, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_DISCOUNT' ) );
279 $this->
text( 195 - $this->_oPdf->getStringWidth( $sDiscount ), $iStartPos + 8, $sDiscount );
283 $this->
line( 45, $iStartPos + 8, 195, $iStartPos + 8 );
287 $sNetSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalnetsum->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
288 $this->
text( 45, $iStartPos + 8, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ALLPRICENETTO' ) );
289 $this->
text( 195 - $this->_oPdf->getStringWidth( $sNetSum ), $iStartPos + 8, $sNetSum );
293 foreach ( $this->_oData->getVats() as $iVat => $dVatPrice ) {
294 $iStartPos += 4 * $iCtr;
295 $sVATSum = $oLang->formatCurrency( $dVatPrice, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
296 $this->
text( 45, $iStartPos + 12, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$iVat.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
297 $this->
text( 195 - $this->_oPdf->getStringWidth( $sVATSum ), $iStartPos + 12, $sVATSum );
314 if ( $this->_oData->oxorder__oxvoucherdiscount->value ) {
315 $dDiscountVal = $this->_oData->oxorder__oxvoucherdiscount->value;
316 if ( $dDiscountVal > 0 ) {
319 $sPayCost =
oxRegistry::getLang()->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
320 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_VOUCHER' ) );
321 $this->
text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
341 if ( $oConfig->getConfigParam(
'blShowVATForDelivery' ) ) {
343 $sDelCostNetto = $oLang->formatCurrency( $this->_oData->getOrderDeliveryPrice()->getNettoPrice(), $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
344 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_SHIPCOST' ).
' '.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_NETTO' ) );
345 $this->
text( 195 - $this->_oPdf->getStringWidth( $sDelCostNetto ), $iStartPos, $sDelCostNetto );
348 if ( $oConfig->getConfigParam(
'sAdditionalServVATCalcMethod') !=
'proportional' ) {
349 $sVatValueText = $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxdelvat->value.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_PERCENTSUM' );
351 $sVatValueText = $this->_oData->translate(
'TOTAL_PLUS_PROPORTIONAL_VAT' );
355 $sDelCostVAT = $oLang->formatCurrency( $this->_oData->getOrderDeliveryPrice()->getVATValue(), $this->_oData->getCurrency()).
' '.$this->_oData->getCurrency()->name;
356 $this->
text( 45, $iStartPos, $sVatValueText );
357 $this->
text( 195 - $this->_oPdf->getStringWidth( $sDelCostVAT ), $iStartPos, $sDelCostVAT );
360 $sAddString =
' '.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_BRUTTO' );
363 if ( $this->_oData->oxorder__oxstorno->value ) {
364 $this->_oData->oxorder__oxdelcost->setValue(0);
367 $sDelCost = $oLang->formatCurrency( $this->_oData->oxorder__oxdelcost->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
368 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_SHIPCOST' ).$sAddString );
369 $this->
text( 195 - $this->_oPdf->getStringWidth( $sDelCost ), $iStartPos, $sDelCost );
382 if ( $this->_oData->oxorder__oxwrapcost->value || $this->_oData->oxorder__oxgiftcardcost->value ) {
387 if ( $oConfig->getConfigParam(
'blShowVATForWrapping') ) {
389 if ($this->_oData->oxorder__oxwrapcost->value) {
392 $sWrapCostNetto = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getNettoPrice(), $this->_oData->getCurrency()).
' '.$this->_oData->getCurrency()->name;
393 $this->
text( 45, $iStartPos, $this->_oData->translate(
'WRAPPING_COSTS' ).
' '.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_NETTO' ) );
394 $this->
text( 195 - $this->_oPdf->getStringWidth( $sWrapCostNetto ), $iStartPos, $sWrapCostNetto );
399 $sWrapCostVAT = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getVATValue(), $this->_oData->getCurrency()).
' '.$this->_oData->getCurrency()->name;
400 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ) );
401 $this->
text( 195 - $this->_oPdf->getStringWidth( $sWrapCostVAT ), $iStartPos, $sWrapCostVAT );
405 if ($this->_oData->oxorder__oxgiftcardcost->value) {
408 $sWrapCostNetto = $oLang->formatCurrency( $this->_oData->getOrderGiftCardPrice()->getNettoPrice(), $this->_oData->getCurrency()).
' '.$this->_oData->getCurrency()->name;
409 $this->
text( 45, $iStartPos, $this->_oData->translate(
'GIFTCARD_COSTS' ).
' '.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_NETTO' ) );
410 $this->
text( 195 - $this->_oPdf->getStringWidth( $sWrapCostNetto ), $iStartPos, $sWrapCostNetto );
415 $sWrapCostVAT = $oLang->formatCurrency( $this->_oData->getOrderGiftCardPrice()->getVATValue(), $this->_oData->getCurrency()).
' '.$this->_oData->getCurrency()->name;
417 if ( $oConfig->getConfigParam(
'sAdditionalServVATCalcMethod') !=
'proportional' ) {
418 $sVatValueText = $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ) .$this->_oData->oxorder__oxgiftcardvat->value.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_PERCENTSUM' );
420 $sVatValueText = $this->_oData->translate(
'TOTAL_PLUS_PROPORTIONAL_VAT' );
423 $this->
text( 45, $iStartPos, $sVatValueText );
424 $this->
text( 195 - $this->_oPdf->getStringWidth( $sWrapCostVAT ), $iStartPos, $sWrapCostVAT );
429 $sAddString =
' '.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_BRUTTO' );
431 if ($this->_oData->oxorder__oxwrapcost->value) {
434 $sWrapCost = $oLang->formatCurrency( $this->_oData->oxorder__oxwrapcost->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
435 $this->
text( 45, $iStartPos, $this->_oData->translate(
'WRAPPING_COSTS' ).$sAddString );
436 $this->
text( 195 - $this->_oPdf->getStringWidth( $sWrapCost ), $iStartPos, $sWrapCost );
440 if ($this->_oData->oxorder__oxgiftcardcost->value) {
443 $sWrapCost = $oLang->formatCurrency( $this->_oData->oxorder__oxgiftcardcost->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
444 $this->
text( 45, $iStartPos, $this->_oData->translate(
'GIFTCARD_COSTS' ).$sAddString );
445 $this->
text( 195 - $this->_oPdf->getStringWidth( $sWrapCost ), $iStartPos, $sWrapCost );
464 if ( $this->_oData->oxorder__oxstorno->value ) {
465 $this->_oData->oxorder__oxpaycost->setValue(0);
468 if ($oConfig->getConfigParam(
'blShowVATForDelivery')) {
469 if ( $this->_oData->oxorder__oxpayvat->value ) {
472 $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getNettoPrice(), $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
473 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ).
' '.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_NETTO' ) );
474 $this->
text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
476 if ( $oConfig->getConfigParam(
'sAdditionalServVATCalcMethod') !=
'proportional' ) {
477 $sVatValueText = $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxpayvat->value.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_PERCENTSUM' );
479 $sVatValueText = $this->_oData->translate(
'TOTAL_PLUS_PROPORTIONAL_VAT' );
484 $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getVATValue(), $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
485 $this->
text( 45, $iStartPos, $sVatValueText );
486 $this->
text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
495 if ( $this->_oData->oxorder__oxpaycost->value ) {
497 $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxpaycost->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
498 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ) );
499 $this->
text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
517 if ( $this->_oData->oxorder__oxtsprotectcosts->value && $oConfig->getConfigParam(
'blShowVATForPayCharge' ) ) {
521 $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getNettoPrice(), $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
522 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_TSPROTECTION' ).
' '.$this->_oData->translate(
'ORDER_OVERVIEW_PDF_NETTO' ) );
523 $this->
text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
527 $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getVATValue(), $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
528 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$oConfig->getConfigParam(
'dDefaultVAT' ).$this->_oData->translate(
'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
529 $this->
text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
533 } elseif ( $this->_oData->oxorder__oxtsprotectcosts->value ) {
536 $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxtsprotectcosts->value, $this->_oData->getCurrency() ).
' '.$this->_oData->getCurrency()->name;
537 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_TSPROTECTION' ) );
538 $this->
text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
556 $sTotalOrderSum = $this->_oData->getFormattedTotalOrderSum() .
' ' . $this->_oData->getCurrency()->name;
557 $this->
text( 45, $iStartPos, $this->_oData->translate(
'ORDER_OVERVIEW_PDF_ALLSUM' ) );
558 $this->
text( 195 - $this->_oPdf->getStringWidth( $sTotalOrderSum ), $iStartPos, $sTotalOrderSum );
561 if ( $this->_oData->oxorder__oxdelvat->value || $this->_oData->oxorder__oxwrapvat->value || $this->_oData->oxorder__oxpayvat->value ) {
575 $oPayment =
oxNew(
'oxpayment' );
576 $oPayment->loadInLang( $this->_oData->getSelectedLang(), $this->_oData->oxorder__oxpaymenttype->value );
578 $text = $this->_oData->translate(
'ORDER_OVERVIEW_PDF_SELPAYMENT' ).$oPayment->oxpayments__oxdesc->value;
580 $this->
text( 15, $iStartPos + 4, $text );
593 $text = $this->_oData->translate(
'ORDER_OVERVIEW_PDF_PAYUPTO' ) . date(
'd.m.Y', strtotime(
'+' . $this->_oData->getPaymentTerm() .
' day', strtotime( $this->_oData->oxorder__oxbilldate->value ) ) );
595 $this->
text( 15, $iStartPos + 4, $text );
613 if ( !$this->_oData->oxorder__oxdiscount->value ) {
625 if ( $this->_oData->oxorder__oxdiscount->value || $this->_oData->oxorder__oxvoucherdiscount->value ) {
626 $this->
line( 45, $siteH - 3, 195, $siteH - 3 );
642 $this->
line( 15, $siteH, 195, $siteH );
649 $this->
line( 15, $siteH, 195, $siteH );
658 return $siteH - $iStartPos;
700 $this->_iSelectedLang = $iLang;
711 if ( $this->_oActShop !== null )
714 $this->_oActShop =
oxNew(
'oxshop' );
715 $this->_oActShop->load( $this->getConfig()->getShopId() );
744 $oPdf->line( 15, 272, 195, 272 );
748 $oPdf->setFont( $oPdfBlock->getFont(),
'', 7 );
749 $oPdf->text( 15, 275, strip_tags( $oShop->oxshops__oxcompany->getRawValue() ) );
750 $oPdf->text( 15, 278, strip_tags( $oShop->oxshops__oxfname->getRawValue() ).
' '. strip_tags( $oShop->oxshops__oxlname->getRawValue() ) );
751 $oPdf->text( 15, 281, strip_tags( $oShop->oxshops__oxstreet->getRawValue() ) );
752 $oPdf->text( 15, 284, strip_tags( $oShop->oxshops__oxzip->value ).
' '. strip_tags( $oShop->oxshops__oxcity->getRawValue() ) );
753 $oPdf->text( 15, 287, strip_tags( $oShop->oxshops__oxcountry->getRawValue() ) );
756 $oPdf->text( 85, 275, $this->
translate(
'ORDER_OVERVIEW_PDF_PHONE' ).strip_tags( $oShop->oxshops__oxtelefon->value ) );
757 $oPdf->text( 85, 278, $this->
translate(
'ORDER_OVERVIEW_PDF_FAX' ).strip_tags( $oShop->oxshops__oxtelefax->value ) );
758 $oPdf->text( 85, 281, strip_tags( $oShop->oxshops__oxurl->value ) );
759 $oPdf->text( 85, 284, strip_tags( $oShop->oxshops__oxorderemail->value ) );
762 $oPdf->text( 150, 275, strip_tags( $oShop->oxshops__oxbankname->getRawValue() ) );
763 $oPdf->text( 150, 278, $this->
translate(
'ORDER_OVERVIEW_PDF_ACCOUNTNR' ).strip_tags( $oShop->oxshops__oxbanknumber->value ) );
764 $oPdf->text( 150, 281, $this->
translate(
'ORDER_OVERVIEW_PDF_BANKCODE' ).strip_tags( $oShop->oxshops__oxbankcode->value ) );
765 $oPdf->text( 150, 284, strip_tags( $oShop->oxshops__oxvatnumber->value ) );
766 $oPdf->text( 150, 287,
'' );
784 $oPdf->setFont( $oPdfBlock->getFont(),
'', 8 );
785 $oPdf->text( 15, 50, $this->
translate(
'ORDER_OVERVIEW_PDF_AMOUNT' ) );
786 $oPdf->text( 30, 50, $this->
translate(
'ORDER_OVERVIEW_PDF_ARTID') );
787 $oPdf->text( 45, 50, $this->
translate(
'ORDER_OVERVIEW_PDF_DESC' ) );
788 $oPdf->text( 160, 50, $this->
translate(
'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
789 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_ALLPRICE' );
790 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 50, $sText );
793 $oPdf->line( 15, 52, 195, 52 );
815 $aSize = getimagesize(
$myConfig->getImageDir().
'/pdf_logo.jpg' );
816 $iMargin = 195 - $aSize[0] * 0.2;
817 $oPdf->setLink( $oShop->oxshops__oxurl->value );
818 $oPdf->image(
$myConfig->getImageDir().
'/pdf_logo.jpg', $iMargin, 10, $aSize[0] * 0.2, $aSize[1] * 0.2,
'', $oShop->oxshops__oxurl->value );
819 return 14 + $aSize[1] * 0.2;
830 public function genPdf( $sFilename, $iSelLang = 0 )
837 if ( !$this->oxorder__oxbillnr->value ) {
838 $this->oxorder__oxbillnr->setValue( $this->getNextBillNum() );
842 if ( $this->oxorder__oxbilldate->value ==
'0000-00-00' ) {
843 $this->oxorder__oxbilldate->setValue( date(
'Y-m-d', mktime( 0, 0, 0, date (
'm' ), date (
'd' ), date(
'Y' ) ) ) );
847 if ( $blIsNewOrder ){
852 $oPdf =
oxNew(
'oxPDF' );
853 $oPdf->setPrintHeader(
false );
872 $oPdf->output( $sFilename,
'I' );
886 $sSal = $this->oxorder__oxbillsal->value;
888 $sSal = $oLang->translateString($this->oxorder__oxbillsal->value, $this->getSelectedLang());
892 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
893 $oPdf->text( 15, 59, $sSal);
894 $oPdf->text( 15, 63, $this->oxorder__oxbillfname->getRawValue().
' '.$this->oxorder__oxbilllname->getRawValue() );
895 $oPdf->text( 15, 67, $this->oxorder__oxbillcompany->getRawValue() );
896 $oPdf->text( 15, 71, $this->oxorder__oxbillstreet->getRawValue().
' '.$this->oxorder__oxbillstreetnr->value );
897 $oPdf->setFont( $oPdfBlock->getFont(),
'B', 10 );
898 $oPdf->text( 15, 75, $this->oxorder__oxbillzip->value.
' '.$this->oxorder__oxbillcity->getRawValue() );
899 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
900 $oPdf->text( 15, 79, $this->oxorder__oxbillcountry->getRawValue() );
913 $sSal = $this->oxorder__oxdelsal->value;
915 $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->getSelectedLang());
919 $oPdf->setFont( $oPdfBlock->getFont(),
'', 6 );
920 $oPdf->text( 15, 87, $this->
translate(
'ORDER_OVERVIEW_PDF_DELIVERYADDRESS' ) );
921 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
922 $oPdf->text( 15, 91, $sSal);
923 $oPdf->text( 15, 95, $this->oxorder__oxdellname->getRawValue().
' '.$this->oxorder__oxdelfname->getRawValue() );
924 $oPdf->text( 15, 99, $this->oxorder__oxdelcompany->getRawValue() );
925 $oPdf->text( 15, 103, $this->oxorder__oxdelstreet->getRawValue().
' '.$this->oxorder__oxdelstreetnr->value );
926 $oPdf->setFont( $oPdfBlock->getFont(),
'B', 10 );
927 $oPdf->text( 15, 107, $this->oxorder__oxdelzip->value.
' '.$this->oxorder__oxdelcity->getRawValue() );
928 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
929 $oPdf->text( 15, 111, $this->oxorder__oxdelcountry->getRawValue() );
943 if (!$this->_oArticles) {
944 $this->_oArticles = $this->getOrderArticles(
true);
950 foreach ( $this->_oArticles as $key => $oOrderArt ) {
953 if ( $iStartPos > 243 ) {
954 $this->pdffooter( $oPdf );
955 $iStartPos = $this->pdfheaderplus( $oPdf );
956 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
958 $iStartPos = $iStartPos + 4;
962 $oPdf->text( 20 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxamount->value ), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value );
965 $oPdf->setFont( $oPdfBlock->getFont(),
'', 8 );
966 $oPdf->text( 28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value );
969 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
970 $oPdf->text( 45, $iStartPos, substr( strip_tags( $this->
_replaceExtendedChars( $oOrderArt->oxorderarticles__oxtitle->getRawValue(), true ) ), 0, 58 ) );
972 if ( $blShowPrice ) {
976 $oPdf->text( 140 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxvat->value ), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value );
980 $dUnitPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnprice->value : $oOrderArt->oxorderarticles__oxbprice->value;
981 $dTotalPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnetprice->value : $oOrderArt->oxorderarticles__oxbrutprice->value;
983 $sText = $oLang->formatCurrency( $dUnitPrice, $this->_oCur ).
' '.$this->_oCur->name;
984 $oPdf->text( 163 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
987 $sText = $oLang->formatCurrency( $dTotalPrice, $this->_oCur ).
' '.$this->_oCur->name;
988 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
993 if ( $oOrderArt->oxorderarticles__oxselvariant->value ) {
994 $iStartPos = $iStartPos + 4;
995 $oPdf->text( 45, $iStartPos, substr( $oOrderArt->oxorderarticles__oxselvariant->value, 0, 58 ) );
1014 $this->_oCur =
$myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
1015 if ( !$this->_oCur ) {
1016 $this->_oCur =
$myConfig->getActShopCurrencyObject();
1023 $oPdf->setFont( $oPdfBlock->getFont(),
'', 6 );
1024 $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().
' - '.$oShop->oxshops__oxstreet->getRawValue().
' - '.$oShop->oxshops__oxzip->value.
' - '.$oShop->oxshops__oxcity->getRawValue() );
1030 if ( $this->oxorder__oxdelsal->value ) {
1035 $oUser =
oxNew(
'oxuser' );
1036 $oUser->load( $this->oxorder__oxuserid->value );
1039 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
1040 $oPdf->setFont( $oPdfBlock->getFont(),
'', 5 );
1041 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 55, $sText );
1044 $sCustNr = $this->
translate(
'ORDER_OVERVIEW_PDF_CUSTNR').
' '.$oUser->oxuser__oxcustnr->value;
1045 $oPdf->setFont( $oPdfBlock->getFont(),
'', 7 );
1046 $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 59, $sCustNr );
1049 if ( $this->oxorder__oxdelsal->value ) {
1056 $sText = $oShop->oxshops__oxcity->getRawValue().
', '.date(
'd.m.Y', strtotime($this->oxorder__oxbilldate->value ) );
1057 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1058 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
1061 if ( $oShop->oxshops__oxvatnumber->value ) {
1062 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_TAXIDNR' ).
' '.$oShop->oxshops__oxvatnumber->value;
1063 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 12, $sText );
1070 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_COUNTNR' ).
' '.$this->oxorder__oxbillnr->value;
1071 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
1074 if ( $this->oxorder__oxstorno->value == 1 ) {
1075 $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() .
' '.$this->translate(
'ORDER_OVERVIEW_PDF_STORNO' ),
oxField::T_RAW );
1079 $oPdf->setFont( $oPdfBlock->getFont(),
'', 12 );
1080 $oPdf->text( 15, $iTop, $this->
translate(
'ORDER_OVERVIEW_PDF_PURCHASENR' ).
' '.$this->oxorder__oxordernr->value );
1083 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1084 $aOrderDate = explode(
' ', $this->oxorder__oxorderdate->value );
1085 $sOrderDate =
oxRegistry::get(
"oxUtilsDate")->formatDBDate( $aOrderDate[0]);
1086 $oPdf->text( 15, $iTop + 8, $this->
translate(
'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate(
'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
1090 $oPdf->setFont( $oPdfBlock->getFont(),
'', 8 );
1091 $oPdf->text( 15, $iTop, $this->
translate(
'ORDER_OVERVIEW_PDF_AMOUNT' ) );
1092 $oPdf->text( 30, $iTop, $this->
translate(
'ORDER_OVERVIEW_PDF_ARTID' ) );
1093 $oPdf->text( 45, $iTop, $this->
translate(
'ORDER_OVERVIEW_PDF_DESC' ) );
1094 $oPdf->text( 135, $iTop, $this->
translate(
'ORDER_OVERVIEW_PDF_VAT' ) );
1095 $oPdf->text( 148, $iTop, $this->
translate(
'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
1096 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_ALLPRICE' );
1097 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
1101 $oPdf->line( 15, $iTop, 195, $iTop );
1105 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1112 $iHeight = $oArtSumm->generate( $siteH );
1113 if ( $siteH + $iHeight > 258 ) {
1116 $oArtSumm->ajustHeight( $iTop - $siteH );
1120 $oArtSumm->run( $oPdf );
1121 $siteH += $iHeight + 8;
1123 $oPdf->text( 15, $siteH, $this->
translate(
'ORDER_OVERVIEW_PDF_GREETINGS' ) );
1140 $sSal = $this->oxorder__oxdelsal->value;
1142 $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->getSelectedLang());
1147 $this->_oCur =
$myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
1148 if ( !isset( $this->_oCur ) ) {
1149 $this->_oCur =
$myConfig->getActShopCurrencyObject();
1153 $oPdf->setFont( $oPdfBlock->getFont(),
'', 6 );
1154 $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().
' - '.$oShop->oxshops__oxstreet->getRawValue().
' - '.$oShop->oxshops__oxzip->value.
' - '.$oShop->oxshops__oxcity->getRawValue() );
1157 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1158 if ( $this->oxorder__oxdelsal->value ) {
1159 $oPdf->text( 15, 59, $sSal );
1160 $oPdf->text( 15, 63, $this->oxorder__oxdellname->getRawValue().
' '.$this->oxorder__oxdelfname->getRawValue() );
1161 $oPdf->text( 15, 67, $this->oxorder__oxdelcompany->getRawValue() );
1162 $oPdf->text( 15, 71, $this->oxorder__oxdelstreet->getRawValue().
' '.$this->oxorder__oxdelstreetnr->value );
1163 $oPdf->setFont( $oPdfBlock->getFont(),
'B', 10 );
1164 $oPdf->text( 15, 75, $this->oxorder__oxdelzip->value.
' '.$this->oxorder__oxdelcity->getRawValue() );
1165 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1166 $oPdf->text( 15, 79, $this->oxorder__oxdelcountry->getRawValue() );
1173 $oUser =
oxNew(
'oxuser' );
1174 $oUser->load( $this->oxorder__oxuserid->value );
1177 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
1178 $oPdf->setFont( $oPdfBlock->getFont(),
'', 5 );
1179 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 70, $sText );
1182 $sCustNr = $this->
translate(
'ORDER_OVERVIEW_PDF_CUSTNR' ).
' '.$oUser->oxuser__oxcustnr->value;
1183 $oPdf->setFont( $oPdfBlock->getFont(),
'', 7 );
1184 $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 73, $sCustNr );
1187 $sText = $oShop->oxshops__oxcity->getRawValue().
', '.date(
'd.m.Y' );
1188 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1189 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 95, $sText );
1193 if ( $oShop->oxshops__oxvatnumber->value ) {
1194 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_TAXIDNR' ).
' '.$oShop->oxshops__oxvatnumber->value;
1195 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
1200 $sText = $this->
translate(
'ORDER_OVERVIEW_PDF_COUNTNR' ).
' '.$this->oxorder__oxbillnr->value;
1201 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
1204 if ( $this->oxorder__oxstorno->value == 1 ) {
1205 $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() .
' '.$this->translate(
'ORDER_OVERVIEW_PDF_STORNO' ),
oxField::T_RAW );
1209 $oPdf->setFont( $oPdfBlock->getFont(),
'', 12 );
1210 $oPdf->text( 15, 108, $this->
translate(
'ORDER_OVERVIEW_PDF_DELIVNOTE' ).
' '.$this->oxorder__oxordernr->value );
1213 $aOrderDate = explode(
' ', $this->oxorder__oxorderdate->value );
1214 $sOrderDate =
oxRegistry::get(
"oxUtilsDate")->formatDBDate( $aOrderDate[0]);
1215 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1216 $oPdf->text(15, 119, $this->
translate(
'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate(
'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
1219 $oPdf->setFont( $oPdfBlock->getFont(),
'', 8 );
1220 $oPdf->text( 15, 128, $this->
translate(
'ORDER_OVERVIEW_PDF_AMOUNT' ) );
1221 $oPdf->text( 30, 128, $this->
translate(
'ORDER_OVERVIEW_PDF_ARTID' ) );
1222 $oPdf->text( 45, 128, $this->
translate(
'ORDER_OVERVIEW_PDF_DESC' ) );
1225 $oPdf->line( 15, 130, 195, 130 );
1228 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1235 $oPdf->line( 15, $siteH + 2, 195, $siteH + 2 );
1239 $oPdf->setFont( $oPdfBlock->getFont(),
'', 10 );
1240 $text = $this->
translate(
'ORDER_OVERVIEW_PDF_PAYUPTO' ) . date(
'd.m.Y', strtotime(
'+' . $this->
getPaymentTerm() .
' day', strtotime( $this->oxorder__oxbilldate->value ) ) );
1241 $oPdf->text( 15, $siteH + 4, $text );
1261 $aReplace = array( chr(169) =>
"©", chr(128) =>
"€",
"\"" =>
""",
"'" =>
"'");
1267 if (version_compare(PHP_VERSION,
'5.3.4') >= 0) {
1268 $aTransTbl = get_html_translation_table (HTML_ENTITIES, ENT_COMPAT,
'ISO-8859-1');
1270 $aTransTbl = get_html_translation_table (HTML_ENTITIES, ENT_COMPAT);
1273 $aTransTbl = array_flip ($aTransTbl) + array_flip ($aReplace);
1274 $sValue = strtr($sValue, $aTransTbl);
1275 $sValue =
getStr()->preg_replace(
'/\&\#([0-9]+)\;/me',
"chr('\\1')", $sValue);
1289 return $this->getProductVats(
false );
1319 if ( null === $iPaymentTerm = $this->getConfig()->getConfigParam(
'iPaymentTerm' ) ) {
1323 return $iPaymentTerm;