oxpricelist.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxPriceList
00009 {
00015     protected $_aList = array();
00016 
00022     public function getBruttoSum()
00023     {
00024         $dSum = 0;
00025         foreach ( $this->_aList as $oPrice ) {
00026             $dSum += $oPrice->getBruttoPrice();
00027         }
00028 
00029         return $dSum;
00030     }
00031 
00037     public function getNettoSum()
00038     {
00039         $dSum = 0;
00040         foreach ( $this->_aList as $oPrice ) {
00041             $dSum += $oPrice->getNettoPrice();
00042         }
00043 
00044         return $dSum;
00045     }
00046 
00052     public function getVatInfo()
00053     {
00054         $oLang = oxLang::getInstance();
00055         $aVatValues = array();
00056         foreach ( $this->_aList as $oPrice ) {
00057             $sVatKey = ( string ) $oLang->formatVat( $oPrice->getVat() );
00058             if ( !isset( $aVatValues[$sVatKey] )) {
00059                 $aVatValues[$sVatKey] = 0;
00060             }
00061             $aVatValues[$sVatKey] += $oPrice->getVATValue();
00062         }
00063 
00064         return $aVatValues;
00065     }
00066 
00072     public function getPriceInfo()
00073     {
00074         $aPrices = array();
00075         foreach ( $this->_aList as $oPrice ) {
00076             $sVat = ( string ) $oPrice->getVat();
00077             if ( !isset( $aPrices[$sVat] )) {
00078                 $aPrices[$sVat] = 0;
00079             }
00080             $aPrices[$sVat] += $oPrice->getBruttoPrice();
00081         }
00082 
00083         return $aPrices;
00084     }
00085 
00092     public function getMostUsedVatPercent()
00093     {
00094         $aPrices = $this->getPriceInfo();
00095         if ( count( $aPrices ) == 0 ) {
00096             return;
00097         }
00098 
00099         return array_search( max( $aPrices ), $aPrices );
00100     }
00101 
00109     public function addToPriceList( $oPrice )
00110     {
00111         $this->_aList[] = $oPrice;
00112     }
00113 }

Generated on Tue Apr 21 15:45:45 2009 for OXID eShop CE by  doxygen 1.5.5