myorder.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class PdfBlock
00007 {
00012     protected $_aCache = array();
00013 
00018     protected $_sFont = 'Arial';
00019 
00028     protected function _toCache( $sFunc, $aParams )
00029     {
00030         $oItem = new stdClass();
00031         $oItem->sFunc   = $sFunc;
00032         $oItem->aParams = $aParams;
00033         $this->_aCache[]  = $oItem;
00034     }
00035 
00043     public function run( $oPdf )
00044     {
00045         foreach ( $this->_aCache as $oItem ) {
00046             $sFn = $oItem->sFunc;
00047             switch ( count( $oItem->aParams ) ) {
00048                 case 0:
00049                     $oPdf->$sFn();
00050                     break;
00051                 case 1:
00052                     $oPdf->$sFn( $oItem->aParams[0]);
00053                     break;
00054                 case 2:
00055                     $oPdf->$sFn( $oItem->aParams[0], $oItem->aParams[1] );
00056                     break;
00057                 case 3:
00058                     $oPdf->$sFn( $oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2]);
00059                     break;
00060                 case 4:
00061                     $oPdf->$sFn( $oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2], $oItem->aParams[3]);
00062                     break;
00063             }
00064         }
00065     }
00066 
00077     public function line( $iLPos, $iLHeight, $iRPos, $iRHeight )
00078     {
00079         $this->_toCache( 'Line', array( $iLPos, $iLHeight, $iRPos, $iRHeight ) );
00080     }
00081 
00091     public function text( $iLPos, $iLHeight, $sString )
00092     {
00093         $this->_toCache( 'Text', array( $iLPos, $iLHeight, $sString ) );
00094     }
00095 
00105     public function font( $sType, $sWeight, $sSize )
00106     {
00107         $this->_toCache( 'SetFont', array( $sType, $sWeight, $sSize ) );
00108     }
00109 
00117     public function ajustHeight( $iDelta )
00118     {
00119         foreach ( $this->_aCache as $key => $oItem ) {
00120             switch ( $oItem->sFunc ) {
00121                 case 'Line':
00122                     $this->_aCache[$key]->aParams[3] += $iDelta;
00123                     $this->_aCache[$key]->aParams[1] += $iDelta;
00124                     break;
00125                 case 'Text':
00126                     $this->_aCache[$key]->aParams[1] += $iDelta;
00127                     break;
00128             }
00129         }
00130     }
00131 
00137     public function getFont()
00138     {
00139         return $this->_sFont;
00140     }
00141 }
00142 
00146 class PdfArticleSummary extends PdfBlock
00147 {
00148 
00153     protected $_oData = null;
00154 
00159     protected $_oPdf = null;
00160 
00169     public function __construct( $oData, $oPdf )
00170     {
00171         $this->_oData = $oData;
00172         $this->_oPdf = $oPdf;
00173     }
00174 
00182     protected function _setTotalCostsWithoutDiscount( &$iStartPos )
00183     {
00184         $oLang = oxLang::getInstance();
00185 
00186         // products netto price
00187         $this->line( 15, $iStartPos + 1, 195, $iStartPos + 1 );
00188         $sNetSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalnetsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00189         $this->text( 45, $iStartPos + 4, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICENETTO' ) );
00190         $this->text( 195 - $this->_oPdf->getStringWidth( $sNetSum ), $iStartPos + 4, $sNetSum );
00191 
00192         // #345 - product VAT info
00193         $iCtr = 0;
00194         foreach ( $this->_oData->getVats() as $iVat => $dVatPrice ) {
00195             $iStartPos += 4 * $iCtr;
00196             $sVATSum = $oLang->formatCurrency( $dVatPrice, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00197             $this->text( 45, $iStartPos + 8, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$iVat.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00198             $this->text( 195 - $this->_oPdf->getStringWidth( $sVATSum ), $iStartPos + 8, $sVATSum );
00199             $iCtr++;
00200         }
00201 
00202         // products brutto price
00203         $sBrutPrice = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalbrutsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00204         $this->text( 45, $iStartPos + 12, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICEBRUTTO' ) );
00205         $this->text( 195 - $this->_oPdf->getStringWidth( $sBrutPrice ), $iStartPos + 12, $sBrutPrice );
00206         $iStartPos++;
00207 
00208         // line separator
00209         $this->line( 45, $iStartPos + 13, 195, $iStartPos + 13 );
00210         $iStartPos += 5;
00211     }
00212 
00220     protected function _setTotalCostsWithDiscount( &$iStartPos )
00221     {
00222         $oLang = oxLang::getInstance();
00223 
00224         // line separator
00225         $this->line( 15, $iStartPos + 1, 195, $iStartPos + 1 );
00226 
00227         // products brutto price
00228         $sBrutPrice = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalbrutsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00229         $this->text( 45, $iStartPos + 4, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICEBRUTTO' ) );
00230         $this->text( 195 - $this->_oPdf->getStringWidth( $sBrutPrice ), $iStartPos + 4, $sBrutPrice );
00231 
00232         // line separator
00233         $this->line( 45, $iStartPos + 5, 195, $iStartPos + 5 );
00234 
00235         // discount
00236         $dDiscountVal = $this->_oData->oxorder__oxdiscount->value;
00237         if ( $dDiscountVal > 0 ) {
00238             $dDiscountVal *= -1;
00239         }
00240         $sDiscount = $oLang->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00241         $this->text( 45, $iStartPos + 8, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_DISCOUNT' ) );
00242         $this->text( 195 - $this->_oPdf->getStringWidth( $sDiscount ), $iStartPos + 8, $sDiscount );
00243         $iStartPos++;
00244 
00245         // line separator
00246         $this->line( 45, $iStartPos + 8, 195, $iStartPos + 8 );
00247         $iStartPos += 4;
00248 
00249         // products netto price
00250         $sNetSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalnetsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00251         $this->text( 45, $iStartPos + 8, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICENETTO' ) );
00252         $this->text( 195 - $this->_oPdf->getStringWidth( $sNetSum ), $iStartPos + 8, $sNetSum );
00253 
00254         // #345 - product VAT info
00255         $iCtr = 0;
00256         foreach ( $this->_oData->getVats() as $iVat => $dVatPrice ) {
00257             $iStartPos += 4 * $iCtr;
00258             $sVATSum = $oLang->formatCurrency( $dVatPrice, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00259             $this->text( 45, $iStartPos + 12, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$iVat.$this->_oData->translate('ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00260             $this->text( 195 - $this->_oPdf->getStringWidth( $sVATSum ), $iStartPos + 12, $sVATSum );
00261             $iCtr++;
00262         }
00263         $iStartPos += 4;
00264     }
00265 
00273     protected function _setVoucherInfo( &$iStartPos )
00274     {
00275         $dVoucher = 0;
00276         if ( $this->_oData->oxorder__oxvoucherdiscount->value ) {
00277             $dDiscountVal = $this->_oData->oxorder__oxvoucherdiscount->value;
00278             if ( $dDiscountVal > 0 ) {
00279                 $dDiscountVal *= -1;
00280             }
00281             $sPayCost = oxLang::getInstance()->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00282             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_VOUCHER' ) );
00283             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00284             $iStartPos += 4;
00285         }
00286 
00287         $iStartPos++;
00288     }
00289 
00297     protected function _setDeliveryInfo( &$iStartPos )
00298     {
00299         $sAddString = '';
00300         $oLang = oxLang::getInstance();
00301         $oConfig = oxConfig::getInstance();
00302         if ( $oConfig->getConfigParam( 'blCalcVATForDelivery' ) ) {
00303             // delivery netto
00304             $sDelCostNetto = $oLang->formatCurrency( $this->_oData->getOrderDeliveryPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00305             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SHIPCOST' ).' '.$this->_oData->translate('ORDER_OVERVIEW_PDF_NETTO' ) );
00306             $this->text( 195 - $this->_oPdf->getStringWidth( $sDelCostNetto ), $iStartPos, $sDelCostNetto );
00307             $iStartPos += 4;
00308 
00309             // delivery VAT
00310             $sDelCostVAT = $oLang->formatCurrency( $this->_oData->getOrderDeliveryPrice()->getVATValue(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00311             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxdelvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00312             $this->text( 195 - $this->_oPdf->getStringWidth( $sDelCostVAT ), $iStartPos, $sDelCostVAT );
00313             //$iStartPos += 4;
00314 
00315             $sAddString = ' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_BRUTTO' );
00316         } else {
00317             // if canceled order, reset value
00318             if ( $this->_oData->oxorder__oxstorno->value ) {
00319                 $this->_oData->oxorder__oxdelcost->setValue(0);
00320             }
00321 
00322             $sDelCost = $oLang->formatCurrency( $this->_oData->oxorder__oxdelcost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00323             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SHIPCOST' ).$sAddString );
00324             $this->text( 195 - $this->_oPdf->getStringWidth( $sDelCost ), $iStartPos, $sDelCost );
00325         }
00326     }
00327 
00335     protected function _setWrappingInfo( &$iStartPos )
00336     {
00337         if ( $this->_oData->oxorder__oxwrapcost->value ) {
00338             $sAddString = '';
00339             $oLang = oxLang::getInstance();
00340 
00341             //displaying wrapping VAT info
00342             if ( $this->_oData->oxorder__oxwrapvat->value ) {
00343 
00344                 // wrapping netto
00345                 $iStartPos += 5;
00346                 $sWrapCostNetto = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getNettoPrice(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00347                 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_WRAPPING' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00348                 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostNetto ), $iStartPos, $sWrapCostNetto );
00349 
00350                 //wrapping VAT
00351                 $iStartPos += 4;
00352                 $sWrapCostVAT = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getVATValue(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00353                 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxwrapvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00354                 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostVAT ), $iStartPos, $sWrapCostVAT );
00355 
00356                 $sAddString = ' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_BRUTTO' );
00357 
00358                 // drawing line separator
00359                 $iStartPos += 4;
00360                 $this->line(45, $iStartPos - 3, 195, $iStartPos - 3);
00361             }
00362             $iStartPos += 4;
00363 
00364             // wrapping cost
00365             $sWrapCost = $oLang->formatCurrency( $this->_oData->oxorder__oxwrapcost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00366             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_WRAPPING' ).$sAddString );
00367             $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCost ), $iStartPos, $sWrapCost );
00368             $iStartPos++;
00369         }
00370     }
00371 
00379     protected function _setPaymentInfo( &$iStartPos )
00380     {
00381         $oLang = oxLang::getInstance();
00382         if ( $this->_oData->oxorder__oxpayvat->value ) {
00383 
00384             // payment netto
00385             $iStartPos += 4;
00386             $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00387             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00388             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
00389 
00390             // payment VAT
00391             $iStartPos += 4;
00392             $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getVATValue(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00393             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxpayvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00394             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
00395 
00396         }
00397 
00398         // if canceled order, reset value
00399         if ( $this->_oData->oxorder__oxstorno->value ) {
00400             $this->_oData->oxorder__oxpaycost->setValue(0);
00401         }
00402 
00403         // payment costs
00404         if ( $this->_oData->oxorder__oxpaycost->value ) {
00405             $iStartPos += 4;
00406             $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxpaycost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00407             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ) );
00408             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00409         }
00410 
00411         $iStartPos++;
00412     }
00413 
00421     protected function _setTsProtection( &$iStartPos )
00422     {
00423         $oLang   = oxLang::getInstance();
00424         $oConfig = oxConfig::getInstance();
00425         if ( $this->_oData->oxorder__oxtsprotectcosts->value && $oConfig->getConfigParam( 'blCalcVATForPayCharge' ) ) {
00426 
00427             // payment netto
00428             $iStartPos += 4;
00429             $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00430             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_TSPROTECTION' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00431             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
00432 
00433             // payment VAT
00434             $iStartPos += 4;
00435             $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getVATValue(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00436             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$oConfig->getConfigParam( 'dDefaultVAT' ).$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00437             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
00438 
00439             $iStartPos++;
00440 
00441         } elseif ( $this->_oData->oxorder__oxtsprotectcosts->value ) {
00442 
00443             $iStartPos += 4;
00444             $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxtsprotectcosts->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00445             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_TSPROTECTION' ) );
00446             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00447 
00448             $iStartPos++;
00449         }
00450     }
00451 
00459     protected function _setGrandTotalPriceInfo( &$iStartPos )
00460     {
00461         $oLang = oxLang::getInstance();
00462 
00463         // total netto price (A. very unprecise, impossible to count because of many factors)
00464         $this->font( $this->getFont(), 'B', 10 );
00465         if ( $this->_oData->oxorder__oxdelvat->value || $this->_oData->oxorder__oxwrapvat->value || $this->_oData->oxorder__oxpayvat->value ) {
00466 
00467             // collecting total net price
00468             $sTotalNetSum = $oLang->formatCurrency( $this->_oData->getOrderNetSum(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00469             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLSUM_NET' ) );
00470             $this->text( 195 - $this->_oPdf->getStringWidth( $sTotalNetSum ), $iStartPos, $sTotalNetSum );
00471             $iStartPos += 4;
00472         }
00473 
00474         // total order sum
00475         $sTotalOrderSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalordersum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00476         $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLSUM' ) );
00477         $this->text( 195 - $this->_oPdf->getStringWidth( $sTotalOrderSum ), $iStartPos, $sTotalOrderSum );
00478         $iStartPos += 2;
00479     }
00480 
00488     protected function _setPaymentMethodInfo( &$iStartPos )
00489     {
00490         $oPayment = oxNew( 'oxpayment' );
00491         $oPayment->loadInLang( $this->_oData->getSelectedLang(), $this->_oData->oxorder__oxpaymenttype->value );
00492 
00493         $text = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SELPAYMENT' ).$oPayment->oxpayments__oxdesc->value;
00494         $this->font( $this->getFont(), '', 10 );
00495         $this->text( 15, $iStartPos + 4, $text );
00496         $iStartPos += 4;
00497     }
00498 
00506     protected function _setPayUntilInfo( &$iStartPos )
00507     {
00508         $text = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYUPTO' ).date( 'd.m.Y', mktime( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 7, date( 'Y' ) ) );
00509         $this->font( $this->getFont(), '', 10 );
00510         $this->text( 15, $iStartPos + 4, $text );
00511         $iStartPos += 4;
00512     }
00513 
00521     public function generate( $iStartPos )
00522     {
00523 
00524         $this->font( $this->getFont(), '', 10 );
00525         $siteH = $iStartPos;
00526 
00527         // #1147 discount for vat must be displayed
00528         if ( !$this->_oData->oxorder__oxdiscount->value ) {
00529             $this->_setTotalCostsWithoutDiscount( $siteH );
00530         } else {
00531             $this->_setTotalCostsWithDiscount( $siteH );
00532         }
00533 
00534         $siteH += 12;
00535 
00536         // voucher info
00537         $this->_setVoucherInfo( $siteH );
00538 
00539         // additional line separator
00540         if ( $this->_oData->oxorder__oxdiscount->value || $this->_oData->oxorder__oxvoucherdiscount->value ) {
00541             $this->line( 45, $siteH - 3, 195, $siteH - 3 );
00542         }
00543 
00544         // delivery info
00545         $this->_setDeliveryInfo( $siteH );
00546 
00547         // wrapping info
00548         $this->_setWrappingInfo( $siteH );
00549 
00550         // payment info
00551         $this->_setPaymentInfo( $siteH );
00552 
00553         // TS protection info
00554         $this->_setTsProtection( $siteH );
00555 
00556         // separating line
00557         $this->line( 15, $siteH, 195, $siteH );
00558         $siteH += 4;
00559 
00560         // total order sum
00561         $this->_setGrandTotalPriceInfo( $siteH );
00562 
00563         // separating line
00564         $this->line( 15, $siteH, 195, $siteH );
00565         $siteH += 4;
00566 
00567         // payment method
00568         $this->_setPaymentMethodInfo( $siteH );
00569 
00570         // pay until ...
00571         $this->_setPayUntilInfo( $siteH );
00572 
00573         return $siteH - $iStartPos;
00574     }
00575 }
00576 
00580 class MyOrder extends MyOrder_parent
00581 {
00582 
00587     protected $_iSelectedLang = 0;
00588 
00593     protected $_oActShop = null;
00594 
00599     protected $_aVATs = array();
00600 
00605     protected $_oCur = null;
00606 
00612     protected function _getActShop()
00613     {
00614         // shop is allready loaded
00615         if ( $this->_oActShop !== null )
00616             return $this->_oActShop;
00617 
00618         $this->_oActShop = oxNew( 'oxshop' );
00619         $this->_oActShop->load( $this->getConfig()->getShopId() );
00620 
00621         return $this->_oActShop;
00622     }
00623 
00631     public function translate( $sString )
00632     {
00633         return oxLang::getInstance()->translateString( $sString, $this->_iSelectedLang );
00634     }
00635 
00643     public function pdfFooter( $oPdf )
00644     {
00645 
00646         $oShop = $this->_getActShop();
00647 
00648         $oPdf->line( 15, 272, 195, 272 );
00649 
00650         $oPdfBlock = new PdfBlock();
00651         /* column 1 - company name, shop owner info, shop address */
00652         $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
00653         $oPdf->text( 15, 275, strip_tags( $oShop->oxshops__oxcompany->getRawValue() ) );
00654         $oPdf->text( 15, 278, strip_tags( $oShop->oxshops__oxfname->getRawValue() ).' '. strip_tags( $oShop->oxshops__oxlname->getRawValue() ) );
00655         $oPdf->text( 15, 281, strip_tags( $oShop->oxshops__oxstreet->getRawValue() ) );
00656         $oPdf->text( 15, 284, strip_tags( $oShop->oxshops__oxzip->value ).' '. strip_tags( $oShop->oxshops__oxcity->getRawValue() ) );
00657         $oPdf->text( 15, 287, strip_tags( $oShop->oxshops__oxcountry->getRawValue() ) );
00658 
00659         /* column 2 - phone, fax, url, email address */
00660         $oPdf->text( 85, 275, $this->translate( 'ORDER_OVERVIEW_PDF_PHONE' ).strip_tags( $oShop->oxshops__oxtelefon->value ) );
00661         $oPdf->text( 85, 278, $this->translate( 'ORDER_OVERVIEW_PDF_FAX' ).strip_tags( $oShop->oxshops__oxtelefax->value ) );
00662         $oPdf->text( 85, 281, strip_tags( $oShop->oxshops__oxurl->value ) );
00663         $oPdf->text( 85, 284, strip_tags( $oShop->oxshops__oxorderemail->value ) );
00664 
00665         /* column 3 - bank information */
00666         $oPdf->text( 150, 275, strip_tags( $oShop->oxshops__oxbankname->getRawValue() ) );
00667         $oPdf->text( 150, 278, $this->translate( 'ORDER_OVERVIEW_PDF_ACCOUNTNR' ).strip_tags( $oShop->oxshops__oxbanknumber->value ) );
00668         $oPdf->text( 150, 281, $this->translate( 'ORDER_OVERVIEW_PDF_BANKCODE' ).strip_tags( $oShop->oxshops__oxbankcode->value ) );
00669         $oPdf->text( 150, 284, strip_tags( $oShop->oxshops__oxvatnumber->value ) );
00670         $oPdf->text( 150, 287, '' );
00671     }
00672 
00680     public function pdfHeaderPlus( $oPdf )
00681     {
00682 
00683         // new page with shop logo
00684         $this->pdfHeader( $oPdf );
00685 
00686         $oPdfBlock = new PdfBlock();
00687         // column names
00688         $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00689         $oPdf->text( 15, 50, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
00690         $oPdf->text( 30, 50, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID') );
00691         $oPdf->text( 45, 50, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
00692         $oPdf->text( 160, 50, $this->translate( 'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
00693         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_ALLPRICE' );
00694         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 50, $sText );
00695 
00696         // line separator
00697         $oPdf->line( 15, 52, 195, 52 );
00698 
00699         return 56;
00700     }
00701 
00709     public function pdfHeader( $oPdf )
00710     {
00711         // adding new page ...
00712         $oPdf->addPage();
00713 
00714         // loading active shop
00715         $oShop = $this->_getActShop();
00716 
00717         //logo
00718         $myConfig = $this->getConfig();
00719         $aSize    = getimagesize( $myConfig->getImageDir().'/pdf_logo.jpg' );
00720         $iMargin  = 195 - $aSize[0] * 0.2;
00721         $oPdf->setLink( $oShop->oxshops__oxurl->value );
00722         $oPdf->image( $myConfig->getImageDir().'/pdf_logo.jpg', $iMargin, 10, $aSize[0] * 0.2, $aSize[1] * 0.2, '', $oShop->oxshops__oxurl->value );
00723         return 14 + $aSize[1] * 0.2;
00724     }
00725 
00734     public function genPdf( $sFilename, $iSelLang = 0 )
00735     {
00736         // setting pdf language
00737         $this->_iSelectedLang = $iSelLang;
00738 
00739         // setting invoice number
00740         if ( !$this->oxorder__oxbillnr->value ) {
00741             $this->oxorder__oxbillnr->setValue($this->getNextBillNum());
00742             $this->save();
00743         }
00744 
00745         // initiating pdf engine
00746         $oPdf = oxNew( 'oxPDF' );
00747         $oPdf->setPrintHeader( false );
00748         $oPdf->open();
00749 
00750         // adding header
00751         $this->pdfHeader( $oPdf );
00752 
00753         // adding info data
00754         switch ( oxConfig::getParameter( 'pdftype' ) ) {
00755             case 'dnote':
00756                 $this->exportDeliveryNote( $oPdf );
00757                 break;
00758             default:
00759                 $this->exportStandart( $oPdf );
00760         }
00761 
00762         // adding footer
00763         $this->pdfFooter( $oPdf );
00764 
00765         // outputting file to browser
00766         $oPdf->output( $sFilename, 'I' );
00767     }
00768 
00769 
00777     protected function _setBillingAddressToPdf( $oPdf )
00778     {
00779         $oLang = oxLang::getInstance();
00780         $sSal = $this->oxorder__oxbillsal->value;
00781         try {
00782             $sSal = $oLang->translateString($this->oxorder__oxbillsal->value, $this->_iSelectedLang);
00783         } catch (Exception $e) {
00784         }
00785         $oPdfBlock = new PdfBlock();
00786         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00787         $oPdf->text( 15, 59, $sSal);
00788         $oPdf->text( 15, 63, $this->oxorder__oxbillfname->getRawValue().' '.$this->oxorder__oxbilllname->getRawValue() );
00789         $oPdf->text( 15, 67, $this->oxorder__oxbillcompany->getRawValue() );
00790         $oPdf->text( 15, 71, $this->oxorder__oxbillstreet->getRawValue().' '.$this->oxorder__oxbillstreetnr->value );
00791         $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
00792         $oPdf->text( 15, 75, $this->oxorder__oxbillzip->value.' '.$this->oxorder__oxbillcity->getRawValue() );
00793         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00794         $oPdf->text( 15, 79, $this->oxorder__oxbillcountry->getRawValue() );
00795     }
00796 
00804     protected function _setDeliveryAddressToPdf( $oPdf )
00805     {
00806         $oLang = oxLang::getInstance();
00807         $sSal = $this->oxorder__oxdelsal->value;
00808         try {
00809             $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->_iSelectedLang);
00810         } catch (Exception $e) {
00811         }
00812         $oPdfBlock = new PdfBlock();
00813         $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
00814         $oPdf->text( 15, 87, $this->translate( 'ORDER_OVERVIEW_PDF_DELIVERYADDRESS' ) );
00815         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00816         $oPdf->text( 15, 91, $sSal);
00817         $oPdf->text( 15, 95, $this->oxorder__oxdellname->getRawValue().' '.$this->oxorder__oxdelfname->getRawValue() );
00818         $oPdf->text( 15, 99, $this->oxorder__oxdelcompany->getRawValue() );
00819         $oPdf->text( 15, 103, $this->oxorder__oxdelstreet->getRawValue().' '.$this->oxorder__oxdelstreetnr->value );
00820         $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
00821         $oPdf->text( 15, 107, $this->oxorder__oxdelzip->value.' '.$this->oxorder__oxdelcity->getRawValue() );
00822         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00823         $oPdf->text( 15, 111, $this->oxorder__oxdelcountry->getRawValue() );
00824     }
00825 
00835     protected function _setOrderArticlesToPdf( $oPdf, &$iStartPos, $blShowPrice = true )
00836     {
00837         if (!$this->_oArticles) {
00838             $this->_oArticles = $this->getOrderArticles(true);
00839         }
00840 
00841         $oCurr = $this->getCurrency();
00842         $oPdfBlock = new PdfBlock();
00843         // product list
00844         foreach ( $this->_oArticles as $key => $oOrderArt ) {
00845 
00846             // starting a new page ...
00847             if ( $iStartPos > 243 ) {
00848                 $this->pdffooter( $oPdf );
00849                 $iStartPos = $this->pdfheaderplus( $oPdf );
00850                 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00851             } else {
00852                 $iStartPos = $iStartPos + 4;
00853             }
00854 
00855             // sold amount
00856             $oPdf->text( 20 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxamount->value ), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value );
00857 
00858             // product number
00859             $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00860             $oPdf->text( 28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value );
00861 
00862             // product title
00863             $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00864             $oPdf->text( 45, $iStartPos, substr( strip_tags( $this->_replaceExtendedChars( $oOrderArt->oxorderarticles__oxtitle->getRawValue(), true ) ), 0, 58 ) );
00865 
00866             if ( $blShowPrice ) {
00867                 $oLang = oxLang::getInstance();
00868 
00869                 // calculating product VAT info
00870                 if ( !isset( $this->_aVATs[$oOrderArt->oxorderarticles__oxvat->value] ) ) {
00871                     $this->_aVATs[$oOrderArt->oxorderarticles__oxvat->value] = 0;
00872                 }
00873                 // #M1434: VAT recalculation in admin (pdf) is wrong
00874                 if ( $oOrderArt->oxorderarticles__oxamount->value > 0 ) {
00875                     $this->_aVATs[$oOrderArt->oxorderarticles__oxvat->value] += ( $oOrderArt->oxorderarticles__oxvatprice->value * $oCurr->rate );
00876                 }
00877 
00878                 // product VAT percent
00879                 $oPdf->text( 150 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxvat->value ), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value );
00880 
00881                 // product price
00882                 $sText = $oLang->formatCurrency( $oOrderArt->oxorderarticles__oxbprice->value, $this->_oCur ).' '.$this->_oCur->name;
00883                 $oPdf->text( 173 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
00884 
00885                 // total product price
00886                 $sText = $oLang->formatCurrency( $oOrderArt->oxorderarticles__oxbrutprice->value, $this->_oCur ).' '.$this->_oCur->name;
00887                 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
00888 
00889             }
00890 
00891             // additional variant info
00892             if ( $oOrderArt->oxorderarticles__oxselvariant->value ) {
00893                 $iStartPos = $iStartPos + 4;
00894                 $oPdf->text( 45, $iStartPos, substr( $oOrderArt->oxorderarticles__oxselvariant->value, 0, 58 ) );
00895             }
00896 
00897         }
00898     }
00899 
00907     public function exportStandart( $oPdf )
00908     {
00909         // preparing order curency info
00910         $myConfig = $this->getConfig();
00911         $oPdfBlock = new PdfBlock();
00912 
00913         $this->_oCur = $myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
00914         if ( !$this->_oCur ) {
00915             $this->_oCur = $myConfig->getActShopCurrencyObject();
00916         }
00917 
00918         // loading active shop
00919         $oShop = $this->_getActShop();
00920 
00921         // shop information
00922         $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
00923         $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().' - '.$oShop->oxshops__oxstreet->getRawValue().' - '.$oShop->oxshops__oxzip->value.' - '.$oShop->oxshops__oxcity->getRawValue() );
00924 
00925         // billing address
00926         $this->_setBillingAddressToPdf( $oPdf );
00927 
00928         // delivery address
00929         if ( $this->oxorder__oxdelsal->value ) {
00930             $this->_setDeliveryAddressToPdf( $oPdf );
00931         }
00932 
00933         // loading user
00934         $oUser = oxNew( 'oxuser' );
00935         $oUser->load( $this->oxorder__oxuserid->value );
00936 
00937         // user info
00938         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
00939         $oPdf->setFont( $oPdfBlock->getFont(), '', 5 );
00940         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 55, $sText );
00941 
00942         // customer number
00943         $sCustNr = $this->translate( 'ORDER_OVERVIEW_PDF_CUSTNR').' '.$oUser->oxuser__oxcustnr->value;
00944         $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
00945         $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 59, $sCustNr );
00946 
00947         // setting position if delivery address is used
00948         if ( $this->oxorder__oxdelsal->value ) {
00949             $iTop = 115;
00950         } else {
00951             $iTop = 91;
00952         }
00953 
00954         // shop city
00955         $sText = $oShop->oxshops__oxcity->getRawValue().', '.date( 'd.m.Y' );
00956         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00957         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
00958 
00959         // shop VAT number
00960         if ( $oShop->oxshops__oxvatnumber->value ) {
00961             $sText = $this->translate( 'ORDER_OVERVIEW_PDF_TAXIDNR' ).' '.$oShop->oxshops__oxvatnumber->value;
00962             $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 12, $sText );
00963             $iTop += 8;
00964         } else {
00965             $iTop += 4;
00966         }
00967 
00968         // invoice number
00969         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_COUNTNR' ).' '.$this->oxorder__oxbillnr->value;
00970         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
00971 
00972         // marking if order is canceled
00973         if ( $this->oxorder__oxstorno->value == 1 ) {
00974             $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() . '   '.$this->translate( 'ORDER_OVERVIEW_PDF_STORNO' ), oxField::T_RAW );
00975         }
00976 
00977         // order number
00978         $oPdf->setFont( $oPdfBlock->getFont(), '', 12 );
00979         $oPdf->text( 15, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_PURCHASENR' ).' '.$this->oxorder__oxordernr->value );
00980 
00981         // order date
00982         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00983         $aOrderDate = explode( ' ', $this->oxorder__oxorderdate->value );
00984         $sOrderDate = oxUtilsDate::getInstance()->formatDBDate( $aOrderDate[0]);
00985         $oPdf->text( 15, $iTop + 8, $this->translate( 'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate( 'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
00986         $iTop += 16;
00987 
00988         // product info header
00989         $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00990         $oPdf->text( 15, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
00991         $oPdf->text( 30, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID' ) );
00992         $oPdf->text( 45, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
00993         $oPdf->text( 145, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_VAT' ) );
00994         $oPdf->text( 158, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
00995         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_ALLPRICE' );
00996         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
00997 
00998         // separator line
00999         $iTop += 2;
01000         $oPdf->line( 15, $iTop, 195, $iTop );
01001 
01002         // #345
01003         $siteH = $iTop;
01004         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01005 
01006         // order articles
01007         $this->_setOrderArticlesToPdf( $oPdf, $siteH, true );
01008 
01009         // generating pdf file
01010         $oArtSumm = new PdfArticleSummary( $this, $oPdf );
01011         $iHeight = $oArtSumm->generate( $siteH );
01012         if ( $siteH + $iHeight > 258 ) {
01013             $this->pdfFooter( $oPdf );
01014             $iTop = $this->pdfHeader( $oPdf );
01015             $oArtSumm->ajustHeight( $iTop - $siteH );
01016             $siteH = $iTop;
01017         }
01018 
01019         $oArtSumm->run( $oPdf );
01020         $siteH += $iHeight + 8;
01021 
01022         $oPdf->text( 15, $siteH, $this->translate( 'ORDER_OVERVIEW_PDF_GREETINGS' ) );
01023     }
01024 
01032     public function exportDeliveryNote( $oPdf )
01033     {
01034         $myConfig = $this->getConfig();
01035         $oShop    = $this->_getActShop();
01036         $oPdfBlock = new PdfBlock();
01037 
01038         $oLang = oxLang::getInstance();
01039         $sSal = $this->oxorder__oxdelsal->value;
01040         try {
01041             $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->_iSelectedLang);
01042         } catch (Exception $e) {
01043         }
01044 
01045         // loading order currency info
01046         $this->_oCur = $myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
01047         if ( !isset( $this->_oCur ) ) {
01048             $this->_oCur = $myConfig->getActShopCurrencyObject();
01049         }
01050 
01051         // shop info
01052         $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
01053         $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().' - '.$oShop->oxshops__oxstreet->getRawValue().' - '.$oShop->oxshops__oxzip->value.' - '.$oShop->oxshops__oxcity->getRawValue() );
01054 
01055         // delivery address
01056         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01057         if ( $this->oxorder__oxdelsal->value ) {
01058             $oPdf->text( 15, 59, $sSal );
01059             $oPdf->text( 15, 63, $this->oxorder__oxdellname->getRawValue().' '.$this->oxorder__oxdelfname->getRawValue() );
01060             $oPdf->text( 15, 67, $this->oxorder__oxdelcompany->getRawValue() );
01061             $oPdf->text( 15, 71, $this->oxorder__oxdelstreet->getRawValue().' '.$this->oxorder__oxdelstreetnr->value );
01062             $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
01063             $oPdf->text( 15, 75, $this->oxorder__oxdelzip->value.' '.$this->oxorder__oxdelcity->getRawValue() );
01064             $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01065             $oPdf->text( 15, 79, $this->oxorder__oxdelcountry->getRawValue() );
01066         } else {
01067             // no delivery address - billing address is used for delivery
01068             $this->_setBillingAddressToPdf( $oPdf );
01069         }
01070 
01071         // loading user info
01072         $oUser = oxNew( 'oxuser' );
01073         $oUser->load( $this->oxorder__oxuserid->value );
01074 
01075         // user info
01076         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
01077         $oPdf->setFont( $oPdfBlock->getFont(), '', 5 );
01078         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 70, $sText );
01079 
01080         // customer number
01081         $sCustNr = $this->translate( 'ORDER_OVERVIEW_PDF_CUSTNR' ).' '.$oUser->oxuser__oxcustnr->value;
01082         $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
01083         $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 73, $sCustNr );
01084 
01085         // shops city
01086         $sText = $oShop->oxshops__oxcity->getRawValue().', '.date( 'd.m.Y' );
01087         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01088         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 95, $sText );
01089 
01090         $iTop = 99;
01091         // shop VAT number
01092         if ( $oShop->oxshops__oxvatnumber->value ) {
01093             $sText = $this->translate( 'ORDER_OVERVIEW_PDF_TAXIDNR' ).' '.$oShop->oxshops__oxvatnumber->value;
01094             $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01095             $iTop += 4;
01096         }
01097 
01098         // invoice number
01099         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_COUNTNR' ).' '.$this->oxorder__oxbillnr->value;
01100         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01101 
01102         // canceled order marker
01103         if ( $this->oxorder__oxstorno->value == 1 ) {
01104             $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() . '   '.$this->translate( 'ORDER_OVERVIEW_PDF_STORNO' ), oxField::T_RAW );
01105         }
01106 
01107         // order number
01108         $oPdf->setFont( $oPdfBlock->getFont(), '', 12 );
01109         $oPdf->text( 15, 108, $this->translate( 'ORDER_OVERVIEW_PDF_DELIVNOTE' ).' '.$this->oxorder__oxordernr->value );
01110 
01111         // order date
01112         $aOrderDate = explode( ' ', $this->oxorder__oxorderdate->value );
01113         $sOrderDate = oxUtilsDate::getInstance()->formatDBDate( $aOrderDate[0]);
01114         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01115         $oPdf->text(15, 119, $this->translate( 'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate( 'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
01116 
01117         // product info header
01118         $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
01119         $oPdf->text( 15, 128, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
01120         $oPdf->text( 30, 128, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID' ) );
01121         $oPdf->text( 45, 128, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
01122 
01123         // line separator
01124         $oPdf->line( 15, 130, 195, 130 );
01125 
01126         // product list
01127         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01128         $siteH = 130;
01129 
01130         // order articles
01131         $this->_setOrderArticlesToPdf( $oPdf, $siteH, false );
01132 
01133         // sine separator
01134         $oPdf->line( 15, $siteH + 2, 195, $siteH + 2 );
01135         $siteH += 4;
01136 
01137         // payment date
01138         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01139         $text = $this->translate( 'ORDER_OVERVIEW_PDF_PAYUPTO' ).date( 'd.m.Y', mktime( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 7, date( 'Y' ) ) );
01140         $oPdf->text( 15, $siteH + 4, $text );
01141     }
01142 
01152     protected function _replaceExtendedChars( $sValue, $blReverse = false )
01153     {
01154         // we need to replace this for compatibility with XHTML
01155         // as this function causes a lot of trouble with editor
01156         // we switch it off, even if this means that fields do not validate through xhtml
01157         // return $sValue;
01158 
01159         // we need to replace this for compatibility with XHTML
01160         $aReplace = array( chr(169) => "&copy;", chr(128) => "&euro;", "\"" => "&quot;", "'" => "&#039;");
01161 
01162         // #899C reverse html entities and references transformation is used in invoicepdf module
01163         // so this part must be enabled. Now it works with html references like &#123;
01164         if ($blReverse) {
01165             // replace now
01166             if (version_compare(PHP_VERSION, '5.3.4') >= 0) {
01167                 $aTransTbl = get_html_translation_table (HTML_ENTITIES, ENT_COMPAT, 'ISO-8859-1');
01168             } else {
01169                 $aTransTbl = get_html_translation_table (HTML_ENTITIES, ENT_COMPAT);
01170             }
01171 
01172             $aTransTbl = array_flip ($aTransTbl) + array_flip ($aReplace);
01173             $sValue = strtr($sValue, $aTransTbl);
01174             $sValue = getStr()->preg_replace('/\&\#([0-9]+)\;/me', "chr('\\1')", $sValue);
01175         }
01176 
01177         return $sValue;
01178     }
01179 
01185     public function getVats()
01186     {
01187         // for new orders
01188         $aVats = $this->getProductVats( false );
01189 
01190         // for older orders
01191         return ( is_array( $aVats ) && count( $aVats ) ) ? $aVats : $this->_aVATs;
01192     }
01193 
01199     public function getCurrency()
01200     {
01201         return $this->_oCur;
01202     }
01203 
01209     public function getSelectedLang()
01210     {
01211         return $this->_iSelectedLang;
01212     }
01213 }