public function getTaxList()
    {
        $taxes = ArrayList::create();

        foreach ($this->Items() as $item) {
            $existing = null;
            $rate = $item->Tax();

            if ($rate->exists()) {
                $existing = $taxes->find("ID", $rate->ID);
            }

            if (!$existing) {
                $currency = DBCurrency::create();
                $currency->setValue($item->getTaxTotal());
                $taxes->push(ArrayData::create([
                    "ID" => $rate->ID,
                    "Rate" => $rate,
                    "Total" => $currency
                ]));
            } elseif ($rate && $existing) {
                $existing->Total->setValue(
                    $existing->Total->getValue() + $item->getTaxTotal()
                );
            }
        }

        return $taxes;
    }
public function getTaxList()
    {
        $taxes = ArrayList::create();

        foreach ($this->Items() as $item) {
            $existing = null;
            $rate = $item->Tax();

            if ($rate->exists()) {
                $existing = $taxes->find("ID", $rate->ID);
            }

            if (!$existing) {
                $currency = DBCurrency::create();
                $currency->setValue($item->getTaxTotal());
                $taxes->push(ArrayData::create([
                    "ID" => $rate->ID,
                    "Rate" => $rate,
                    "Total" => $currency
                ]));
            } elseif ($rate && $existing) {
                $existing->Total->setValue(
                    $existing->Total->getValue() + $item->getTaxTotal()
                );
            }
        }

        return $taxes;
    }
public function getTaxList ( ) { $ taxes = ArrayList :: create ( ) ; foreach ( $ this -> Items ( ) as $ item ) { $ existing = null ; $ rate = $ item -> Tax ( ) ; if ( $ rate -> exists ( ) ) { $ existing = $ taxes -> find ( "ID" , $ rate -> ID ) ; } if ( ! $ existing ) { $ currency = DBCurrency :: create ( ) ; $ currency -> setValue ( $ item -> getTaxTotal ( ) ) ; $ taxes -> push ( ArrayData :: create ( [ "ID" => $ rate -> ID , "Rate" => $ rate , "Total" => $ currency ] ) ) ; } elseif ( $ rate && $ existing ) { $ existing -> Total -> setValue ( $ existing -> Total -> getValue ( ) + $ item -> getTaxTotal ( ) ) ; } } return $ taxes ; }
Get a list of all taxes used and an associated value

@return ArrayList
Get a list of all taxes used and an associated value