Rabatte auf Rechnung ausgeben

Hallo zusammen,
wenn ich auf Artikel Rabatte gebe, dann wird das alles richtig im Warenkorb angezeigt. Gibt es die Möglichkeit die Rabatte auch in der Rechnung auszugeben? Also wie im Shop den Originalpreis durchgestrichen oder so und dann den neuen Preis.

Siehe auch Anhang!

Danke schon mal im Voraus für eure Unterstützung!

TIM

Du müsstest das Feld oxtprice aus dem Artikelstammsatz im Rechnungsprogramm heranziehen und ausgeben. Das klappt z.b. wie im Code unten angegeben. Ich hab die ganze Funktion einkopiert. Der relevante code sind die beiden mit ******* eingeschlossenen Blöcke. Das Rechnungsprogramm ist modules/invoicepdf/myorder.php.

Der Code ist sicher nicht optimal, müsste aber funktionieren.

Die Feinheiten kannst du ja selber anpassen.

Durchstreichen geht leider nicht ohne die oxPdf-Klasse zu überschreiben, das hab ich mir aber erspart.

Hier die komplette Funktion:


    protected function _setOrderArticlesToPdf( $oPdf, &$iStartPos, $blShowPrice = true )
    {
        if (!$this->_oArticles) {
            $this->_oArticles = $this->getOrderArticles(true);
        }

        $oCurr = $this->getCurrency();
        $oPdfBlock = new PdfBlock();
        // product list
        foreach ( $this->_oArticles as $key => $oOrderArt ) {

            // **************************************************
            // $key ist oxid von oxorderarticles, zeigt also auf den orderarticle
            // Im orderarticle ist feld oxartid, das auf den oxarticles-oxid zeigt
            // $oOrderArt ist der ganze orderarticle-Datensatz
            $myKey = $oOrderArt->oxorderarticles__oxartid->value;
            $oArticle = oxNew("oxarticle");
            $tprice = 0;
            if($oArticle->load($myKey)) {
                $tprice = $oArticle->oxarticles__oxtprice->value;
            }
            // **************************************************

            // starting a new page ...
            if ( $iStartPos > 243 ) {
                $this->pdffooter( $oPdf );
                $iStartPos = $this->pdfheaderplus( $oPdf );
                $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
            } else {
                $iStartPos = $iStartPos + 4;
            }

            // sold amount
            $oPdf->text( 20 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxamount->value ), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value );

            // product number
            $oPdf->setFont( $oPdfBlock->getFont(), '', 8 );
            $oPdf->text( 28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value );

            // product title
            $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
            $oPdf->text( 45, $iStartPos, substr( strip_tags( $this->_replaceExtendedChars( $oOrderArt->oxorderarticles__oxtitle->getRawValue(), true ) ), 0, 58 ) );

            if ( $blShowPrice ) {
                $oLang = oxRegistry::getLang();

                // product VAT percent
                $oPdf->text( 140 - $oPdf->getStringWidth( $oOrderArt->oxorderarticles__oxvat->value ), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value );

                // product price

                $dUnitPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnprice->value : $oOrderArt->oxorderarticles__oxbprice->value;
                $dTotalPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnetprice->value : $oOrderArt->oxorderarticles__oxbrutprice->value;

                $sText = $oLang->formatCurrency( $dUnitPrice, $this->_oCur ).' '.$this->_oCur->name;
                $oPdf->text( 163 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );

                // **************************************************
                // originalpreis kursiv in () einfügen, durchstreichen geht leider nicht ohne weiteres
                $oPdf->setFont( $oPdfBlock->getFont(), 'I', 10 );
                $mText = '(' . $oLang->formatCurrency( $tprice, $this->_oCur ).' '.$this->_oCur->name . ')';
                $oPdf->text( 130 - $oPdf->getStringWidth( $sText ), $iStartPos, $mText );
                $oPdf->setFont( $oPdfBlock->getFont(), '', 10 );
                // **************************************************

                // total product price
                $sText = $oLang->formatCurrency( $dTotalPrice, $this->_oCur ).' '.$this->_oCur->name;
                $oPdf->text( 195 - $oPdf->getStringWidth( $sText ), $iStartPos, $sText );

            }

            // additional variant info
            if ( $oOrderArt->oxorderarticles__oxselvariant->value ) {
                $iStartPos = $iStartPos + 4;
                $oPdf->text( 45, $iStartPos, substr( $oOrderArt->oxorderarticles__oxselvariant->value, 0, 58 ) );
            }

        }
    }

Im Ergebnis sieht das dann so aus: