src/MyWebShop/Invoice/Creator.php
protected function getItemLine($item)
    {
        $result = array();

        // @todo: add property source(s) for this item line.
        $this->addPropertySource('item', $item);

        $this->addProductInfo($result);
        $sign = $this->invoiceSource->getSign();

        // @todo: add other tags and available meta tags (* = required):
        // * quantity
        // * unitprice and/or unitpriceinc
        // * vat related tags:
        //     * vatrate and/or vatamount
        //     * vat range tags (call method getVatRangeTags()
        //     * vat rate source
        // - meta-unitprice-recalculate: if admin enters product prices inc vat
        //   (which is normal) then the product price ex vat may be imprecise.
        //   If the exact vat rate is not yet known, it may be recalculated in
        //   the Completor phase.
        // - line totals
        // Should result in something like this:

        // Check for cost price.
        $productPriceEx = $sign * $item->priceEx;
        $precisionEx = 0.01;
        $productVat = $sign * $item->productTax;
        $precisionVat = 0.01;
        $productPriceInc = $sign * $item->priceInc;
        $quantity = $item->quantity;

        // Check for cost price and margin scheme.
        if (!empty($line['costPrice']) && $this->allowMarginScheme()) {
            // Margin scheme:
            // - Do not put VAT on invoice: send price incl VAT as unitprice.
            // - But still send the VAT rate to Acumulus.
            $result[Tag::UnitPrice] = $productPriceInc;
        } else {
            $result += array(
                Tag::UnitPrice => $productPriceEx,
                Meta::UnitPriceInc => $productPriceInc,
                Meta::RecalculatePrice => $productPricesIncludeTax ? Tag::UnitPrice : Meta::UnitPriceInc,
            );
        }
        $result[Tag::Quantity] = $quantity;

        // Add tax info.
        $result += $this->getVatRangeTags($productVat, $productPriceEx, $precisionVat, $precisionEx);

        // @todo: remove property source(s) for this item line.
        $this->removePropertySource('item');

        return $result;
    }
protected function getItemLine($item)
    {
        $result = array();

        // @todo: add property source(s) for this item line.
        $this->addPropertySource('item', $item);

        $this->addProductInfo($result);
        $sign = $this->invoiceSource->getSign();

        // @todo: add other tags and available meta tags (* = required):
        // * quantity
        // * unitprice and/or unitpriceinc
        // * vat related tags:
        //     * vatrate and/or vatamount
        //     * vat range tags (call method getVatRangeTags()
        //     * vat rate source
        // - meta-unitprice-recalculate: if admin enters product prices inc vat
        //   (which is normal) then the product price ex vat may be imprecise.
        //   If the exact vat rate is not yet known, it may be recalculated in
        //   the Completor phase.
        // - line totals
        // Should result in something like this:

        // Check for cost price.
        $productPriceEx = $sign * $item->priceEx;
        $precisionEx = 0.01;
        $productVat = $sign * $item->productTax;
        $precisionVat = 0.01;
        $productPriceInc = $sign * $item->priceInc;
        $quantity = $item->quantity;

        // Check for cost price and margin scheme.
        if (!empty($line['costPrice']) && $this->allowMarginScheme()) {
            // Margin scheme:
            // - Do not put VAT on invoice: send price incl VAT as unitprice.
            // - But still send the VAT rate to Acumulus.
            $result[Tag::UnitPrice] = $productPriceInc;
        } else {
            $result += array(
                Tag::UnitPrice => $productPriceEx,
                Meta::UnitPriceInc => $productPriceInc,
                Meta::RecalculatePrice => $productPricesIncludeTax ? Tag::UnitPrice : Meta::UnitPriceInc,
            );
        }
        $result[Tag::Quantity] = $quantity;

        // Add tax info.
        $result += $this->getVatRangeTags($productVat, $productPriceEx, $precisionVat, $precisionEx);

        // @todo: remove property source(s) for this item line.
        $this->removePropertySource('item');

        return $result;
    }
protected function getItemLine ( $ item ) { $ result = array ( ) ; // @todo: add property source(s) for this item line. $ this -> addPropertySource ( 'item' , $ item ) ; $ this -> addProductInfo ( $ result ) ; $ sign = $ this -> invoiceSource -> getSign ( ) ; // @todo: add other tags and available meta tags (* = required): // * quantity // * unitprice and/or unitpriceinc // * vat related tags: //     * vatrate and/or vatamount //     * vat range tags (call method getVatRangeTags() //     * vat rate source // - meta-unitprice-recalculate: if admin enters product prices inc vat //   (which is normal) then the product price ex vat may be imprecise. //   If the exact vat rate is not yet known, it may be recalculated in //   the Completor phase. // - line totals // Should result in something like this: // Check for cost price. $ productPriceEx = $ sign * $ item -> priceEx ; $ precisionEx = 0.01 ; $ productVat = $ sign * $ item -> productTax ; $ precisionVat = 0.01 ; $ productPriceInc = $ sign * $ item -> priceInc ; $ quantity = $ item -> quantity ; // Check for cost price and margin scheme. if ( ! empty ( $ line [ 'costPrice' ] ) && $ this -> allowMarginScheme ( ) ) { // Margin scheme: // - Do not put VAT on invoice: send price incl VAT as unitprice. // - But still send the VAT rate to Acumulus. $ result [ Tag :: UnitPrice ] = $ productPriceInc ; } else { $ result += array ( Tag :: UnitPrice => $ productPriceEx , Meta :: UnitPriceInc => $ productPriceInc , Meta :: RecalculatePrice => $ productPricesIncludeTax ? Tag :: UnitPrice : Meta :: UnitPriceInc , ) ; } $ result [ Tag :: Quantity ] = $ quantity ; // Add tax info. $ result += $ this -> getVatRangeTags ( $ productVat , $ productPriceEx , $ precisionVat , $ precisionEx ) ; // @todo: remove property source(s) for this item line. $ this -> removePropertySource ( 'item' ) ; return $ result ; }
Returns 1 item line, be it for an order or credit slip.

@todo: specify type of this parameter
@param $item
An OrderDetail line.

@return array
Returns 1 item line be it for an order or credit slip .