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         $oLang = oxLang::getInstance();
00300         $sAddString = '';
00301         if ( $this->_oData->oxorder__oxdelvat->value ) {
00302 
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 
00317             // drawing line separator
00318             $this->line( 45, $iStartPos - 3, 195, $iStartPos - 3 );
00319             $iStartPos++;
00320         }
00321 
00322         // delivery costs
00323 
00324         // if canceled order, reset value
00325         if ( $this->_oData->oxorder__oxstorno->value ) {
00326             $this->_oData->oxorder__oxdelcost->setValue(0);
00327         }
00328 
00329         $sDelCost = $oLang->formatCurrency( $this->_oData->oxorder__oxdelcost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00330         $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SHIPCOST' ).$sAddString );
00331         $this->text( 195 - $this->_oPdf->getStringWidth( $sDelCost ), $iStartPos, $sDelCost );
00332     }
00333 
00341     protected function _setWrappingInfo( &$iStartPos )
00342     {
00343         if ( $this->_oData->oxorder__oxwrapcost->value ) {
00344             $sAddString = '';
00345             $oLang = oxLang::getInstance();
00346 
00347             //displaying wrapping VAT info
00348             if ( $this->_oData->oxorder__oxwrapvat->value ) {
00349 
00350                 // wrapping netto
00351                 $iStartPos += 5;
00352                 $sWrapCostNetto = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getNettoPrice(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00353                 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_WRAPPING' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00354                 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostNetto ), $iStartPos, $sWrapCostNetto );
00355 
00356                 //wrapping VAT
00357                 $iStartPos += 4;
00358                 $sWrapCostVAT = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getVATValue(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00359                 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxwrapvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00360                 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostVAT ), $iStartPos, $sWrapCostVAT );
00361 
00362                 $sAddString = ' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_BRUTTO' );
00363 
00364                 // drawing line separator
00365                 $iStartPos += 4;
00366                 $this->line(45, $iStartPos - 3, 195, $iStartPos - 3);
00367             }
00368             $iStartPos += 4;
00369 
00370             // wrapping cost
00371             $sWrapCost = $oLang->formatCurrency( $this->_oData->oxorder__oxwrapcost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00372             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_WRAPPING' ).$sAddString );
00373             $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCost ), $iStartPos, $sWrapCost );
00374             $iStartPos++;
00375         }
00376     }
00377 
00385     protected function _setPaymentInfo( &$iStartPos )
00386     {
00387         $oLang = oxLang::getInstance();
00388         if ( $this->_oData->oxorder__oxpayvat->value ) {
00389 
00390             // payment netto
00391             $iStartPos += 4;
00392             $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00393             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00394             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
00395 
00396             // payment VAT
00397             $iStartPos += 4;
00398             $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getVATValue(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00399             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxpayvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00400             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
00401 
00402         }
00403 
00404         // if canceled order, reset value
00405         if ( $this->_oData->oxorder__oxstorno->value ) {
00406             $this->_oData->oxorder__oxpaycost->setValue(0);
00407         }
00408 
00409         // payment costs
00410         if ( $this->_oData->oxorder__oxpaycost->value ) {
00411             $iStartPos += 4;
00412             $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxpaycost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00413             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ) );
00414             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00415         }
00416 
00417         $iStartPos++;
00418     }
00419 
00427     protected function _setTsProtection( &$iStartPos )
00428     {
00429         $oLang   = oxLang::getInstance();
00430         $oConfig = oxConfig::getInstance();
00431         if ( $oConfig->getConfigParam( 'blCalcVATForPayCharge' ) ) {
00432 
00433             // payment netto
00434             $iStartPos += 4;
00435             $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00436             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_TSPROTECTION' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00437             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
00438 
00439             // payment VAT
00440             $iStartPos += 4;
00441             $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getVATValue(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00442             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$oConfig->getConfigParam( 'dDefaultVAT' ).$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00443             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
00444 
00445         }
00446 
00447         // payment costs
00448         if ( $this->_oData->oxorder__oxtsprotectcosts->value ) {
00449             $iStartPos += 4;
00450             $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxtsprotectcosts->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00451             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_TSPROTECTION' ) );
00452             $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00453         }
00454 
00455         $iStartPos++;
00456     }
00457 
00465     protected function _setGrandTotalPriceInfo( &$iStartPos )
00466     {
00467         $oLang = oxLang::getInstance();
00468 
00469         // total netto price (A. very unprecise, impossible to count because of many factors)
00470         $this->font( $this->getFont(), 'B', 10 );
00471         if ( $this->_oData->oxorder__oxdelvat->value || $this->_oData->oxorder__oxwrapvat->value || $this->_oData->oxorder__oxpayvat->value ) {
00472 
00473             // collecting total net price
00474             $sTotalNetSum = $oLang->formatCurrency( $this->_oData->getOrderNetSum(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00475             $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLSUM_NET' ) );
00476             $this->text( 195 - $this->_oPdf->getStringWidth( $sTotalNetSum ), $iStartPos, $sTotalNetSum );
00477             $iStartPos += 4;
00478         }
00479 
00480         // total order sum
00481         $sTotalOrderSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalordersum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00482         $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLSUM' ) );
00483         $this->text( 195 - $this->_oPdf->getStringWidth( $sTotalOrderSum ), $iStartPos, $sTotalOrderSum );
00484         $iStartPos += 2;
00485     }
00486 
00494     protected function _setPaymentMethodInfo( &$iStartPos )
00495     {
00496         $oPayment = oxNew( 'oxpayment' );
00497         $oPayment->loadInLang( $this->_oData->getSelectedLang(), $this->_oData->oxorder__oxpaymenttype->value );
00498 
00499         $text = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SELPAYMENT' ).$oPayment->oxpayments__oxdesc->value;
00500         $this->font( $this->getFont(), '', 10 );
00501         $this->text( 15, $iStartPos + 4, $text );
00502         $iStartPos += 4;
00503     }
00504 
00512     protected function _setPayUntilInfo( &$iStartPos )
00513     {
00514         $text = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYUPTO' ).date( 'd.m.Y', mktime( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 7, date( 'Y' ) ) );
00515         $this->font( $this->getFont(), '', 10 );
00516         $this->text( 15, $iStartPos + 4, $text );
00517         $iStartPos += 4;
00518     }
00519 
00527     public function generate( $iStartPos )
00528     {
00529 
00530         $this->font( $this->getFont(), '', 10 );
00531         $siteH = $iStartPos;
00532 
00533         // #1147 discount for vat must be displayed
00534         if ( !$this->_oData->oxorder__oxdiscount->value ) {
00535             $this->_setTotalCostsWithoutDiscount( $siteH );
00536         } else {
00537             $this->_setTotalCostsWithDiscount( $siteH );
00538         }
00539 
00540         $siteH += 12;
00541 
00542         // voucher info
00543         $this->_setVoucherInfo( $siteH );
00544 
00545         // additional line separator
00546         if ( $this->_oData->oxorder__oxdiscount->value || $this->_oData->oxorder__oxvoucherdiscount->value ) {
00547             $this->line( 45, $siteH - 3, 195, $siteH - 3 );
00548         }
00549 
00550         // delivery info
00551         $this->_setDeliveryInfo( $siteH );
00552 
00553         // wrapping info
00554         $this->_setWrappingInfo( $siteH );
00555 
00556         // payment info
00557         $this->_setPaymentInfo( $siteH );
00558 
00559         // TS protection info
00560         $this->_setTsProtection( $siteH );
00561 
00562         // separating line
00563         $this->line( 15, $siteH, 195, $siteH );
00564         $siteH += 4;
00565 
00566         // total order sum
00567         $this->_setGrandTotalPriceInfo( $siteH );
00568 
00569         // separating line
00570         $this->line( 15, $siteH, 195, $siteH );
00571         $siteH += 4;
00572 
00573         // payment method
00574         $this->_setPaymentMethodInfo( $siteH );
00575 
00576         // pay until ...
00577         $this->_setPayUntilInfo( $siteH );
00578 
00579         return $siteH - $iStartPos;
00580     }
00581 }
00582 
00586 class MyOrder extends MyOrder_parent
00587 {
00588 
00593     protected $_iSelectedLang = 0;
00594 
00599     protected $_oActShop = null;
00600 
00605     protected $_aVATs = array();
00606 
00611     protected $_oCur = null;
00612 
00618     protected function _getActShop()
00619     {
00620         // shop is allready loaded
00621         if ( $this->_oActShop !== null )
00622             return $this->_oActShop;
00623 
00624         $this->_oActShop = oxNew( 'oxshop' );
00625         $this->_oActShop->load( $this->getConfig()->getShopId() );
00626 
00627         return $this->_oActShop;
00628     }
00629 
00637     public function translate( $sString )
00638     {
00639         return oxLang::getInstance()->translateString( $sString, $this->_iSelectedLang );
00640     }
00641 
00649     public function pdfFooter( $oPdf )
00650     {
00651 
00652         $oShop = $this->_getActShop();
00653 
00654         $oPdf->line( 15, 272, 195, 272 );
00655 
00656         $oPdfBlock = new PdfBlock();
00657         /* column 1 - company name, shop owner info, shop address */
00658         $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
00659         $oPdf->text( 15, 275, strip_tags( $oShop->oxshops__oxcompany->getRawValue() ) );
00660         $oPdf->text( 15, 278, strip_tags( $oShop->oxshops__oxfname->getRawValue() ).' '. strip_tags( $oShop->oxshops__oxlname->getRawValue() ) );
00661         $oPdf->text( 15, 281, strip_tags( $oShop->oxshops__oxstreet->getRawValue() ) );
00662         $oPdf->text( 15, 284, strip_tags( $oShop->oxshops__oxzip->value ).' '. strip_tags( $oShop->oxshops__oxcity->getRawValue() ) );
00663         $oPdf->text( 15, 287, strip_tags( $oShop->oxshops__oxcountry->getRawValue() ) );
00664 
00665         /* column 2 - phone, fax, url, email address */
00666         $oPdf->text( 85, 275, $this->translate( 'ORDER_OVERVIEW_PDF_PHONE' ).strip_tags( $oShop->oxshops__oxtelefon->value ) );
00667         $oPdf->text( 85, 278, $this->translate( 'ORDER_OVERVIEW_PDF_FAX' ).strip_tags( $oShop->oxshops__oxtelefax->value ) );
00668         $oPdf->text( 85, 281, strip_tags( $oShop->oxshops__oxurl->value ) );
00669         $oPdf->text( 85, 284, strip_tags( $oShop->oxshops__oxorderemail->value ) );
00670 
00671         /* column 3 - bank information */
00672         $oPdf->text( 150, 275, strip_tags( $oShop->oxshops__oxbankname->getRawValue() ) );
00673         $oPdf->text( 150, 278, $this->translate( 'ORDER_OVERVIEW_PDF_ACCOUNTNR' ).strip_tags( $oShop->oxshops__oxbanknumber->value ) );
00674         $oPdf->text( 150, 281, $this->translate( 'ORDER_OVERVIEW_PDF_BANKCODE' ).strip_tags( $oShop->oxshops__oxbankcode->value ) );
00675         $oPdf->text( 150, 284, strip_tags( $oShop->oxshops__oxvatnumber->value ) );
00676         $oPdf->text( 150, 287, '' );
00677     }
00678 
00686     public function pdfHeaderPlus( $oPdf )
00687     {
00688 
00689         // new page with shop logo
00690         $this->pdfHeader( $oPdf );
00691 
00692         $oPdfBlock = new PdfBlock();
00693         // column names
00694         $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00695         $oPdf->text( 15, 50, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
00696         $oPdf->text( 30, 50, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID') );
00697         $oPdf->text( 45, 50, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
00698         $oPdf->text( 160, 50, $this->translate( 'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
00699         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_ALLPRICE' );
00700         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 50, $sText );
00701 
00702         // line separator
00703         $oPdf->line( 15, 52, 195, 52 );
00704 
00705         return 56;
00706     }
00707 
00715     public function pdfHeader( $oPdf )
00716     {
00717         // adding new page ...
00718         $oPdf->addPage();
00719 
00720         // loading active shop
00721         $oShop = $this->_getActShop();
00722 
00723         //logo
00724         $myConfig = $this->getConfig();
00725         $aSize    = getimagesize( $myConfig->getImageDir().'/pdf_logo.jpg' );
00726         $iMargin  = 195 - $aSize[0] * 0.2;
00727         $oPdf->setLink( $oShop->oxshops__oxurl->value );
00728         $oPdf->image( $myConfig->getImageDir().'/pdf_logo.jpg', $iMargin, 10, $aSize[0] * 0.2, $aSize[1] * 0.2, '', $oShop->oxshops__oxurl->value );
00729         return 14 + $aSize[1] * 0.2;
00730     }
00731 
00740     public function genPdf( $sFilename, $iSelLang = 0 )
00741     {
00742         // setting pdf language
00743         $this->_iSelectedLang = $iSelLang;
00744 
00745         // setting invoice number
00746         if ( !$this->oxorder__oxbillnr->value ) {
00747             $this->oxorder__oxbillnr->setValue($this->getNextBillNum());
00748             $this->save();
00749         }
00750 
00751         // initiating pdf engine
00752         $oPdf = oxNew( 'oxPDF' );
00753         $oPdf->setPrintHeader( false );
00754         $oPdf->open();
00755 
00756         // adding header
00757         $this->pdfHeader( $oPdf );
00758 
00759         // adding info data
00760         switch ( oxConfig::getParameter( 'pdftype' ) ) {
00761             case 'dnote':
00762                 $this->exportDeliveryNote( $oPdf );
00763                 break;
00764             default:
00765                 $this->exportStandart( $oPdf );
00766         }
00767 
00768         // adding footer
00769         $this->pdfFooter( $oPdf );
00770 
00771         // outputting file to browser
00772         $oPdf->output( $sFilename, 'I' );
00773     }
00774 
00775 
00783     protected function _setBillingAddressToPdf( $oPdf )
00784     {
00785         $oLang = oxLang::getInstance();
00786         $sSal = $this->oxorder__oxbillsal->value;
00787         try {
00788             $sSal = $oLang->translateString($this->oxorder__oxbillsal->value, $this->_iSelectedLang);
00789         } catch (Exception $e) {
00790         }
00791         $oPdfBlock = new PdfBlock();
00792         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00793         $oPdf->text( 15, 59, $sSal);
00794         $oPdf->text( 15, 63, $this->oxorder__oxbillfname->getRawValue().' '.$this->oxorder__oxbilllname->getRawValue() );
00795         $oPdf->text( 15, 67, $this->oxorder__oxbillcompany->getRawValue() );
00796         $oPdf->text( 15, 71, $this->oxorder__oxbillstreet->getRawValue().' '.$this->oxorder__oxbillstreetnr->value );
00797         $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
00798         $oPdf->text( 15, 75, $this->oxorder__oxbillzip->value.' '.$this->oxorder__oxbillcity->getRawValue() );
00799         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00800         $oPdf->text( 15, 79, $this->oxorder__oxbillcountry->getRawValue() );
00801     }
00802 
00810     protected function _setDeliveryAddressToPdf( $oPdf )
00811     {
00812         $oLang = oxLang::getInstance();
00813         $sSal = $this->oxorder__oxdelsal->value;
00814         try {
00815             $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->_iSelectedLang);
00816         } catch (Exception $e) {
00817         }
00818         $oPdfBlock = new PdfBlock();
00819         $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
00820         $oPdf->text( 15, 87, $this->translate( 'ORDER_OVERVIEW_PDF_DELIVERYADDRESS' ) );
00821         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00822         $oPdf->text( 15, 91, $sSal);
00823         $oPdf->text( 15, 95, $this->oxorder__oxdellname->getRawValue().' '.$this->oxorder__oxdelfname->getRawValue() );
00824         $oPdf->text( 15, 99, $this->oxorder__oxdelcompany->getRawValue() );
00825         $oPdf->text( 15, 103, $this->oxorder__oxdelstreet->getRawValue().' '.$this->oxorder__oxdelstreetnr->value );
00826         $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
00827         $oPdf->text( 15, 107, $this->oxorder__oxdelzip->value.' '.$this->oxorder__oxdelcity->getRawValue() );
00828         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00829         $oPdf->text( 15, 111, $this->oxorder__oxdelcountry->getRawValue() );
00830     }
00831 
00841     protected function _setOrderArticlesToPdf( $oPdf, &$iStartPos, $blShowPrice = true )
00842     {
00843         if (!$this->_oArticles) {
00844             $this->_oArticles = $this->getOrderArticles(true);
00845         }
00846 
00847         $oCurr = $this->getCurrency();
00848         $oPdfBlock = new PdfBlock();
00849         // product list
00850         foreach ( $this->_oArticles as $key => $oOrderArt ) {
00851 
00852             // starting a new page ...
00853             if ( $iStartPos > 243 ) {
00854                 $this->pdffooter( $oPdf );
00855                 $iStartPos = $this->pdfheaderplus( $oPdf );
00856                 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00857             } else {
00858                 $iStartPos = $iStartPos + 4;
00859             }
00860 
00861             // sold amount
00862             $oPdf->text( 20 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxamount->value ), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value );
00863 
00864             // product number
00865             $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00866             $oPdf->text( 28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value );
00867 
00868             // product title
00869             $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00870             $oPdf->text( 45, $iStartPos, substr( strip_tags( $this->_replaceExtendedChars( $oOrderArt->oxorderarticles__oxtitle->getRawValue(), true ) ), 0, 58 ) );
00871 
00872             if ( $blShowPrice ) {
00873                 $oLang = oxLang::getInstance();
00874 
00875                 // calculating product VAT info
00876                 if ( !isset( $this->_aVATs[$oOrderArt->oxorderarticles__oxvat->value] ) ) {
00877                     $this->_aVATs[$oOrderArt->oxorderarticles__oxvat->value] = 0;
00878                 }
00879                 // #M1434: VAT recalculation in admin (pdf) is wrong
00880                 if ( $oOrderArt->oxorderarticles__oxamount->value > 0 ) {
00881                     $this->_aVATs[$oOrderArt->oxorderarticles__oxvat->value] += ( $oOrderArt->oxorderarticles__oxvatprice->value * $oCurr->rate );
00882                 }
00883 
00884                 // product VAT percent
00885                 $oPdf->text( 150 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxvat->value ), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value );
00886 
00887                 // product price
00888                 $sText = $oLang->formatCurrency( $oOrderArt->oxorderarticles__oxbprice->value, $this->_oCur ).' '.$this->_oCur->name;
00889                 $oPdf->text( 173 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
00890 
00891                 // total product price
00892                 $sText = $oLang->formatCurrency( $oOrderArt->oxorderarticles__oxbrutprice->value, $this->_oCur ).' '.$this->_oCur->name;
00893                 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
00894 
00895             }
00896 
00897             // additional variant info
00898             if ( $oOrderArt->oxorderarticles__oxselvariant->value ) {
00899                 $iStartPos = $iStartPos + 4;
00900                 $oPdf->text( 45, $iStartPos, substr( $oOrderArt->oxorderarticles__oxselvariant->value, 0, 58 ) );
00901             }
00902 
00903         }
00904     }
00905 
00913     public function exportStandart( $oPdf )
00914     {
00915         // preparing order curency info
00916         $myConfig = $this->getConfig();
00917         $oPdfBlock = new PdfBlock();
00918 
00919         $this->_oCur = $myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
00920         if ( !$this->_oCur ) {
00921             $this->_oCur = $myConfig->getActShopCurrencyObject();
00922         }
00923 
00924         // loading active shop
00925         $oShop = $this->_getActShop();
00926 
00927         // shop information
00928         $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
00929         $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().' - '.$oShop->oxshops__oxstreet->getRawValue().' - '.$oShop->oxshops__oxzip->value.' - '.$oShop->oxshops__oxcity->getRawValue() );
00930 
00931         // billing address
00932         $this->_setBillingAddressToPdf( $oPdf );
00933 
00934         // delivery address
00935         if ( $this->oxorder__oxdelsal->value ) {
00936             $this->_setDeliveryAddressToPdf( $oPdf );
00937         }
00938 
00939         // loading user
00940         $oUser = oxNew( 'oxuser' );
00941         $oUser->load( $this->oxorder__oxuserid->value );
00942 
00943         // user info
00944         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
00945         $oPdf->setFont( $oPdfBlock->getFont(), '', 5 );
00946         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 55, $sText );
00947 
00948         // customer number
00949         $sCustNr = $this->translate( 'ORDER_OVERVIEW_PDF_CUSTNR').' '.$oUser->oxuser__oxcustnr->value;
00950         $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
00951         $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 59, $sCustNr );
00952 
00953         // setting position if delivery address is used
00954         if ( $this->oxorder__oxdelsal->value ) {
00955             $iTop = 115;
00956         } else {
00957             $iTop = 91;
00958         }
00959 
00960         // shop city
00961         $sText = $oShop->oxshops__oxcity->getRawValue().', '.date( 'd.m.Y' );
00962         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00963         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
00964 
00965         // shop VAT number
00966         if ( $oShop->oxshops__oxvatnumber->value ) {
00967             $sText = $this->translate( 'ORDER_OVERVIEW_PDF_TAXIDNR' ).' '.$oShop->oxshops__oxvatnumber->value;
00968             $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 12, $sText );
00969             $iTop += 8;
00970         } else {
00971             $iTop += 4;
00972         }
00973 
00974         // invoice number
00975         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_COUNTNR' ).' '.$this->oxorder__oxbillnr->value;
00976         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
00977 
00978         // marking if order is canceled
00979         if ( $this->oxorder__oxstorno->value == 1 ) {
00980             $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() . '   '.$this->translate( 'ORDER_OVERVIEW_PDF_STORNO' ), oxField::T_RAW );
00981         }
00982 
00983         // order number
00984         $oPdf->setFont( $oPdfBlock->getFont(), '', 12 );
00985         $oPdf->text( 15, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_PURCHASENR' ).' '.$this->oxorder__oxordernr->value );
00986 
00987         // order date
00988         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00989         $aOrderDate = explode( ' ', $this->oxorder__oxorderdate->value );
00990         $sOrderDate = oxUtilsDate::getInstance()->formatDBDate( $aOrderDate[0]);
00991         $oPdf->text( 15, $iTop + 8, $this->translate( 'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate( 'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
00992         $iTop += 16;
00993 
00994         // product info header
00995         $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00996         $oPdf->text( 15, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
00997         $oPdf->text( 30, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID' ) );
00998         $oPdf->text( 45, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
00999         $oPdf->text( 145, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_VAT' ) );
01000         $oPdf->text( 158, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
01001         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_ALLPRICE' );
01002         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01003 
01004         // separator line
01005         $iTop += 2;
01006         $oPdf->line( 15, $iTop, 195, $iTop );
01007 
01008         // #345
01009         $siteH = $iTop;
01010         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01011 
01012         // order articles
01013         $this->_setOrderArticlesToPdf( $oPdf, $siteH, true );
01014 
01015         // generating pdf file
01016         $oArtSumm = new PdfArticleSummary( $this, $oPdf );
01017         $iHeight = $oArtSumm->generate( $siteH );
01018         if ( $siteH + $iHeight > 258 ) {
01019             $this->pdfFooter( $oPdf );
01020             $iTop = $this->pdfHeader( $oPdf );
01021             $oArtSumm->ajustHeight( $iTop - $siteH );
01022             $siteH = $iTop;
01023         }
01024 
01025         $oArtSumm->run( $oPdf );
01026         $siteH += $iHeight + 8;
01027 
01028         $oPdf->text( 15, $siteH, $this->translate( 'ORDER_OVERVIEW_PDF_GREETINGS' ) );
01029     }
01030 
01038     public function exportDeliveryNote( $oPdf )
01039     {
01040         $myConfig = $this->getConfig();
01041         $oShop    = $this->_getActShop();
01042         $oPdfBlock = new PdfBlock();
01043 
01044         $oLang = oxLang::getInstance();
01045         $sSal = $this->oxorder__oxdelsal->value;
01046         try {
01047             $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->_iSelectedLang);
01048         } catch (Exception $e) {
01049         }
01050 
01051         // loading order currency info
01052         $this->_oCur = $myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
01053         if ( !isset( $this->_oCur ) ) {
01054             $this->_oCur = $myConfig->getActShopCurrencyObject();
01055         }
01056 
01057         // shop info
01058         $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
01059         $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().' - '.$oShop->oxshops__oxstreet->getRawValue().' - '.$oShop->oxshops__oxzip->value.' - '.$oShop->oxshops__oxcity->getRawValue() );
01060 
01061         // delivery address
01062         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01063         if ( $this->oxorder__oxdelsal->value ) {
01064             $oPdf->text( 15, 59, $sSal );
01065             $oPdf->text( 15, 63, $this->oxorder__oxdellname->getRawValue().' '.$this->oxorder__oxdelfname->getRawValue() );
01066             $oPdf->text( 15, 67, $this->oxorder__oxdelcompany->getRawValue() );
01067             $oPdf->text( 15, 71, $this->oxorder__oxdelstreet->getRawValue().' '.$this->oxorder__oxdelstreetnr->value );
01068             $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
01069             $oPdf->text( 15, 75, $this->oxorder__oxdelzip->value.' '.$this->oxorder__oxdelcity->getRawValue() );
01070             $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01071             $oPdf->text( 15, 79, $this->oxorder__oxdelcountry->getRawValue() );
01072         } else {
01073             // no delivery address - billing address is used for delivery
01074             $this->_setBillingAddressToPdf( $oPdf );
01075         }
01076 
01077         // loading user info
01078         $oUser = oxNew( 'oxuser' );
01079         $oUser->load( $this->oxorder__oxuserid->value );
01080 
01081         // user info
01082         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
01083         $oPdf->setFont( $oPdfBlock->getFont(), '', 5 );
01084         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 70, $sText );
01085 
01086         // customer number
01087         $sCustNr = $this->translate( 'ORDER_OVERVIEW_PDF_CUSTNR' ).' '.$oUser->oxuser__oxcustnr->value;
01088         $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
01089         $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 73, $sCustNr );
01090 
01091         // shops city
01092         $sText = $oShop->oxshops__oxcity->getRawValue().', '.date( 'd.m.Y' );
01093         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01094         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 95, $sText );
01095 
01096         $iTop = 99;
01097         // shop VAT number
01098         if ( $oShop->oxshops__oxvatnumber->value ) {
01099             $sText = $this->translate( 'ORDER_OVERVIEW_PDF_TAXIDNR' ).' '.$oShop->oxshops__oxvatnumber->value;
01100             $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01101             $iTop += 4;
01102         }
01103 
01104         // invoice number
01105         $sText = $this->translate( 'ORDER_OVERVIEW_PDF_COUNTNR' ).' '.$this->oxorder__oxbillnr->value;
01106         $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01107 
01108         // canceled order marker
01109         if ( $this->oxorder__oxstorno->value == 1 ) {
01110             $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() . '   '.$this->translate( 'ORDER_OVERVIEW_PDF_STORNO' ), oxField::T_RAW );
01111         }
01112 
01113         // order number
01114         $oPdf->setFont( $oPdfBlock->getFont(), '', 12 );
01115         $oPdf->text( 15, 108, $this->translate( 'ORDER_OVERVIEW_PDF_DELIVNOTE' ).' '.$this->oxorder__oxordernr->value );
01116 
01117         // order date
01118         $aOrderDate = explode( ' ', $this->oxorder__oxorderdate->value );
01119         $sOrderDate = oxUtilsDate::getInstance()->formatDBDate( $aOrderDate[0]);
01120         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01121         $oPdf->text(15, 119, $this->translate( 'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate( 'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
01122 
01123         // product info header
01124         $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
01125         $oPdf->text( 15, 128, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
01126         $oPdf->text( 30, 128, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID' ) );
01127         $oPdf->text( 45, 128, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
01128 
01129         // line separator
01130         $oPdf->line( 15, 130, 195, 130 );
01131 
01132         // product list
01133         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01134         $siteH = 130;
01135 
01136         // order articles
01137         $this->_setOrderArticlesToPdf( $oPdf, $siteH, false );
01138 
01139         // sine separator
01140         $oPdf->line( 15, $siteH + 2, 195, $siteH + 2 );
01141         $siteH += 4;
01142 
01143         // payment date
01144         $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01145         $text = $this->translate( 'ORDER_OVERVIEW_PDF_PAYUPTO' ).date( 'd.m.Y', mktime( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 7, date( 'Y' ) ) );
01146         $oPdf->text( 15, $siteH + 4, $text );
01147     }
01148 
01158     protected function _replaceExtendedChars( $sValue, $blReverse = false )
01159     {
01160         // we need to replace this for compatibility with XHTML
01161         // as this function causes a lot of trouble with editor
01162         // we switch it off, even if this means that fields do not validate through xhtml
01163         // return $sValue;
01164 
01165         // we need to replace this for compatibility with XHTML
01166         $aReplace = array( chr(169) => "&copy;", chr(128) => "&euro;", "\"" => "&quot;", "'" => "&#039;");
01167 
01168         // #899C reverse html entities and references transformation is used in invoicepdf module
01169         // so this part must be enabled. Now it works with html references like &#123;
01170         if ($blReverse) {
01171             // replace now
01172             $aTransTbl = get_html_translation_table (HTML_ENTITIES);
01173             $aTransTbl = array_flip ($aTransTbl) + array_flip ($aReplace);
01174             $sValue = strtr($sValue, $aTransTbl);
01175             $sValue = getStr()->preg_replace('/\&\#([0-9]+)\;/me', "chr('\\1')", $sValue);
01176         }
01177 
01178         return $sValue;
01179     }
01180 
01186     public function getVats()
01187     {
01188         // for new orders
01189         $aVats = $this->getProductVats( false );
01190 
01191         // for older orders
01192         return ( is_array( $aVats ) && count( $aVats ) ) ? $aVats : $this->_aVATs;
01193     }
01194 
01200     public function getCurrency()
01201     {
01202         return $this->_oCur;
01203     }
01204 
01210     public function getSelectedLang()
01211     {
01212         return $this->_iSelectedLang;
01213     }
01214 
01222     public function getOrderArticles( $blStorno = false )
01223     {
01224         if ( $this->_oArticles == null ) {
01225             // order articles
01226             $this->_oArticles = oxNew( 'oxlist' );
01227             $this->_oArticles->init( 'oxorderarticle' );
01228 
01229             $sSelect = 'select oxorderarticles.* from oxorderarticles where oxorderarticles.oxorderid="'.$this->getId().'"';
01230             if ( $blStorno ) {
01231                 $sSelect.= ' and oxstorno = 0';
01232             }
01233             $sSelect.= ' order by oxorderarticles.oxartid';
01234             $this->_oArticles->selectString( $sSelect );
01235         }
01236 
01237         return $this->_oArticles;
01238     }
01239 }