From 683f36457838d38f7afec296d4e66ec5f91fe03a Mon Sep 17 00:00:00 2001 From: Piotr Kowalski Date: Wed, 11 Apr 2018 21:17:15 +0200 Subject: [PATCH] Odczytanie cen statystycznych produktu --- src/apisubiektgt/subiektgt/product.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/apisubiektgt/subiektgt/product.php b/src/apisubiektgt/subiektgt/product.php index eb61b12..72a3f54 100644 --- a/src/apisubiektgt/subiektgt/product.php +++ b/src/apisubiektgt/subiektgt/product.php @@ -95,7 +95,27 @@ protected function getGtObject(){ $this->qty = intval($qty['Dostepne']); return true; } + public function getPriceCalculations(){ + if(!$this->productGt){ + return false; + } + $this->setGtObject(); + $this->productGt = $this->subiektGt->Towary->Wczytaj($this->code); + + Logger::getInstance()->log('api','Pobrano kalkulacje cen: '.$this->productGt->Symbol,__CLASS__.'->'.__FUNCTION__,__LINE__); + + $priceList = $this->productGt->Zakupy; + + for ($i = 1, $size = $priceList->Liczba; $i<$size + 1; ++$i) + { + $data[$i]['nazwa'] = $priceList->Element($i)->Nazwa; + $data[$i]['wartosc'] = (string)$priceList->Element($i)->Wartosc; + } + + + return $data; + } public function getListByStore(){ $sql = "SELECT tw_Symbol as code ,Rezerwacja as resevation,Dostepne as available FROM vwTowar WHERE st_MagId = ".intval($this->id_store); @@ -141,4 +161,4 @@ public function getGt(){ return $this->productGt; } } -?> \ No newline at end of file +?>