public function saveStockFlow($recordData) { return $this->_save($recordData, Billing_Controller_StockFlow::getInstance(), 'StockFlow'); }
private function inspectAddOrderPosition($receipt, $oPosition) { // if its an invoice -> decrease stock amount if ($receipt->isInvoice() || $receipt->isCredit()) { $stfController = Billing_Controller_StockFlow::getInstance(); $sf = new Billing_Model_StockFlow(null, true); $stockLocation = Billing_Controller_StockLocation::getInstance()->getDefaultStockLocation(); $stockLocationId = $stockLocation->getId(); $article = $oPosition->getForeignRecord('article_id', Billing_Controller_Article::getInstance()); if ($article->__get('is_stock_article')) { $articleId = $article->getId(); $priceNetto = $oPosition->__get('price_netto'); $direction = 'OUT'; $bookingDate = strftime('%Y-%m-%d'); $amount = $oPosition->__get('amount'); $reason = 'Lieferung'; $sf->__set('article_id', $articleId); $sf->__set('stock_location_id', $stockLocationId); $sf->__set('price_netto', $priceNetto); $sf->__set('direction', $direction); $sf->__set('booking_date', $bookingDate); $sf->__set('amount', $amount); $sf->__set('reason', $reason); $stfController->create($sf); } } }