public static function getTotalStockGap($id_container) { $query = new DbQuery(); $query->select('id_product, id_product_attribute, (qte_after - qte_before) as gap'); $query->from('erpip_inventory_product'); $query->where('id_erpip_inventory = ' . (int) $id_container); $rows = Db::getInstance()->executeS($query); $total = 0; if (!empty($rows)) { foreach ($rows as $row) { $wholesale_price = InventoryProduct::getWholesalePrice($row['id_product'], $row['id_product_attribute']); $total += (int) $row['gap'] * (int) $wholesale_price; } } return $total; }