Ejemplo n.º 1
0
 /**
  * @param XMLWriter $xmlWriter
  * @param Invoice   $invoice
  */
 protected function addItems(XMLWriter $xmlWriter, Invoice $invoice)
 {
     $xmlWriter->startElement('items');
     foreach ($invoice->getItems() as $item) {
         $xmlWriter->startElement('item');
         $xmlWriter->writeElement('description', $item->getDescription());
         $xmlWriter->writeElement('quantity', $this->formatQuantity($item->getQuantity(), $item->getUnit(), $invoice->getLocale()));
         $xmlWriter->writeElement('unit-price', $this->currencyFormatter->formatCurrency($item->getUnitPrice(), $invoice->getCurrencyCode()));
         $xmlWriter->writeElement('amount', $this->currencyFormatter->formatCurrency($item->getAmount(), $invoice->getCurrencyCode()));
         $xmlWriter->endElement();
     }
     $xmlWriter->endElement();
 }