Go to the documentation of this file.00001 <?php
00002
00007 class oxTsProduct extends oxSuperCfg
00008 {
00014 protected $_sTsId = null;
00015
00021 protected $_iAmount = null;
00022
00030 protected $_fPrice = null;
00031
00039 protected $_fNettoPrice = null;
00040
00048 protected $_fVatValue = null;
00049
00055 protected $_oPrice = null;
00056
00057
00063 protected $_dVat = null;
00064
00070 protected $_sTsProtectProducts = array( "TS080501_500_30_EUR" => array( "netto" => "0.82", "amount" => "500" ),
00071 "TS080501_1500_30_EUR" => array( "netto" => "2.47", "amount" => "1500" ),
00072 "TS080501_2500_30_EUR" => array( "netto" => "4.12", "amount" => "2500" ),
00073 "TS080501_5000_30_EUR" => array( "netto" => "8.24", "amount" => "5000" ),
00074 "TS080501_10000_30_EUR" => array( "netto" => "16.47", "amount" => "10000" ),
00075 "TS080501_20000_30_EUR" => array( "netto" => "32.94", "amount" => "20000" )
00076 );
00077
00083 public function getVat()
00084 {
00085 return $this->_dVat;
00086 }
00087
00095 public function setVat( $dVat )
00096 {
00097 $this->_dVat = $dVat;
00098 }
00099
00105 public function getTsId()
00106 {
00107 return $this->_sTsId;
00108 }
00109
00117 public function setTsId( $sTsId )
00118 {
00119 $this->_sTsId = $sTsId;
00120 }
00121
00127 public function getAmount()
00128 {
00129 if ( $this->_iAmount == null ) {
00130 if ( $sTsId = $this->getTsId() ) {
00131 $aTsProducts = $this->getAllTsProducts();
00132 if ( $aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId]) ) {
00133 $this->_iAmount = $aTsProducts[$sTsId]['amount'];
00134 }
00135 }
00136 }
00137 return $this->_iAmount;
00138 }
00139
00147 public function getFPrice()
00148 {
00149 if ( $this->_fPrice == null ) {
00150 if ( $oPrice = $this->getPrice() ) {
00151 $this->_fPrice = oxRegistry::getLang()->formatCurrency( $oPrice->getBruttoPrice() );
00152 }
00153 }
00154 return $this->_fPrice;
00155 }
00156
00164 public function getFNettoPrice()
00165 {
00166 if ( $this->_fNettoPrice == null ) {
00167 if ( $oPrice = $this->getPrice() ) {
00168 $this->_fNettoPrice = oxRegistry::getLang()->formatCurrency( $oPrice->getNettoPrice() );
00169 }
00170 }
00171 return $this->_fNettoPrice;
00172 }
00173
00181 public function getFVatValue()
00182 {
00183 if ( $this->_fVatValue == null ) {
00184 if ( $oPrice = $this->getPrice() ) {
00185 $this->_fVatValue = oxRegistry::getLang()->formatCurrency( $oPrice->getVatValue() );
00186 }
00187 }
00188 return $this->_fVatValue;
00189 }
00190
00196 public function getPrice()
00197 {
00198 if ( $this->_oPrice == null ) {
00199 if ( $sTsId = $this->getTsId() ) {
00200 $aTsProducts = $this->getAllTsProducts();
00201 if ( $aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId]) ) {
00202 $dPrice = $aTsProducts[$sTsId]['netto'];
00203 $oPrice = oxNew( 'oxPrice' );
00204 $oPrice->setNettoPriceMode();
00205 $oPrice->setPrice( $dPrice );
00206 $oPrice->setVat( $this->getVat() );
00207 $this->_oPrice = $oPrice;
00208 }
00209 }
00210 }
00211 return $this->_oPrice;
00212 }
00213
00219 public function getAllTsProducts()
00220 {
00221 return $this->_sTsProtectProducts;
00222 }
00223 }