Bonjour,
J'ai quelques soucis pour résoudre ce problème:
J'ai créé dans ma table PRODUCTS, 2 champs appelés TAUX_CHANGE et COEFF_IMPORT, jusque là pas de problème !!
Le script MARGIN_REPORT2.PHP me donne un rapport de marge avec entre autres le coût des produits (COST)
J'aimerais que ce COST soit mutiplié par la valeur TAUX_CHANGE et COEFF_IMPORT.
Je suis persuadé que la partie de code, du fichier MARGIN_REPORT2.PHP, à modifier se trouve ici:
1 2 3 4 5 6 7 8 9 10 11 12
| $prods_query = mysql_query("select op.products_id, op.products_price, op.products_quantity, p.products_cost from orders_products op, products p where op.orders_id = '" . $o[$i] . "' and op.products_id = p.products_id");
while ($prods = mysql_fetch_array($prods_query, MYSQL_ASSOC)) {
$p[] = array($prods['products_id'], $prods['products_price'], $prods['products_cost'], $prods['products_quantity']);
$price = $price + ($prods['products_price'] * $prods['products_quantity']);
$cost = $cost + ($prods['products_cost'] * $prods['products_quantity']);
$items_sold = $items_sold + $prods['products_quantity'];
$total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']);
$total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']);
$total_items_sold = $total_items_sold + $prods['products_quantity'];
// the following two lines will give us per order margin as well as the total margin
$margin = tep_round((($prods['products_price'])/($prods['products_cost'])), 2);
$total_margin = tep_round((($total_price)/($total_cost)), 2); |
J'en suis persuadé parce que par exemple, quand je remplace la ligne:
$cost = $cost + ($prods['products_cost'] * $prods['products_quantity']);
par:
$cost = $cost + ($prods['products_cost'] * $prods['products_quantity'] * 2);
J'ai bien dans mon rapport le coût des produits (COST) qui est multiplié par 2.
Par contre je n'arrive pas à multiplier par les champs TAUX_CHANGE et COEFF_IMPORT
J'espère avoir été le plus clair possible dans la description de mon problème.
Merci.
Partager