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 = oxRegistry::getLang();
00185
00186
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
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
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
00209 $this->line( 45, $iStartPos + 13, 195, $iStartPos + 13 );
00210 $iStartPos += 5;
00211 }
00212
00220 protected function _setTotalCostsWithDiscount( &$iStartPos )
00221 {
00222 $oLang = oxRegistry::getLang();
00223
00224
00225 $this->line( 15, $iStartPos + 1, 195, $iStartPos + 1 );
00226
00227 if ( $this->_oData->isNettoMode() ) {
00228
00229
00230 $sNetSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalnetsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00231 $this->text( 45, $iStartPos + 4, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICENETTO' ) );
00232 $this->text( 195 - $this->_oPdf->getStringWidth( $sNetSum ), $iStartPos + 4, $sNetSum );
00233
00234
00235 $dDiscountVal = $this->_oData->oxorder__oxdiscount->value;
00236 if ( $dDiscountVal > 0 ) {
00237 $dDiscountVal *= -1;
00238 }
00239 $sDiscount = $oLang->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00240 $this->text( 45, $iStartPos + 8, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_DISCOUNT' ) );
00241 $this->text( 195 - $this->_oPdf->getStringWidth( $sDiscount ), $iStartPos + 8, $sDiscount );
00242 $iStartPos++;
00243
00244
00245 $this->line( 45, $iStartPos + 8, 195, $iStartPos + 8 );
00246
00247 $iCtr = 0;
00248 foreach ( $this->_oData->getVats() as $iVat => $dVatPrice ) {
00249 $iStartPos += 4 * $iCtr;
00250 $sVATSum = $oLang->formatCurrency( $dVatPrice, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00251 $this->text( 45, $iStartPos + 12, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$iVat.$this->_oData->translate('ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00252 $this->text( 195 - $this->_oPdf->getStringWidth( $sVATSum ), $iStartPos + 12, $sVATSum );
00253 $iCtr++;
00254 }
00255 $iStartPos += 4;
00256
00257
00258 $sBrutPrice = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalbrutsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00259 $this->text( 45, $iStartPos + 12, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICEBRUTTO' ) );
00260 $this->text( 195 - $this->_oPdf->getStringWidth( $sBrutPrice ), $iStartPos + 12, $sBrutPrice );
00261 $iStartPos += 4;
00262
00263 } else {
00264
00265 $sBrutPrice = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalbrutsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00266 $this->text( 45, $iStartPos + 4, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICEBRUTTO' ) );
00267 $this->text( 195 - $this->_oPdf->getStringWidth( $sBrutPrice ), $iStartPos + 4, $sBrutPrice );
00268
00269
00270 $this->line( 45, $iStartPos + 5, 195, $iStartPos + 5 );
00271
00272
00273 $dDiscountVal = $this->_oData->oxorder__oxdiscount->value;
00274 if ( $dDiscountVal > 0 ) {
00275 $dDiscountVal *= -1;
00276 }
00277 $sDiscount = $oLang->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00278 $this->text( 45, $iStartPos + 8, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_DISCOUNT' ) );
00279 $this->text( 195 - $this->_oPdf->getStringWidth( $sDiscount ), $iStartPos + 8, $sDiscount );
00280 $iStartPos++;
00281
00282
00283 $this->line( 45, $iStartPos + 8, 195, $iStartPos + 8 );
00284 $iStartPos += 4;
00285
00286
00287 $sNetSum = $oLang->formatCurrency( $this->_oData->oxorder__oxtotalnetsum->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00288 $this->text( 45, $iStartPos + 8, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLPRICENETTO' ) );
00289 $this->text( 195 - $this->_oPdf->getStringWidth( $sNetSum ), $iStartPos + 8, $sNetSum );
00290
00291
00292 $iCtr = 0;
00293 foreach ( $this->_oData->getVats() as $iVat => $dVatPrice ) {
00294 $iStartPos += 4 * $iCtr;
00295 $sVATSum = $oLang->formatCurrency( $dVatPrice, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00296 $this->text( 45, $iStartPos + 12, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$iVat.$this->_oData->translate('ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00297 $this->text( 195 - $this->_oPdf->getStringWidth( $sVATSum ), $iStartPos + 12, $sVATSum );
00298 $iCtr++;
00299 }
00300 $iStartPos += 4;
00301 }
00302 }
00303
00311 protected function _setVoucherInfo( &$iStartPos )
00312 {
00313 $dVoucher = 0;
00314 if ( $this->_oData->oxorder__oxvoucherdiscount->value ) {
00315 $dDiscountVal = $this->_oData->oxorder__oxvoucherdiscount->value;
00316 if ( $dDiscountVal > 0 ) {
00317 $dDiscountVal *= -1;
00318 }
00319 $sPayCost = oxRegistry::getLang()->formatCurrency( $dDiscountVal, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00320 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_VOUCHER' ) );
00321 $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00322 $iStartPos += 4;
00323 }
00324
00325 $iStartPos++;
00326 }
00327
00335 protected function _setDeliveryInfo( &$iStartPos )
00336 {
00337 $sAddString = '';
00338 $oLang = oxRegistry::getLang();
00339 $oConfig = oxRegistry::getConfig();
00340
00341 if ( $oConfig->getConfigParam( 'blShowVATForDelivery' ) ) {
00342
00343 $sDelCostNetto = $oLang->formatCurrency( $this->_oData->getOrderDeliveryPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00344 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SHIPCOST' ).' '.$this->_oData->translate('ORDER_OVERVIEW_PDF_NETTO' ) );
00345 $this->text( 195 - $this->_oPdf->getStringWidth( $sDelCostNetto ), $iStartPos, $sDelCostNetto );
00346 $iStartPos += 4;
00347
00348 if ( $oConfig->getConfigParam('sAdditionalServVATCalcMethod') != 'proportional' ) {
00349 $sVatValueText = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxdelvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' );
00350 } else {
00351 $sVatValueText = $this->_oData->translate( 'TOTAL_PLUS_PROPORTIONAL_VAT' );
00352 }
00353
00354
00355 $sDelCostVAT = $oLang->formatCurrency( $this->_oData->getOrderDeliveryPrice()->getVATValue(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00356 $this->text( 45, $iStartPos, $sVatValueText );
00357 $this->text( 195 - $this->_oPdf->getStringWidth( $sDelCostVAT ), $iStartPos, $sDelCostVAT );
00358
00359
00360 $sAddString = ' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_BRUTTO' );
00361 } else {
00362
00363 if ( $this->_oData->oxorder__oxstorno->value ) {
00364 $this->_oData->oxorder__oxdelcost->setValue(0);
00365 }
00366
00367 $sDelCost = $oLang->formatCurrency( $this->_oData->oxorder__oxdelcost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00368 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SHIPCOST' ).$sAddString );
00369 $this->text( 195 - $this->_oPdf->getStringWidth( $sDelCost ), $iStartPos, $sDelCost );
00370 }
00371 }
00372
00380 protected function _setWrappingInfo( &$iStartPos )
00381 {
00382 if ( $this->_oData->oxorder__oxwrapcost->value ) {
00383 $sAddString = '';
00384 $oLang = oxRegistry::getLang();
00385 $oConfig = oxRegistry::getConfig();
00386
00387
00388 if ( $oConfig->getConfigParam('blShowVATForWrapping') ) {
00389
00390 if ($this->_oData->oxorder__oxwrapcost->value) {
00391
00392 $iStartPos += 4;
00393 $sWrapCostNetto = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getNettoPrice(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00394 $this->text( 45, $iStartPos, $this->_oData->translate( 'WRAPPING_COSTS' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00395 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostNetto ), $iStartPos, $sWrapCostNetto );
00396
00397
00398
00399 $iStartPos += 4;
00400 $sWrapCostVAT = $oLang->formatCurrency( $this->_oData->getOrderWrappingPrice()->getVATValue(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00401 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ) );
00402 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostVAT ), $iStartPos, $sWrapCostVAT );
00403
00404 }
00405
00406
00407 if ($this->_oData->oxorder__oxgiftcardcost->value) {
00408
00409 $iStartPos += 4;
00410 $sWrapCostNetto = $oLang->formatCurrency( $this->_oData->getOrderGiftCardPrice()->getNettoPrice(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00411 $this->text( 45, $iStartPos, $this->_oData->translate( 'GIFTCARD_COSTS' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00412 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostNetto ), $iStartPos, $sWrapCostNetto );
00413
00414
00415
00416 $iStartPos += 4;
00417 $sWrapCostVAT = $oLang->formatCurrency( $this->_oData->getOrderGiftCardPrice()->getVATValue(), $this->_oData->getCurrency()).' '.$this->_oData->getCurrency()->name;
00418
00419 if ( $oConfig->getConfigParam('sAdditionalServVATCalcMethod') != 'proportional' ) {
00420 $sVatValueText = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ) .$this->_oData->oxorder__oxgiftcardvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' );
00421 } else {
00422 $sVatValueText = $this->_oData->translate( 'TOTAL_PLUS_PROPORTIONAL_VAT' );
00423 }
00424
00425 $this->text( 45, $iStartPos, $sVatValueText );
00426 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCostVAT ), $iStartPos, $sWrapCostVAT );
00427 $iStartPos++;
00428 }
00429
00430 } else {
00431 $iStartPos += 4;
00432
00433 if ($this->_oData->oxorder__oxwrapcost->value) {
00434
00435 $sAddString = ' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_BRUTTO' );
00436 $sWrapCost = $oLang->formatCurrency( $this->_oData->oxorder__oxwrapcost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00437 $this->text( 45, $iStartPos, $this->_oData->translate( 'WRAPPING_COSTS' ).$sAddString );
00438 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCost ), $iStartPos, $sWrapCost );
00439 $iStartPos++;
00440 }
00441
00442 if ($this->_oData->oxorder__oxgiftcardcost->value) {
00443 $iStartPos += 4;
00444
00445 $sWrapCost = $oLang->formatCurrency( $this->_oData->oxorder__oxgiftcardcost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00446 $this->text( 45, $iStartPos, $this->_oData->translate( 'GIFTCARD_COSTS' ).$sAddString );
00447 $this->text( 195 - $this->_oPdf->getStringWidth( $sWrapCost ), $iStartPos, $sWrapCost );
00448 $iStartPos++;
00449 }
00450
00451 }
00452
00453 }
00454 }
00455
00463 protected function _setPaymentInfo( &$iStartPos )
00464 {
00465 $oLang = oxRegistry::getLang();
00466 $oConfig = oxRegistry::getConfig();
00467
00468 if ( $this->_oData->oxorder__oxstorno->value ) {
00469 $this->_oData->oxorder__oxpaycost->setValue(0);
00470 }
00471
00472 if ($oConfig->getConfigParam('blShowVATForDelivery')) {
00473 if ( $this->_oData->oxorder__oxpayvat->value ) {
00474
00475 $iStartPos += 4;
00476 $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00477 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00478 $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
00479
00480 if ( $oConfig->getConfigParam('sAdditionalServVATCalcMethod') != 'proportional' ) {
00481 $sVatValueText = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$this->_oData->oxorder__oxpayvat->value.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' );
00482 } else {
00483 $sVatValueText = $this->_oData->translate( 'TOTAL_PLUS_PROPORTIONAL_VAT' );
00484 }
00485
00486
00487 $iStartPos += 4;
00488 $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderPaymentPrice()->getVATValue(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00489 $this->text( 45, $iStartPos, $sVatValueText );
00490 $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
00491
00492 }
00493
00494
00495
00496 } else {
00497
00498
00499 if ( $this->_oData->oxorder__oxpaycost->value ) {
00500 $iStartPos += 4;
00501 $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxpaycost->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00502 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYMENTIMPACT' ) );
00503 $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00504 }
00505
00506 $iStartPos++;
00507 }
00508 }
00509
00517 protected function _setTsProtection( &$iStartPos )
00518 {
00519 $oLang = oxRegistry::getLang();
00520 $oConfig = oxRegistry::getConfig();
00521 if ( $this->_oData->oxorder__oxtsprotectcosts->value && $oConfig->getConfigParam( 'blShowVATForPayCharge' ) ) {
00522
00523
00524 $iStartPos += 4;
00525 $sPayCostNetto = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getNettoPrice(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00526 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_TSPROTECTION' ).' '.$this->_oData->translate( 'ORDER_OVERVIEW_PDF_NETTO' ) );
00527 $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostNetto ), $iStartPos, $sPayCostNetto );
00528
00529
00530 $iStartPos += 4;
00531 $sPayCostVAT = $oLang->formatCurrency( $this->_oData->getOrderTsProtectionPrice()->getVATValue(), $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00532 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ZZGLVAT' ).$oConfig->getConfigParam( 'dDefaultVAT' ).$this->_oData->translate( 'ORDER_OVERVIEW_PDF_PERCENTSUM' ) );
00533 $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCostVAT ), $iStartPos, $sPayCostVAT );
00534
00535 $iStartPos++;
00536
00537 } elseif ( $this->_oData->oxorder__oxtsprotectcosts->value ) {
00538
00539 $iStartPos += 4;
00540 $sPayCost = $oLang->formatCurrency( $this->_oData->oxorder__oxtsprotectcosts->value, $this->_oData->getCurrency() ).' '.$this->_oData->getCurrency()->name;
00541 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_TSPROTECTION' ) );
00542 $this->text( 195 - $this->_oPdf->getStringWidth( $sPayCost ), $iStartPos, $sPayCost );
00543
00544 $iStartPos++;
00545 }
00546 }
00547
00555 protected function _setGrandTotalPriceInfo( &$iStartPos )
00556 {
00557 $this->font( $this->getFont(), 'B', 10 );
00558
00559
00560 $sTotalOrderSum = $this->_oData->getFormattedTotalOrderSum() . ' ' . $this->_oData->getCurrency()->name;
00561 $this->text( 45, $iStartPos, $this->_oData->translate( 'ORDER_OVERVIEW_PDF_ALLSUM' ) );
00562 $this->text( 195 - $this->_oPdf->getStringWidth( $sTotalOrderSum ), $iStartPos, $sTotalOrderSum );
00563 $iStartPos += 2;
00564
00565 if ( $this->_oData->oxorder__oxdelvat->value || $this->_oData->oxorder__oxwrapvat->value || $this->_oData->oxorder__oxpayvat->value ) {
00566 $iStartPos += 2;
00567 }
00568 }
00569
00577 protected function _setPaymentMethodInfo( &$iStartPos )
00578 {
00579 $oPayment = oxNew( 'oxpayment' );
00580 $oPayment->loadInLang( $this->_oData->getSelectedLang(), $this->_oData->oxorder__oxpaymenttype->value );
00581
00582 $text = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_SELPAYMENT' ).$oPayment->oxpayments__oxdesc->value;
00583 $this->font( $this->getFont(), '', 10 );
00584 $this->text( 15, $iStartPos + 4, $text );
00585 $iStartPos += 4;
00586 }
00587
00595 protected function _setPayUntilInfo( &$iStartPos )
00596 {
00597 $text = $this->_oData->translate( 'ORDER_OVERVIEW_PDF_PAYUPTO' ) . $this->_oData->oxorder__oxbilldate->value;
00598 $this->font( $this->getFont(), '', 10 );
00599 $this->text( 15, $iStartPos + 4, $text );
00600 $iStartPos += 4;
00601 }
00602
00610 public function generate( $iStartPos )
00611 {
00612
00613 $this->font( $this->getFont(), '', 10 );
00614 $siteH = $iStartPos;
00615
00616
00617 if ( !$this->_oData->oxorder__oxdiscount->value ) {
00618 $this->_setTotalCostsWithoutDiscount( $siteH );
00619 } else {
00620 $this->_setTotalCostsWithDiscount( $siteH );
00621 }
00622
00623 $siteH += 12;
00624
00625
00626 $this->_setVoucherInfo( $siteH );
00627
00628
00629 if ( $this->_oData->oxorder__oxdiscount->value || $this->_oData->oxorder__oxvoucherdiscount->value ) {
00630 $this->line( 45, $siteH - 3, 195, $siteH - 3 );
00631 }
00632
00633
00634 $this->_setDeliveryInfo( $siteH );
00635
00636
00637 $this->_setPaymentInfo( $siteH );
00638
00639
00640 $this->_setWrappingInfo( $siteH );
00641
00642
00643 $this->_setTsProtection( $siteH );
00644
00645
00646 $this->line( 15, $siteH, 195, $siteH );
00647 $siteH += 4;
00648
00649
00650 $this->_setGrandTotalPriceInfo( $siteH );
00651
00652
00653 $this->line( 15, $siteH, 195, $siteH );
00654 $siteH += 4;
00655
00656
00657 $this->_setPaymentMethodInfo( $siteH );
00658
00659
00660 $this->_setPayUntilInfo( $siteH );
00661
00662 return $siteH - $iStartPos;
00663 }
00664 }
00665
00669 class MyOrder extends MyOrder_parent
00670 {
00671
00676 protected $_iSelectedLang = 0;
00677
00682 protected $_oActShop = null;
00683
00688 protected $_aVATs = array();
00689
00694 protected $_oCur = null;
00695
00701 protected function _getActShop()
00702 {
00703
00704 if ( $this->_oActShop !== null )
00705 return $this->_oActShop;
00706
00707 $this->_oActShop = oxNew( 'oxshop' );
00708 $this->_oActShop->load( $this->getConfig()->getShopId() );
00709
00710 return $this->_oActShop;
00711 }
00712
00720 public function translate( $sString )
00721 {
00722 return oxRegistry::getLang()->translateString( $sString, $this->_iSelectedLang );
00723 }
00724
00732 public function pdfFooter( $oPdf )
00733 {
00734
00735 $oShop = $this->_getActShop();
00736
00737 $oPdf->line( 15, 272, 195, 272 );
00738
00739 $oPdfBlock = new PdfBlock();
00740
00741 $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
00742 $oPdf->text( 15, 275, strip_tags( $oShop->oxshops__oxcompany->getRawValue() ) );
00743 $oPdf->text( 15, 278, strip_tags( $oShop->oxshops__oxfname->getRawValue() ).' '. strip_tags( $oShop->oxshops__oxlname->getRawValue() ) );
00744 $oPdf->text( 15, 281, strip_tags( $oShop->oxshops__oxstreet->getRawValue() ) );
00745 $oPdf->text( 15, 284, strip_tags( $oShop->oxshops__oxzip->value ).' '. strip_tags( $oShop->oxshops__oxcity->getRawValue() ) );
00746 $oPdf->text( 15, 287, strip_tags( $oShop->oxshops__oxcountry->getRawValue() ) );
00747
00748
00749 $oPdf->text( 85, 275, $this->translate( 'ORDER_OVERVIEW_PDF_PHONE' ).strip_tags( $oShop->oxshops__oxtelefon->value ) );
00750 $oPdf->text( 85, 278, $this->translate( 'ORDER_OVERVIEW_PDF_FAX' ).strip_tags( $oShop->oxshops__oxtelefax->value ) );
00751 $oPdf->text( 85, 281, strip_tags( $oShop->oxshops__oxurl->value ) );
00752 $oPdf->text( 85, 284, strip_tags( $oShop->oxshops__oxorderemail->value ) );
00753
00754
00755 $oPdf->text( 150, 275, strip_tags( $oShop->oxshops__oxbankname->getRawValue() ) );
00756 $oPdf->text( 150, 278, $this->translate( 'ORDER_OVERVIEW_PDF_ACCOUNTNR' ).strip_tags( $oShop->oxshops__oxbanknumber->value ) );
00757 $oPdf->text( 150, 281, $this->translate( 'ORDER_OVERVIEW_PDF_BANKCODE' ).strip_tags( $oShop->oxshops__oxbankcode->value ) );
00758 $oPdf->text( 150, 284, strip_tags( $oShop->oxshops__oxvatnumber->value ) );
00759 $oPdf->text( 150, 287, '' );
00760 }
00761
00769 public function pdfHeaderPlus( $oPdf )
00770 {
00771
00772
00773 $this->pdfHeader( $oPdf );
00774
00775 $oPdfBlock = new PdfBlock();
00776
00777 $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00778 $oPdf->text( 15, 50, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
00779 $oPdf->text( 30, 50, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID') );
00780 $oPdf->text( 45, 50, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
00781 $oPdf->text( 160, 50, $this->translate( 'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
00782 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_ALLPRICE' );
00783 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 50, $sText );
00784
00785
00786 $oPdf->line( 15, 52, 195, 52 );
00787
00788 return 56;
00789 }
00790
00798 public function pdfHeader( $oPdf )
00799 {
00800
00801 $oPdf->addPage();
00802
00803
00804 $oShop = $this->_getActShop();
00805
00806
00807 $myConfig = $this->getConfig();
00808 $aSize = getimagesize( $myConfig->getImageDir().'/pdf_logo.jpg' );
00809 $iMargin = 195 - $aSize[0] * 0.2;
00810 $oPdf->setLink( $oShop->oxshops__oxurl->value );
00811 $oPdf->image( $myConfig->getImageDir().'/pdf_logo.jpg', $iMargin, 10, $aSize[0] * 0.2, $aSize[1] * 0.2, '', $oShop->oxshops__oxurl->value );
00812 return 14 + $aSize[1] * 0.2;
00813 }
00814
00823 public function genPdf( $sFilename, $iSelLang = 0 )
00824 {
00825
00826 $this->_iSelectedLang = $iSelLang;
00827
00828
00829 if ( !$this->oxorder__oxbillnr->value ) {
00830 $this->oxorder__oxbillnr->setValue($this->getNextBillNum());
00831 $this->oxorder__oxbilldate->setValue( date( 'd.m.Y', mktime( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 7, date( 'Y' ) ) ) );
00832 $this->save();
00833 }
00834
00835
00836 $oPdf = oxNew( 'oxPDF' );
00837 $oPdf->setPrintHeader( false );
00838 $oPdf->open();
00839
00840
00841 $this->pdfHeader( $oPdf );
00842
00843
00844 switch ( oxConfig::getParameter( 'pdftype' ) ) {
00845 case 'dnote':
00846 $this->exportDeliveryNote( $oPdf );
00847 break;
00848 default:
00849 $this->exportStandart( $oPdf );
00850 }
00851
00852
00853 $this->pdfFooter( $oPdf );
00854
00855
00856 $oPdf->output( $sFilename, 'I' );
00857 }
00858
00859
00867 protected function _setBillingAddressToPdf( $oPdf )
00868 {
00869 $oLang = oxRegistry::getLang();
00870 $sSal = $this->oxorder__oxbillsal->value;
00871 try {
00872 $sSal = $oLang->translateString($this->oxorder__oxbillsal->value, $this->_iSelectedLang);
00873 } catch (Exception $e) {
00874 }
00875 $oPdfBlock = new PdfBlock();
00876 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00877 $oPdf->text( 15, 59, $sSal);
00878 $oPdf->text( 15, 63, $this->oxorder__oxbillfname->getRawValue().' '.$this->oxorder__oxbilllname->getRawValue() );
00879 $oPdf->text( 15, 67, $this->oxorder__oxbillcompany->getRawValue() );
00880 $oPdf->text( 15, 71, $this->oxorder__oxbillstreet->getRawValue().' '.$this->oxorder__oxbillstreetnr->value );
00881 $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
00882 $oPdf->text( 15, 75, $this->oxorder__oxbillzip->value.' '.$this->oxorder__oxbillcity->getRawValue() );
00883 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00884 $oPdf->text( 15, 79, $this->oxorder__oxbillcountry->getRawValue() );
00885 }
00886
00894 protected function _setDeliveryAddressToPdf( $oPdf )
00895 {
00896 $oLang = oxRegistry::getLang();
00897 $sSal = $this->oxorder__oxdelsal->value;
00898 try {
00899 $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->_iSelectedLang);
00900 } catch (Exception $e) {
00901 }
00902 $oPdfBlock = new PdfBlock();
00903 $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
00904 $oPdf->text( 15, 87, $this->translate( 'ORDER_OVERVIEW_PDF_DELIVERYADDRESS' ) );
00905 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00906 $oPdf->text( 15, 91, $sSal);
00907 $oPdf->text( 15, 95, $this->oxorder__oxdellname->getRawValue().' '.$this->oxorder__oxdelfname->getRawValue() );
00908 $oPdf->text( 15, 99, $this->oxorder__oxdelcompany->getRawValue() );
00909 $oPdf->text( 15, 103, $this->oxorder__oxdelstreet->getRawValue().' '.$this->oxorder__oxdelstreetnr->value );
00910 $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
00911 $oPdf->text( 15, 107, $this->oxorder__oxdelzip->value.' '.$this->oxorder__oxdelcity->getRawValue() );
00912 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00913 $oPdf->text( 15, 111, $this->oxorder__oxdelcountry->getRawValue() );
00914 }
00915
00925 protected function _setOrderArticlesToPdf( $oPdf, &$iStartPos, $blShowPrice = true )
00926 {
00927 if (!$this->_oArticles) {
00928 $this->_oArticles = $this->getOrderArticles(true);
00929 }
00930
00931 $oCurr = $this->getCurrency();
00932 $oPdfBlock = new PdfBlock();
00933
00934 foreach ( $this->_oArticles as $key => $oOrderArt ) {
00935
00936
00937 if ( $iStartPos > 243 ) {
00938 $this->pdffooter( $oPdf );
00939 $iStartPos = $this->pdfheaderplus( $oPdf );
00940 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00941 } else {
00942 $iStartPos = $iStartPos + 4;
00943 }
00944
00945
00946 $oPdf->text( 20 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxamount->value ), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value );
00947
00948
00949 $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
00950 $oPdf->text( 28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value );
00951
00952
00953 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
00954 $oPdf->text( 45, $iStartPos, substr( strip_tags( $this->_replaceExtendedChars( $oOrderArt->oxorderarticles__oxtitle->getRawValue(), true ) ), 0, 58 ) );
00955
00956 if ( $blShowPrice ) {
00957 $oLang = oxRegistry::getLang();
00958
00959
00960 $oPdf->text( 140 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxvat->value ), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value );
00961
00962
00963
00964 $dUnitPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnprice->value : $oOrderArt->oxorderarticles__oxbprice->value;
00965 $dTotalPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnetprice->value : $oOrderArt->oxorderarticles__oxbrutprice->value;
00966
00967 $sText = $oLang->formatCurrency( $dUnitPrice, $this->_oCur ).' '.$this->_oCur->name;
00968 $oPdf->text( 163 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
00969
00970
00971 $sText = $oLang->formatCurrency( $dTotalPrice, $this->_oCur ).' '.$this->_oCur->name;
00972 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );
00973
00974 }
00975
00976
00977 if ( $oOrderArt->oxorderarticles__oxselvariant->value ) {
00978 $iStartPos = $iStartPos + 4;
00979 $oPdf->text( 45, $iStartPos, substr( $oOrderArt->oxorderarticles__oxselvariant->value, 0, 58 ) );
00980 }
00981
00982 }
00983 }
00984
00992 public function exportStandart( $oPdf )
00993 {
00994
00995 $myConfig = $this->getConfig();
00996 $oPdfBlock = new PdfBlock();
00997
00998 $this->_oCur = $myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
00999 if ( !$this->_oCur ) {
01000 $this->_oCur = $myConfig->getActShopCurrencyObject();
01001 }
01002
01003
01004 $oShop = $this->_getActShop();
01005
01006
01007 $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
01008 $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().' - '.$oShop->oxshops__oxstreet->getRawValue().' - '.$oShop->oxshops__oxzip->value.' - '.$oShop->oxshops__oxcity->getRawValue() );
01009
01010
01011 $this->_setBillingAddressToPdf( $oPdf );
01012
01013
01014 if ( $this->oxorder__oxdelsal->value ) {
01015 $this->_setDeliveryAddressToPdf( $oPdf );
01016 }
01017
01018
01019 $oUser = oxNew( 'oxuser' );
01020 $oUser->load( $this->oxorder__oxuserid->value );
01021
01022
01023 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
01024 $oPdf->setFont( $oPdfBlock->getFont(), '', 5 );
01025 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 55, $sText );
01026
01027
01028 $sCustNr = $this->translate( 'ORDER_OVERVIEW_PDF_CUSTNR').' '.$oUser->oxuser__oxcustnr->value;
01029 $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
01030 $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 59, $sCustNr );
01031
01032
01033 if ( $this->oxorder__oxdelsal->value ) {
01034 $iTop = 115;
01035 } else {
01036 $iTop = 91;
01037 }
01038
01039
01040 $sText = $oShop->oxshops__oxcity->getRawValue().', '.date( 'd.m.Y' );
01041 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01042 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
01043
01044
01045 if ( $oShop->oxshops__oxvatnumber->value ) {
01046 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_TAXIDNR' ).' '.$oShop->oxshops__oxvatnumber->value;
01047 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 12, $sText );
01048 $iTop += 8;
01049 } else {
01050 $iTop += 4;
01051 }
01052
01053
01054 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_COUNTNR' ).' '.$this->oxorder__oxbillnr->value;
01055 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop + 8, $sText );
01056
01057
01058 if ( $this->oxorder__oxstorno->value == 1 ) {
01059 $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() . ' '.$this->translate( 'ORDER_OVERVIEW_PDF_STORNO' ), oxField::T_RAW );
01060 }
01061
01062
01063 $oPdf->setFont( $oPdfBlock->getFont(), '', 12 );
01064 $oPdf->text( 15, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_PURCHASENR' ).' '.$this->oxorder__oxordernr->value );
01065
01066
01067 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01068 $aOrderDate = explode( ' ', $this->oxorder__oxorderdate->value );
01069 $sOrderDate = oxRegistry::get("oxUtilsDate")->formatDBDate( $aOrderDate[0]);
01070 $oPdf->text( 15, $iTop + 8, $this->translate( 'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate( 'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
01071 $iTop += 16;
01072
01073
01074 $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
01075 $oPdf->text( 15, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
01076 $oPdf->text( 30, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID' ) );
01077 $oPdf->text( 45, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
01078 $oPdf->text( 135, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_VAT' ) );
01079 $oPdf->text( 148, $iTop, $this->translate( 'ORDER_OVERVIEW_PDF_UNITPRICE' ) );
01080 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_ALLPRICE' );
01081 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01082
01083
01084 $iTop += 2;
01085 $oPdf->line( 15, $iTop, 195, $iTop );
01086
01087
01088 $siteH = $iTop;
01089 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01090
01091
01092 $this->_setOrderArticlesToPdf( $oPdf, $siteH, true );
01093
01094
01095 $oArtSumm = new PdfArticleSummary( $this, $oPdf );
01096 $iHeight = $oArtSumm->generate( $siteH );
01097 if ( $siteH + $iHeight > 258 ) {
01098 $this->pdfFooter( $oPdf );
01099 $iTop = $this->pdfHeader( $oPdf );
01100 $oArtSumm->ajustHeight( $iTop - $siteH );
01101 $siteH = $iTop;
01102 }
01103
01104 $oArtSumm->run( $oPdf );
01105 $siteH += $iHeight + 8;
01106
01107 $oPdf->text( 15, $siteH, $this->translate( 'ORDER_OVERVIEW_PDF_GREETINGS' ) );
01108 }
01109
01117 public function exportDeliveryNote( $oPdf )
01118 {
01119 $myConfig = $this->getConfig();
01120 $oShop = $this->_getActShop();
01121 $oPdfBlock = new PdfBlock();
01122
01123 $oLang = oxRegistry::getLang();
01124 $sSal = $this->oxorder__oxdelsal->value;
01125 try {
01126 $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->_iSelectedLang);
01127 } catch (Exception $e) {
01128 }
01129
01130
01131 $this->_oCur = $myConfig->getCurrencyObject( $this->oxorder__oxcurrency->value );
01132 if ( !isset( $this->_oCur ) ) {
01133 $this->_oCur = $myConfig->getActShopCurrencyObject();
01134 }
01135
01136
01137 $oPdf->setFont( $oPdfBlock->getFont(), '', 6 );
01138 $oPdf->text( 15, 55, $oShop->oxshops__oxname->getRawValue().' - '.$oShop->oxshops__oxstreet->getRawValue().' - '.$oShop->oxshops__oxzip->value.' - '.$oShop->oxshops__oxcity->getRawValue() );
01139
01140
01141 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01142 if ( $this->oxorder__oxdelsal->value ) {
01143 $oPdf->text( 15, 59, $sSal );
01144 $oPdf->text( 15, 63, $this->oxorder__oxdellname->getRawValue().' '.$this->oxorder__oxdelfname->getRawValue() );
01145 $oPdf->text( 15, 67, $this->oxorder__oxdelcompany->getRawValue() );
01146 $oPdf->text( 15, 71, $this->oxorder__oxdelstreet->getRawValue().' '.$this->oxorder__oxdelstreetnr->value );
01147 $oPdf->setFont( $oPdfBlock->getFont(), 'B', 10 );
01148 $oPdf->text( 15, 75, $this->oxorder__oxdelzip->value.' '.$this->oxorder__oxdelcity->getRawValue() );
01149 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01150 $oPdf->text( 15, 79, $this->oxorder__oxdelcountry->getRawValue() );
01151 } else {
01152
01153 $this->_setBillingAddressToPdf( $oPdf );
01154 }
01155
01156
01157 $oUser = oxNew( 'oxuser' );
01158 $oUser->load( $this->oxorder__oxuserid->value );
01159
01160
01161 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_FILLONPAYMENT' );
01162 $oPdf->setFont( $oPdfBlock->getFont(), '', 5 );
01163 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 70, $sText );
01164
01165
01166 $sCustNr = $this->translate( 'ORDER_OVERVIEW_PDF_CUSTNR' ).' '.$oUser->oxuser__oxcustnr->value;
01167 $oPdf->setFont( $oPdfBlock->getFont(), '', 7 );
01168 $oPdf->text( 195 - $oPdf->getStringWidth( $sCustNr ), 73, $sCustNr );
01169
01170
01171 $sText = $oShop->oxshops__oxcity->getRawValue().', '.date( 'd.m.Y' );
01172 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01173 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), 95, $sText );
01174
01175 $iTop = 99;
01176
01177 if ( $oShop->oxshops__oxvatnumber->value ) {
01178 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_TAXIDNR' ).' '.$oShop->oxshops__oxvatnumber->value;
01179 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01180 $iTop += 4;
01181 }
01182
01183
01184 $sText = $this->translate( 'ORDER_OVERVIEW_PDF_COUNTNR' ).' '.$this->oxorder__oxbillnr->value;
01185 $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iTop, $sText );
01186
01187
01188 if ( $this->oxorder__oxstorno->value == 1 ) {
01189 $this->oxorder__oxordernr->setValue( $this->oxorder__oxordernr->getRawValue() . ' '.$this->translate( 'ORDER_OVERVIEW_PDF_STORNO' ), oxField::T_RAW );
01190 }
01191
01192
01193 $oPdf->setFont( $oPdfBlock->getFont(), '', 12 );
01194 $oPdf->text( 15, 108, $this->translate( 'ORDER_OVERVIEW_PDF_DELIVNOTE' ).' '.$this->oxorder__oxordernr->value );
01195
01196
01197 $aOrderDate = explode( ' ', $this->oxorder__oxorderdate->value );
01198 $sOrderDate = oxRegistry::get("oxUtilsDate")->formatDBDate( $aOrderDate[0]);
01199 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01200 $oPdf->text(15, 119, $this->translate( 'ORDER_OVERVIEW_PDF_ORDERSFROM' ).$sOrderDate.$this->translate( 'ORDER_OVERVIEW_PDF_ORDERSAT' ).$oShop->oxshops__oxurl->value );
01201
01202
01203 $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
01204 $oPdf->text( 15, 128, $this->translate( 'ORDER_OVERVIEW_PDF_AMOUNT' ) );
01205 $oPdf->text( 30, 128, $this->translate( 'ORDER_OVERVIEW_PDF_ARTID' ) );
01206 $oPdf->text( 45, 128, $this->translate( 'ORDER_OVERVIEW_PDF_DESC' ) );
01207
01208
01209 $oPdf->line( 15, 130, 195, 130 );
01210
01211
01212 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01213 $siteH = 130;
01214
01215
01216 $this->_setOrderArticlesToPdf( $oPdf, $siteH, false );
01217
01218
01219 $oPdf->line( 15, $siteH + 2, 195, $siteH + 2 );
01220 $siteH += 4;
01221
01222
01223 $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
01224 $text = $this->translate( 'ORDER_OVERVIEW_PDF_PAYUPTO' ).date( 'd.m.Y', mktime( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 7, date( 'Y' ) ) );
01225 $oPdf->text( 15, $siteH + 4, $text );
01226 }
01227
01237 protected function _replaceExtendedChars( $sValue, $blReverse = false )
01238 {
01239
01240
01241
01242
01243
01244
01245 $aReplace = array( chr(169) => "©", chr(128) => "€", "\"" => """, "'" => "'");
01246
01247
01248
01249 if ($blReverse) {
01250
01251 if (version_compare(PHP_VERSION, '5.3.4') >= 0) {
01252 $aTransTbl = get_html_translation_table (HTML_ENTITIES, ENT_COMPAT, 'ISO-8859-1');
01253 } else {
01254 $aTransTbl = get_html_translation_table (HTML_ENTITIES, ENT_COMPAT);
01255 }
01256
01257 $aTransTbl = array_flip ($aTransTbl) + array_flip ($aReplace);
01258 $sValue = strtr($sValue, $aTransTbl);
01259 $sValue = getStr()->preg_replace('/\&\#([0-9]+)\;/me', "chr('\\1')", $sValue);
01260 }
01261
01262 return $sValue;
01263 }
01264
01270 public function getVats()
01271 {
01272
01273 return $this->getProductVats( false );
01274 }
01275
01281 public function getCurrency()
01282 {
01283 return $this->_oCur;
01284 }
01285
01291 public function getSelectedLang()
01292 {
01293 return $this->_iSelectedLang;
01294 }
01295 }