getHiboutik("products"); foreach ($products as $key => $value) { $my_product_id = $value -> product_id; $my_product_name[$my_product_id] = $value -> product_model; $my_product_category[$my_product_id] = $value -> product_category; $my_product_size_type[$my_product_id] = $value -> product_size_type; $my_product_product_stock_management[$my_product_id] = $value -> product_stock_management; } //récupération des types de tailles et des tailles $size_types = $hiboutik->getHiboutik("size_types"); foreach ($size_types as $key => $value) { $my_size_type_id = $value -> size_type_id; $sizes = $hiboutik->getHiboutik("sizes/$my_size_type_id"); foreach ($sizes as $key_size => $value_size) { $my_size_id = $value_size -> size_id; $my_size_name[$my_size_type_id][$my_size_id] = $value_size -> size_name; } } //récupération des entrepôts $warehouses = $hiboutik->getHiboutik("warehouses"); foreach ($warehouses as $key => $value) { $warehouse_id = $value -> warehouse_id; $my_warehouse_name[$warehouse_id] = $value -> warehouse_name; } //récupération des catégories $categories = $hiboutik->getHiboutik("categories"); foreach ($categories as $key => $value) { $category_id = $value -> category_id; $my_category_name[$category_id] = $value -> category_name; } print(" Hiboutik - $account
"); for ($i = 1; $i <= $warehouse_id; $i++) { $cumul_produits_vendus = array(); $cumul_produits_vendus_7jours = array(); //récupération de ce qui a été vendu sur les 7 derniers jours for ($j = 0; $j < 7; $j++) { //calcul de la date $date_calcul = $maintenant - ($j * 24 * 60 * 60); $annee = date("Y", $date_calcul); $mois = date("m", $date_calcul); $jour = date("d", $date_calcul); $products_sold = $hiboutik->getHiboutik("products_sold/$i/$annee/$mois/$jour"); foreach ($products_sold as $key => $value) { $my_product_id = $value -> product_id; $my_product_size = $value -> product_size; $my_quantity = $value -> quantity; $cumul_produits_vendus[$my_product_id][$my_product_size] = $cumul_produits_vendus[$my_product_id][$my_product_size] + $my_quantity; } } $cumul_produits_vendus_7jours = $cumul_produits_vendus; //récupération de ce qui a été vendu sur les 15 derniers jours for ($j = 7; $j < 15; $j++) { //calcul de la date $date_calcul = $maintenant - ($j * 24 * 60 * 60); $annee = date("Y", $date_calcul); $mois = date("m", $date_calcul); $jour = date("d", $date_calcul); $products_sold = $hiboutik->getHiboutik("products_sold/$i/$annee/$mois/$jour"); foreach ($products_sold as $key => $value) { $my_product_id = $value -> product_id; $my_product_size = $value -> product_size; $my_quantity = $value -> quantity; $cumul_produits_vendus[$my_product_id][$my_product_size] = $cumul_produits_vendus[$my_product_id][$my_product_size] + $my_quantity; } } //récupération du stock disponible $stock_dispo = array(); $stock_alerte = array(); $stock_available = $hiboutik->getHiboutik("stock_available/warehouse_id/$i"); foreach ($stock_available as $key => $value) { $id_prod_sa = $value -> product_id; $id_prod_taille_sa = $value -> product_size; $id_prod_inventory_alert = $value -> inventory_alert; $stock_dispo[$id_prod_sa][$id_prod_taille_sa] = $value -> stock_available; $stock_alerte[$id_prod_sa][$id_prod_taille_sa] = $value -> inventory_alert; } if (!empty($cumul_produits_vendus)) { print("

$my_warehouse_name[$i]

"); foreach ($cumul_produits_vendus as $key => $value) { $my_product_id = $key; foreach ($value as $key2 => $value2) { $my_product_size = $key2; $my_product_size_type_fin = $my_product_size_type[$my_product_id]; $my_quantity_7 = $cumul_produits_vendus_7jours[$my_product_id][$my_product_size]; $my_quantity = $cumul_produits_vendus[$my_product_id][$my_product_size]; $my_product_size_libelle = $my_size_name[$my_product_size_type_fin][$my_product_size]; $my_stock_dispo = $stock_dispo[$my_product_id][$my_product_size]; $my_alerte_stock = $stock_alerte[$my_product_id][$my_product_size]; $my_ecart_stock = 0; if ($my_alerte_stock <> "0") $my_ecart_stock = $my_stock_dispo - $my_alerte_stock; $my_product_category_aff = $my_product_category[$my_product_id]; $my_product_category_aff = $my_category_name[$my_product_category_aff]; $my_class_color = ""; if ($my_stock_dispo <= $my_alerte_stock) $my_class_color = " style=\"background-color: red;\""; if ($my_product_id > "0" AND $my_product_product_stock_management[$my_product_id]) { print(" $my_alerte_stock $my_ecart_stock "); } } } print("
id Produit Catégorie id_taille Taille Vendus j-15 Vendus j-7 Stock Alerte Ecart
$my_product_id
$my_product_category_aff $my_product_size $my_product_size_libelle $my_quantity $my_quantity_7 $my_stock_dispo
"); } } print("
"); ?>